sw/source/uibase/docvw/SidebarTxtControl.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit c0597c3126d6be683bd2085d1213b8b47f431558
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Nov 3 20:43:31 2021 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Nov 4 10:43:00 2021 +0100

    Resolves: tdf#144686 set the initial "papersize" to the sidebarwidth
    
    this is the width it is eventually set to, setting that when constructed
    makes more sense so text height calculations for the annotation window
    are always sane for sidebar layout.
    
    Change-Id: I159255cd877478902599fc4e62b3f6c7df70abb4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124661
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx 
b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index eaeca216f1bf..3ffcdf76d6ee 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -112,9 +112,12 @@ void SidebarTextControl::SetDrawingArea(weld::DrawingArea* 
pDrawingArea)
     pEditView->setEditViewCallbacks(this);
 
     EditEngine* pEditEngine = GetEditEngine();
-    // tdf#143443 note we don't call SetPaperSize on pEditEngine unlike
-    // similar cases so that the Control defaults to the smallest possible
-    // height it might take, it can grow later
+    // For tdf#143443 note we want an 'infinite' height initially (which is the
+    // editengines default). For tdf#144686 it is helpful if the initial width
+    // is the "SidebarWidth" so the calculated text height is always meaningful
+    // for layout in the sidebar.
+    Size aPaperSize(mrPostItMgr.GetSidebarWidth(), 
pEditEngine->GetPaperSize().Height());
+    pEditEngine->SetPaperSize(aPaperSize);
     pEditEngine->SetRefDevice(&rDevice);
 
     pEditView->SetOutputArea(tools::Rectangle(Point(0, 0), aOutputSize));

Reply via email to