[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source sc/uiconfig vcl/source

Caolán McNamara caolanm at redhat.com
Wed Nov 1 14:40:30 UTC 2017


 sc/source/ui/inc/tptable.hxx           |    8 ++
 sc/source/ui/pagedlg/tptable.cxx       |   77 ++++++++++++++++++++------
 sc/uiconfig/scalc/ui/sheetprintpage.ui |   97 ++++++++++++---------------------
 vcl/source/window/builder.cxx          |    6 ++
 4 files changed, 111 insertions(+), 77 deletions(-)

New commits:
commit 19ec0aac77913ede79fc107c341c89e945309a9b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 26 12:49:44 2017 +0100

    Resolves: tdf#113455 Impossible to clear width/height in pages
    
    backport with stock-item "clear" to avoid new translation
    
    Change-Id: I88f80d417108822ceeb73c07cb49892925a2e57f
    Reviewed-on: https://gerrit.libreoffice.org/43892
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/ui/inc/tptable.hxx b/sc/source/ui/inc/tptable.hxx
index f3d01eef310d..3b01422a68ce 100644
--- a/sc/source/ui/inc/tptable.hxx
+++ b/sc/source/ui/inc/tptable.hxx
@@ -46,6 +46,9 @@ private:
     void            ShowImage();
 
 private:
+    sal_uInt16              m_nOrigScalePageWidth;
+    sal_uInt16              m_nOrigScalePageHeight;
+
     VclPtr<RadioButton>     m_pBtnTopDown;
     VclPtr<RadioButton>     m_pBtnLeftRight;
     VclPtr<FixedImage>      m_pBmpPageDir;
@@ -66,7 +69,9 @@ private:
     VclPtr<MetricField>         m_pEdScaleAll;
     VclPtr<VclGrid>             m_pGrHeightWidth;
     VclPtr<NumericField>        m_pEdScalePageWidth;
+    VclPtr<CheckBox>            m_pCbScalePageWidth;
     VclPtr<NumericField>        m_pEdScalePageHeight;
+    VclPtr<CheckBox>            m_pCbScalePageHeight;
     VclPtr<VclHBox>             m_pBxScalePageNum;
     VclPtr<NumericField>        m_pEdScalePageNum;
 
@@ -74,8 +79,9 @@ private:
 
     // Handler:
     DECL_LINK(PageDirHdl, Button*, void);
-    DECL_LINK( PageNoHdl, Button*, void );
+    DECL_LINK(PageNoHdl, Button*, void);
     DECL_LINK(ScaleHdl, ListBox&, void);
+    DECL_LINK(ToggleHdl, CheckBox&, void);
 };
 
 #endif // INCLUDED_SC_SOURCE_UI_INC_TPTABLE_HXX
