[Libreoffice-commits] core.git: 14 commits - sfx2/source sfx2/uiconfig

Efe Gürkan YALAMAN efeyalaman at gmail.com
Thu Aug 14 13:20:54 PDT 2014


 sfx2/source/dialog/backingwindow.cxx |  147 +++++++++++++++++++++++++++++++++-
 sfx2/source/dialog/backingwindow.hxx |   21 ++++
 sfx2/uiconfig/ui/startcenter.ui      |  149 ++++++++++++++++++++++++++---------
 3 files changed, 275 insertions(+), 42 deletions(-)

New commits:
commit 3e46f2c5a03134b0e819fad98e31b4a7e9925c33
Author: Efe Gürkan YALAMAN <efeyalaman at gmail.com>
Date:   Fri Aug 8 18:03:12 2014 +0300

    Fixed the Templates button
    
    It works as a button. When clicked the triangle works as dropdown.
    
    Change-Id: Ib4e3b6a1832efef3382e7bd01b06d2ff8d4e7543

diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 22147f5..28179f9 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -122,9 +122,6 @@ BackingWindow::BackingWindow( Window* i_pParent ) :
     get(mpHelpButton, "help");
     get(mpExtensionsButton, "extensions");
 
-    //get(mpViewBar, "action_view");
-    //get(mpTemplateBar, "action_templates");
-
     //Containers are invisible to cursor traversal
     //So on pressing "right" when in Help the
     //extension button is considered as a candidate
@@ -266,7 +263,7 @@ void BackingWindow::initControls()
     mpAllRecentThumbnails->Reload();
     mpAllRecentThumbnails->ShowTooltips( true );
 
-    //initialize Template views
+    //initialize Template view
     mpLocalView->SetStyle( mpLocalView->GetStyle() | WB_VSCROLL);
     mpLocalView->setItemDimensions(TEMPLATE_ITEM_MAX_WIDTH,TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT,
                         TEMPLATE_ITEM_MAX_HEIGHT-TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT,
@@ -278,25 +275,12 @@ void BackingWindow::initControls()
 
     mpCurrentView = mpLocalView;
 
-    //mpViewBar->SetButtonType(BUTTON_SYMBOLTEXT);
-    //mpViewBar->SetItemBits(mpViewBar->GetItemId("repository"), TIB_DROPDOWNONLY);
-    //mpViewBar->SetClickHdl(LINK(this,BackingWindow,TBXViewHdl));
-    //mpViewBar->SetDropdownClickHdl(LINK(this,BackingWindow,TBXDropdownHdl));
-    //mpViewBar->Hide();
-    //mpViewBar->HideItem("import");
-
-    //mpTemplateBar->SetButtonType(BUTTON_SYMBOLTEXT);
-    //mpTemplateBar->SetItemBits(mpTemplateBar->GetItemId(TEMPLATEBAR_MOVE), TIB_DROPDOWNONLY);
-    //mpTemplateBar->SetClickHdl( LINK( this, BackingWindow,TBXTemplateHdl ) );
-    //mpTemplateBar->SetDoubleClickHdl( LINK(this, BackingWindow, OpenTemplateHdl) );
-    //mpTemplateBar->SetDropdownClickHdl(LINK(this, BackingWindow,TBXDropdownHdl));
+    mpTemplateButton->SetMenuMode( MENUBUTTON_MENUMODE_TIMED );
 
     //set handlers
     mpLocalView->setOpenRegionHdl(LINK(this, BackingWindow, OpenRegionHdl));
     mpLocalView->setOpenTemplateHdl(LINK(this,BackingWindow,OpenTemplateHdl));
 
-    /*FIXME: Add other things for Local View*/
-
     setupButton( mpOpenButton );
     setupButton( mpTemplateButton );
     setupButton( mpWriterAllButton );
@@ -348,7 +332,6 @@ void BackingWindow::setupButton( PushButton* pButton )
 
     // color that fits the theme
     pButton->SetControlForeground(aButtonsText);
-
     pButton->SetClickHdl( LINK( this, BackingWindow, ClickHdl ) );
 }
 
@@ -361,15 +344,13 @@ void BackingWindow::setupButton( MenuButton* pButton )
     // color that fits the theme
     pButton->SetControlForeground(aButtonsText);
 
-    //Menubutton implementation
     PopupMenu* pMenu = pButton->GetPopupMenu();
     pMenu->SetMenuFlags(pMenu->GetMenuFlags() | MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES);
 
-    //pButton->SetClickHdl(LINK(this, BackingWindow, ClickHdl));
+    pButton->SetClickHdl(LINK(this, BackingWindow, ClickHdl));
     pButton->SetSelectHdl(LINK(this, BackingWindow, MenuSelectHdl));
 }
 
-
 void BackingWindow::Paint( const Rectangle& )
 {
     Resize();
@@ -572,18 +553,9 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton )
     }
     else if( pButton == mpTemplateButton )
     {
-/*        Reference< XDispatchProvider > xFrame( mxFrame, UNO_QUERY );
-
-        Sequence< com::sun::star::beans::PropertyValue > aArgs(1);
-        PropertyValue* pArg = aArgs.getArray();
-        pArg[0].Name = "Referer";
-        pArg[0].Value <<= OUString("private:user");
-
-        dispatchURL( TEMPLATE_URL, OUString(), xFrame, aArgs );
-*/
         mpAllRecentThumbnails->Hide();
+        mpCurrentView->filterItems(ViewFilter_Application(FILTER_APP_NONE));
         mpLocalView->Show();
-        //mpViewBar->Hide();
     }
     return 0;
 }
@@ -592,11 +564,7 @@ IMPL_LINK( BackingWindow, MenuSelectHdl, MenuButton*, pButton )
 {
     OString sId = pButton->GetCurItemIdent();
 
-    if( sId == "filter_none" )
-    {
-        mpCurrentView->filterItems(ViewFilter_Application(FILTER_APP_NONE));
-    }
-    else if( sId == "filter_writer" )
+    if( sId == "filter_writer" )
     {
         mpCurrentView->filterItems(ViewFilter_Application(FILTER_APP_WRITER));
     }
@@ -625,7 +593,6 @@ IMPL_LINK( BackingWindow, MenuSelectHdl, MenuButton*, pButton )
 
     }
 
-
     mpAllRecentThumbnails->Hide();
     mpLocalView->Show();
 
@@ -637,13 +604,10 @@ IMPL_LINK_NOARG( BackingWindow, OpenRegionHdl)
 {
     maSelFolders.clear();
     maSelTemplates.clear();
-    //mpTemplateBar->Hide();
-    //mpViewBar->Hide();
 
     return 0;
 }
 
-//FIXME: Cleanup the code
 IMPL_LINK(BackingWindow, OpenTemplateHdl, ThumbnailViewItem*, pItem)
 {
     if (!mbIsSaveMode)
diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx
index f842644..e4f7a394 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -57,11 +57,11 @@ class BackingWindow
     com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider >        mxDesktopDispatchProvider;
     com::sun::star::uno::Reference<com::sun::star::frame::XFrame>                    mxFrame;
     com::sun::star::uno::Reference< com::sun::star::frame::XDesktop2 >               mxDesktop;
+
     /** helper for drag&drop. */
     com::sun::star::uno::Reference< com::sun::star::datatransfer::dnd::XDropTargetListener > mxDropTargetListener;
 
     PushButton*                     mpOpenButton;
-    //PushButton*                     mpTemplateButton;
     MenuButton*                     mpTemplateButton;
 
     FixedText*                      mpCreateLabel;
@@ -88,9 +88,6 @@ class BackingWindow
     TemplateLocalView*              mpLocalView;
     TemplateAbstractView*           mpCurrentView;
 
-    //ToolBox*                        mpViewBar;
-    //ToolBox*                        mpTemplateBar;
-
     std::vector<Window*>            maDndWindows;
 
     Rectangle                       maStartCentButtons;
diff --git a/sfx2/uiconfig/ui/startcenter.ui b/sfx2/uiconfig/ui/startcenter.ui
index 3185bfa..c619058 100644
--- a/sfx2/uiconfig/ui/startcenter.ui
+++ b/sfx2/uiconfig/ui/startcenter.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.0 on Fri Aug  1 02:51:49 2014 -->
+<!-- Generated with glade 3.16.0 on Fri Aug  8 17:26:41 2014 -->
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
   <!-- interface-requires LibreOffice 1.0 -->
@@ -434,19 +434,10 @@
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <child>
-      <object class="GtkMenuItem" id="filter_none">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes">All Templates</property>
-        <property name="use_underline">True</property>
-      </object>
-    </child>
-    <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>
@@ -454,7 +445,6 @@
         <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>
@@ -462,7 +452,6 @@
         <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>
commit 8cf2021712b8f3c4b04c60d18cd2d0150e40c26a
Author: Efe Gürkan YALAMAN <efeyalaman at gmail.com>
Date:   Fri Aug 1 02:59:41 2014 +0300

    All templates option added
    
    Change-Id: I622d5d6fd7fa7be474fa56abf67a1a62fddbcf60

diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index e306dd5..22147f5 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -365,7 +365,7 @@ void BackingWindow::setupButton( MenuButton* pButton )
     PopupMenu* pMenu = pButton->GetPopupMenu();
     pMenu->SetMenuFlags(pMenu->GetMenuFlags() | MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES);
 
-    pButton->SetClickHdl(LINK(this, BackingWindow, ClickHdl));
+    //pButton->SetClickHdl(LINK(this, BackingWindow, ClickHdl));
     pButton->SetSelectHdl(LINK(this, BackingWindow, MenuSelectHdl));
 }
 
