[PATCH] New table dialog from impress and draw converted to Glade UI

Robert Roth (via Code Review) gerrit at gerrit.libreoffice.org
Fri Jan 25 17:13:44 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1874

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/74/1874/1

New table dialog from impress and draw converted to Glade UI

Change-Id: Iedd44ae171a25d9d6599e4f44698d7458c486be6
---
M cui/AllLangResTarget_cui.mk
M cui/UI_cui.mk
M cui/source/dialogs/newtabledlg.cxx
D cui/source/dialogs/newtabledlg.hrc
D cui/source/dialogs/newtabledlg.src
M cui/source/inc/cuires.hrc
M cui/source/inc/newtabledlg.hxx
A cui/uiconfig/ui/newtabledialog.ui
8 files changed, 184 insertions(+), 149 deletions(-)



diff --git a/cui/AllLangResTarget_cui.mk b/cui/AllLangResTarget_cui.mk
index 92231f6..aa5fd23 100644
--- a/cui/AllLangResTarget_cui.mk
+++ b/cui/AllLangResTarget_cui.mk
@@ -66,7 +66,6 @@
     cui/source/dialogs/hyperdlg.src \
     cui/source/dialogs/iconcdlg.src \
     cui/source/dialogs/multipat.src \
-    cui/source/dialogs/newtabledlg.src \
     cui/source/dialogs/passwdomdlg.src \
     cui/source/dialogs/postdlg.src \
     cui/source/dialogs/scriptdlg.src \
diff --git a/cui/UI_cui.mk b/cui/UI_cui.mk
index d2d7d8b..8531edb 100644
--- a/cui/UI_cui.mk
+++ b/cui/UI_cui.mk
@@ -22,6 +22,7 @@
 	cui/uiconfig/ui/macroselectordialog \
 	cui/uiconfig/ui/messbox \
 	cui/uiconfig/ui/namedialog \
+	cui/uiconfig/ui/newtabledialog \
 	cui/uiconfig/ui/numberingformatpage \
 	cui/uiconfig/ui/numberingoptionspage \
 	cui/uiconfig/ui/numberingpositionpage \
diff --git a/cui/source/dialogs/newtabledlg.cxx b/cui/source/dialogs/newtabledlg.cxx
index 63272c6..d9a1844 100644
--- a/cui/source/dialogs/newtabledlg.cxx
+++ b/cui/source/dialogs/newtabledlg.cxx
@@ -20,22 +20,12 @@
 #include "cuires.hrc"
 #include "dialmgr.hxx"
 #include "newtabledlg.hxx"
-#include "newtabledlg.hrc"
 
 SvxNewTableDialog::SvxNewTableDialog( Window* pParent )
-: ModalDialog( pParent, CUI_RES( RID_SVX_NEWTABLE_DLG ) )
-, maFtColumns( this, CUI_RES( FT_COLUMNS ) )
-, maNumColumns( this, CUI_RES( NF_COLUMNS ) )
-, maFtRows( this, CUI_RES( FT_ROWS ) )
-, maNumRows( this, CUI_RES( NF_ROWS ) )
-, maFlSep( this, CUI_RES( FL_SEP ) )
-, maHelpButton( this, CUI_RES( BTN_HELP ) )
-, maOkButton( this, CUI_RES( BTN_OK ) )
-, maCancelButton( this, CUI_RES( BTN_CANCEL ) )
+: ModalDialog( pParent, "NewTableDialog", "cui/ui/newtabledialog.ui" )
 {
-    maNumRows.SetValue(2);
-    maNumColumns.SetValue(5);
-    FreeResource();
+    get(mpNumRows, "rows");
+    get(mpNumColumns, "columns");
 }
 
 short SvxNewTableDialog::Execute(void)
