4f75136
From 17f749afd75c407bf7adae9b8e15276de14ef5d5 Mon Sep 17 00:00:00 2001
4f75136
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
4f75136
Date: Thu, 29 Sep 2016 10:09:02 +0100
4f75136
Subject: [PATCH] only date autofilter menus need the space for the tree
4f75136
 expanders
4f75136
4f75136
so for lists that don't include dates then drop the tree view bits
4f75136
to save space to the left of the entries
4f75136
4f75136
Change-Id: I44f624d8a06d578674806813239a408466c87d70
4f75136
---
4f75136
 sc/source/ui/cctrl/checklistmenu.cxx | 14 ++++++++++----
4f75136
 sc/source/ui/inc/checklistmenu.hxx   |  1 +
4f75136
 sc/source/ui/view/gridwin.cxx        |  1 +
4f75136
 3 files changed, 12 insertions(+), 4 deletions(-)
4f75136
4f75136
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
4f75136
index a017cda..0b5174e 100644
4f75136
--- a/sc/source/ui/cctrl/checklistmenu.cxx
4f75136
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
4f75136
@@ -877,7 +877,7 @@ void ScCheckListMenuWindow::CancelButton::Click()
4f75136
 ScCheckListMenuWindow::ScCheckListMenuWindow(vcl::Window* pParent, ScDocument* pDoc) :
4f75136
     ScMenuFloatingWindow(pParent, pDoc),
4f75136
     maEdSearch(VclPtr<ScSearchEdit>::Create(this)),
4f75136
-    maChecks(VclPtr<ScCheckListBox>::Create(this,  WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT) ),
4f75136
+    maChecks(VclPtr<ScCheckListBox>::Create(this)),
4f75136
     maChkToggleAll(VclPtr<TriStateBox>::Create(this, 0)),
4f75136
     maBtnSelectSingle(VclPtr<ImageButton>::Create(this, 0)),
4f75136
     maBtnUnselectSingle(VclPtr<ImageButton>::Create(this, 0)),
4f75136
@@ -905,9 +905,6 @@ ScCheckListMenuWindow::ScCheckListMenuWindow(vcl::Window* pParent, ScDocument* p
4f75136
 
4f75136
     maEdSearch->SetTabStopsContainer( &maTabStops );
4f75136
     maChecks->SetTabStopsContainer( &maTabStops );
4f75136
-
4f75136
-    // Enable type-ahead search in the check list box.
4f75136
-    maChecks->SetStyle(maChecks->GetStyle() | WB_QUICK_SEARCH);
4f75136
 }
4f75136
 
4f75136
 ScCheckListMenuWindow::~ScCheckListMenuWindow()
4f75136
@@ -1831,6 +1828,15 @@ void ScSearchEdit::MouseButtonDown(const MouseEvent& rMEvt)
4f75136
         mpTabStops->SetTabStop( this );
4f75136
 }
4f75136
 
4f75136
+void ScCheckListMenuWindow::setHasDates(bool bHasDates)
4f75136
+{
4f75136
+    // WB_QUICK_SEARCH Enables type-ahead search in the check list box.
4f75136
+    if (bHasDates)
4f75136
+        maChecks->SetStyle(WB_QUICK_SEARCH | WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT);
4f75136
+    else
4f75136
+        maChecks->SetStyle(WB_QUICK_SEARCH | WB_HASBUTTONS);
4f75136
+}
4f75136
+
4f75136
 void ScCheckListMenuWindow::initMembers()
4f75136
 {
4f75136
     size_t n = maMembers.size();
4f75136
diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx
4f75136
index 6994bc1..856a607 100644
4f75136
--- a/sc/source/ui/inc/checklistmenu.hxx
4f75136
+++ b/sc/source/ui/inc/checklistmenu.hxx
4f75136
@@ -325,6 +325,7 @@ public:
4f75136
     virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
4f75136
 
4f75136
     void setMemberSize(size_t n);
4f75136
+    void setHasDates(bool bHasDates);
4f75136
     void addDateMember(const OUString& rName, double nVal, bool bVisible);
4f75136
     void addMember(const OUString& rName, bool bVisible);
4f75136
     void initMembers();
4f75136
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
4f75136
index 6e4338c..34a4914 100644
4f75136
--- a/sc/source/ui/view/gridwin.cxx
4f75136
+++ b/sc/source/ui/view/gridwin.cxx
4f75136
@@ -714,6 +714,7 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow)
4f75136
     std::vector<ScTypedStrData> aStrings;
4f75136
     pDoc->GetFilterEntries(nCol, nRow, nTab, aStrings, bHasDates);
4f75136
 
4f75136
+    mpAutoFilterPopup->setHasDates(bHasDates);
4f75136
     mpAutoFilterPopup->setMemberSize(aStrings.size());
4f75136
     std::vector<ScTypedStrData>::const_iterator it = aStrings.begin(), itEnd = aStrings.end();
4f75136
     for (; it != itEnd; ++it)
4f75136
-- 
4f75136
2.7.4
4f75136