diff --git a/sc/source/ui/pagedlg/tptable.cxx b/sc/source/ui/pagedlg/tptable.cxx
index 1190ef82fbc7..d7be1c3cf171 100644
--- a/sc/source/ui/pagedlg/tptable.cxx
+++ b/sc/source/ui/pagedlg/tptable.cxx
@@ -55,9 +55,11 @@ static bool lcl_PutScaleItem2( sal_uInt16               nWhich,
                        SfxItemSet&          rCoreSet,
                        const SfxItemSet&    rOldSet,
                        const ListBox&       rListBox,
-                       sal_uInt16               nLBEntry,
+                       sal_uInt16           nLBEntry,
                        const NumericField&  rEd1,
-                       const NumericField&  rEd2 );
+                       sal_uInt16           nOrigScalePageWidth,
+                       const NumericField&  rEd2,
+                       sal_uInt16           nOrigScalePageHeight );
 
 static bool lcl_PutBoolItem( sal_uInt16            nWhich,
                       SfxItemSet&       rCoreSet,
@@ -78,9 +80,10 @@ static bool lcl_PutBoolItem( sal_uInt16            nWhich,
 #define SC_TPTABLE_SCALE_TO         1
 #define SC_TPTABLE_SCALE_TO_PAGES   2
 
-ScTablePage::ScTablePage( vcl::Window* pParent, const SfxItemSet& rCoreAttrs ) :
-
-        SfxTabPage( pParent, "SheetPrintPage","modules/scalc/ui/sheetprintpage.ui", &rCoreAttrs )
+ScTablePage::ScTablePage(vcl::Window* pParent, const SfxItemSet& rCoreAttrs)
+    : SfxTabPage(pParent, "SheetPrintPage","modules/scalc/ui/sheetprintpage.ui", &rCoreAttrs)
+    , m_nOrigScalePageWidth(0)
+    , m_nOrigScalePageHeight(0)
 {
     get(m_pBtnTopDown,"radioBTN_TOPDOWN");
     get(m_pBtnLeftRight,"radioBTN_LEFTRIGHT");
@@ -102,7 +105,9 @@ ScTablePage::ScTablePage( vcl::Window* pParent, const SfxItemSet& rCoreAttrs ) :
     get(m_pEdScaleAll,"spinED_SCALEALL");
     get(m_pGrHeightWidth,"gridWH");
     get(m_pEdScalePageWidth,"spinED_SCALEPAGEWIDTH");
+    get(m_pCbScalePageWidth,"unsetwidth");
     get(m_pEdScalePageHeight,"spinED_SCALEPAGEHEIGHT");
+    get(m_pCbScalePageHeight,"unsetheight");
     get(m_pBxScalePageNum,"boxNP");
     get(m_pEdScalePageNum,"spinED_SCALEPAGENUM");
 
@@ -112,7 +117,8 @@ ScTablePage::ScTablePage( vcl::Window* pParent, const SfxItemSet& rCoreAttrs ) :
     m_pBtnTopDown->SetClickHdl( PAGEDIR_HDL );
     m_pBtnLeftRight->SetClickHdl( PAGEDIR_HDL );
     m_pLbScaleMode->SetSelectHdl( LINK(this,ScTablePage,ScaleHdl) );
-
+    m_pCbScalePageWidth->SetToggleHdl(LINK(this, ScTablePage, ToggleHdl));
+    m_pCbScalePageHeight->SetToggleHdl(LINK(this, ScTablePage, ToggleHdl));
 }
 
 void ScTablePage::ShowImage()
@@ -146,7 +152,9 @@ void ScTablePage::dispose()
     m_pBxScaleAll.clear();
     m_pEdScaleAll.clear();
     m_pGrHeightWidth.clear();
+    m_pCbScalePageWidth.clear();
     m_pEdScalePageWidth.clear();
+    m_pCbScalePageHeight.clear();
     m_pEdScalePageHeight.clear();
     m_pBxScalePageNum.clear();
     m_pEdScalePageNum.clear();
@@ -203,10 +211,12 @@ void ScTablePage::Reset( const SfxItemSet* rCoreSet )
         /*  width==0 and height==0 is invalid state, used as "not selected".
             Dialog shows width=height=1 then. */
         bool bValid = nWidth || nHeight;
-        if( bValid )
+        if (bValid)
             m_pLbScaleMode->SelectEntryPos( SC_TPTABLE_SCALE_TO );
         m_pEdScalePageWidth->SetValue( bValid ? nWidth : 1 );
         m_pEdScalePageHeight->SetValue( bValid ? nHeight : 1 );
+        m_pCbScalePageWidth->Check(bValid && !nWidth);
+        m_pCbScalePageHeight->Check(bValid && !nHeight);
     }
 
     nWhich = GetWhich(SID_SCATTR_PAGE_SCALETOPAGES);
@@ -244,8 +254,8 @@ void ScTablePage::Reset( const SfxItemSet* rCoreSet )
     m_pBtnPageNo->SaveValue();
     m_pEdPageNo->SaveValue();
     m_pEdScaleAll->SaveValue();
-    m_pEdScalePageWidth->SaveValue();
-    m_pEdScalePageHeight->SaveValue();
+    m_nOrigScalePageWidth = m_pEdScalePageWidth->IsEnabled() ? m_pEdScalePageWidth->GetValue() : 0;
+    m_nOrigScalePageHeight = m_pEdScalePageHeight->IsEnabled() ? m_pEdScalePageHeight->GetValue() : 0;
     m_pEdScalePageNum->SaveValue();
 }
 
@@ -317,7 +327,7 @@ bool ScTablePage::FillItemSet( SfxItemSet* rCoreSet )
                                          *rCoreSet, rOldSet, *m_pBtnDrawings );
 
     // scaling:
-    if( !m_pEdScalePageWidth->GetValue() && !m_pEdScalePageHeight->GetValue() )
+    if( !m_pEdScalePageWidth->IsEnabled() && !m_pEdScalePageHeight->IsEnabled() )
     {
         m_pLbScaleMode->SelectEntryPos( SC_TPTABLE_SCALE_PERCENT );
         m_pEdScaleAll->SetValue( 100 );
@@ -331,7 +341,8 @@ bool ScTablePage::FillItemSet( SfxItemSet* rCoreSet )
     bDataChanged |= lcl_PutScaleItem2( GetWhich(SID_SCATTR_PAGE_SCALETO),
                                       *rCoreSet, rOldSet,
                                       *m_pLbScaleMode, SC_TPTABLE_SCALE_TO,
-                                      *m_pEdScalePageWidth, *m_pEdScalePageHeight );
+                                      *m_pEdScalePageWidth, m_nOrigScalePageWidth,
+                                      *m_pEdScalePageHeight, m_nOrigScalePageHeight );
 
     bDataChanged |= lcl_PutScaleItem( GetWhich(SID_SCATTR_PAGE_SCALETOPAGES),
                                       *rCoreSet, rOldSet,
@@ -387,6 +398,36 @@ IMPL_LINK_NOARG(ScTablePage, ScaleHdl, ListBox&, void)
     m_pBxScalePageNum->Show(m_pLbScaleMode->GetSelectEntryPos() == SC_TPTABLE_SCALE_TO_PAGES);
 }
 