@@ -49,12 +39,12 @@
 
 sal_Int32 SvxNewTableDialog::getRows() const
 {
-    return sal::static_int_cast< sal_Int32 >( maNumRows.GetValue() );
+    return sal::static_int_cast< sal_Int32 >( mpNumRows->GetValue() );
 }
 
 sal_Int32 SvxNewTableDialog::getColumns() const
 {
-    return sal::static_int_cast< sal_Int32 >( maNumColumns.GetValue() );
+    return sal::static_int_cast< sal_Int32 >( mpNumColumns->GetValue() );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/newtabledlg.hrc b/cui/source/dialogs/newtabledlg.hrc
deleted file mode 100644
index 3def9e7..0000000
--- a/cui/source/dialogs/newtabledlg.hrc
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#define FT_COLUMNS 1
-#define NF_COLUMNS 2
-#define FT_ROWS 3
-#define NF_ROWS 4
-#define FL_SEP 5
-#define BTN_HELP 6
-#define BTN_OK 7
-#define BTN_CANCEL 8
diff --git a/cui/source/dialogs/newtabledlg.src b/cui/source/dialogs/newtabledlg.src
deleted file mode 100644
index 19ae6bd..0000000
--- a/cui/source/dialogs/newtabledlg.src
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "newtabledlg.hrc"
-#include "cuires.hrc"
-
-ModalDialog RID_SVX_NEWTABLE_DLG
-{
-    HelpID = "cui:ModalDialog:RID_SVX_NEWTABLE_DLG";
-    OutputSize = TRUE;
-    SVLook = TRUE ;
-    Moveable = TRUE ;
-    Size = MAP_APPFONT ( 181 , 6+15+15+15+14+6 ) ;
-    Text [ en-US ] = "Insert Table" ;
-
-    FixedText FT_COLUMNS
-    {
-        Pos = MAP_APPFONT ( 6 , 8 ) ;
-        Size = MAP_APPFONT ( 60 , 8 ) ;
-        Text [ en-US ] = "Number of columns:" ;
-    };
-    NumericField NF_COLUMNS
-    {
-        HelpID = "cui:NumericField:RID_SVX_NEWTABLE_DLG:NF_COLUMNS";
-        Border = TRUE ;
-        Pos = MAP_APPFONT ( 80 , 6 ) ;
-        Size = MAP_APPFONT ( 40 , 12 ) ;
-        TabStop = TRUE ;
-        Repeat = TRUE ;
-        Spin = TRUE ;
-        Minimum = 1 ;
-        Maximum = 75 ;
-        SpinSize = 1 ;
-        StrictFormat = TRUE ;
-    };
-    FixedText FT_ROWS
-    {
-        Pos = MAP_APPFONT ( 6 , 8+15 ) ;
-        Size = MAP_APPFONT ( 60 , 8 ) ;
-        Text [ en-US ] = "Number of rows:" ;
-    };
-    NumericField NF_ROWS
-    {
-        HelpID = "cui:NumericField:RID_SVX_NEWTABLE_DLG:NF_ROWS";
-        Border = TRUE ;
-        Pos = MAP_APPFONT ( 80 , 6+15 ) ;
-        Size = MAP_APPFONT ( 40 , 12 ) ;
-        TabStop = TRUE ;
-        Repeat = TRUE ;
-        Spin = TRUE ;
-        Minimum = 1 ;
-        Maximum = 75 ;
-        SpinSize = 1 ;
-        StrictFormat = TRUE ;
-    };
-    FixedLine FL_SEP
-    {
-        Pos = MAP_APPFONT ( 0 , 6+15+15 ) ;
-        Size = MAP_APPFONT ( 181 , 12 ) ;
-    };
-    HelpButton BTN_HELP
-    {
-        Pos = MAP_APPFONT ( 6 , 6+15+15+15 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        TabStop = TRUE ;
-    };
-    OKButton BTN_OK
-    {
-        Pos = MAP_APPFONT ( 69 , 6+15+15+15 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        TabStop = TRUE ;
-        DefButton = TRUE ;
-    };
-    CancelButton BTN_CANCEL
-    {
-        Pos = MAP_APPFONT ( 125 , 6+15+15+15 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        TabStop = TRUE ;
-    };
-};
diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc
index d8d9ef0..828f8b9 100644
--- a/cui/source/inc/cuires.hrc
+++ b/cui/source/inc/cuires.hrc
@@ -268,9 +268,6 @@
 #define RID_SVXDLG_MULTIPATH                (RID_SVX_START + 201)
 #define RID_MULTIPATH_DBL_ERR               (RID_SVX_START + 207)
 
-// new table dialog
-#define RID_SVX_NEWTABLE_DLG                ( RID_SVX_START + 44 )
-
 // script organizer
 #define RID_DLG_SCRIPTORGANIZER             (RID_SVX_START + 258)
 #define RID_DLG_NEWLIB                      (RID_SVX_START + 290)
diff --git a/cui/source/inc/newtabledlg.hxx b/cui/source/inc/newtabledlg.hxx
index d6b9ae4..6f1f56f 100644
--- a/cui/source/inc/newtabledlg.hxx
+++ b/cui/source/inc/newtabledlg.hxx
@@ -29,15 +29,8 @@
 class SvxNewTableDialog : public SvxAbstractNewTableDialog, public ModalDialog
 {
 private:
-    FixedText           maFtColumns;
-    NumericField        maNumColumns;
-    FixedText           maFtRows;
-    NumericField        maNumRows;
-
-    FixedLine           maFlSep;
-    HelpButton          maHelpButton;
-    OKButton            maOkButton;
-    CancelButton        maCancelButton;
+    NumericField*       mpNumColumns;
+    NumericField*       mpNumRows;
 
 public:
     SvxNewTableDialog( Window* pWindow );
diff --git a/cui/uiconfig/ui/newtabledialog.ui b/cui/uiconfig/ui/newtabledialog.ui
new file mode 100644
index 0000000..e4841d6
--- /dev/null
+++ b/cui/uiconfig/ui/newtabledialog.ui
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkDialog" id="NewTableDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Insert Table</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button1">
+                <property name="label">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+                <property name="secondary">True</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="ok">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="cancel">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkGrid" id="grid1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="border_width">6</property>
+            <property name="row_spacing">12</property>
+            <property name="column_spacing">12</property>
+            <child>
+              <object class="GtkLabel" id="columns_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">_Number of columns:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">columns</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="rows_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">_Number of rows:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">rows</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkSpinButton" id="columns">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="has_focus">True</property>
+                <property name="invisible_char">•</property>
+                <property name="activates_default">True</property>
+                <property name="adjustment">columns_value</property>
+                <property name="climb_rate">1</property>
+                <property name="snap_to_ticks">True</property>
+                <property name="numeric">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkSpinButton" id="rows">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">•</property>
+                <property name="adjustment">rows_value</property>
+                <property name="snap_to_ticks">True</property>
+                <property name="numeric">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">button1</action-widget>
+      <action-widget response="0">ok</action-widget>
+      <action-widget response="0">cancel</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkAdjustment" id="rows_value">
+    <property name="lower">1</property>
+    <property name="upper">75</property>
+    <property name="value">2</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="columns_value">
+    <property name="lower">1</property>
+    <property name="upper">75</property>
+    <property name="value">5</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+</interface>

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iedd44ae171a25d9d6599e4f44698d7458c486be6
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Robert Roth <robert.roth.off at gmail.com>



More information about the LibreOffice mailing list