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

Efe Gürkan YALAMAN efeyalaman at gmail.com
Fri Jun 13 18:04:05 PDT 2014


 sfx2/source/dialog/backingwindow.cxx |  104 +++++++++++++--
 sfx2/source/dialog/backingwindow.hxx |    5 
 sfx2/uiconfig/ui/startcenter.ui      |  242 +++++++++++++++++++++++++++--------
 3 files changed, 289 insertions(+), 62 deletions(-)

New commits:
commit 521c549ea611c136f9e078e5f00c3b86ee46c40f
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 544447f..3b0a342 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -70,6 +70,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";
+
 const int nButtonsFontSize = 15;
 const Color aButtonsBackground(114, 168, 84); // TDF green
 const Color aButtonsText(COL_WHITE);
@@ -115,6 +124,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
@@ -275,6 +285,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));
@@ -794,6 +809,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 8a26598..33a1778 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 -->
@@ -389,75 +389,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 138b46fb0b0951f406ea60a7beffefb1f27aa7ac
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 b170b60..544447f 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/svapp.hxx>
 #include <vcl/virdev.hxx>
@@ -50,7 +51,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;
@@ -592,6 +593,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())
@@ -728,15 +779,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,


More information about the Libreoffice-commits mailing list