[Libreoffice-commits] .: Branch 'libreoffice-4-0' - sfx2/inc sfx2/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 12 06:49:30 PST 2012


 sfx2/inc/templatedlg.hxx        |   15 +----
 sfx2/source/doc/templatedlg.cxx |  103 +++++++++++++---------------------------
 sfx2/source/doc/templatedlg.hrc |   12 ++--
 sfx2/source/doc/templatedlg.src |   79 +++++++++++++-----------------
 4 files changed, 79 insertions(+), 130 deletions(-)

New commits:
commit 78f9e681b689480c4463390ee6965fbe0861a3fc
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Wed Dec 12 15:43:24 2012 +0100

    Template manager: use tabs instead of buttons to filter the documents
    
    Change-Id: I2ec7baffaf5e88c7daf6040bdac8e173651b42f1

diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx
index ae2cb16..bbdcbda 100644
--- a/sfx2/inc/templatedlg.hxx
+++ b/sfx2/inc/templatedlg.hxx
@@ -14,6 +14,7 @@
 
 #include <vcl/dialog.hxx>
 #include <vcl/button.hxx>
+#include <vcl/tabctrl.hxx>
 
 class Edit;
 class PopupMenu;
@@ -45,11 +46,7 @@ public:
 
     void setDocumentModel (const com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel);
 
-    DECL_LINK(ViewAllHdl, void*);
-    DECL_LINK(ViewDocsHdl, void*);
-    DECL_LINK(ViewPresentsHdl, void*);
-    DECL_LINK(ViewSheetsHdl, void*);
-    DECL_LINK(ViewDrawsHdl, void*);
+    DECL_LINK(ActivatePageHdl, void*);
 
 private:
 
@@ -87,8 +84,6 @@ private:
     void OnRepositoryDelete ();
     void OnTemplateSaveAs ();
 
-    void centerTopButtons ();
-
     void createRepositoryMenu ();
 
     void createDefaultTemplateMenu ();
@@ -116,11 +111,7 @@ private:
 
 private:
 
-    PushButton aButtonAll;
-    PushButton aButtonDocs;
-    PushButton aButtonPresents;
-    PushButton aButtonSheets;
-    PushButton aButtonDraws;
+    TabControl maTabControl;
     Control *mpToolbars;
 
     Edit *mpSearchEdit;
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index e0ea98c..548fdd9 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -99,12 +99,8 @@ private:
 
 SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
     : ModelessDialog(parent, SfxResId(DLG_TEMPLATE_MANAGER)),
-      aButtonAll(this,SfxResId(BTN_SELECT_ALL)),
-      aButtonDocs(this,SfxResId(BTN_SELECT_DOCS)),
-      aButtonPresents(this,SfxResId(BTN_SELECT_PRESENTATIONS)),
-      aButtonSheets(this,SfxResId(BTN_SELECT_SHEETS)),
-      aButtonDraws(this,SfxResId(BTN_SELECT_DRAWS)),
-      mpToolbars( new Control(this,SfxResId(TOOLBARS))),
+      maTabControl(this,SfxResId(TAB_CONTROL)),
+      mpToolbars( new Control(&maTabControl,SfxResId(TOOLBARS))),
       mpSearchEdit(new Edit(this,WB_HIDE | WB_BORDER)),
       mpViewBar( new ToolBox(mpToolbars, SfxResId(TBX_ACTION_VIEW))),
       mpActionBar( new ToolBox(mpToolbars, SfxResId(TBX_ACTION_ACTION))),
@@ -131,6 +127,14 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
 
     Size aWinSize = GetOutputSize();
 
+    // Fit the tab page control and the toolbars
+    Size aTabSize = maTabControl.GetSizePixel();
+    Size aTabPageSize = maTabControl.GetTabPageSizePixel();
+    Point aToolbarsPos(0, aTabSize.getHeight() - aTabPageSize.getHeight());
+    mpToolbars->SetPosPixel(aToolbarsPos);
+    aTabPageSize.setHeight(mpToolbars->GetSizePixel().getHeight() + 3);
+    maTabControl.SetTabPageSizePixel(aTabPageSize);
+
     // Calculate toolboxs size and positions
     Size aViewSize = mpViewBar->CalcMinimumWindowSizePixel();
     Size aActionSize = mpActionBar->CalcMinimumWindowSizePixel();
@@ -166,7 +170,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
 
     // Set view position below toolbox
     Point aViewPos = maView->GetPosPixel();
-    aViewPos.setY(mpToolbars->GetPosPixel().Y() + mpToolbars->GetSizePixel().getHeight());
+    aViewPos.setY(maTabControl.GetPosPixel().Y() + maTabControl.GetSizePixel().getHeight());
     aViewPos.setX(0);
     Size aThumbSize(aWinSize.getWidth(), aWinSize.getHeight() - aViewPos.getY());
     maView->SetPosSizePixel(aViewPos, aThumbSize);
@@ -179,7 +183,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
     aSearchSize.setWidth(aWinSize.getWidth() - 2*PADDING_DLG_BORDER);
 
     mpSearchEdit->SetSizePixel(aSearchSize);
