sd/source/ui/annotations/annotationwindow.cxx |    9 +++++++--
 sw/source/uibase/docvw/AnnotationWin2.cxx     |    9 +++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit c1f939c454d844d7a5d59a87f6d20c61b54fcb61
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Dec 10 16:25:45 2021 +0000
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Sat Dec 11 02:00:11 2021 +0100

    Resolves: tdf#145974 reduce the papersize by scrollbar thickness
    
    if scrollbar required and scrollbar isn't an overlay one
    
    Change-Id: I839fd8c214febadb80f692b53dc156e251f506ce
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126603
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/sd/source/ui/annotations/annotationwindow.cxx 
b/sd/source/ui/annotations/annotationwindow.cxx
index 0022b84c9625..21b3bb997ed6 100644
--- a/sd/source/ui/annotations/annotationwindow.cxx
+++ b/sd/source/ui/annotations/annotationwindow.cxx
@@ -390,8 +390,13 @@ void AnnotationWindow::DoResize()
 
     if( aTextHeight > aHeight )
     {
-        // we need vertical scrollbars and have to reduce the width
-        aWidth -= mxVScrollbar->get_scroll_thickness();
+        const int nThickness = mxVScrollbar->get_scroll_thickness();
+        if (nThickness)
+        {
+            // we need vertical scrollbars and have to reduce the width
+            aWidth -= nThickness;
+            mpOutliner->SetPaperSize(rDevice.PixelToLogic(Size(aWidth, 
aHeight)));
+        }
         mxVScrollbar->set_vpolicy(VclPolicyType::ALWAYS);
     }
     else
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx 
b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 70460686d03d..a64dd1ebc0bc 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -755,8 +755,13 @@ void SwAnnotationWin::DoResize()
 
     if (aTextHeight > aHeight)
     {
-        // we need vertical scrollbars and have to reduce the width
-        aWidth -= mxVScrollbar->get_scroll_thickness();
+        const int nThickness = mxVScrollbar->get_scroll_thickness();
+        if (nThickness)
+        {
+            // we need vertical scrollbars and have to reduce the width
+            aWidth -= nThickness;
+            mpOutliner->SetPaperSize(PixelToLogic(Size(aWidth, aHeight)));
+        }
         mxVScrollbar->set_vpolicy(VclPolicyType::ALWAYS);
     }
     else

Reply via email to