[Libreoffice-commits] core.git: include/svtools svtools/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed Sep 9 09:12:58 UTC 2020
include/svtools/valueset.hxx | 2 ++
svtools/source/control/valueset.cxx | 36 ++++++++++++++++++++----------------
2 files changed, 22 insertions(+), 16 deletions(-)
New commits:
commit 325faca502ffca43cf8cbb272fac2516bcb8eb55
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Sep 8 20:24:14 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Sep 9 11:12:25 2020 +0200
tdf#134413 must add scrollbar width on turning it off to occupy the same space
when scrollbars have width
Change-Id: I3f9f6951add23f8ac93a03cf3356add5a2b3ddd8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102275
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx
index 128ffcb8daf6..d0320fdd5d02 100644
--- a/include/svtools/valueset.hxx
+++ b/include/svtools/valueset.hxx
@@ -255,6 +255,8 @@ private:
SVT_DLLPRIVATE void QueueReformat();
SVT_DLLPRIVATE void SetFirstLine(sal_uInt16 nNewFirstLine); // set mnFirstLine and update scrollbar to match
SVT_DLLPRIVATE void RecalcScrollBar();
+ SVT_DLLPRIVATE void TurnOffScrollBar();
+ SVT_DLLPRIVATE void TurnOnScrollBar();
DECL_DLLPRIVATE_LINK(ImplScrollHdl, weld::ScrolledWindow&, void);
Size GetLargestItemSize();
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index a99588187e35..2eb875e55d53 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -552,13 +552,29 @@ void ValueSet::RemoveItem( sal_uInt16 nItemId )
QueueReformat();
}
+void ValueSet::TurnOffScrollBar()
+{
+ mxScrolledWindow->set_vpolicy(VclPolicyType::NEVER);
+ weld::DrawingArea* pDrawingArea = GetDrawingArea();
+ Size aPrefSize(pDrawingArea->get_preferred_size());
+ pDrawingArea->set_size_request(aPrefSize.Width() + GetScrollWidth(), aPrefSize.Height());
+}
+
+void ValueSet::TurnOnScrollBar()
+{
+ mxScrolledWindow->set_vpolicy(VclPolicyType::ALWAYS);
+ weld::DrawingArea* pDrawingArea = GetDrawingArea();
+ Size aPrefSize(pDrawingArea->get_preferred_size());
+ pDrawingArea->set_size_request(aPrefSize.Width() - GetScrollWidth(), aPrefSize.Height());
+}
+
void ValueSet::RecalcScrollBar()
{
// reset scrolled window state to initial value
// so it will get configured to the right adjustment
WinBits nStyle = GetStyle();
if (mxScrolledWindow && (nStyle & WB_VSCROLL))
- mxScrolledWindow->set_vpolicy(VclPolicyType::NEVER);
+ TurnOffScrollBar();
}
void ValueSet::Clear()
@@ -854,11 +870,7 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext)
long nNoneSpace;
if (mxScrolledWindow && !(nStyle & WB_VSCROLL) && mxScrolledWindow->get_vpolicy() != VclPolicyType::NEVER)
- {
- mxScrolledWindow->set_vpolicy(VclPolicyType::NEVER);
- Size aPrefSize(GetDrawingArea()->get_preferred_size());
- GetDrawingArea()->set_size_request(aPrefSize.Width() + GetScrollWidth(), aPrefSize.Height());
- }
+ TurnOffScrollBar();
// calculate item offset
if (nStyle & WB_ITEMBORDER)
@@ -1008,11 +1020,7 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext)
}
if (mxScrolledWindow && mxScrolledWindow->get_vpolicy() != VclPolicyType::NEVER)
- {
- mxScrolledWindow->set_vpolicy(VclPolicyType::NEVER);
- Size aPrefSize(GetDrawingArea()->get_preferred_size());
- GetDrawingArea()->set_size_request(aPrefSize.Width() + GetScrollWidth(), aPrefSize.Height());
- }
+ TurnOffScrollBar();
}
else
{
@@ -1164,11 +1172,7 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext)
}
if (bTurnScrollbarOn)
- {
- mxScrolledWindow->set_vpolicy(VclPolicyType::ALWAYS);
- Size aPrefSize(GetDrawingArea()->get_preferred_size());
- GetDrawingArea()->set_size_request(aPrefSize.Width() - GetScrollWidth(), aPrefSize.Height());
- }
+ TurnOnScrollBar();
}
}
More information about the Libreoffice-commits
mailing list