@@ -592,21 +592,25 @@ IMPL_LINK( BackingWindow, MenuSelectHdl, MenuButton*, pButton )
 {
     OString sId = pButton->GetCurItemIdent();
 
-    if( sId == "filter_writer" )
+    if( sId == "filter_none" )
+    {
+        mpCurrentView->filterItems(ViewFilter_Application(FILTER_APP_NONE));
+    }
+    else if( sId == "filter_writer" )
     {
         mpCurrentView->filterItems(ViewFilter_Application(FILTER_APP_WRITER));
     }
     else if( sId == "filter_calc" )
     {
-        mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_CALC));
+        mpCurrentView->filterItems(ViewFilter_Application(FILTER_APP_CALC));
     }
     else if( sId == "filter_impress" )
     {
-        mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_IMPRESS));
+        mpCurrentView->filterItems(ViewFilter_Application(FILTER_APP_IMPRESS));
     }
     else if( sId == "filter_draw" )
     {
-        mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_DRAW));
+        mpCurrentView->filterItems(ViewFilter_Application(FILTER_APP_DRAW));
     }
     else if( sId == "edit" )
     {
diff --git a/sfx2/uiconfig/ui/startcenter.ui b/sfx2/uiconfig/ui/startcenter.ui
index eb6fbf2..3185bfa 100644
--- a/sfx2/uiconfig/ui/startcenter.ui
+++ b/sfx2/uiconfig/ui/startcenter.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.0 on Sun Jul 27 15:03:37 2014 -->
+<!-- Generated with glade 3.16.0 on Fri Aug  1 02:51:49 2014 -->
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
   <!-- interface-requires LibreOffice 1.0 -->
@@ -434,6 +434,14 @@
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <child>
+      <object class="GtkMenuItem" id="filter_none">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">All Templates</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
       <object class="GtkMenuItem" id="filter_writer">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
commit d351591593aada8a55d58068516643eb353a76ec
Author: Efe Gürkan YALAMAN <efeyalaman at gmail.com>
Date:   Fri Aug 1 02:46:51 2014 +0300

    Some code cleanup
    
    SetupButton function overloaded for MenuButton type.
    
    Change-Id: Ib171c7590a59ad360dd8ebab1039d3eba5d565ef

diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 6e94934..e306dd5 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -53,9 +53,6 @@
 #include <com/sun/star/task/InteractionHandler.hpp>
 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
 
-//FIXME:well find a better way for it.
-#include "../doc/doc.hrc"
-
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::frame;
@@ -295,32 +292,13 @@ void BackingWindow::initControls()
     //mpTemplateBar->SetDropdownClickHdl(LINK(this, BackingWindow,TBXDropdownHdl));
 
     //set handlers
-    //mpLocalView->setItemStateHdl(LINK(this, BackingWindow, TVItemStateHdl));
     mpLocalView->setOpenRegionHdl(LINK(this, BackingWindow, OpenRegionHdl));
     mpLocalView->setOpenTemplateHdl(LINK(this,BackingWindow,OpenTemplateHdl));
 
-    /*FIXME: Add other things for Local View
-     *Filter and the bars*/
+    /*FIXME: Add other things for Local View*/
 
     setupButton( mpOpenButton );
-    //setupButton( mpTemplateButton );
-    Font aFont(mpTemplateButton->GetSettings().GetStyleSettings().GetPushButtonFont());
-    aFont.SetSize(Size(0, aFont.GetSize().Height() * fMultiplier));
-    mpTemplateButton->SetControlFont(aFont);
-
-    // color that fits the theme
-    mpTemplateButton->SetControlForeground(aButtonsText);
-
-
-
-    //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( mpTemplateButton );
     setupButton( mpWriterAllButton );
     setupButton( mpDrawAllButton );
     setupButton( mpCalcAllButton );
@@ -374,6 +352,24 @@ void BackingWindow::setupButton( PushButton* pButton )
     pButton->SetClickHdl( LINK( this, BackingWindow, ClickHdl ) );
 }
 
+void BackingWindow::setupButton( MenuButton* pButton )
+{
+    Font aFont(pButton->GetSettings().GetStyleSettings().GetPushButtonFont());
+    aFont.SetSize(Size(0, aFont.GetSize().Height() * fMultiplier));
+    pButton->SetControlFont(aFont);
+
+    // color that fits the theme
+    pButton->SetControlForeground(aButtonsText);
+
+    //Menubutton implementation
+    PopupMenu* pMenu = pButton->GetPopupMenu();
+    pMenu->SetMenuFlags(pMenu->GetMenuFlags() | MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES);
+
+    pButton->SetClickHdl(LINK(this, BackingWindow, ClickHdl));
+    pButton->SetSelectHdl(LINK(this, BackingWindow, MenuSelectHdl));
+}
+
+
 void BackingWindow::Paint( const Rectangle& )
 {
     Resize();
@@ -612,6 +608,18 @@ IMPL_LINK( BackingWindow, MenuSelectHdl, MenuButton*, pButton )
     {
         mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_DRAW));
     }
+    else if( sId == "edit" )
+    {
+        Reference< XDispatchProvider > xFrame( mxFrame, UNO_QUERY );
+
+        Sequence< com::sun::star::beans::PropertyValue > aArgs(1);
+        PropertyValue* pArg = aArgs.getArray();
+        pArg[0].Name = "Referer";
+        pArg[0].Value <<= OUString("private:user");
+
+        dispatchURL( TEMPLATE_URL, OUString(), xFrame, aArgs );
+
+    }
 
 
     mpAllRecentThumbnails->Hide();
diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx
index 586b879..f842644 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -101,6 +101,7 @@ class BackingWindow
     svt::AcceleratorExecute*        mpAccExec;
 
     void setupButton( PushButton* pButton );
+    void setupButton( MenuButton* pButton );
     //Template Manager
     void OnTemplateOpen ();
 
diff --git a/sfx2/uiconfig/ui/startcenter.ui b/sfx2/uiconfig/ui/startcenter.ui
index 6cbbd64..eb6fbf2 100644
--- a/sfx2/uiconfig/ui/startcenter.ui
+++ b/sfx2/uiconfig/ui/startcenter.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.0 on Wed Jul 23 16:41:24 2014 -->
+<!-- Generated with glade 3.16.0 on Sun Jul 27 15:03:37 2014 -->
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
   <!-- interface-requires LibreOffice 1.0 -->
@@ -465,13 +465,6 @@
       </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>
commit 13c4d0abf2af43a212922cec3904bcf8a5671aeb
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 49892ef..6e94934 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 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 2e1a585..6cbbd64 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>
commit 219f314c47add3d850bc0bdee2cd2381d48f49ea
Author: Efe Gürkan YALAMAN <efeyalaman at gmail.com>
Date:   Fri Jul 4 18:04:30 2014 +0300

    Start of filtering implementation
    
    Change-Id: Iebf71deb4739703d87b944300cbc1b8ee2daacc5

diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index e6e739b..49892ef 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -34,6 +34,7 @@
 #include <vcl/msgbox.hxx>
 #include <vcl/toolbox.hxx>
 
+#include <vcl/menubtn.hxx>
 
 #include <comphelper/processfactory.hxx>
 #include <comphelper/sequenceashashmap.hxx>
@@ -302,7 +303,20 @@ void BackingWindow::initControls()
      *Filter and the bars*/
 
     setupButton( mpOpenButton );
-    setupButton( mpTemplateButton );
+    //setupButton( mpTemplateButton );
+    Font aFont(mpTemplateButton->GetSettings().GetStyleSettings().GetPushButtonFont());
+    aFont.SetSize(Size(0, aFont.GetSize().Height() * fMultiplier));
+    mpTemplateButton->SetControlFont(aFont);
+
+    // color that fits the theme
+    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();
 
     setupButton( mpWriterAllButton );
     setupButton( mpDrawAllButton );
@@ -575,6 +589,21 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton )
     return 0;
 }
 
+IMPL_LINK( BackingWindow, ActivateHdl, Button*, pButton )
+{
+    printf("---------------------------------");
+    MenuButton *pMenuButton = static_cast<MenuButton*> (pButton);
+    PopupMenu *pFilterMenu = new PopupMenu;
+
+    //pFilterMenu->SetSelectHdl(LINK( this, BackingWindow, FilterMenuSelectHdl));
+    pFilterMenu->InsertItem(0, "Writer");
+
+
+    pMenuButton->SetPopupMenu( pFilterMenu );
+
+
+    return 0;
+}
 
 
 IMPL_LINK_NOARG( BackingWindow, OpenRegionHdl)
diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx
index c6cdade..b2b14ca 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -111,6 +111,7 @@ class BackingWindow
     std::set<const ThumbnailViewItem*,selection_cmp_fn> maSelFolders;
 
     DECL_LINK(ClickHdl, Button*);
+    DECL_LINK(ActivateHdl, Button*);
     DECL_LINK(ExtLinkClickHdl, Button*);
     DECL_LINK(OpenRegionHdl, void*);
     DECL_LINK(OpenTemplateHdl, ThumbnailViewItem*);
commit e3f513ce20044db9ea26a22e366c0eb9ec945320
Author: Efe Gürkan YALAMAN <efeyalaman at gmail.com>
Date:   Wed Jul 2 15:18:28 2014 +0300

    Code Cleanup
    
    Some unneccesary code cleaned up.
    
    Change-Id: Iebc43ddc8276d5865c640b7fa955152a3361eb36

diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index b0b82a32..e6e739b 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -71,14 +71,14 @@ const char TEMPLATE_URL[] =       "slot:5500";
 const char OPEN_URL[] =           ".uno:Open";
 const char SERVICENAME_CFGREADACCESS[] = "com.sun.star.configuration.ConfigurationAccess";
 
-const char TEMPLATEBAR_SAVE[] = "template_save";
-const char TEMPLATEBAR_OPEN[] = "open";
-const char TEMPLATEBAR_EDIT[] = "edit";
-const char TEMPLATEBAR_PROPERTIES[] = "properties";
-const char TEMPLATEBAR_DEFAULT[] = "default";
-const char TEMPLATEBAR_MOVE[] = "move";
-const char TEMPLATEBAR_EXPORT[] = "export";
-const char TEMPLATEBAR_DELETE[] = "template_delete";
+//const char TEMPLATEBAR_SAVE[] = "template_save";
+//const char TEMPLATEBAR_OPEN[] = "open";
+//const char TEMPLATEBAR_EDIT[] = "edit";
+//const char TEMPLATEBAR_PROPERTIES[] = "properties";
+//const char TEMPLATEBAR_DEFAULT[] = "default";
+//const char TEMPLATEBAR_MOVE[] = "move";
+//const char TEMPLATEBAR_EXPORT[] = "export";
+//const char TEMPLATEBAR_DELETE[] = "template_delete";
 
 float fMultiplier = 1.4f;
 const Color aButtonsBackground(114, 168, 84); // TDF green