-    mpSearchEdit->SetPosPixel(Point(PADDING_DLG_BORDER,aActionPos.Y()+aActionSize.getHeight()));
+    mpSearchEdit->SetPosPixel(Point(PADDING_DLG_BORDER,aViewPos.Y()));
     mpSearchEdit->SetUpdateDataHdl(LINK(this,SfxTemplateManagerDlg,SearchUpdateHdl));
     mpSearchEdit->EnableUpdateData();
 
@@ -218,17 +222,11 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
 
     mpSearchView->setItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVTemplateStateHdl));
 
-    aButtonAll.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewAllHdl));
-    aButtonDocs.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewDocsHdl));
-    aButtonPresents.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewPresentsHdl));
-    aButtonSheets.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewSheetsHdl));
-    aButtonDraws.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewDrawsHdl));
+    maTabControl.SetActivatePageHdl(LINK(this,SfxTemplateManagerDlg,ActivatePageHdl));
 
     // Set dialog to correct dimensions
     SetSizePixel(aWinSize);
 
-    centerTopButtons();
-
     mpViewBar->Show();
     mpActionBar->Show();
 
@@ -285,33 +283,28 @@ void SfxTemplateManagerDlg::setDocumentModel(const uno::Reference<frame::XModel>
     m_xModel = rModel;
 }
 
-IMPL_LINK_NOARG(SfxTemplateManagerDlg,ViewAllHdl)
-{
-    mpCurView->filterTemplatesByApp(FILTER_APP_NONE);
-    return 0;
-}
-
-IMPL_LINK_NOARG(SfxTemplateManagerDlg,ViewDocsHdl)
-{
-    mpCurView->filterTemplatesByApp(FILTER_APP_WRITER);
-    return 0;
-}
-
-IMPL_LINK_NOARG(SfxTemplateManagerDlg,ViewPresentsHdl)
-{
-    mpCurView->filterTemplatesByApp(FILTER_APP_IMPRESS);
-    return 0;
-}
-
-IMPL_LINK_NOARG(SfxTemplateManagerDlg,ViewSheetsHdl)
-{
-    mpCurView->filterTemplatesByApp(FILTER_APP_CALC);
-    return 0;
-}
-
-IMPL_LINK_NOARG(SfxTemplateManagerDlg,ViewDrawsHdl)
+IMPL_LINK_NOARG(SfxTemplateManagerDlg,ActivatePageHdl)
 {
-    mpCurView->filterTemplatesByApp(FILTER_APP_DRAW);
+    FILTER_APPLICATION eFilter = FILTER_APP_NONE;
+    switch (maTabControl.GetCurPageId())
+    {
+        case FILTER_DOCS:
+            eFilter = FILTER_APP_WRITER;
+            break;
+        case FILTER_PRESENTATIONS:
+            eFilter = FILTER_APP_IMPRESS;
+            break;
+        case FILTER_SHEETS:
+            eFilter = FILTER_APP_CALC;
+            break;
+        case FILTER_DRAWS:
+            eFilter = FILTER_APP_DRAW;
+            break;
+        default:
+        case FILTER_ALL:
+            ;
+    }
+    mpCurView->filterTemplatesByApp(eFilter);
     return 0;
 }
 
@@ -927,7 +920,7 @@ void SfxTemplateManagerDlg::OnTemplateSearch ()
         mpActionBar->SetItemState(TBI_TEMPLATE_SEARCH,STATE_CHECK);
     }
 
-    SetSizePixel(aWinSize);
+//    SetSizePixel(aWinSize);
     maView->SetPosPixel(aPos);
     mpOnlineView->SetPosPixel(aPos);
     mpSearchView->SetPosPixel(aPos);
@@ -1194,32 +1187,6 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs()
     }
 }
 
