From 5d5f10b3fa7c59c25f1b85d909db6909548ee111 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 23 Nov 2020 16:40:23 +0000 Subject: tdf#138430 toolbar bullet dropdown should have a scrolledwindow as should the matching dialog pages Change-Id: Ib327d3c02d1bc5ae11a6a76d52c9e17803f05534 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106436 Tested-by: Jenkins Reviewed-by: Christian Lohmaier --- cui/source/tabpages/numpages.cxx | 6 +++--- include/svtools/valueset.hxx | 2 +- svtools/source/control/valueset.cxx | 20 +++++++++++++------- svx/source/tbxctrls/bulletsnumbering.cxx | 2 +- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index c271ebaaa858..b921e6cde953 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -163,7 +163,7 @@ SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(weld::Container* pPage, weld::D , bModified(false) , bPreset(false) , nNumItemId(SID_ATTR_NUMBERING_RULE) - , m_xExamplesVS(new SvxNumValueSet(nullptr)) + , m_xExamplesVS(new SvxNumValueSet(m_xBuilder->weld_scrolled_window("valuesetwin"))) , m_xExamplesVSWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xExamplesVS)) { SetExchangeSupport(); @@ -342,7 +342,7 @@ SvxBulletPickTabPage::SvxBulletPickTabPage(weld::Container* pPage, weld::DialogC , bModified(false) , bPreset(false) , nNumItemId(SID_ATTR_NUMBERING_RULE) - , m_xExamplesVS(new SvxNumValueSet(nullptr)) + , m_xExamplesVS(new SvxNumValueSet(m_xBuilder->weld_scrolled_window("valuesetwin"))) , m_xExamplesVSWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xExamplesVS)) { SetExchangeSupport(); @@ -491,7 +491,7 @@ SvxNumPickTabPage::SvxNumPickTabPage(weld::Container* pPage, weld::DialogControl , nNumItemId(SID_ATTR_NUMBERING_RULE) , bModified(false) , bPreset(false) - , m_xExamplesVS(new SvxNumValueSet(nullptr)) + , m_xExamplesVS(new SvxNumValueSet(m_xBuilder->weld_scrolled_window("valuesetwin"))) , m_xExamplesVSWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xExamplesVS)) { SetExchangeSupport(); diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index b27885d9b72b..d5c991d86a02 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -256,7 +256,7 @@ 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 bool TurnOffScrollBar(); SVT_DLLPRIVATE void TurnOnScrollBar(); DECL_DLLPRIVATE_LINK(ImplScrollHdl, weld::ScrolledWindow&, void); diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 4070630fe44a..8e679562ad48 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -539,14 +539,15 @@ void ValueSet::RemoveItem( sal_uInt16 nItemId ) QueueReformat(); } -void ValueSet::TurnOffScrollBar() +bool ValueSet::TurnOffScrollBar() { if (mxScrolledWindow->get_vpolicy() == VclPolicyType::NEVER) - return; + return false; mxScrolledWindow->set_vpolicy(VclPolicyType::NEVER); weld::DrawingArea* pDrawingArea = GetDrawingArea(); Size aPrefSize(pDrawingArea->get_preferred_size()); pDrawingArea->set_size_request(aPrefSize.Width() + GetScrollWidth(), aPrefSize.Height()); + return true; } void ValueSet::TurnOnScrollBar() @@ -561,11 +562,16 @@ void ValueSet::TurnOnScrollBar() 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)) - TurnOffScrollBar(); + if (!mxScrolledWindow) + return; + const bool bScrollAllowed = GetStyle() & WB_VSCROLL; + if (!bScrollAllowed) + return; + // reset scrolled window state to initial value so it will get configured + // to the right adjustment on the next format which we toggle on to happen + // if the scrolledwindow wasn't in its initial state already + if (TurnOffScrollBar()) + mbFormat = true; } void ValueSet::Clear() diff --git a/svx/source/tbxctrls/bulletsnumbering.cxx b/svx/source/tbxctrls/bulletsnumbering.cxx index 430ca197457d..d30a6aabcfd0 100644 --- a/svx/source/tbxctrls/bulletsnumbering.cxx +++ b/svx/source/tbxctrls/bulletsnumbering.cxx @@ -68,7 +68,7 @@ NumberingPopup::NumberingPopup(NumberingToolBoxControl& rController, : WeldToolbarPopup(rController.getFrameInterface(), pParent, "svx/ui/numberingwindow.ui", "NumberingWindow") , mePageType(ePageType) , mrController(rController) - , mxValueSet(new SvxNumValueSet(nullptr)) + , mxValueSet(new SvxNumValueSet(m_xBuilder->weld_scrolled_window("valuesetwin"))) , mxValueSetWin(new weld::CustomWeld(*m_xBuilder, "valueset", *mxValueSet)) , mxMoreButton(m_xBuilder->weld_button("more")) { -- cgit