@@ -124,8 +124,8 @@ BackingWindow::BackingWindow( Window* i_pParent ) :
     get(mpHelpButton, "help");
     get(mpExtensionsButton, "extensions");
 
-    get(mpViewBar, "action_view");
-    get(mpTemplateBar, "action_templates");
+    //get(mpViewBar, "action_view");
+    //get(mpTemplateBar, "action_templates");
 
     //Containers are invisible to cursor traversal
     //So on pressing "right" when in Help the
@@ -280,21 +280,21 @@ void BackingWindow::initControls()
 
     mpCurrentView = mpLocalView;
 
-    mpViewBar->SetButtonType(BUTTON_SYMBOLTEXT);
-    mpViewBar->SetItemBits(mpViewBar->GetItemId("repository"), TIB_DROPDOWNONLY);
+    //mpViewBar->SetButtonType(BUTTON_SYMBOLTEXT);
+    //mpViewBar->SetItemBits(mpViewBar->GetItemId("repository"), TIB_DROPDOWNONLY);
     //mpViewBar->SetClickHdl(LINK(this,BackingWindow,TBXViewHdl));
     //mpViewBar->SetDropdownClickHdl(LINK(this,BackingWindow,TBXDropdownHdl));
-    mpViewBar->Hide();
-    mpViewBar->HideItem("import");
+    //mpViewBar->Hide();
+    //mpViewBar->HideItem("import");
 
-    mpTemplateBar->SetButtonType(BUTTON_SYMBOLTEXT);
-    mpTemplateBar->SetItemBits(mpTemplateBar->GetItemId(TEMPLATEBAR_MOVE), TIB_DROPDOWNONLY);
+    //mpTemplateBar->SetButtonType(BUTTON_SYMBOLTEXT);
+    //mpTemplateBar->SetItemBits(mpTemplateBar->GetItemId(TEMPLATEBAR_MOVE), TIB_DROPDOWNONLY);
     //mpTemplateBar->SetClickHdl( LINK( this, BackingWindow,TBXTemplateHdl ) );
     //mpTemplateBar->SetDoubleClickHdl( LINK(this, BackingWindow, OpenTemplateHdl) );
     //mpTemplateBar->SetDropdownClickHdl(LINK(this, BackingWindow,TBXDropdownHdl));
 
     //set handlers
-    mpLocalView->setItemStateHdl(LINK(this, BackingWindow, TVItemStateHdl));
+    //mpLocalView->setItemStateHdl(LINK(this, BackingWindow, TVItemStateHdl));
     mpLocalView->setOpenRegionHdl(LINK(this, BackingWindow, OpenRegionHdl));
     mpLocalView->setOpenTemplateHdl(LINK(this,BackingWindow,OpenTemplateHdl));
 
@@ -491,207 +491,6 @@ void BackingWindow::Resize()
         Invalidate();
 }
 
-//Editing related method
-/*
-void BackingWindow::OnTemplateImport ()
-{
-    size_t nDialogType =
-        com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE;
-
-    sfx2::FileDialogHelper aFileDlg(nDialogType, SFXWB_MULTISELECTION);
-
-    // add "All" filter
-    aFileDlg.AddFilter( SfxResId(STR_SFX_FILTERNAME_ALL).toString(),
-                        OUString(FILEDIALOG_FILTER_ALL) );
-
-    // add template filter
-    OUString sFilterExt;
-    OUString sFilterName( SfxResId( STR_TEMPLATE_FILTER ).toString() );
-
-    // add filters of modules which are installed
-    SvtModuleOptions aModuleOpt;
-    if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) )
-        sFilterExt += "*.ott;*.stw;*.oth";
-
-    if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) )
-    {
-        if ( !sFilterExt.isEmpty() )
-            sFilterExt += ";";
-
-        sFilterExt += "*.ots;*.stc";
-    }
-
-    if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) )
-    {
-        if ( !sFilterExt.isEmpty() )
-            sFilterExt += ";";
-
-        sFilterExt += "*.otp;*.sti";
-    }
-
-    if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) )
-    {
-        if ( !sFilterExt.isEmpty() )
-            sFilterExt += ";";
-
-        sFilterExt += "*.otg;*.std";
-
-
-    if ( !sFilterExt.isEmpty() )
-        sFilterExt += ";";
-
-    sFilterExt += "*.vor";
-
-    sFilterName += " (";
-    sFilterName += sFilterExt;
-    sFilterName += ")";
-
-    aFileDlg.AddFilter( sFilterName, sFilterExt );
-    aFileDlg.SetCurrentFilter( sFilterName );
-
-    ErrCode nCode = aFileDlg.Execute();
-
-    if ( nCode == ERRCODE_NONE )
-    {
-        com::sun::star::uno::Sequence<OUString> aFiles = aFileDlg.GetSelectedFiles();
-
-        if (aFiles.hasElements())
-        {
-            if (!maSelFolders.empty())
-            {
-                //Import to the selected regions
-                std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter;
-                for (pIter = maSelFolders.begin(); pIter != maSelFolders.end(); ++pIter)
-                {
-                    OUString aTemplateList;
-                    TemplateContainerItem *pFolder = (TemplateContainerItem*)(*pIter);
-
-                    for (size_t i = 0, n = aFiles.getLength(); i < n; ++i)
-                    {
-                        if(!mpLocalView->copyFrom(pFolder,aFiles[i]))
-                        {
-                            if (aTemplateList.isEmpty())
-                                aTemplateList = aFiles[i];
-                            else
-                                aTemplateList = aTemplateList + "\n" + aFiles[i];
-                        }
-                    }
-
-                    if (!aTemplateList.isEmpty())
-                    {
-                        OUString aMsg(SfxResId(STR_MSG_ERROR_IMPORT).toString());
-                        aMsg = aMsg.replaceFirst("$1",pFolder->maTitle);
-                        ErrorBox(this,WB_OK,aMsg.replaceFirst("$2",aTemplateList));
-                    }
-                }
-            }
-            else
-            {
-                //Import to current region
-                OUString aTemplateList;
-                for (size_t i = 0, n = aFiles.getLength(); i < n; ++i)
-                {
-                    if(!mpLocalView->copyFrom(aFiles[i]))
-                    {
-                        if (aTemplateList.isEmpty())
-                            aTemplateList = aFiles[i];
-                        else
-                            aTemplateList = aTemplateList + "\n" + aFiles[i];
-                    }
-                }
-
-                if (!aTemplateList.isEmpty())
-                {
-                    OUString aMsg(SfxResId(STR_MSG_ERROR_IMPORT).toString());
-                    aMsg = aMsg.replaceFirst("$1",mpLocalView->getCurRegionName());
-                    ErrorBox(this,WB_OK,aMsg.replaceFirst("$2",aTemplateList));
-                }
-            }
-
-            mpLocalView->Invalidate(INVALIDATE_NOERASE);
-            }
-        }
-    }
-}*/
-
-//Editing related method
-/*void BackingWindow::OnFolderDelete()
-{
-    QueryBox aQueryDlg(this, WB_YES_NO | WB_DEF_YES, SfxResId(STR_QMSG_SEL_FOLDER_DELETE).toString());
-
-    if ( aQueryDlg.Execute() == RET_NO )
-        return;
-
-    OUString aFolderList;
-
-    std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter;
-    std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelFolders = maSelFolders; //Copy to avoid invalidating      an iterator
-
-    for (pIter = aSelFolders.begin(); pIter != aSelFolders.end(); ++pIter)
-    {
-        if (!mpLocalView->removeRegion((*pIter)->mnId))
-        {
-            if (aFolderList.isEmpty())
-                aFolderList = (*pIter)->maTitle;
-            else
-                aFolderList = aFolderList + "\n" + (*pIter)->maTitle;
-
-            ++pIter;
-            if (pIter == aSelFolders.end())
-                break;
-        }
-    }
-
-    if (!aFolderList.isEmpty())
-    {
-        OUString aMsg( SfxResId(STR_MSG_ERROR_DELETE_FOLDER).toString() );
-        ErrorBox(this, WB_OK,aMsg.replaceFirst("$1",aFolderList)).Execute();
-    }
-}*/
-
-//Editing related method
-/*void BackingWindow::OnFolderNew()
-{
-    InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this);
-
-    int ret = dlg.Execute();
-
-    if (ret)
-    {
-        OUString aName = dlg.getEntryText();
-
-        mpCurrentView->createRegion(aName);
-    }
-}*/
-
-
-// void BackingWindow::OnRegionState (const ThumbnailViewItem *pItem)
-// {
-//     if (pItem->isSelected())
-//     {
-//         if (maSelFolders.empty() && !mbIsSaveMode)
-//         {
-//             mpViewBar->ShowItem("import");
-//             mpViewBar->ShowItem("delete");
-//             mpViewBar->HideItem("new_folder");
-//         }
-
-//         maSelFolders.insert(pItem);
-//     }
-//     else
-//     {
-//         maSelFolders.erase(pItem);
-
-//         if (maSelFolders.empty() && !mbIsSaveMode)
-//         {
-//             mpViewBar->HideItem("import");
-//             mpViewBar->HideItem("delete");
-//             mpViewBar->ShowItem("new_folder");
-//         }
-//     }
-// }
-
-
 IMPL_LINK(BackingWindow, ExtLinkClickHdl, Button*, pButton)
 {
     OUString aNode;
@@ -771,40 +570,19 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton )
 */
         mpAllRecentThumbnails->Hide();
         mpLocalView->Show();
-        mpViewBar->Hide();
-        mpViewBar->HideItem("import");
-        mpViewBar->HideItem("delete");
-        mpViewBar->HideItem("new_folder");
+        //mpViewBar->Hide();
     }
     return 0;
 }
 
