[PATCH libreoffice-4-0] Template manager: moved the controls into a proper TabPage t...

Bosdonnat Cedric (via Code Review) gerrit at gerrit.libreoffice.org
Tue Mar 19 08:29:27 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2843

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/43/2843/1

Template manager: moved the controls into a proper TabPage to avoid problems

Conflicts:
	sfx2/inc/templatedlg.hxx
	sfx2/source/doc/templatedlg.src

Change-Id: Ibff35bf24873a38c9a09d71fb3630a57e06f1a3c
---
M sfx2/inc/templatedlg.hxx
M sfx2/source/control/templateview.src
M sfx2/source/doc/doc.hrc
M sfx2/source/doc/templatedlg.cxx
M sfx2/source/doc/templatedlg.src
5 files changed, 98 insertions(+), 74 deletions(-)



diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx
index 47c1989..095292e 100644
--- a/sfx2/inc/templatedlg.hxx
+++ b/sfx2/inc/templatedlg.hxx
@@ -15,6 +15,7 @@
 #include <vcl/dialog.hxx>
 #include <vcl/button.hxx>
 #include <vcl/tabctrl.hxx>
+#include <vcl/tabpage.hxx>
 
 class Edit;
 class PopupMenu;
@@ -126,6 +127,7 @@
 private:
 
     TabControl maTabControl;
+    TabPage maTabPage;
     Control *mpToolbars;
 
     Edit *mpSearchEdit;
diff --git a/sfx2/source/control/templateview.src b/sfx2/source/control/templateview.src
index d2711a7..db4d575 100644
--- a/sfx2/source/control/templateview.src
+++ b/sfx2/source/control/templateview.src
@@ -11,7 +11,6 @@
 Control CONTROL_BUTTONS
 {
     Size = MAP_APPFONT( 290, 17 );
-    Border = True;
     TabStop = False;
 };
 
@@ -20,6 +19,7 @@
     Pos = MAP_APPFONT( 1, 1 );
     Size = MAP_APPFONT( 50, 14 );
     Text [ en-US ] = "All Templates";
+    TabStop = True;
 };
 
 FixedText FT_NAME
diff --git a/sfx2/source/doc/doc.hrc b/sfx2/source/doc/doc.hrc
index f3edfa7..b56a473 100644
--- a/sfx2/source/doc/doc.hrc
+++ b/sfx2/source/doc/doc.hrc
@@ -39,6 +39,7 @@
 #define DLG_DOC_TEMPLATE                    (RID_SFX_DOC_START+2)
 #define DLG_ORGANIZE                        (RID_SFX_DOC_START+3)
 #define DLG_TEMPLATE_MANAGER                (RID_SFX_DOC_START+4)
+#define TAB_TEMPLATE_MANAGER                (RID_SFX_DOC_START+5)
 
 #define BMP_STYLES_CLOSED                   (RID_SFX_DOC_START+ 0)
 #define BMP_STYLES_OPENED                   (RID_SFX_DOC_START+ 1)
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 7041966..1d52d45 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -99,22 +99,38 @@
     OUString maKeyword;
 };
 
+class TemplateManagerPage : public TabPage
+{
+    private:
+        FixedText maFixedText;
+
+    public:
+        TemplateManagerPage( Window* pParent );
+        ~TemplateManagerPage( ) { };
+};
+
 SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
     : ModelessDialog(parent, SfxResId(DLG_TEMPLATE_MANAGER)),
       maTabControl(this,SfxResId(TAB_CONTROL)),
-      mpToolbars( new Control(&maTabControl,SfxResId(TOOLBARS))),
+      maTabPage(&maTabControl, SfxResId(TAB_TEMPLATE_MANAGER)),
+      mpToolbars( new Control(&maTabPage,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))),
       mpTemplateBar( new ToolBox(mpToolbars, SfxResId(TBX_ACTION_TEMPLATES))),
