summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-11-27 20:30:33 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-12-02 22:09:11 +0100
commit4f08f9d4bb0ae51e6bc71370089839d31cc71723 (patch)
treeea8354e7878e191244e25dd7b039e968ad328f1b
parent546634fe82ce0fb4a711b04c16f104bef81f2b40 (diff)
don't need to have a specific mbCanHaveSubMenu mode anymore
since the gap in the vcl treeview separator problem is fixed Change-Id: I105167127588c11895d81dd2aea3c9e119170069 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125952 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit bc4e3a1ef4df033a7a5e3526de4edf51dacdb839) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126206 Tested-by: Jenkins
-rw-r--r--sc/source/ui/cctrl/checklistmenu.cxx29
-rw-r--r--sc/source/ui/inc/checklistmenu.hxx3
-rw-r--r--sc/source/ui/view/gridwin.cxx2
-rw-r--r--sc/source/ui/view/gridwin2.cxx2
4 files changed, 11 insertions, 25 deletions
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index efb4ab7dd2ce..b12868ea2f2a 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -129,13 +129,10 @@ void ScCheckListMenuControl::addMenuItem(const OUString& rText, Action* pAction,
mxMenu->show();
mxMenu->append_text(rText);
- if (mbCanHaveSubMenu)
- {
- if (bIndicateSubMenu)
- mxMenu->set_image(mxMenu->n_children() - 1, *mxDropDown, 1);
- else
- mxMenu->set_image(mxMenu->n_children() - 1, css::uno::Reference<css::graphic::XGraphic>(), 1);
- }
+ if (bIndicateSubMenu)
+ mxMenu->set_image(mxMenu->n_children() - 1, *mxDropDown, 1);
+ else
+ mxMenu->set_image(mxMenu->n_children() - 1, css::uno::Reference<css::graphic::XGraphic>(), 1);
}
void ScCheckListMenuControl::addSeparator()
@@ -148,7 +145,6 @@ void ScCheckListMenuControl::addSeparator()
IMPL_LINK(ScCheckListMenuControl, TreeSizeAllocHdl, const Size&, rSize, void)
{
- assert(mbCanHaveSubMenu);
std::vector<int> aWidths
{
o3tl::narrowing<int>(rSize.Width() - (mxMenu->get_text_height() * 3) / 4 - 6)
@@ -168,8 +164,6 @@ void ScCheckListMenuControl::CreateDropDown()
ScListSubMenuControl* ScCheckListMenuControl::addSubMenuItem(const OUString& rText, bool bEnabled)
{
- assert(mbCanHaveSubMenu);
-
MenuItemData aItem;
aItem.mbEnabled = bEnabled;
@@ -178,9 +172,7 @@ ScListSubMenuControl* ScCheckListMenuControl::addSubMenuItem(const OUString& rTe
mxMenu->show();
mxMenu->append_text(rText);
- if (mbCanHaveSubMenu)
- mxMenu->set_image(mxMenu->n_children() - 1, *mxDropDown, 1);
-
+ mxMenu->set_image(mxMenu->n_children() - 1, *mxDropDown, 1);
return maMenuItems.back().mxSubMenuWin.get();
}
@@ -441,8 +433,7 @@ constexpr int nBorderWidth = 4;
// number of rows visible in checklist
constexpr int nCheckListVisibleRows = 8;
-ScCheckListMenuControl::ScCheckListMenuControl(weld::Widget* pParent,
- ScDocument* pDoc, bool bCanHaveSubMenu,
+ScCheckListMenuControl::ScCheckListMenuControl(weld::Widget* pParent, ScDocument* pDoc,
bool bHasDates, int nWidth, vcl::ILibreOfficeKitNotifier* pNotifier)
: mxBuilder(Application::CreateBuilder(pParent, "modules/scalc/ui/filterdropdown.ui"))
, mxPopover(mxBuilder->weld_popover("FilterDropDown"))
@@ -469,7 +460,6 @@ ScCheckListMenuControl::ScCheckListMenuControl(weld::Widget* pParent,
, mnAsyncPostPopdownId(nullptr)
, mpNotifier(pNotifier)
, mbHasDates(bHasDates)
- , mbCanHaveSubMenu(bCanHaveSubMenu)
, mbIsPoppedUp(false)
, maOpenTimer(this)
, maCloseTimer(this)
@@ -538,11 +528,8 @@ ScCheckListMenuControl::ScCheckListMenuControl(weld::Widget* pParent,
mxBtnSelectSingle->connect_clicked(LINK(this, ScCheckListMenuControl, ButtonHdl));
mxBtnUnselectSingle->connect_clicked(LINK(this, ScCheckListMenuControl, ButtonHdl));
- if (mbCanHaveSubMenu)
- {
- CreateDropDown();
- mxMenu->connect_size_allocate(LINK(this, ScCheckListMenuControl, TreeSizeAllocHdl));
- }
+ CreateDropDown();
+ mxMenu->connect_size_allocate(LINK(this, ScCheckListMenuControl, TreeSizeAllocHdl));
// determine what width the checklist will end up with
mnCheckWidthReq = mxContainer->get_preferred_size().Width();
diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx
index c73843df8a16..2e6041270b5b 100644
--- a/sc/source/ui/inc/checklistmenu.hxx
+++ b/sc/source/ui/inc/checklistmenu.hxx
@@ -124,7 +124,7 @@ public:
};
ScCheckListMenuControl(weld::Widget* pParent, ScDocument* pDoc,
- bool bCanHaveSubMenu, bool bTreeMode, int nWidth,
+ bool bTreeMode, int nWidth,
vcl::ILibreOfficeKitNotifier* pNotifier);
~ScCheckListMenuControl();
@@ -293,7 +293,6 @@ private:
vcl::ILibreOfficeKitNotifier* mpNotifier;
bool mbHasDates;
- bool mbCanHaveSubMenu;
bool mbIsPoppedUp;
struct SubMenuItemData
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index f783ffdf7ca2..337e269e6d13 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -594,7 +594,7 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow)
weld::Window* pPopupParent = GetFrameWeld();
int nColWidth = ScViewData::ToPixel(rDoc.GetColWidth(nCol, nTab), mrViewData.GetPPTX());
- mpAutoFilterPopup.reset(new ScCheckListMenuControl(pPopupParent, &rDoc, true,
+ mpAutoFilterPopup.reset(new ScCheckListMenuControl(pPopupParent, &rDoc,
aFilterEntries.mbHasDates, nColWidth, pNotifier));
int nMaxTextWidth = 0;
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index 8050310b107d..bf9e41bd7369 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -475,7 +475,7 @@ void ScGridWindow::DPLaunchFieldPopupMenu(const Point& rScrPos, const Size& rScr
weld::Window* pPopupParent = GetFrameWeld();
mpDPFieldPopup.reset(new ScCheckListMenuControl(pPopupParent, &mrViewData.GetDocument(),
- bDimOrientNotPage, false, -1, pNotifier));
+ false, -1, pNotifier));
mpDPFieldPopup->setExtendedData(std::move(pDPData));
mpDPFieldPopup->setOKAction(new DPFieldPopupOKAction(this));