-IMPL_LINK_NOARG(BackingWindow, DoubleClickHdl)
-{
-    ThumbnailViewItem *pItem = const_cast<ThumbnailViewItem*>(*maSelTemplates.begin());
 
-    OpenTemplateHdl(pItem);
-    return 0;
-}
 
-
-//FIXME: Obvious enough
 IMPL_LINK_NOARG( BackingWindow, OpenRegionHdl)
 {
     maSelFolders.clear();
     maSelTemplates.clear();
-
-    //mpViewBar->ShowItem("new_folder", mpCurrentView->isNestedRegionAllowed());
-
-    //if (!mbIsSaveMode)
-      //  mpViewBar->ShowItem("import", mpCurrentView->isImportAllowed());
-
-    mpTemplateBar->Hide();
-    mpViewBar->Hide();
-    mpViewBar->HideItem("import");
-    mpViewBar->HideItem("delete");
-    mpViewBar->HideItem("new_folder");
-    //mpActionBar->Show();
+    //mpTemplateBar->Hide();
+    //mpViewBar->Hide();
 
     return 0;
 }
@@ -841,66 +619,6 @@ IMPL_LINK(BackingWindow, OpenTemplateHdl, ThumbnailViewItem*, pItem)
     return 0;
 }
 
-//FIXME: Implement OnSomething() methods
-//IMPL_LINK_NOARG(BackingWindow,TBXViewHdl)
-//{
-  //  const size_t nCurItemId = mpViewBar->GetCurItemId();
-
-    /*//if (nCurItemId == mpViewBar->GetItemId("import"))
-      //  OnTemplateImport();
-    else if (nCurItemId == mpViewBar->GetItemId("delete"))
-    {
-        if (mpCurrentView == mpLocalView)
-            OnFolderDelete();
-        //else
-            ////OnRepositoryDelete();
-    }
-    else if (nCurItemId == mpViewBar->GetItemId("new_folder"))
-        OnFolderNew();
-    //else if (nCurItemId == mpViewBar->GetItemId("save"))
-        ////OnTemplateSaveAs();
-    */
-    //return 0;
-//}
-
-//FIXME: Implement OnSomething() methods // might be deleted
-IMPL_LINK_NOARG(BackingWindow,TBXTemplateHdl)
-{
-    //const size_t nCurItemId = mpTemplateBar->GetCurItemId();
-
-    //if (nCurItemId == mpTemplateBar->GetItemId(TEMPLATEBAR_OPEN))
-        //OnTemplateOpen();
-    //else if (nCurItemId == mpTemplateBar->GetItemId(TEMPLATEBAR_EDIT))
-        //OnTemplateEdit();
-    //else if (nCurItemId == mpTemplateBar->GetItemId(TEMPLATEBAR_PROPERTIES))
-        //OnTemplateProperties();
-    //else if (nCurItemId == mpTemplateBar->GetItemId(TEMPLATEBAR_DELETE))
-        //OnTemplateDelete();
-    //else if (nCurItemId == mpTemplateBar->GetItemId(TEMPLATEBAR_DEFAULT))
-        //OnTemplateAsDefault();
-    //else if (nCurItemId == mpTemplateBar->GetItemId(TEMPLATEBAR_EXPORT))
-        //OnTemplateExport();
-
-    return 0;
-}
-
-
-IMPL_LINK(BackingWindow, TVItemStateHdl, const ThumbnailViewItem*, pItem)
-{
-    //const TemplateContainerItem *pCntItem = dynamic_cast<const TemplateContainerItem*>(pItem);
-
-    //if (pCntItem)
-        //OnRegionState(pItem);
-    //else
-        //FIXME:Move this to here
-        //OnTemplateState(pItem);
-
-    return 0;
-}
-
-
-
-
 struct ImplDelayedDispatch
 {
     Reference< XDispatch >      xDispatch;
diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx
index 452ada2..c6cdade 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -85,8 +85,8 @@ class BackingWindow
     TemplateLocalView*              mpLocalView;
     TemplateAbstractView*           mpCurrentView;
 
-    ToolBox*                        mpViewBar;
-    ToolBox*                        mpTemplateBar;
+    //ToolBox*                        mpViewBar;
+    //ToolBox*                        mpTemplateBar;
 
     std::vector<Window*>            maDndWindows;
 
@@ -100,10 +100,6 @@ class BackingWindow
     void setupButton( PushButton* pButton );
     //Template Manager
     void OnTemplateOpen ();
-    //void OnTemplateImport ();
-    //void OnFolderNew ();
-    //void OnFolderDelete ();
-    //void OnRegionState (const ThumbnailViewItem *pItem);
 
     void dispatchURL( const OUString& i_rURL,
                       const OUString& i_rTarget = OUString( "_default" ),
@@ -117,11 +113,7 @@ class BackingWindow
     DECL_LINK(ClickHdl, Button*);
     DECL_LINK(ExtLinkClickHdl, Button*);
     DECL_LINK(OpenRegionHdl, void*);
-    DECL_LINK(TBXViewHdl, void*);
-    DECL_LINK(TBXTemplateHdl, void*);
-    DECL_LINK(TVItemStateHdl, const ThumbnailViewItem*);
     DECL_LINK(OpenTemplateHdl, ThumbnailViewItem*);
-    DECL_LINK(DoubleClickHdl, void*);
 
     void initControls();
 
diff --git a/sfx2/uiconfig/ui/startcenter.ui b/sfx2/uiconfig/ui/startcenter.ui
index 63d6cfb..2e1a585 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 Sat Jun 14 02:47:36 2014 -->
+<!-- Generated with glade 3.16.0 on Wed Jul  2 15:37:52 2014 -->
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
   <!-- interface-requires LibreOffice 1.0 -->
+  <!-- interface-requires gtk+ 3.0 -->
   <object class="GtkImage" id="calc_all_image">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -388,219 +388,6 @@
             <property name="can_focus">False</property>
             <property name="orientation">vertical</property>
             <child>
-              <object class="GtkBox" id="box3">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="hexpand">True</property>
-                <child>
-                  <object class="GtkToolbar" id="action_view">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="hexpand">True</property>
-                    <child>
-                      <object class="GtkToolButton" id="repository">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="action_name">repository</property>
-                        <property name="label" translatable="yes">Repository</property>
-                        <property name="use_underline">True</property>
-                        <property name="icon_name">sfx2/imglst/actionview026.png</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkToolButton" id="import">
-                        <property name="can_focus">False</property>
-                        <property name="action_name">import</property>
-                        <property name="label" translatable="yes">Import</property>
-                        <property name="use_underline">True</property>
-                        <property name="icon_name">sfx2/imglst/actionview010.png</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkToolButton" id="delete">
-                        <property name="can_focus">False</property>
-                        <property name="action_name">delete</property>
-                        <property name="label" translatable="yes">Delete</property>
-                        <property name="use_underline">True</property>
-                        <property name="icon_name">sfx2/imglst/actionview025.png</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkToolButton" id="save">
-                        <property name="can_focus">False</property>
-                        <property name="action_name">save</property>
-                        <property name="label" translatable="yes">Save</property>
-                        <property name="use_underline">True</property>
-                        <property name="icon_name">sfx2/imglst/actionview028.png</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkToolButton" id="new_folder">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="action_name">new_folder</property>
-                        <property name="label" translatable="yes">New Folder</property>
-                        <property name="use_underline">True</property>
-                        <property name="icon_name">sfx2/imglst/actionview029.png</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkToolbar" id="action_templates">
-                    <property name="can_focus">False</property>
-                    <property name="hexpand">True</property>
-                    <child>
-                      <object class="GtkToolButton" id="template_save">
-                        <property name="can_focus">False</property>
-                        <property name="action_name">template_save</property>
-                        <property name="label" translatable="yes">Save</property>
-                        <property name="use_underline">True</property>
-                        <property name="icon_name">sfx2/imglst/actionview028.png</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkToolButton" id="open">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="action_name">open</property>
-                        <property name="label" translatable="yes">Open</property>
-                        <property name="use_underline">True</property>
-                        <property name="icon_name">sfx2/imglst/actionview030.png</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkToolButton" id="edit">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="action_name">edit</property>
-                        <property name="label" translatable="yes">Edit</property>
-                        <property name="use_underline">True</property>
-                        <property name="icon_name">sfx2/imglst/actiontemplates019.png</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkToolButton" id="properties">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="action_name">properties</property>
-                        <property name="label" translatable="yes">Properties</property>
-                        <property name="use_underline">True</property>
-                        <property name="icon_name">sfx2/imglst/actiontemplates016.png</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkToolButton" id="default">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="action_name">default</property>
-                        <property name="label" translatable="yes">Set as Default</property>
-                        <property name="use_underline">True</property>
-                        <property name="icon_name">sfx2/imglst/actiontemplates015.png</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkToolButton" id="move">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="action_name">move</property>
-                        <property name="label" translatable="yes">Move to Folder</property>
-                        <property name="use_underline">True</property>
-                        <property name="icon_name">sfx2/imglst/actiontemplates017.png</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkToolButton" id="export">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="action_name">export</property>
-                        <property name="label" translatable="yes">Export</property>
-                        <property name="use_underline">True</property>
-                        <property name="icon_name">sfx2/imglst/actiontemplates020.png</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkToolButton" id="template_delete">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="action_name">template_delete</property>
-                        <property name="label" translatable="yes">Delete</property>
-                        <property name="use_underline">True</property>
-                        <property name="icon_name">sfx2/imglst/actiontemplates018.png</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
               <object class="sfxlo-RecentDocsView" id="all_recent">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
commit 37bd2d2dfe77865257bb30cc0d9d7f50cfb22c58
Author: Efe Gürkan YALAMAN <efeyalaman at gmail.com>
Date:   Wed Jun 25 14:36:34 2014 +0300

    Selecting and opening templates implemented.
    
    All editing related code commented out. Code needs to be cleaned up.
    
    Change-Id: Ibe901684d8747552b8ebeeea848c8f5e050ae726

diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 1aaefe4..b0b82a32 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -282,18 +282,21 @@ void BackingWindow::initControls()
 
     mpViewBar->SetButtonType(BUTTON_SYMBOLTEXT);
     mpViewBar->SetItemBits(mpViewBar->GetItemId("repository"), TIB_DROPDOWNONLY);
-    mpViewBar->SetClickHdl(LINK(this,BackingWindow,TBXViewHdl));
+    //mpViewBar->SetClickHdl(LINK(this,BackingWindow,TBXViewHdl));
     //mpViewBar->SetDropdownClickHdl(LINK(this,BackingWindow,TBXDropdownHdl));
     mpViewBar->Hide();
+    mpViewBar->HideItem("import");
 
     mpTemplateBar->SetButtonType(BUTTON_SYMBOLTEXT);
     mpTemplateBar->SetItemBits(mpTemplateBar->GetItemId(TEMPLATEBAR_MOVE), TIB_DROPDOWNONLY);
-    mpTemplateBar->SetClickHdl( LINK( this, BackingWindow,TBXTemplateHdl ) );
+    //mpTemplateBar->SetClickHdl( LINK( this, BackingWindow,TBXTemplateHdl ) );
+    //mpTemplateBar->SetDoubleClickHdl( LINK(this, BackingWindow, OpenTemplateHdl) );
     //mpTemplateBar->SetDropdownClickHdl(LINK(this, BackingWindow,TBXDropdownHdl));
 
     //set handlers
     mpLocalView->setItemStateHdl(LINK(this, BackingWindow, TVItemStateHdl));
     mpLocalView->setOpenRegionHdl(LINK(this, BackingWindow, OpenRegionHdl));
+    mpLocalView->setOpenTemplateHdl(LINK(this,BackingWindow,OpenTemplateHdl));
 
     /*FIXME: Add other things for Local View
      *Filter and the bars*/
@@ -488,6 +491,8 @@ void BackingWindow::Resize()
         Invalidate();
 }
 
+//Editing related method
+/*
 void BackingWindow::OnTemplateImport ()
 {
     size_t nDialogType =
@@ -607,9 +612,10 @@ void BackingWindow::OnTemplateImport ()
             }
         }
     }
-}
+}*/
 
-void BackingWindow::OnFolderDelete()
+//Editing related method
+/*void BackingWindow::OnFolderDelete()
 {
     QueryBox aQueryDlg(this, WB_YES_NO | WB_DEF_YES, SfxResId(STR_QMSG_SEL_FOLDER_DELETE).toString());
 
@@ -641,10 +647,10 @@ void BackingWindow::OnFolderDelete()
         OUString aMsg( SfxResId(STR_MSG_ERROR_DELETE_FOLDER).toString() );
         ErrorBox(this, WB_OK,aMsg.replaceFirst("$1",aFolderList)).Execute();
     }
-}
+}*/
 
-
-void BackingWindow::OnFolderNew()
+//Editing related method
+/*void BackingWindow::OnFolderNew()
 {
     InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this);
 
@@ -656,34 +662,34 @@ void BackingWindow::OnFolderNew()
 
         mpCurrentView->createRegion(aName);
     }
-}
-
-
-void BackingWindow::OnRegionState (const ThumbnailViewItem *pItem)
-{
-    if (pItem->isSelected())
-    {
-        if (maSelFolders.empty() && !mbIsSaveMode)
-        {
-            mpViewBar->ShowItem("import");
-            mpViewBar->ShowItem("delete");
-            mpViewBar->HideItem("new_folder");
-        }
-
-        maSelFolders.insert(pItem);
-    }
-    else
-    {
-        maSelFolders.erase(pItem);
-
-        if (maSelFolders.empty() && !mbIsSaveMode)
-        {
-            mpViewBar->HideItem("import");
-            mpViewBar->HideItem("delete");
-            mpViewBar->ShowItem("new_folder");
-        }
-    }
-}
+}*/
+
+
+// void BackingWindow::OnRegionState (const ThumbnailViewItem *pItem)
+// {
+//     if (pItem->isSelected())
+//     {
+//         if (maSelFolders.empty() && !mbIsSaveMode)
+//         {
+//             mpViewBar->ShowItem("import");
+//             mpViewBar->ShowItem("delete");
+//             mpViewBar->HideItem("new_folder");
+//         }
+
+//         maSelFolders.insert(pItem);
+//     }
+//     else
+//     {
+//         maSelFolders.erase(pItem);
+
+//         if (maSelFolders.empty() && !mbIsSaveMode)
+//         {
+//             mpViewBar->HideItem("import");
+//             mpViewBar->HideItem("delete");
+//             mpViewBar->ShowItem("new_folder");
+//         }
+//     }
+// }
 
 
 IMPL_LINK(BackingWindow, ExtLinkClickHdl, Button*, pButton)
@@ -765,36 +771,83 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton )
 */
         mpAllRecentThumbnails->Hide();
         mpLocalView->Show();
