[Libreoffice-commits] core.git: Branch 'feature/template_manager_improvements' - sfx2/source sfx2/uiconfig

Efe Gürkan YALAMAN efeyalaman at gmail.com
Sun Jul 27 05:04:14 PDT 2014


 sfx2/source/dialog/backingwindow.cxx |   41 ++++++++++++++++-------
 sfx2/source/dialog/backingwindow.hxx |    7 ++--
 sfx2/uiconfig/ui/startcenter.ui      |   61 +++++++++++++++++++++++++++++++++--
 3 files changed, 91 insertions(+), 18 deletions(-)

New commits:
commit c6aa9122c4153ef29a0112458001e27f97ade876
Author: Efe Gürkan YALAMAN <efeyalaman at gmail.com>
Date:   Sun Jul 27 15:02:24 2014 +0300

    Template Filtering Implementation
    
    Change-Id: I9270136afeaadbbe16c408e6e7d2fbde5b53d324

diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 15c126a..34a40e1 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -311,11 +311,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 );
@@ -588,18 +591,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 b2b14ca..586b879 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 d37a21d..792b43b 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>
@@ -431,4 +431,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>


More information about the Libreoffice-commits mailing list