-void SfxTemplateManagerDlg::centerTopButtons()
-{
-    Point aFirstBtnPos = aButtonAll.GetPosPixel();
-
-    Size aBtnSize = aButtonAll.GetOutputSize();
-    Size aWinSize = GetOutputSize();
-
-    long nTotalWidth = aBtnSize.getWidth()*5;
-    long nSpace = (aWinSize.getWidth() - nTotalWidth)/2;
-
-    Point aBtnPos(nSpace,aFirstBtnPos.getY());
-    aButtonAll.SetPosPixel(aBtnPos);
-
-    aBtnPos.setX(aBtnPos.getX() + aBtnSize.getWidth());
-    aButtonDocs.SetPosPixel(aBtnPos);
-
-    aBtnPos.setX(aBtnPos.getX() + aBtnSize.getWidth());
-    aButtonPresents.SetPosPixel(aBtnPos);
-
-    aBtnPos.setX(aBtnPos.getX() + aBtnSize.getWidth());
-    aButtonSheets.SetPosPixel(aBtnPos);
-
-    aBtnPos.setX(aBtnPos.getX() + aBtnSize.getWidth());
-    aButtonDraws.SetPosPixel(aBtnPos);
-}
-
 void SfxTemplateManagerDlg::createRepositoryMenu()
 {
     mpRepositoryMenu->Clear();
diff --git a/sfx2/source/doc/templatedlg.hrc b/sfx2/source/doc/templatedlg.hrc
index 7624e48..02c6702 100644
--- a/sfx2/source/doc/templatedlg.hrc
+++ b/sfx2/source/doc/templatedlg.hrc
@@ -6,12 +6,12 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#define BTN_SELECT_ALL              1
-#define BTN_SELECT_DOCS             2
-#define BTN_SELECT_PRESENTATIONS    3
-#define BTN_SELECT_SHEETS           4
-#define BTN_SELECT_DRAWS            5
-#define BTN_SELECTION_MODE          6
+#define TAB_CONTROL                 1
+#define FILTER_ALL                  2
+#define FILTER_DOCS                 3
+#define FILTER_PRESENTATIONS        4
+#define FILTER_SHEETS               5
+#define FILTER_DRAWS                6
 
 #define TEMPLATE_VIEW               7
 
diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src
index 7a61186..a9ed10d 100644
--- a/sfx2/source/doc/templatedlg.src
+++ b/sfx2/source/doc/templatedlg.src
@@ -111,50 +111,43 @@ ModelessDialog DLG_TEMPLATE_MANAGER
     Size = MAP_APPFONT ( 290 , 250 );
     Text [en-US] = "Template Manager";
 
-    PushButton BTN_SELECT_ALL
+    TabControl TAB_CONTROL
     {
-        Pos = MAP_APPFONT(10,5);
-        Size = MAP_APPFONT(50,14);
-        TabStop = TRUE;
-        DefButton = TRUE;
-        Text [en-US] = "All";
-    };
-
-    PushButton BTN_SELECT_DOCS
-    {
-        Pos = MAP_APPFONT(60,5);
-        Size = MAP_APPFONT(50,14);
-        TabStop = TRUE;
-        Text [en-US] = "Documents";
-    };
-
-    PushButton BTN_SELECT_PRESENTATIONS
-    {
-        Pos = MAP_APPFONT(110,5);
-        Size = MAP_APPFONT(50,14);
-        TabStop = TRUE;
-        Text [en-US] = "Presentations";
-    };
-
-    PushButton BTN_SELECT_SHEETS
-    {
-        Pos = MAP_APPFONT(160,5);
-        Size = MAP_APPFONT(50,14);
-        TabStop = TRUE;
-        Text [en-US] = "Spreadsheets";
-    };
-
-    PushButton BTN_SELECT_DRAWS
-    {
-        Pos = MAP_APPFONT(210,5);
-        Size = MAP_APPFONT(50,14);
-        TabStop = TRUE;
-        Text [en-US] = "Drawings";
+        OutputSize = TRUE;
+        Size = MAP_APPFONT( 290, 22 );
+        Pos = MAP_APPFONT( 0, 0 );
+        PageList =
+        {
+            PageItem
+            {
+                Identifier = FILTER_ALL;
+                Text [ en-US ] = "All";
+            };
+            PageItem
+            {
+                Identifier = FILTER_DOCS;
+                Text [ en-US ] = "Documents";
+            };
+            PageItem
+            {
+                Identifier = FILTER_SHEETS;
+                Text [ en-US ] = "Spreadsheets";
+            };
+            PageItem
+            {
+                Identifier = FILTER_PRESENTATIONS;
+                Text [ en-US ] = "Presentations";
+            };
+            PageItem
+            {
+                Identifier = FILTER_DRAWS;
+                Text [ en-US ] = "Drawings";
+            };
+        };
     };
 
     Control TEMPLATE_VIEW
     {
-        Pos = MAP_APPFONT(5,30);
         Size = MAP_APPFONT(280,220);
         TabStop = TRUE;
     };
@@ -177,8 +170,7 @@ ModelessDialog DLG_TEMPLATE_MANAGER
 
     Control TOOLBARS
     {
-        Pos = MAP_APPFONT( 0 , 22 );
-        Size = MAP_APPFONT( 290 , 20 );
+        Size = MAP_APPFONT( 290 , 16 );
         TabStop = False;
     };
 
@@ -242,7 +234,6 @@ ModelessDialog DLG_TEMPLATE_MANAGER
     ToolBox TBX_ACTION_ACTION
     {
         SVLook = TRUE ;
-        TabStop = TRUE ;
         Pos = MAP_APPFONT ( 4 , 0 ) ;
 
         ItemList =
@@ -254,7 +245,7 @@ ModelessDialog DLG_TEMPLATE_MANAGER
 
                 ItemImage = Image
                 {
-                    ImageBitmap = Bitmap { File = "search.png" ; };
+                    ImageBitmap = Bitmap { File = "actionaction012.png" ; };
                 };
             };
 
@@ -265,7 +256,7 @@ ModelessDialog DLG_TEMPLATE_MANAGER
 
                 ItemImage = Image
                 {
-                    ImageBitmap = Bitmap { File = "exec_action.png" ; };
+                    ImageBitmap = Bitmap { File = "actionaction013.png" ; };
                 };
             };
         };


More information about the Libreoffice-commits mailing list