-        mpViewBar->Show();
+        mpViewBar->Hide();
+        mpViewBar->HideItem("import");
+        mpViewBar->HideItem("delete");
+        mpViewBar->HideItem("new_folder");
     }
     return 0;
 }
 
+IMPL_LINK_NOARG(BackingWindow, DoubleClickHdl)
+{
+    ThumbnailViewItem *pItem = const_cast<ThumbnailViewItem*>(*maSelTemplates.begin());
+
+    OpenTemplateHdl(pItem);
+    return 0;
+}
+
+
 //FIXME: Obvious enough
 IMPL_LINK_NOARG( BackingWindow, OpenRegionHdl)
 {
     maSelFolders.clear();
     maSelTemplates.clear();
 
-    mpViewBar->ShowItem("new_folder", mpCurrentView->isNestedRegionAllowed());
+    //mpViewBar->ShowItem("new_folder", mpCurrentView->isNestedRegionAllowed());
 
-    if (!mbIsSaveMode)
-        mpViewBar->ShowItem("import", mpCurrentView->isImportAllowed());
+    //if (!mbIsSaveMode)
+      //  mpViewBar->ShowItem("import", mpCurrentView->isImportAllowed());
 
-    //mpTemplateBar->Hide();
-    mpViewBar->Show();
+    mpTemplateBar->Hide();
+    mpViewBar->Hide();
+    mpViewBar->HideItem("import");
+    mpViewBar->HideItem("delete");
+    mpViewBar->HideItem("new_folder");
     //mpActionBar->Show();
 
     return 0;
 }
 
-//FIXME: Implement OnSomething() methods
-IMPL_LINK_NOARG(BackingWindow,TBXViewHdl)
+//FIXME: Cleanup the code
+IMPL_LINK(BackingWindow, OpenTemplateHdl, ThumbnailViewItem*, pItem)
 {
-    const size_t nCurItemId = mpViewBar->GetCurItemId();
+    if (!mbIsSaveMode)
+    {
+        uno::Sequence< PropertyValue > aArgs(4);
+        aArgs[0].Name = "AsTemplate";
+        aArgs[0].Value <<= sal_True;
+        aArgs[1].Name = "MacroExecutionMode";
+        aArgs[1].Value <<= MacroExecMode::USE_CONFIG;
+        aArgs[2].Name = "UpdateDocMode";
+        aArgs[2].Value <<= UpdateDocMode::ACCORDING_TO_CONFIG;
+        aArgs[3].Name = "InteractionHandler";
+        aArgs[3].Value <<= task::InteractionHandler::createWithParent( ::comphelper::getProcessComponentContext(), 0 );
+
+        TemplateViewItem *pTemplateItem = static_cast<TemplateViewItem*>(pItem);
+
+        Reference< XDispatchProvider > xFrame( mxFrame, UNO_QUERY );
+
+        try
+        {
+            dispatchURL( pTemplateItem->getPath(), "_default", xFrame, aArgs );
+            //mxDesktop->loadComponentFromURL(pTemplateItem->getPath(),"_default", 0, aArgs );
+        }
+        catch( const uno::Exception& )
+        {
+        }
+    }
+
+    return 0;
+}
 
-    if (nCurItemId == mpViewBar->GetItemId("import"))
-        OnTemplateImport();
+//FIXME: Implement OnSomething() methods
+//IMPL_LINK_NOARG(BackingWindow,TBXViewHdl)
+//{
+  //  const size_t nCurItemId = mpViewBar->GetCurItemId();
+
+    /*//if (nCurItemId == mpViewBar->GetItemId("import"))
+      //  OnTemplateImport();
     else if (nCurItemId == mpViewBar->GetItemId("delete"))
     {
         if (mpCurrentView == mpLocalView)
@@ -806,11 +859,11 @@ IMPL_LINK_NOARG(BackingWindow,TBXViewHdl)
         OnFolderNew();
     //else if (nCurItemId == mpViewBar->GetItemId("save"))
         ////OnTemplateSaveAs();
+    */
+    //return 0;
+//}
 
