[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - include/svtools svtools/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Sep 11 19:49:45 UTC 2020
include/svtools/valueset.hxx | 2 ++
svtools/source/control/valueset.cxx | 36 ++++++++++++++++++++----------------
2 files changed, 22 insertions(+), 16 deletions(-)
New commits:
commit 51c17d2bdb35fdb4ab21a94d3bba40f97dc5c138
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Sep 8 20:24:14 2020 +0100
Commit: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Fri Sep 11 21:49:13 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/+/102288
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx
index 6c6055d0d982..b27885d9b72b 100644
--- a/include/svtools/valueset.hxx
+++ b/include/svtools/valueset.hxx
@@ -256,6 +256,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 00bd7226478a..dde904d2b9a2 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -539,13 +539,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()
@@ -841,11 +857,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)
@@ -995,11 +1007,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
{
@@ -1151,11 +1159,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