-      mpSearchView(new TemplateSearchView(this)),
-      maView(new TemplateLocalView(this,SfxResId(TEMPLATE_VIEW))),
-      mpOnlineView(new TemplateRemoteView(this, WB_VSCROLL,false)),
+      mpSearchView(new TemplateSearchView(&maTabPage)),
+      maView(new TemplateLocalView(&maTabPage,SfxResId(TEMPLATE_VIEW))),
+      mpOnlineView(new TemplateRemoteView(&maTabPage, WB_VSCROLL,false)),
       mbIsSaveMode(false),
       mxDesktop(comphelper::getProcessServiceFactory()->createInstance( "com.sun.star.frame.Desktop" ),uno::UNO_QUERY ),
       mbIsSynced(false),
       maRepositories()
 {
+    maTabControl.SetTabPage( FILTER_DOCS, &maTabPage );
+    maTabControl.SetTabPage( FILTER_SHEETS, &maTabPage );
+    maTabControl.SetTabPage( FILTER_PRESENTATIONS, &maTabPage );
+    maTabControl.SetTabPage( FILTER_DRAWS, &maTabPage );
+
     // Create popup menus
     mpActionMenu = new PopupMenu;
     mpActionMenu->InsertItem(MNI_ACTION_SORT_NAME,SfxResId(STR_ACTION_SORT_NAME).toString(),SfxResId(IMG_ACTION_SORT));
@@ -293,20 +309,17 @@
     Size aTabSize = maTabControl.GetSizePixel();
     aTabSize.setWidth(aWinSize.getWidth());
     maTabControl.SetSizePixel(aTabSize);
-    Size aTabPageSize = maTabControl.GetTabPageSizePixel();
-    Point aToolbarsPos(0, aTabSize.getHeight() - aTabPageSize.getHeight());
-    mpToolbars->SetPosPixel(aToolbarsPos);
-    aTabPageSize.setHeight(mpToolbars->GetSizePixel().getHeight() + 3);
-    maTabControl.SetTabPageSizePixel(aTabPageSize);
-
-    Size aToolbarsSize = mpToolbars->GetSizePixel();
-    aToolbarsSize.setWidth(aWinSize.getWidth());
-    mpToolbars->SetSizePixel(aToolbarsSize);
+    maTabControl.SetTabPageSizePixel(aWinSize);
 
     // Calculate toolboxes size and positions
     Size aViewSize = mpViewBar->CalcMinimumWindowSizePixel();
     Size aActionSize = mpActionBar->CalcMinimumWindowSizePixel();
     Size aTemplateSize = mpTemplateBar->CalcMinimumWindowSizePixel();
+
+    long nToolbarsHeight = std::max(std::max(aViewSize.getHeight(), aActionSize.getHeight()), aTemplateSize.getHeight());
+
+    Size aToolbarsSize (aWinSize.getWidth(), nToolbarsHeight);
+    mpToolbars->SetSizePixel(aToolbarsSize);
 
     aActionSize.setWidth(3*aActionSize.getWidth());
     aViewSize.setWidth(aWinSize.getWidth()-aActionSize.getWidth()-mpViewBar->GetPosPixel().X());
@@ -321,9 +334,9 @@
 
     // Set view position below toolbox
     Point aViewPos = maView->GetPosPixel();
-    aViewPos.setY(maTabControl.GetPosPixel().Y() + maTabControl.GetSizePixel().getHeight());
+    aViewPos.setY(aToolbarsSize.getHeight());
     aViewPos.setX(0);
-    Size aThumbSize(aWinSize.getWidth(), aWinSize.getHeight() - aViewPos.getY());
+    Size aThumbSize(aWinSize.getWidth(), maTabControl.GetTabPageSizePixel().getWidth() - aViewPos.getY());
     maView->SetPosSizePixel(aViewPos, aThumbSize);
 
     if (aWinSize.getHeight() < aViewPos.getY() + aThumbSize.getHeight() + PADDING_DLG_BORDER)
diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src
index a351431..6928ef1 100644
--- a/sfx2/source/doc/templatedlg.src
+++ b/sfx2/source/doc/templatedlg.src
@@ -101,73 +101,22 @@
     Text [ en-US ] = "A template named $1 already exist in $2. Do you want to overwrite it?";
 };
 
-ModelessDialog DLG_TEMPLATE_MANAGER
+TabPage TAB_TEMPLATE_MANAGER
 {
-    OutputSize = TRUE;
-    SVLook = TRUE;
-    Moveable = TRUE;
-    Closeable = TRUE;
-    Sizeable = TRUE;
+    Size = MAP_APPFONT( 290, 220 );
     Hide = TRUE;
-    Size = MAP_APPFONT ( 290 , 250 );
-    Text [en-US] = "Template Manager";
 
-    TabControl TAB_CONTROL
+    Control TOOLBARS
     {
-        OutputSize = TRUE;
-        Size = MAP_APPFONT( 290, 22 );
-        Pos = MAP_APPFONT( 0, 0 );
-        PageList =
-        {
-            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";
-            };
-        };
+        Size = MAP_APPFONT( 290 , 20 );
+        TabStop = False;
     };
 
     Control TEMPLATE_VIEW
     {
-        Size = MAP_APPFONT(280,220);
+        Pos = MAP_APPFONT( 0, 20 );
+        Size = MAP_APPFONT( 290, 200 );
         TabStop = TRUE;
-    };
-
-    Image IMG_ACTION_SORT
-    {
-        ImageBitmap = Bitmap
-        {
-            File = "sortascending.png";
-        };
-    };
-
-    Image IMG_ACTION_REFRESH
-    {
-        ImageBitmap = Bitmap
-        {
-            File = "reload.png";
-        };
-    };
-
-    Control TOOLBARS
-    {
-        Size = MAP_APPFONT( 290 , 16 );
-        TabStop = False;
     };
 
     ToolBox TBX_ACTION_VIEW
@@ -334,4 +283,63 @@
             };
         };
     };
+
+    Image IMG_ACTION_SORT
+    {
+        ImageBitmap = Bitmap
+        {
+            File = "sortascending.png";
+        };
+    };
+
+    Image IMG_ACTION_REFRESH
+    {
+        ImageBitmap = Bitmap
+        {
+            File = "reload.png";
+        };
+    };
+};
+
+ModelessDialog DLG_TEMPLATE_MANAGER
+{
+    OutputSize = TRUE;
+    SVLook = TRUE;
+    Moveable = TRUE;
+    Closeable = TRUE;
+    Sizeable = TRUE;
+    Hide = TRUE;
+    Size = MAP_APPFONT ( 290 , 250 );
+    Text [en-US] = "Template Manager";
+
+    TabControl TAB_CONTROL
+    {
+        OutputSize = TRUE;
+        Size = MAP_APPFONT( 290, 250 );
+        Pos = MAP_APPFONT( 0, 0 );
+        PageList =
+        {
+            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";
+            };
+        };
+    };
+
 };

-- 
To view, visit https://gerrit.libreoffice.org/2843
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibff35bf24873a38c9a09d71fb3630a57e06f1a3c
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Bosdonnat Cedric <cedric.bosdonnat at free.fr>



More information about the LibreOffice mailing list