-    return 0;
-}
-
-//FIXME: Implement OnSomething() methods
+//FIXME: Implement OnSomething() methods // might be deleted
 IMPL_LINK_NOARG(BackingWindow,TBXTemplateHdl)
 {
     //const size_t nCurItemId = mpTemplateBar->GetCurItemId();
@@ -834,10 +887,10 @@ IMPL_LINK_NOARG(BackingWindow,TBXTemplateHdl)
 
 IMPL_LINK(BackingWindow, TVItemStateHdl, const ThumbnailViewItem*, pItem)
 {
-    const TemplateContainerItem *pCntItem = dynamic_cast<const TemplateContainerItem*>(pItem);
+    //const TemplateContainerItem *pCntItem = dynamic_cast<const TemplateContainerItem*>(pItem);
 
-    if (pCntItem)
-        OnRegionState(pItem);
+    //if (pCntItem)
+        //OnRegionState(pItem);
     //else
         //FIXME:Move this to here
         //OnTemplateState(pItem);
diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx
index f46596f..452ada2 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -99,10 +99,11 @@ class BackingWindow
 
     void setupButton( PushButton* pButton );
     //Template Manager
-    void OnTemplateImport ();
-    void OnFolderNew ();
-    void OnFolderDelete ();
-    void OnRegionState (const ThumbnailViewItem *pItem);
+    void OnTemplateOpen ();
+    //void OnTemplateImport ();
+    //void OnFolderNew ();
+    //void OnFolderDelete ();
+    //void OnRegionState (const ThumbnailViewItem *pItem);
 
     void dispatchURL( const OUString& i_rURL,
                       const OUString& i_rTarget = OUString( "_default" ),
@@ -119,6 +120,8 @@ class BackingWindow
     DECL_LINK(TBXViewHdl, void*);
     DECL_LINK(TBXTemplateHdl, void*);
     DECL_LINK(TVItemStateHdl, const ThumbnailViewItem*);
+    DECL_LINK(OpenTemplateHdl, ThumbnailViewItem*);
+    DECL_LINK(DoubleClickHdl, void*);
 
     void initControls();
 
commit c1f1593014304939f6d0952e2199b568884dc562
Author: Efe Gürkan YALAMAN <efeyalaman at gmail.com>
Date:   Sat Jun 14 04:02:19 2014 +0300

    Initial TemplateBar moved from TemplateManager
    
    Change-Id: I335e69de31bd64e7c4504a58d7652f755491af33

diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 5026b93..1aaefe4 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -71,6 +71,15 @@ const char TEMPLATE_URL[] =       "slot:5500";
 const char OPEN_URL[] =           ".uno:Open";
 const char SERVICENAME_CFGREADACCESS[] = "com.sun.star.configuration.ConfigurationAccess";
 
+const char TEMPLATEBAR_SAVE[] = "template_save";
+const char TEMPLATEBAR_OPEN[] = "open";
+const char TEMPLATEBAR_EDIT[] = "edit";
+const char TEMPLATEBAR_PROPERTIES[] = "properties";
+const char TEMPLATEBAR_DEFAULT[] = "default";
+const char TEMPLATEBAR_MOVE[] = "move";
+const char TEMPLATEBAR_EXPORT[] = "export";
+const char TEMPLATEBAR_DELETE[] = "template_delete";
+
 float fMultiplier = 1.4f;
 const Color aButtonsBackground(114, 168, 84); // TDF green
 const Color aButtonsText(COL_WHITE);
@@ -116,6 +125,7 @@ BackingWindow::BackingWindow( Window* i_pParent ) :
     get(mpExtensionsButton, "extensions");
 
     get(mpViewBar, "action_view");
+    get(mpTemplateBar, "action_templates");
 
     //Containers are invisible to cursor traversal
     //So on pressing "right" when in Help the
@@ -276,6 +286,11 @@ void BackingWindow::initControls()
     //mpViewBar->SetDropdownClickHdl(LINK(this,BackingWindow,TBXDropdownHdl));
     mpViewBar->Hide();
 
+    mpTemplateBar->SetButtonType(BUTTON_SYMBOLTEXT);
+    mpTemplateBar->SetItemBits(mpTemplateBar->GetItemId(TEMPLATEBAR_MOVE), TIB_DROPDOWNONLY);
+    mpTemplateBar->SetClickHdl( LINK( this, BackingWindow,TBXTemplateHdl ) );
+    //mpTemplateBar->SetDropdownClickHdl(LINK(this, BackingWindow,TBXDropdownHdl));
+
     //set handlers
     mpLocalView->setItemStateHdl(LINK(this, BackingWindow, TVItemStateHdl));
     mpLocalView->setOpenRegionHdl(LINK(this, BackingWindow, OpenRegionHdl));
@@ -795,6 +810,28 @@ IMPL_LINK_NOARG(BackingWindow,TBXViewHdl)
     return 0;
 }
 
+//FIXME: Implement OnSomething() methods
+IMPL_LINK_NOARG(BackingWindow,TBXTemplateHdl)
+{
+    //const size_t nCurItemId = mpTemplateBar->GetCurItemId();
+
+    //if (nCurItemId == mpTemplateBar->GetItemId(TEMPLATEBAR_OPEN))
+        //OnTemplateOpen();
+    //else if (nCurItemId == mpTemplateBar->GetItemId(TEMPLATEBAR_EDIT))
+        //OnTemplateEdit();
+    //else if (nCurItemId == mpTemplateBar->GetItemId(TEMPLATEBAR_PROPERTIES))
+        //OnTemplateProperties();
+    //else if (nCurItemId == mpTemplateBar->GetItemId(TEMPLATEBAR_DELETE))
+        //OnTemplateDelete();
+    //else if (nCurItemId == mpTemplateBar->GetItemId(TEMPLATEBAR_DEFAULT))
+        //OnTemplateAsDefault();
+    //else if (nCurItemId == mpTemplateBar->GetItemId(TEMPLATEBAR_EXPORT))
+        //OnTemplateExport();
+
+    return 0;
+}
+
+
 IMPL_LINK(BackingWindow, TVItemStateHdl, const ThumbnailViewItem*, pItem)
 {
     const TemplateContainerItem *pCntItem = dynamic_cast<const TemplateContainerItem*>(pItem);
diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx
index 743954c..f46596f 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -86,6 +86,7 @@ class BackingWindow
     TemplateAbstractView*           mpCurrentView;
 
     ToolBox*                        mpViewBar;
+    ToolBox*                        mpTemplateBar;
 
     std::vector<Window*>            maDndWindows;
 
@@ -97,11 +98,10 @@ class BackingWindow
     svt::AcceleratorExecute*        mpAccExec;
 
     void setupButton( PushButton* pButton );
+    //Template Manager
     void OnTemplateImport ();
-
     void OnFolderNew ();
     void OnFolderDelete ();
-
     void OnRegionState (const ThumbnailViewItem *pItem);
 
     void dispatchURL( const OUString& i_rURL,
@@ -117,6 +117,7 @@ class BackingWindow
     DECL_LINK(ExtLinkClickHdl, Button*);
     DECL_LINK(OpenRegionHdl, void*);
     DECL_LINK(TBXViewHdl, void*);
+    DECL_LINK(TBXTemplateHdl, void*);
     DECL_LINK(TVItemStateHdl, const ThumbnailViewItem*);
 
     void initControls();
diff --git a/sfx2/uiconfig/ui/startcenter.ui b/sfx2/uiconfig/ui/startcenter.ui
index 2013694..63d6cfb 100644
--- a/sfx2/uiconfig/ui/startcenter.ui
+++ b/sfx2/uiconfig/ui/startcenter.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.0 on Sun Jun  1 16:42:18 2014 -->
+<!-- Generated with glade 3.16.0 on Sat Jun 14 02:47:36 2014 -->
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
   <!-- interface-requires LibreOffice 1.0 -->
@@ -388,75 +388,209 @@
             <property name="can_focus">False</property>
             <property name="orientation">vertical</property>
             <child>
-              <object class="GtkToolbar" id="action_view">
+              <object class="GtkBox" id="box3">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="hexpand">True</property>
                 <child>
-                  <object class="GtkToolButton" id="repository">
+                  <object class="GtkToolbar" id="action_view">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="action_name">repository</property>
-                    <property name="label" translatable="yes">Repository</property>
-                    <property name="use_underline">True</property>
-                    <property name="icon_name">sfx2/imglst/actionview026.png</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="homogeneous">True</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkToolButton" id="import">
-                    <property name="can_focus">False</property>
-                    <property name="action_name">import</property>
-                    <property name="label" translatable="yes">Import</property>
-                    <property name="use_underline">True</property>
-                    <property name="icon_name">sfx2/imglst/actionview010.png</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="homogeneous">True</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkToolButton" id="delete">
-                    <property name="can_focus">False</property>
-                    <property name="action_name">delete</property>
-                    <property name="label" translatable="yes">Delete</property>
-                    <property name="use_underline">True</property>
-                    <property name="icon_name">sfx2/imglst/actionview025.png</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="homogeneous">True</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkToolButton" id="save">
-                    <property name="can_focus">False</property>
-                    <property name="action_name">save</property>
-                    <property name="label" translatable="yes">Save</property>
-                    <property name="use_underline">True</property>
-                    <property name="icon_name">sfx2/imglst/actionview028.png</property>
+                    <property name="hexpand">True</property>
+                    <child>
+                      <object class="GtkToolButton" id="repository">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="action_name">repository</property>
+                        <property name="label" translatable="yes">Repository</property>
+                        <property name="use_underline">True</property>
+                        <property name="icon_name">sfx2/imglst/actionview026.png</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="homogeneous">True</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkToolButton" id="import">
+                        <property name="can_focus">False</property>
+                        <property name="action_name">import</property>
+                        <property name="label" translatable="yes">Import</property>
+                        <property name="use_underline">True</property>
+                        <property name="icon_name">sfx2/imglst/actionview010.png</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="homogeneous">True</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkToolButton" id="delete">
+                        <property name="can_focus">False</property>
+                        <property name="action_name">delete</property>
+                        <property name="label" translatable="yes">Delete</property>
+                        <property name="use_underline">True</property>
+                        <property name="icon_name">sfx2/imglst/actionview025.png</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="homogeneous">True</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkToolButton" id="save">
+                        <property name="can_focus">False</property>
+                        <property name="action_name">save</property>
+                        <property name="label" translatable="yes">Save</property>
+                        <property name="use_underline">True</property>
+                        <property name="icon_name">sfx2/imglst/actionview028.png</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="homogeneous">True</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkToolButton" id="new_folder">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="action_name">new_folder</property>
+                        <property name="label" translatable="yes">New Folder</property>
+                        <property name="use_underline">True</property>
+                        <property name="icon_name">sfx2/imglst/actionview029.png</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="homogeneous">True</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="homogeneous">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkToolButton" id="new_folder">
-                    <property name="visible">True</property>
+                  <object class="GtkToolbar" id="action_templates">
                     <property name="can_focus">False</property>
-                    <property name="action_name">new_folder</property>
-                    <property name="label" translatable="yes">New Folder</property>
-                    <property name="use_underline">True</property>
-                    <property name="icon_name">sfx2/imglst/actionview029.png</property>
+                    <property name="hexpand">True</property>
+                    <child>
+                      <object class="GtkToolButton" id="template_save">
+                        <property name="can_focus">False</property>
+                        <property name="action_name">template_save</property>
+                        <property name="label" translatable="yes">Save</property>
+                        <property name="use_underline">True</property>
+                        <property name="icon_name">sfx2/imglst/actionview028.png</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="homogeneous">True</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkToolButton" id="open">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="action_name">open</property>
+                        <property name="label" translatable="yes">Open</property>
+                        <property name="use_underline">True</property>
+                        <property name="icon_name">sfx2/imglst/actionview030.png</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="homogeneous">True</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkToolButton" id="edit">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="action_name">edit</property>
+                        <property name="label" translatable="yes">Edit</property>
+                        <property name="use_underline">True</property>
+                        <property name="icon_name">sfx2/imglst/actiontemplates019.png</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="homogeneous">True</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkToolButton" id="properties">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="action_name">properties</property>
+                        <property name="label" translatable="yes">Properties</property>
+                        <property name="use_underline">True</property>
+                        <property name="icon_name">sfx2/imglst/actiontemplates016.png</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="homogeneous">True</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkToolButton" id="default">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="action_name">default</property>
+                        <property name="label" translatable="yes">Set as Default</property>
+                        <property name="use_underline">True</property>
+                        <property name="icon_name">sfx2/imglst/actiontemplates015.png</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="homogeneous">True</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkToolButton" id="move">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="action_name">move</property>
+                        <property name="label" translatable="yes">Move to Folder</property>
+                        <property name="use_underline">True</property>
+                        <property name="icon_name">sfx2/imglst/actiontemplates017.png</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="homogeneous">True</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkToolButton" id="export">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="action_name">export</property>
+                        <property name="label" translatable="yes">Export</property>
+                        <property name="use_underline">True</property>
+                        <property name="icon_name">sfx2/imglst/actiontemplates020.png</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="homogeneous">True</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkToolButton" id="template_delete">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="action_name">template_delete</property>
+                        <property name="label" translatable="yes">Delete</property>
+                        <property name="use_underline">True</property>
+                        <property name="icon_name">sfx2/imglst/actiontemplates018.png</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="homogeneous">True</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="homogeneous">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
                   </packing>
                 </child>
               </object>
commit 9a4d86a0fd65876d5d456088bb6abbe047d9893a
Author: Efe Gürkan YALAMAN <efeyalaman at gmail.com>
Date:   Sat Jun 14 03:08:29 2014 +0300

    Some folder features moved to backingwindow
    
    Create new folder and delete a folder moved from template manager dialog
    to startcenter.
    
    Change-Id: If89b9fd7ee499f7fccda08d3ac989728148a24a0

diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index de5105c..5026b93 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -18,6 +18,7 @@
  */
 
 #include "backingwindow.hxx"
+#include "inputdlg.hxx"
 
 #include <vcl/settings.hxx>
 #include <vcl/svapp.hxx>
@@ -51,7 +52,7 @@
 #include <com/sun/star/task/InteractionHandler.hpp>
 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
 
-//well find a better way for it.
+//FIXME:well find a better way for it.
 #include "../doc/doc.hrc"
 
 using namespace ::com::sun::star;
@@ -593,6 +594,56 @@ void BackingWindow::OnTemplateImport ()
     }
 }
 
+void BackingWindow::OnFolderDelete()
+{
+    QueryBox aQueryDlg(this, WB_YES_NO | WB_DEF_YES, SfxResId(STR_QMSG_SEL_FOLDER_DELETE).toString());
+
+    if ( aQueryDlg.Execute() == RET_NO )
+        return;
+
+    OUString aFolderList;
+
+    std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter;
+    std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelFolders = maSelFolders; //Copy to avoid invalidating      an iterator
+
+    for (pIter = aSelFolders.begin(); pIter != aSelFolders.end(); ++pIter)
+    {
+        if (!mpLocalView->removeRegion((*pIter)->mnId))
+        {
+            if (aFolderList.isEmpty())
+                aFolderList = (*pIter)->maTitle;
+            else
+                aFolderList = aFolderList + "\n" + (*pIter)->maTitle;
+
+            ++pIter;
+            if (pIter == aSelFolders.end())
+                break;
+        }
+    }
+
+    if (!aFolderList.isEmpty())
+    {
+        OUString aMsg( SfxResId(STR_MSG_ERROR_DELETE_FOLDER).toString() );
+        ErrorBox(this, WB_OK,aMsg.replaceFirst("$1",aFolderList)).Execute();
+    }
+}
+
+
+void BackingWindow::OnFolderNew()
+{
+    InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this);
+
+    int ret = dlg.Execute();
+
+    if (ret)
+    {
+        OUString aName = dlg.getEntryText();
+
+        mpCurrentView->createRegion(aName);
+    }
+}
+
+
 void BackingWindow::OnRegionState (const ThumbnailViewItem *pItem)
 {
     if (pItem->isSelected())
@@ -729,15 +780,15 @@ IMPL_LINK_NOARG(BackingWindow,TBXViewHdl)
 
     if (nCurItemId == mpViewBar->GetItemId("import"))
         OnTemplateImport();
-    //else if (nCurItemId == mpViewBar->GetItemId("delete"))
-    //{
-        //if (mpCurView == mpLocalView)
-            ////OnFolderDelete();
+    else if (nCurItemId == mpViewBar->GetItemId("delete"))
+    {
+        if (mpCurrentView == mpLocalView)
+            OnFolderDelete();
         //else
             ////OnRepositoryDelete();
-    //}
-    //else if (nCurItemId == mpViewBar->GetItemId("new_folder"))
-        ////OnFolderNew();
+    }
+    else if (nCurItemId == mpViewBar->GetItemId("new_folder"))
+        OnFolderNew();
     //else if (nCurItemId == mpViewBar->GetItemId("save"))
         ////OnTemplateSaveAs();
 
diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx
index b80201a..743954c 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -98,6 +98,10 @@ class BackingWindow
 
     void setupButton( PushButton* pButton );
     void OnTemplateImport ();
+
+    void OnFolderNew ();
+    void OnFolderDelete ();
+
     void OnRegionState (const ThumbnailViewItem *pItem);
 
     void dispatchURL( const OUString& i_rURL,
commit f689f13c6c0b249e74a3bbb334b5e90d86abef7f
Author: Efe Gürkan YALAMAN <efeyalaman at gmail.com>
Date:   Fri Jun 6 17:30:13 2014 +0300

    selection function moved
    
    The localview is not causing crash now.
    
    Change-Id: Iea2fe607555d2d3c955f8f198240a2b2d1e26788

diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 78ba029..de5105c 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -74,12 +74,28 @@ float fMultiplier = 1.4f;
 const Color aButtonsBackground(114, 168, 84); // TDF green
 const Color aButtonsText(COL_WHITE);
 
+/***
+ *
+ * Order items in ascending order (useful for the selection sets and move/copy operations since the associated ids
+ * change when processed by the SfxDocumentTemplates class so we want to process to ones with higher id first)
+ *
+ ***/
+
+static bool cmpSelectionItems (const ThumbnailViewItem *pItem1, const ThumbnailViewItem *pItem2)
+{
+    return pItem1->mnId > pItem2->mnId;
+}
+
+
 BackingWindow::BackingWindow( Window* i_pParent ) :
     Window( i_pParent ),
     mxDesktop( Desktop::create(comphelper::getProcessComponentContext()) ),
     mbInitControls( false ),
     mnHideExternalLinks( 0 ),
-    mpAccExec( NULL )
+    mpAccExec( NULL ),
+    maSelTemplates(cmpSelectionItems),
+    maSelFolders(cmpSelectionItems)
+
 {
     m_pUIBuilder = new VclBuilder(this, getUIRootDir(), "sfx/ui/startcenter.ui", "StartCenter" );
 
commit 507b68aba74c40bd362b50a9a854daf2746bd4e7
Author: Efe Gürkan YALAMAN <efeyalaman at gmail.com>
Date:   Mon Jun 2 01:42:37 2014 +0300

    Some handlers and buttons moved
    
    Some more handlers and buttons moved. Still not usable mostly.
    
    Change-Id: I19c9c36a490030369b4e8d84b41f6d2962665426

diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 81d6b48..78ba029 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -27,6 +27,12 @@
 #include <svtools/openfiledroptargetlistener.hxx>
 #include <svtools/colorcfg.hxx>
 #include <svtools/langhelp.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <sfx2/sfxresid.hxx>
+#include <sfx2/templatecontaineritem.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/toolbox.hxx>
+
 
 #include <comphelper/processfactory.hxx>
 #include <comphelper/sequenceashashmap.hxx>
@@ -43,6 +49,10 @@
 #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
 #include <com/sun/star/util/URLTransformer.hpp>
 #include <com/sun/star/task/InteractionHandler.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+
+//well find a better way for it.
+#include "../doc/doc.hrc"
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::beans;
@@ -241,11 +251,18 @@ void BackingWindow::initControls()
     mpLocalView->Hide();
     mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_NONE));
 
+    mpCurrentView = mpLocalView;
+
     mpViewBar->SetButtonType(BUTTON_SYMBOLTEXT);
     mpViewBar->SetItemBits(mpViewBar->GetItemId("repository"), TIB_DROPDOWNONLY);
-    //mpViewBar->SetClickHdl(LINK(this,BackingWindow,TBXViewHdl));
+    mpViewBar->SetClickHdl(LINK(this,BackingWindow,TBXViewHdl));
     //mpViewBar->SetDropdownClickHdl(LINK(this,BackingWindow,TBXDropdownHdl));
     mpViewBar->Hide();
+
+    //set handlers
+    mpLocalView->setItemStateHdl(LINK(this, BackingWindow, TVItemStateHdl));
+    mpLocalView->setOpenRegionHdl(LINK(this, BackingWindow, OpenRegionHdl));
+
     /*FIXME: Add other things for Local View
      *Filter and the bars*/
 
@@ -439,6 +456,154 @@ void BackingWindow::Resize()
         Invalidate();
 }
 
+void BackingWindow::OnTemplateImport ()
+{
+    size_t nDialogType =
+        com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE;
+
+    sfx2::FileDialogHelper aFileDlg(nDialogType, SFXWB_MULTISELECTION);
+
+    // add "All" filter
+    aFileDlg.AddFilter( SfxResId(STR_SFX_FILTERNAME_ALL).toString(),
+                        OUString(FILEDIALOG_FILTER_ALL) );
+
+    // add template filter
+    OUString sFilterExt;
+    OUString sFilterName( SfxResId( STR_TEMPLATE_FILTER ).toString() );
+
+    // add filters of modules which are installed
+    SvtModuleOptions aModuleOpt;
+    if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) )
+        sFilterExt += "*.ott;*.stw;*.oth";
+
+    if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) )
+    {
+        if ( !sFilterExt.isEmpty() )
+            sFilterExt += ";";
+
+        sFilterExt += "*.ots;*.stc";
+    }
+
+    if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) )
+    {
+        if ( !sFilterExt.isEmpty() )
+            sFilterExt += ";";
+
+        sFilterExt += "*.otp;*.sti";
+    }
+
+    if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) )
+    {
+        if ( !sFilterExt.isEmpty() )
+            sFilterExt += ";";
+
+        sFilterExt += "*.otg;*.std";
+
+
+    if ( !sFilterExt.isEmpty() )
+        sFilterExt += ";";
+
+    sFilterExt += "*.vor";
+
+    sFilterName += " (";
+    sFilterName += sFilterExt;
+    sFilterName += ")";
+
+    aFileDlg.AddFilter( sFilterName, sFilterExt );
+    aFileDlg.SetCurrentFilter( sFilterName );
+
+    ErrCode nCode = aFileDlg.Execute();
+
+    if ( nCode == ERRCODE_NONE )
+    {
+        com::sun::star::uno::Sequence<OUString> aFiles = aFileDlg.GetSelectedFiles();
+
+        if (aFiles.hasElements())
+        {
+            if (!maSelFolders.empty())
+            {
+                //Import to the selected regions
+                std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter;
+                for (pIter = maSelFolders.begin(); pIter != maSelFolders.end(); ++pIter)
+                {
+                    OUString aTemplateList;
+                    TemplateContainerItem *pFolder = (TemplateContainerItem*)(*pIter);
+
+                    for (size_t i = 0, n = aFiles.getLength(); i < n; ++i)
+                    {
+                        if(!mpLocalView->copyFrom(pFolder,aFiles[i]))
+                        {
+                            if (aTemplateList.isEmpty())
+                                aTemplateList = aFiles[i];
+                            else
+                                aTemplateList = aTemplateList + "\n" + aFiles[i];
+                        }
+                    }
+
+                    if (!aTemplateList.isEmpty())
+                    {
+                        OUString aMsg(SfxResId(STR_MSG_ERROR_IMPORT).toString());
+                        aMsg = aMsg.replaceFirst("$1",pFolder->maTitle);
+                        ErrorBox(this,WB_OK,aMsg.replaceFirst("$2",aTemplateList));
+                    }
+                }
+            }
+            else
+            {
+                //Import to current region
+                OUString aTemplateList;
+                for (size_t i = 0, n = aFiles.getLength(); i < n; ++i)
+                {
+                    if(!mpLocalView->copyFrom(aFiles[i]))
+                    {
+                        if (aTemplateList.isEmpty())
+                            aTemplateList = aFiles[i];
+                        else
+                            aTemplateList = aTemplateList + "\n" + aFiles[i];
+                    }
+                }
+
+                if (!aTemplateList.isEmpty())
+                {
+                    OUString aMsg(SfxResId(STR_MSG_ERROR_IMPORT).toString());
+                    aMsg = aMsg.replaceFirst("$1",mpLocalView->getCurRegionName());
+                    ErrorBox(this,WB_OK,aMsg.replaceFirst("$2",aTemplateList));
+                }
+            }
+
+            mpLocalView->Invalidate(INVALIDATE_NOERASE);
+            }
+        }
+    }
+}
+
+void BackingWindow::OnRegionState (const ThumbnailViewItem *pItem)
+{
+    if (pItem->isSelected())
+    {
+        if (maSelFolders.empty() && !mbIsSaveMode)
+        {
+            mpViewBar->ShowItem("import");
+            mpViewBar->ShowItem("delete");
+            mpViewBar->HideItem("new_folder");
+        }
+
+        maSelFolders.insert(pItem);
+    }
+    else
+    {
+        maSelFolders.erase(pItem);
+
+        if (maSelFolders.empty() && !mbIsSaveMode)
+        {
+            mpViewBar->HideItem("import");
+            mpViewBar->HideItem("delete");
+            mpViewBar->ShowItem("new_folder");
+        }
+    }
+}
+
+
 IMPL_LINK(BackingWindow, ExtLinkClickHdl, Button*, pButton)
 {
     OUString aNode;
@@ -523,23 +688,61 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton )
     return 0;
 }
 
