[PATCH] conversion the calc default option page to .ui

Faisal al-otaibi (via Code Review) gerrit at gerrit.libreoffice.org
Thu May 30 03:32:52 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/4092

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/92/4092/1

conversion the calc default option page to .ui

Change-Id: I09d8b012633e7fce916b54eee6b1b0d9db50ac23
---
M sc/UIConfig_scalc.mk
M sc/inc/helpids.h
M sc/source/ui/inc/optdlg.hrc
M sc/source/ui/inc/tpdefaults.hxx
M sc/source/ui/optdlg/tpdefaults.cxx
M sc/source/ui/src/optdlg.src
A sc/uiconfig/scalc/ui/optdefaultpage.ui
7 files changed, 150 insertions(+), 93 deletions(-)



diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index cf715ff..94a8aea 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -80,6 +80,7 @@
 	sc/uiconfig/scalc/ui/leftheaderdialog \
 	sc/uiconfig/scalc/ui/managenamesdialog \
 	sc/uiconfig/scalc/ui/optcalculatepage \
+	sc/uiconfig/scalc/ui/optdefaultpage \
 	sc/uiconfig/scalc/ui/printeroptions \
 	sc/uiconfig/scalc/ui/protectsheetdlg \
 	sc/uiconfig/scalc/ui/sheetprintpage \
diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h
index 3eff53e..8bbc07a 100644
--- a/sc/inc/helpids.h
+++ b/sc/inc/helpids.h
@@ -65,7 +65,6 @@
 #define HID_SCPAGE_AREAS                                        "SC_HID_SCPAGE_AREAS"
 #define HID_SCPAGE_COMPATIBILITY                                "SC_HID_SCPAGE_COMPATIBILITY"
 #define HID_SCPAGE_PRINT                                        "SC_HID_SCPAGE_PRINT"
-#define HID_SCPAGE_DEFAULTS                                     "SC_HID_SCPAGE_DEFAULTS"
 #define HID_SCPAGE_SUBT_GROUP1                                  "SC_HID_SCPAGE_SUBT_GROUP1"
 #define HID_SCPAGE_SUBT_GROUP2                                  "SC_HID_SCPAGE_SUBT_GROUP2"
 #define HID_SCPAGE_SUBT_GROUP3                                  "SC_HID_SCPAGE_SUBT_GROUP3"
diff --git a/sc/source/ui/inc/optdlg.hrc b/sc/source/ui/inc/optdlg.hrc
index ad60340..515ddcb 100644
--- a/sc/source/ui/inc/optdlg.hrc
+++ b/sc/source/ui/inc/optdlg.hrc
@@ -156,11 +156,4 @@
 #define FT_KEY_BINDINGS       2
 #define LB_KEY_BINDINGS       3
 
-// TP_DEFAULTS
-#define FL_INIT_SPREADSHEET  1
-#define FT_NSHEETS           2
-#define ED_NSHEETS           3
-#define FT_SHEETPREFIX       4
-#define ED_SHEETPREFIX       5
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/tpdefaults.hxx b/sc/source/ui/inc/tpdefaults.hxx
index bd967bb..4c13f2a 100644
--- a/sc/source/ui/inc/tpdefaults.hxx
+++ b/sc/source/ui/inc/tpdefaults.hxx
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __SC_TPDEFAULTS_HXX__
-#define __SC_TPDEFAULTS_HXX__
+//#ifndef __SC_TPDEFAULTS_HXX__
+//#define __SC_TPDEFAULTS_HXX__
 
 #include <sfx2/tabdlg.hxx>
 #include <vcl/fixed.hxx>
@@ -38,16 +38,15 @@
     DECL_LINK( PrefixEditOnFocusHdl, Edit* );
 
 private:
-    FixedLine     aFLInitSpreadSheet;
-    FixedText     aFtNSheets;
-    NumericField  aEdNSheets;
-    FixedText     aFtSheetPrefix;
-    Edit          aEdSheetPrefix;
+    FixedText*    m_pFtNSheets;
+    NumericField* m_pEdNSheets;
+    FixedText*    m_pFtSheetPrefix;
+    Edit*         m_pEdSheetPrefix;
 
     // Stores old Sheet Prefix
     OUString maOldPrefixValue;
 };
 
-#endif
+//#endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/optdlg/tpdefaults.cxx b/sc/source/ui/optdlg/tpdefaults.cxx
index 2dc5a42..06a75cd 100644
--- a/sc/source/ui/optdlg/tpdefaults.cxx
+++ b/sc/source/ui/optdlg/tpdefaults.cxx
@@ -19,36 +19,35 @@
 
 
 ScTpDefaultsOptions::ScTpDefaultsOptions(Window *pParent, const SfxItemSet &rCoreSet) :
