diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-09-08 20:24:14 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-09-09 11:12:25 +0200 |
commit | 325faca502ffca43cf8cbb272fac2516bcb8eb55 (patch) | |
tree | 1f3208e8e47e28d055fab2080d20802e9b0b75d8 /svtools | |
parent | 23552e1bde1bb4682639847677964334e2576a9e (diff) |
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@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/control/valueset.cxx | 36 |
1 files changed, 20 insertions, 16 deletions
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(); } } |