sc/source/ui/cctrl/checklistmenu.cxx |   29 ++++++++---------------------
 sc/source/ui/inc/checklistmenu.hxx   |    3 +--
 sc/source/ui/view/gridwin.cxx        |    2 +-
 sc/source/ui/view/gridwin2.cxx       |    2 +-
 4 files changed, 11 insertions(+), 25 deletions(-)

New commits:
commit bc4e3a1ef4df033a7a5e3526de4edf51dacdb839
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sat Nov 27 20:30:33 2021 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sun Nov 28 11:13:17 2021 +0100

    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 <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx 
b/sc/source/ui/cctrl/checklistmenu.cxx
index e140cee466d0..8a4add14b4fd 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();
 }
 
@@ -443,8 +435,7 @@ ScCheckListMember::ScCheckListMember()
 // the value of border-width of FilterDropDown
 constexpr int nBorderWidth = 4;
 
-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"))
@@ -471,7 +462,6 @@ 
ScCheckListMenuControl::ScCheckListMenuControl(weld::Widget* pParent,
     , mnAsyncPostPopdownId(nullptr)
     , mpNotifier(pNotifier)
     , mbHasDates(bHasDates)
-    , mbCanHaveSubMenu(bCanHaveSubMenu)
     , mbIsPoppedUp(false)
     , maOpenTimer(this)
     , maCloseTimer(this)
@@ -540,11 +530,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));

Reply via email to