-    SfxTabPage(pParent, ScResId(RID_SCPAGE_DEFAULTS), rCoreSet),
-    aFLInitSpreadSheet ( this, ScResId( FL_INIT_SPREADSHEET ) ),
-    aFtNSheets         ( this, ScResId( FT_NSHEETS ) ),
-    aEdNSheets         ( this, ScResId( ED_NSHEETS ) ),
-    aFtSheetPrefix     ( this, ScResId( FT_SHEETPREFIX ) ),
-    aEdSheetPrefix     ( this, ScResId( ED_SHEETPREFIX ) )
+    SfxTabPage(pParent, "OptDefaultPage", "modules/scalc/ui/optdefaultpage.ui", rCoreSet)
+
 {
-    FreeResource();
+    get( m_pFtNSheets, "textsheetsnumber");
+    get( m_pEdNSheets, "sheetsnumber");
+    get( m_pFtSheetPrefix, "textsheetprefix");
+    get( m_pEdSheetPrefix, "sheetprefix");
 
     // the following computation must be modified accordingly if a third line is added to this dialog
-    long nTxtW1 = aFtNSheets.GetCtrlTextWidth( aFtNSheets.GetText() );
-    long nCtrlW1 = aFtNSheets.GetSizePixel().Width();
-    long nTxtW2 = aFtSheetPrefix.GetCtrlTextWidth(aFtSheetPrefix.GetText() );
-    long nCtrlW2 = aFtSheetPrefix.GetSizePixel().Width();
+    long nTxtW1  = m_pFtNSheets->GetCtrlTextWidth( m_pFtNSheets->GetText() );
+    long nCtrlW1 = m_pFtNSheets->GetSizePixel().Width();
+    long nTxtW2  = m_pFtSheetPrefix->GetCtrlTextWidth(m_pFtSheetPrefix->GetText() );
+    long nCtrlW2 = m_pFtSheetPrefix->GetSizePixel().Width();
     if ( nTxtW1 >= nCtrlW1 || nTxtW2 >= nCtrlW2)
     {
         long nTxtW = std::max(nTxtW1,nTxtW2);
-        Size aNewSize = aFtNSheets.GetSizePixel();
+        Size aNewSize = m_pFtNSheets->GetSizePixel();
         aNewSize.Width() = nTxtW;
-        aFtNSheets.SetSizePixel( aNewSize );
-        aFtSheetPrefix.SetSizePixel( aNewSize );
-        Point aNewPoint = aEdNSheets.GetPosPixel();
+        m_pFtNSheets->SetSizePixel( aNewSize );
+        m_pFtSheetPrefix->SetSizePixel( aNewSize );
+        Point aNewPoint = m_pEdNSheets->GetPosPixel();
         aNewPoint.X() += (nTxtW - nCtrlW1);
-        aEdNSheets.SetPosPixel( aNewPoint );
-        aNewPoint.Y() = aEdSheetPrefix.GetPosPixel().Y();
-        aEdSheetPrefix.SetPosPixel( aNewPoint );
+        m_pEdNSheets->SetPosPixel( aNewPoint );
+        aNewPoint.Y() = m_pEdSheetPrefix->GetPosPixel().Y();
+        m_pEdSheetPrefix->SetPosPixel( aNewPoint );
     }
-    aEdNSheets.SetModifyHdl( LINK(this, ScTpDefaultsOptions, NumModifiedHdl) );
-    aEdSheetPrefix.SetModifyHdl( LINK(this, ScTpDefaultsOptions, PrefixModifiedHdl) );
-    aEdSheetPrefix.SetGetFocusHdl( LINK(this, ScTpDefaultsOptions, PrefixEditOnFocusHdl) );
+    m_pEdNSheets->SetModifyHdl( LINK(this, ScTpDefaultsOptions, NumModifiedHdl) );
+    m_pEdSheetPrefix->SetModifyHdl( LINK(this, ScTpDefaultsOptions, PrefixModifiedHdl) );
+    m_pEdSheetPrefix->SetGetFocusHdl( LINK(this, ScTpDefaultsOptions, PrefixEditOnFocusHdl) );
 }
 
 ScTpDefaultsOptions::~ScTpDefaultsOptions()
@@ -65,12 +64,12 @@
     sal_Bool bRet = false;
     ScDefaultsOptions aOpt;
 
-    SCTAB nTabCount = static_cast<SCTAB>(aEdNSheets.GetValue());
-    OUString aSheetPrefix = aEdSheetPrefix.GetText();
+    SCTAB nTabCount = static_cast<SCTAB>(m_pEdNSheets->GetValue());
+    OUString aSheetPrefix = m_pEdSheetPrefix->GetText();
 
 
-    if ( aEdNSheets.GetSavedValue() != aEdNSheets.GetText()
-         || aEdSheetPrefix.GetSavedValue() != aSheetPrefix )
+    if ( m_pEdNSheets->GetSavedValue() != m_pEdNSheets->GetText()
+         || m_pEdSheetPrefix->GetSavedValue() != aSheetPrefix )
     {
         aOpt.SetInitTabCount( nTabCount );
         aOpt.SetInitTabPrefix( aSheetPrefix );
@@ -89,10 +88,10 @@
     if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SCDEFAULTSOPTIONS, false , &pItem))
         aOpt = ((const ScTpDefaultsItem*)pItem)->GetDefaultsOptions();
 