+IMPL_LINK(ScTablePage, ToggleHdl, CheckBox&, rBox, void)
+{
+    if (&rBox == m_pCbScalePageWidth)
+    {
+        if (rBox.IsChecked())
+        {
+            m_pEdScalePageWidth->SetText(OUString());
+            m_pEdScalePageWidth->Disable();
+        }
+        else
+        {
+            m_pEdScalePageWidth->SetValue(1);
+            m_pEdScalePageWidth->Enable();
+        }
+    }
+    else
+    {
+        if (rBox.IsChecked())
+        {
+            m_pEdScalePageHeight->SetText(OUString());
+            m_pEdScalePageHeight->Disable();
+        }
+        else
+        {
+            m_pEdScalePageHeight->SetValue(1);
+            m_pEdScalePageHeight->Enable();
+        }
+    }
+}
+
 // Helper functions for FillItemSet:
 
 static bool lcl_PutBoolItem( sal_uInt16            nWhich,
@@ -450,16 +491,18 @@ static bool lcl_PutScaleItem2( sal_uInt16               nWhich,
                       SfxItemSet&           rCoreSet,
                       const SfxItemSet&     rOldSet,
                       const ListBox&        rListBox,
-                      sal_uInt16                nLBEntry,
+                      sal_uInt16            nLBEntry,
                       const NumericField&   rEd1,
-                      const NumericField&   rEd2 )
+                      sal_uInt16            nOrigScalePageWidth,
+                      const NumericField&   rEd2,
+                      sal_uInt16            nOrigScalePageHeight )
 {
-    sal_uInt16 nValue1 = (sal_uInt16)rEd1.GetValue();
-    sal_uInt16 nValue2 = (sal_uInt16)rEd2.GetValue();
+    sal_uInt16 nValue1 = rEd1.IsEnabled() ? rEd1.GetValue() : 0;
+    sal_uInt16 nValue2 = rEd2.IsEnabled() ? rEd2.GetValue() : 0;
     bool bIsSel = (rListBox.GetSelectEntryPos() == nLBEntry);
     bool bDataChanged = (rListBox.GetSavedValue() != nLBEntry) ||
-                        rEd1.IsValueChangedFromSaved() ||
-                        rEd2.IsValueChangedFromSaved() ||
+                        nValue1 != nOrigScalePageWidth ||
+                        nValue1 != nOrigScalePageHeight ||
                         !WAS_DEFAULT( nWhich, rOldSet );
 
     if( bDataChanged )
diff --git a/sc/uiconfig/scalc/ui/sheetprintpage.ui b/sc/uiconfig/scalc/ui/sheetprintpage.ui
index d651a577c088..8277a366022f 100644
--- a/sc/uiconfig/scalc/ui/sheetprintpage.ui
+++ b/sc/uiconfig/scalc/ui/sheetprintpage.ui
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.0 -->
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
+  <requires lib="gtk+" version="3.0"/>
   <object class="GtkAdjustment" id="adjustmentFirstPage">
     <property name="lower">1.05</property>
     <property name="upper">9999.0400000000009</property>
@@ -72,8 +73,6 @@
                       <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>
@@ -93,8 +92,6 @@
                       <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>
@@ -110,8 +107,6 @@
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">2</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -125,8 +120,6 @@
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="top_attach">2</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -176,8 +169,6 @@
       <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>
@@ -213,8 +204,6 @@
                   <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>
@@ -231,8 +220,6 @@
                   <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>
@@ -248,8 +235,6 @@
                   <packing>
                     <property name="left_attach">0</property>
                     <property name="top_attach">2</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -265,8 +250,6 @@
                   <packing>
                     <property name="left_attach">0</property>
                     <property name="top_attach">3</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -282,8 +265,6 @@
                   <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>
                 <child>
@@ -299,8 +280,6 @@
                   <packing>
                     <property name="left_attach">2</property>
                     <property name="top_attach">1</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -316,8 +295,6 @@
                   <packing>
                     <property name="left_attach">2</property>
                     <property name="top_attach">2</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -333,8 +310,6 @@
                   <packing>
                     <property name="left_attach">2</property>
                     <property name="top_attach">3</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -367,8 +342,6 @@
       <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>
@@ -392,16 +365,14 @@
                   <object class="GtkLabel" id="labelScalingMode">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes">Scaling _mode:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">comboLB_SCALEMODE</property>
+                    <property name="xalign">0</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>
@@ -419,10 +390,10 @@
                           <object class="GtkLabel" id="labelSF">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
                             <property name="label" translatable="yes">_Scaling factor:</property>
                             <property name="use_underline">True</property>
                             <property name="mnemonic_widget">spinED_SCALEALL:0%</property>
+                            <property name="xalign">0</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -435,7 +406,6 @@
                             <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="adjustment">adjustmentScalingFactor</property>
                           </object>
                           <packing>
@@ -462,32 +432,28 @@
                           <object class="GtkLabel" id="labelWP">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
                             <property name="label" translatable="yes">_Width in pages:</property>
                             <property name="use_underline">True</property>
                             <property name="mnemonic_widget">spinED_SCALEPAGEWIDTH</property>
+                            <property name="xalign">0</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="labelHP">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
                             <property name="label" translatable="yes">_Height in pages:</property>
                             <property name="use_underline">True</property>
                             <property name="mnemonic_widget">spinED_SCALEPAGEHEIGHT</property>
+                            <property name="xalign">0</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>
@@ -496,14 +462,11 @@
                             <property name="can_focus">True</property>
                             <property name="invisible_char">•</property>
                             <property name="shadow_type">none</property>
-                            <property name="invisible_char_set">True</property>
                             <property name="adjustment">adjustmentPage</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>
@@ -511,14 +474,39 @@
                             <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="adjustment">adjustmentPage</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="GtkCheckButton" id="unsetwidth">
+                            <property name="label">gtk-clear</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_stock">True</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">2</property>
+                            <property name="top_attach">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="unsetheight">
+                            <property name="label">gtk-clear</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_stock">True</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">2</property>
+                            <property name="top_attach">1</property>
                           </packing>
                         </child>
                       </object>
@@ -537,10 +525,10 @@
                           <object class="GtkLabel" id="labelNP">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
                             <property name="label" translatable="yes">N_umber of pages:</property>
                             <property name="use_underline">True</property>
                             <property name="mnemonic_widget">spinED_SCALEPAGENUM</property>
+                            <property name="xalign">0</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -553,7 +541,6 @@
                             <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="adjustment">adjustmentPage</property>
                             <property name="update_policy">if-valid</property>
                           </object>
@@ -574,19 +561,12 @@
                   <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>
-                  <placeholder/>
-                </child>
-                <child>
                   <object class="GtkComboBoxText" id="comboLB_SCALEMODE">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="entry_text_column">0</property>
-                    <property name="id_column">1</property>
                     <items>
                       <item translatable="yes">Reduce/enlarge printout</item>
                       <item translatable="yes">Fit print range(s) to width/height</item>
@@ -596,10 +576,11 @@
                   <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>
+                  <placeholder/>
+                </child>
               </object>
             </child>
           </object>
@@ -618,8 +599,6 @@
       <packing>
         <property name="left_attach">0</property>
         <property name="top_attach">2</property>
-        <property name="width">1</property>
-        <property name="height">1</property>
       </packing>
     </child>
   </object>
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 83d61fbbad93..ed98523f82b9 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1439,7 +1439,13 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
         if (bIsTriState)
             xCheckBox->SetState(TRISTATE_INDET);
         xCheckBox->SetImageAlign(ImageAlign::Left); //default to left
+
         xWindow = xCheckBox;
+
+        if (::extractStock(rMap))
+        {
+            xWindow->SetText(getStockText(extractLabel(rMap)));
+        }
     }
     else if (name == "GtkSpinButton")
     {


More information about the Libreoffice-commits mailing list