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

New commits:
commit cff943453a8d42b64b8019b43f6cdc934d5d5f44
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Nov 3 20:43:31 2021 +0000
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Nov 4 12:25:36 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/+/124688
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx 
b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index 6a7a7770a17e..6f1c1d49da3f 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