-    aEdNSheets.SetValue( static_cast<sal_uInt16>( aOpt.GetInitTabCount()) );
-    aEdSheetPrefix.SetText( aOpt.GetInitTabPrefix() );
-    aEdNSheets.SaveValue();
-    aEdSheetPrefix.SaveValue();
+    m_pEdNSheets->SetValue( static_cast<sal_uInt16>( aOpt.GetInitTabCount()) );
+    m_pEdSheetPrefix->SetText( aOpt.GetInitTabPrefix() );
+    m_pEdNSheets->SaveValue();
+    m_pEdSheetPrefix->SaveValue();
 }
 
 int ScTpDefaultsOptions::DeactivatePage(SfxItemSet* /*pSet*/)
@@ -102,11 +101,11 @@
 
 void ScTpDefaultsOptions::CheckNumSheets()
 {
-    sal_Int64 nVal = aEdNSheets.GetValue();
+    sal_Int64 nVal = m_pEdNSheets->GetValue();
     if (nVal > MAXINITTAB)
-        aEdNSheets.SetValue(MAXINITTAB);
+        m_pEdNSheets->SetValue(MAXINITTAB);
     if (nVal < MININITTAB)
-        aEdNSheets.SetValue(MININITTAB);
+        m_pEdNSheets->SetValue(MININITTAB);
 }
 
 void ScTpDefaultsOptions::CheckPrefix(Edit* pEdit)
diff --git a/sc/source/ui/src/optdlg.src b/sc/source/ui/src/optdlg.src
index 4621c13..5c87e41 100644
--- a/sc/source/ui/src/optdlg.src
+++ b/sc/source/ui/src/optdlg.src
@@ -790,49 +790,4 @@
     };
 };
 
-TabPage RID_SCPAGE_DEFAULTS
-{
-    HelpId = HID_SCPAGE_DEFAULTS ;
-    SVLook = TRUE ;
-    Hide = TRUE ;
-    Pos = MAP_APPFONT ( 0 , 0 ) ;
-    Size = MAP_APPFONT ( TP_WIDTH , TP_HEIGHT ) ;
-    FixedLine FL_INIT_SPREADSHEET
-    {
-        Pos = MAP_APPFONT ( 6 , 3 ) ;
-        Size = MAP_APPFONT ( 248 , 8 ) ;
-        Text [ en-US ] = "New Spreadsheet";
-    };
-    FixedText FT_NSHEETS
-    {
-        Pos = MAP_APPFONT ( 12 , 16 ) ;
-        Size = MAP_APPFONT ( 110 , 8 ) ;
-        Text [ en-US ] = "Number of worksheets in new document";
-    };
-    NumericField ED_NSHEETS
-    {
-        HelpID = "sc:NumericField:RID_SCPAGE_CALC:ED_NSHEETS";
-        Border = TRUE ;
-        Pos = MAP_APPFONT ( 130 , 14 ) ;
-        Size = MAP_APPFONT ( 25 , 12 ) ;
-        Minimum = 1 ;
-        Maximum = 32000 ;
-        Spin = TRUE ;
-        Repeat = TRUE ;
-    };
-    FixedText FT_SHEETPREFIX
-    {
-        Pos = MAP_APPFONT ( 12 , 32 ) ;
-        Size = MAP_APPFONT ( 110 , 8 ) ;
-        Text [ en-US ] = "Prefix name for new worksheet";
-    };
-    Edit ED_SHEETPREFIX
-    {
-        HelpID = "sc:Edit:RID_SCPAGE_CALC:ED_SHEETPREFIX";
-        Border = TRUE ;
-        Pos = MAP_APPFONT ( 130 , 30 ) ;
-        Size = MAP_APPFONT ( 60 , 12 ) ;
-    };
-};
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/uiconfig/scalc/ui/optdefaultpage.ui b/sc/uiconfig/scalc/ui/optdefaultpage.ui
new file mode 100644
index 0000000..ac0b8ad
--- /dev/null
+++ b/sc/uiconfig/scalc/ui/optdefaultpage.ui
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkBox" id="OptDefaultPage">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">12</property>
+    <child>
+      <object class="GtkFrame" id="frame1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label_xalign">0</property>
+        <property name="shadow_type">none</property>
+        <child>
+          <object class="GtkAlignment" id="alignment1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="top_padding">6</property>
+            <property name="left_padding">12</property>
+            <child>
+              <object class="GtkGrid" id="grid2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="row_spacing">6</property>
+                <property name="column_spacing">12</property>
+                <child>
+                  <object class="GtkLabel" id="textsheetsnumber">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">_Number of worksheets in new document</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">sheetsnumber</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="textsheetprefix">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">_Prefix name for new worksheet</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">sheetprefix</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="GtkEntry" id="sheetprefix">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">●</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>
+                <child>
+                  <object class="GtkSpinButton" id="sheetsnumber">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">●</property>
+                    <property name="invisible_char_set">True</property>
+                    <property name="climb_rate">1</property>
+                    <property name="update_policy">if-valid</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>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">New Spreadsheet</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I09d8b012633e7fce916b54eee6b1b0d9db50ac23
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Faisal al-otaibi <fmalotaibi at kacst.edu.sa>



More information about the LibreOffice mailing list