[PATCH] Small improvement in page widget ui

Olivier Hallot (via Code Review) gerrit at gerrit.libreoffice.org
Thu Mar 7 17:07:41 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2590

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/90/2590/1

Small improvement in page widget ui

Save a coupe of bytes and better use of widget features

Change-Id: I6860339a8b62c7e95605a0abc47e99d7ef49696b
---
M cui/source/inc/page.hxx
M cui/source/tabpages/page.cxx
M cui/uiconfig/ui/pageformatpage.ui
3 files changed, 96 insertions(+), 107 deletions(-)



diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx
index 64e06de..fa18d96 100644
--- a/cui/source/inc/page.hxx
+++ b/cui/source/inc/page.hxx
@@ -120,14 +120,9 @@
 
     String              sStandardRegister;
 
-    FixedText*           m_pInsideText;
-    FixedText*           m_pOutsideText;
+    FixedText*           m_pInsideLbl;
+    FixedText*           m_pOutsideLbl;
     FixedText*           m_pPrintRangeQueryText;
-
-    OUString            aInsideText;
-    OUString            aOutsideText;
-    OUString            aLeftText;
-    OUString            aRightText;
 
     long                nFirstLeftMargin;
     long                nFirstRightMargin;
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index fe2c43d..f04d6a6 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -223,8 +223,8 @@
 
     get(m_pAdaptBox,"checkAdaptBox");
     // Strings stored in UI
-    get(m_pInsideText,"labelInner");
-    get(m_pOutsideText,"labelOuter");
+    get(m_pInsideLbl,"labelInner");
+    get(m_pOutsideLbl,"labelOuter");
     get(m_pPrintRangeQueryText,"labelMsg");
 
     bBorderModified = sal_False;
@@ -370,11 +370,6 @@
 
 void SvxPageDescPage::Init_Impl()
 {
-    aLeftText = m_pLeftMarginLbl->GetText();
-    aRightText = m_pRightMarginLbl->GetText();
-    aInsideText = m_pInsideText->GetText();
-    aOutsideText = m_pOutsideText->GetText();
-
         // adjust the handler
     m_pLayoutBox->SetSelectHdl( LINK( this, SvxPageDescPage, LayoutHdl_Impl ) );
     m_pPaperSizeBox->SetDropDownLineCount(10);
@@ -900,19 +895,17 @@
 
     if ( nPos == SVX_PAGE_MIRROR )
     {
-        if ( m_pLeftMarginLbl->GetText() != aInsideText )
-               m_pLeftMarginLbl->SetText( aInsideText );
-
-        if ( m_pRightMarginLbl->GetText() != aOutsideText )
-            m_pRightMarginLbl->SetText( aOutsideText );
+        m_pLeftMarginLbl->Hide();
+        m_pRightMarginLbl->Hide();
+        m_pInsideLbl->Show();
+        m_pOutsideLbl->Show();
     }
     else
     {
-        if ( m_pLeftMarginLbl->GetText() != aLeftText )
-            m_pLeftMarginLbl->SetText( aLeftText );
-
-        if ( m_pRightMarginLbl->GetText() != aRightText )
-            m_pRightMarginLbl->SetText( aRightText );
+        m_pLeftMarginLbl->Show();
+        m_pRightMarginLbl->Show();
+        m_pInsideLbl->Hide();
+        m_pOutsideLbl->Hide();
     }
     UpdateExample_Impl( true );
     return 0;
diff --git a/cui/uiconfig/ui/pageformatpage.ui b/cui/uiconfig/ui/pageformatpage.ui
index 1463671..a3fe196 100644
--- a/cui/uiconfig/ui/pageformatpage.ui
+++ b/cui/uiconfig/ui/pageformatpage.ui
@@ -342,38 +342,6 @@
                     <property name="row_spacing">6</property>
                     <property name="column_spacing">12</property>
                     <child>
-                      <object class="GtkLabel" id="labelLeftMargin">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Left:</property>
-                        <property name="use_underline">True</property>
-                        <property name="mnemonic_widget">spinMargLeft:0.00cm</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="labelRightMargin">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Right:</property>
-                        <property name="use_underline">True</property>
-                        <property name="mnemonic_widget">spinMargRight:0.00cm</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="GtkLabel" id="labelTopMargin">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
@@ -457,6 +425,88 @@
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="top_attach">3</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="box2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="orientation">vertical</property>
+                        <child>
+                          <object class="GtkLabel" id="labelRightMargin">
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Right:</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">spinMargRight:0.00cm</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="labelOuter">
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">O_uter:</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">spinMargRight:0.00cm</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </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="GtkBox" id="box3">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="orientation">vertical</property>
+                        <child>
+                          <object class="GtkLabel" id="labelLeftMargin">
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Left:</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">spinMargLeft:0.00cm</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="labelInner">
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">I_nner:</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">spinMargLeft:0.00cm</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </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>
@@ -731,49 +781,11 @@
       </packing>
     </child>
     <child>
-      <object class="GtkGrid" id="grid1">
-        <property name="visible">True</property>
+      <object class="GtkLabel" id="labelMsg">
         <property name="can_focus">False</property>
-        <child>
-          <object class="GtkLabel" id="labelInner">
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">I_nner:</property>
-            <property name="use_underline">True</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="labelOuter">
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">O_uter:</property>
-            <property name="use_underline">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="GtkLabel" id="labelMsg">
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">The margin settings are out of print range.
+        <property name="label" translatable="yes">The margin settings are out of print range.
 
 Do you still want to apply these settings?</property>
-          </object>
-          <packing>
-            <property name="left_attach">2</property>
-            <property name="top_attach">0</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
       </object>
       <packing>
         <property name="left_attach">0</property>
@@ -946,16 +958,5 @@
   </object>
   <object class="GtkSizeGroup" id="sizegroup6">
     <property name="ignore_hidden">True</property>
-    <widgets>
-      <widget name="labelFormat"/>
-      <widget name="labelWidth"/>
-      <widget name="labelHeight"/>
-      <widget name="labelOrientation"/>
-      <widget name="labelTextFlow"/>
-      <widget name="labelLeftMargin"/>
-      <widget name="labelRightMargin"/>
-      <widget name="labelTopMargin"/>
-      <widget name="labelBottomMargin"/>
-    </widgets>
   </object>
 </interface>

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6860339a8b62c7e95605a0abc47e99d7ef49696b
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Olivier Hallot <olivier.hallot at alta.org.br>



More information about the LibreOffice mailing list