+//FIXME: Obvious enough
 IMPL_LINK_NOARG( BackingWindow, OpenRegionHdl)
 {
-    //maSelFolders.clear();
-    //maSelTemplates.clear();
+    maSelFolders.clear();
+    maSelTemplates.clear();
 
-    //mpViewBar->ShowItem(VIEWBAR_NEW_FOLDER, mpCurView->isNestedRegionAllowed());
+    mpViewBar->ShowItem("new_folder", mpCurrentView->isNestedRegionAllowed());
 
-    //if (!mbIsSaveMode)
-        //mpViewBar->ShowItem(VIEWBAR_IMPORT, mpCurView->isImportAllowed());
+    if (!mbIsSaveMode)
+        mpViewBar->ShowItem("import", mpCurrentView->isImportAllowed());
 
     //mpTemplateBar->Hide();
-    //mpViewBar->Show();
+    mpViewBar->Show();
     //mpActionBar->Show();
 
     return 0;
 }
 
+//FIXME: Implement OnSomething() methods
+IMPL_LINK_NOARG(BackingWindow,TBXViewHdl)
+{
+    const size_t nCurItemId = mpViewBar->GetCurItemId();
+
+    if (nCurItemId == mpViewBar->GetItemId("import"))
+        OnTemplateImport();
+    //else if (nCurItemId == mpViewBar->GetItemId("delete"))
+    //{
+        //if (mpCurView == mpLocalView)
+            ////OnFolderDelete();
+        //else
+            ////OnRepositoryDelete();
+    //}
+    //else if (nCurItemId == mpViewBar->GetItemId("new_folder"))
+        ////OnFolderNew();
+    //else if (nCurItemId == mpViewBar->GetItemId("save"))
+        ////OnTemplateSaveAs();
+
+    return 0;
+}
+
+IMPL_LINK(BackingWindow, TVItemStateHdl, const ThumbnailViewItem*, pItem)
+{
+    const TemplateContainerItem *pCntItem = dynamic_cast<const TemplateContainerItem*>(pItem);
+
+    if (pCntItem)
+        OnRegionState(pItem);
+    //else
+        //FIXME:Move this to here
+        //OnTemplateState(pItem);
+
+    return 0;
+}
+
+
+
 
 struct ImplDelayedDispatch
 {
diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx
index cff49ec..b80201a 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -26,7 +26,6 @@
 #include <vcl/button.hxx>
 #include <vcl/tabctrl.hxx>
 #include <vcl/layout.hxx>
-#include <vcl/toolbox.hxx>
 
 #include <sfx2/recentdocsview.hxx>
 #include <sfx2/templatelocalview.hxx>
@@ -45,10 +44,13 @@
 
 #include <set>
 
+class ToolBox;
+
 class BackingWindow
     : public Window
     , public VclBuilderContainer
 {
+    typedef bool (*selection_cmp_fn)(const ThumbnailViewItem*,const ThumbnailViewItem*);
     com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >         mxContext;
     com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider >        mxDesktopDispatchProvider;
     com::sun::star::uno::Reference<com::sun::star::frame::XFrame>                    mxFrame;
@@ -89,11 +91,14 @@ class BackingWindow
 
     Rectangle                       maStartCentButtons;
 
+    bool                            mbIsSaveMode;
     bool                            mbInitControls;
     sal_Int32                       mnHideExternalLinks;
     svt::AcceleratorExecute*        mpAccExec;
 
     void setupButton( PushButton* pButton );
+    void OnTemplateImport ();
+    void OnRegionState (const ThumbnailViewItem *pItem);
 
     void dispatchURL( const OUString& i_rURL,
                       const OUString& i_rTarget = OUString( "_default" ),
@@ -101,9 +106,14 @@ class BackingWindow
                       const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& = com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >()
                       );
 
+    std::set<const ThumbnailViewItem*,selection_cmp_fn> maSelTemplates;
+    std::set<const ThumbnailViewItem*,selection_cmp_fn> maSelFolders;
+
     DECL_LINK(ClickHdl, Button*);
     DECL_LINK(ExtLinkClickHdl, Button*);
     DECL_LINK(OpenRegionHdl, void*);
+    DECL_LINK(TBXViewHdl, void*);
+    DECL_LINK(TVItemStateHdl, const ThumbnailViewItem*);
 
     void initControls();
 
commit 031f11ee3b3cefe2814744a6d854857652f81e51
Author: Efe Gürkan YALAMAN <efeyalaman at gmail.com>
Date:   Sun Jun 1 17:02:56 2014 +0300

    ViewBar moved to Start Center
    
    View bar moved to the start center without handlers. Visible but
    useless ATM.
    
    Change-Id: I1cb64faa1ee86b19ecbb793351c8c11362ef799e

diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index e223ee9..81d6b48 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -88,6 +88,8 @@ BackingWindow::BackingWindow( Window* i_pParent ) :
     get(mpHelpButton, "help");
     get(mpExtensionsButton, "extensions");
 
+    get(mpViewBar, "action_view");
+
     //Containers are invisible to cursor traversal
     //So on pressing "right" when in Help the
     //extension button is considered as a candidate
@@ -239,6 +241,11 @@ void BackingWindow::initControls()
     mpLocalView->Hide();

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list