summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfe Gürkan YALAMAN <efeyalaman@gmail.com>2014-07-27 15:02:24 +0300
committerJan Holesovsky <kendy@collabora.com>2014-08-14 22:20:25 +0200
commit13c4d0abf2af43a212922cec3904bcf8a5671aeb (patch)
treecea55431963f20e3807c65f90dd59fe7783729c5
parent219f314c47add3d850bc0bdee2cd2381d48f49ea (diff)
Template Filtering Implementation
Change-Id: I9270136afeaadbbe16c408e6e7d2fbde5b53d324
-rw-r--r--sfx2/source/dialog/backingwindow.cxx41
-rw-r--r--sfx2/source/dialog/backingwindow.hxx7
-rw-r--r--sfx2/uiconfig/ui/startcenter.ui61
3 files changed, 91 insertions, 18 deletions
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 49892ef3cc1a..6e949346d31c 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -312,11 +312,14 @@ void BackingWindow::initControls()
mpTemplateButton->SetControlForeground(aButtonsText);
- mpTemplateButton->SetDropDown( PUSHBUTTON_DROPDOWN_MENUBUTTON );
- MenuButton *pMenuButton = static_cast<MenuButton*> (mpTemplateButton);
- pMenuButton->SetMenuMode( MENUBUTTON_MENUMODE_TIMED );
- pMenuButton->SetActivateHdl( LINK( this, BackingWindow, ActivateHdl ));
- //pMenuButton->Activate();
+
+ //Menubutton implementation
+ PopupMenu* pMenu = mpTemplateButton->GetPopupMenu();
+ pMenu->SetMenuFlags(
+ pMenu->GetMenuFlags() | MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES );
+
+ mpTemplateButton->SetSelectHdl(LINK(this,BackingWindow,MenuSelectHdl));
+ mpTemplateButton->SetClickHdl( LINK(this, BackingWindow, ClickHdl) );
setupButton( mpWriterAllButton );
setupButton( mpDrawAllButton );
@@ -589,18 +592,30 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton )
return 0;
}
-IMPL_LINK( BackingWindow, ActivateHdl, Button*, pButton )
+IMPL_LINK( BackingWindow, MenuSelectHdl, MenuButton*, pButton )
{
- printf("---------------------------------");
- MenuButton *pMenuButton = static_cast<MenuButton*> (pButton);
- PopupMenu *pFilterMenu = new PopupMenu;
-
- //pFilterMenu->SetSelectHdl(LINK( this, BackingWindow, FilterMenuSelectHdl));
- pFilterMenu->InsertItem(0, "Writer");
+ OString sId = pButton->GetCurItemIdent();
+ if( sId == "filter_writer" )
+ {
+ mpCurrentView->filterItems(ViewFilter_Application(FILTER_APP_WRITER));
+ }
+ else if( sId == "filter_calc" )
+ {
+ mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_CALC));
+ }
+ else if( sId == "filter_impress" )
+ {
+ mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_IMPRESS));
+ }
+ else if( sId == "filter_draw" )
+ {
+ mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_DRAW));
+ }
- pMenuButton->SetPopupMenu( pFilterMenu );
+ mpAllRecentThumbnails->Hide();
+ mpLocalView->Show();
return 0;
}
diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx
index b2b14ca0e739..586b879e4bc1 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -27,6 +27,8 @@
#include <vcl/tabctrl.hxx>
#include <vcl/layout.hxx>
+#include <vcl/menubtn.hxx>
+
#include <sfx2/recentdocsview.hxx>
#include <sfx2/templatelocalview.hxx>
#include <sfx2/templateabstractview.hxx>
@@ -59,7 +61,8 @@ class BackingWindow
com::sun::star::uno::Reference< com::sun::star::datatransfer::dnd::XDropTargetListener > mxDropTargetListener;
PushButton* mpOpenButton;
- PushButton* mpTemplateButton;
+ //PushButton* mpTemplateButton;
+ MenuButton* mpTemplateButton;
FixedText* mpCreateLabel;
@@ -111,7 +114,7 @@ class BackingWindow
std::set<const ThumbnailViewItem*,selection_cmp_fn> maSelFolders;
DECL_LINK(ClickHdl, Button*);
- DECL_LINK(ActivateHdl, Button*);
+ DECL_LINK(MenuSelectHdl, MenuButton*);
DECL_LINK(ExtLinkClickHdl, Button*);
DECL_LINK(OpenRegionHdl, void*);
DECL_LINK(OpenTemplateHdl, ThumbnailViewItem*);
diff --git a/sfx2/uiconfig/ui/startcenter.ui b/sfx2/uiconfig/ui/startcenter.ui
index 2e1a5857fb15..6cbbd64ea4f6 100644
--- a/sfx2/uiconfig/ui/startcenter.ui
+++ b/sfx2/uiconfig/ui/startcenter.ui
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.0 on Wed Jul 2 15:37:52 2014 -->
+<!-- Generated with glade 3.16.0 on Wed Jul 23 16:41:24 2014 -->
<interface>
- <!-- interface-requires LibreOffice 1.0 -->
<!-- interface-requires gtk+ 3.0 -->
+ <!-- interface-requires LibreOffice 1.0 -->
<object class="GtkImage" id="calc_all_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -86,7 +86,7 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="templates_all">
+ <object class="GtkButton" id="templates_all:filtermenu">
<property name="label" translatable="yes">T_emplates</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -430,4 +430,59 @@
</packing>
</child>
</object>
+ <object class="GtkMenu" id="filtermenu">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkMenuItem" id="filter_writer">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Writer Templates</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="filter_calc">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Calc Templates</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="filter_impress">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Impress Templates</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="filter_draw">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Draw Templates</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="filter_math">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Math Templates</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparatorMenuItem" id="menuitem3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="edit">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Edit Templates</property>
+ </object>
+ </child>
+ </object>
</interface>