[Libreoffice-commits] .: Branch 'feature/new-autofilter-popup' - sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Wed Nov 2 19:05:29 PDT 2011
sc/source/ui/view/gridwin.cxx | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
New commits:
commit 4bebac7302fbfe0939dbe1843f05afc9c46f6967
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Wed Nov 2 22:05:07 2011 -0400
Populate the popup with unique values and the default action items.
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 558bd85..e38386c 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -585,17 +585,47 @@ void ScGridWindow::ExecPageFieldSelect( SCCOL nCol, SCROW nRow, sal_Bool bHasSel
}
}
+namespace {
+
+class PopupAction : public ScMenuFloatingWindow::Action
+{
+public:
+ virtual void execute()
+ {
+ }
+};
+
+
+}
+
void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow)
{
mpAutoFilterPopup.reset(new ScCheckListMenuWindow(this, pViewData->GetDocument()));
Point aPos = pViewData->GetScrPos(nCol, nRow, eWhich);
+ SCTAB nTab = pViewData->GetTabNo();
+ ScDocument* pDoc = pViewData->GetDocument();
long nSizeX = 0;
long nSizeY = 0;
pViewData->GetMergeSizePixel(nCol, nRow, nSizeX, nSizeY);
Rectangle aCellRect(OutputToScreenPixel(aPos), Size(nSizeX, nSizeY));
// Populate the check box list.
+ bool bHasDates = false;
+ TypedScStrCollection aStrings(128, 128);
+ pDoc->GetFilterEntries(nCol, nRow, nTab, true, aStrings, bHasDates);
+ sal_uInt16 nCount = aStrings.GetCount();
+ mpAutoFilterPopup->setMemberSize(nCount);
+ for (sal_uInt16 i = 0; i < nCount; ++i)
+ mpAutoFilterPopup->addMember(aStrings[i]->GetString(), true);
+ mpAutoFilterPopup->initMembers();
+
+ // Populate the menu.
+ mpAutoFilterPopup->addMenuItem(ScResId::toString(ScResId(SCSTR_ALLFILTER)), true, new PopupAction);
+ mpAutoFilterPopup->addMenuItem(ScResId::toString(ScResId(SCSTR_TOP10FILTER)), true, new PopupAction);
+ mpAutoFilterPopup->addMenuItem(ScResId::toString(ScResId(SCSTR_STDFILTER)), true, new PopupAction);
+ mpAutoFilterPopup->addMenuItem(ScResId::toString(ScResId(SCSTR_EMPTY)), true, new PopupAction);
+ mpAutoFilterPopup->addMenuItem(ScResId::toString(ScResId(SCSTR_NOTEMPTY)), true, new PopupAction);
mpAutoFilterPopup->SetPopupModeEndHdl( LINK(this, ScGridWindow, PopupModeEndHdl) );
mpAutoFilterPopup->StartPopupMode(aCellRect, (FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_GRABFOCUS));
More information about the Libreoffice-commits
mailing list