From f40390d98f45e6cb19ad896dc30eff07f746942f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 10 Dec 2021 16:25:45 +0000 Subject: [PATCH] Resolves: tdf#145974 reduce the papersize by scrollbar thickness MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit if scrollbar required and scrollbar isn't an overlay one Change-Id: I839fd8c214febadb80f692b53dc156e251f506ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126645 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sd/source/ui/annotations/annotationwindow.cxx | 9 +++++++-- sw/source/uibase/docvw/AnnotationWin2.cxx | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx index c3b797f239ce..42ebe77c306f 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 30e391182118..913430ed9822 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -752,8 +752,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