cui/source/inc/paragrph.hxx          |    1 +
 cui/source/tabpages/paragrph.cxx     |   24 +++++++++++++-----------
 cui/uiconfig/ui/paraindentspacing.ui |   22 ++++++++++++++++++++++
 solenv/sanitizers/ui/cui.suppr       |    1 +
 4 files changed, 37 insertions(+), 11 deletions(-)

New commits:
commit 82c808f88342430e18ef2b692bde5014d79c246f
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Apr 24 15:10:32 2023 +0100
Commit:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
CommitDate: Wed May 17 13:59:06 2023 +0200

    Resolves: tdf#154958 add an empty spin button to use for the unused case
    
    instead of reusing the percentage one, which will set its min value
    under gtk
    
    Change-Id: I342f8f0588574c45c5752964b95232e419f752ab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150944
    Tested-by: Jenkins
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>

diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
index c44374776d79..53bc8ec561c9 100644
--- a/cui/source/inc/paragrph.hxx
+++ b/cui/source/inc/paragrph.hxx
@@ -68,6 +68,7 @@ private:
     std::unique_ptr<weld::ComboBox> m_xLineDist;
     std::unique_ptr<weld::MetricSpinButton> m_xLineDistAtPercentBox;
     std::unique_ptr<weld::MetricSpinButton> m_xLineDistAtMetricBox;
+    std::unique_ptr<weld::MetricSpinButton> m_xLineDistAtPlaceHolderBox;
     std::unique_ptr<weld::Label> m_xLineDistAtLabel;
     std::unique_ptr<weld::Label> m_xAbsDist;
 
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index ff6426b499aa..f03464c70d73 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -677,6 +677,7 @@ 
SvxStdParagraphTabPage::SvxStdParagraphTabPage(weld::Container* pPage, weld::Dia
     , m_xLineDist(m_xBuilder->weld_combo_box("comboLB_LINEDIST"))
     , 
m_xLineDistAtPercentBox(m_xBuilder->weld_metric_spin_button("spinED_LINEDISTPERCENT",
 FieldUnit::PERCENT))
     , 
m_xLineDistAtMetricBox(m_xBuilder->weld_metric_spin_button("spinED_LINEDISTMETRIC",
 FieldUnit::CM))
+    , 
m_xLineDistAtPlaceHolderBox(m_xBuilder->weld_metric_spin_button("spinED_BLANK", 
FieldUnit::CM))
     , m_xLineDistAtLabel(m_xBuilder->weld_label("labelFT_LINEDIST"))
     , m_xAbsDist(m_xBuilder->weld_label("labelST_LINEDIST_ABS"))
     , m_xRegisterCB(m_xBuilder->weld_check_button("checkCB_REGISTER"))
@@ -688,6 +689,8 @@ 
SvxStdParagraphTabPage::SvxStdParagraphTabPage(weld::Container* pPage, weld::Dia
     SetExchangeSupport();
 
     m_xLineDistAtMetricBox->hide();
+    m_xLineDistAtPlaceHolderBox->hide();
+    m_xLineDistAtPlaceHolderBox->set_text(OUString());
 
     Init_Impl();
     m_xFLineIndent->set_min(-9999, FieldUnit::NONE);    // is set to 0 on 
default
@@ -791,10 +794,9 @@ IMPL_LINK(SvxStdParagraphTabPage, LineDistHdl_Impl, 
weld::ComboBox&, rBox, void)
         case LLINESPACE_15:
         case LLINESPACE_2:
             m_xLineDistAtLabel->set_sensitive(false);
-            m_xLineDistAtPercentBox->set_sensitive(false);
-            m_xLineDistAtPercentBox->set_text(OUString());
-            m_xLineDistAtMetricBox->set_sensitive(false);
-            m_xLineDistAtMetricBox->set_text(OUString());
+            m_xLineDistAtPercentBox->hide();
+            m_xLineDistAtMetricBox->hide();
+            m_xLineDistAtPlaceHolderBox->show();
             break;
 
         case LLINESPACE_DURCH:
@@ -802,32 +804,32 @@ IMPL_LINK(SvxStdParagraphTabPage, LineDistHdl_Impl, 
weld::ComboBox&, rBox, void)
             // limit MS min(10, aPageSize)
             m_xLineDistAtMetricBox->set_min(0, FieldUnit::NONE);
 
-            if (m_xLineDistAtMetricBox->get_text().isEmpty())
+            if (m_xLineDistAtPlaceHolderBox->get_visible())
                 
m_xLineDistAtMetricBox->set_value(m_xLineDistAtMetricBox->normalize(1), 
FieldUnit::NONE);
+            m_xLineDistAtPlaceHolderBox->hide();
             m_xLineDistAtPercentBox->hide();
             m_xLineDistAtMetricBox->show();
-            m_xLineDistAtMetricBox->set_sensitive(true);
             m_xLineDistAtLabel->set_sensitive(true);
             break;
 
         case LLINESPACE_MIN:
             m_xLineDistAtMetricBox->set_min(0, FieldUnit::NONE);
 
-            if (m_xLineDistAtMetricBox->get_text().isEmpty())
+            if (m_xLineDistAtPlaceHolderBox->get_visible())
                 
m_xLineDistAtMetricBox->set_value(m_xLineDistAtMetricBox->normalize(10), 
FieldUnit::TWIP);
+            m_xLineDistAtPlaceHolderBox->hide();
             m_xLineDistAtPercentBox->hide();
             m_xLineDistAtMetricBox->show();
-            m_xLineDistAtMetricBox->set_sensitive(true);
             m_xLineDistAtLabel->set_sensitive(true);
             break;
 
         case LLINESPACE_PROP:
 
-            if (m_xLineDistAtPercentBox->get_text().isEmpty())
+            if (m_xLineDistAtPlaceHolderBox->get_visible())
                 
m_xLineDistAtPercentBox->set_value(m_xLineDistAtPercentBox->normalize(100), 
FieldUnit::TWIP);
+            m_xLineDistAtPlaceHolderBox->hide();
             m_xLineDistAtMetricBox->hide();
             m_xLineDistAtPercentBox->show();
-            m_xLineDistAtPercentBox->set_sensitive(true);
             m_xLineDistAtLabel->set_sensitive(true);
             break;
         case LLINESPACE_FIX:
@@ -839,9 +841,9 @@ IMPL_LINK(SvxStdParagraphTabPage, LineDistHdl_Impl, 
weld::ComboBox&, rBox, void)
             // it is time for the default
             if (m_xLineDistAtMetricBox->get_value(FieldUnit::NONE) != nTemp)
                 SetMetricValue( *m_xLineDistAtMetricBox, FIX_DIST_DEF, 
MapUnit::MapTwip ); // fix is only in Writer
+            m_xLineDistAtPlaceHolderBox->hide();
             m_xLineDistAtPercentBox->hide();
             m_xLineDistAtMetricBox->show();
-            m_xLineDistAtMetricBox->set_sensitive(true);
             m_xLineDistAtLabel->set_sensitive(true);
         }
         break;
diff --git a/cui/uiconfig/ui/paraindentspacing.ui 
b/cui/uiconfig/ui/paraindentspacing.ui
index 8a37b7d8653e..bcfbf428df34 100644
--- a/cui/uiconfig/ui/paraindentspacing.ui
+++ b/cui/uiconfig/ui/paraindentspacing.ui
@@ -2,6 +2,11 @@
 <!-- Generated with glade 3.22.1 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.20"/>
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="upper">100</property>
+    <property name="step-increment">1</property>
+    <property name="page-increment">10</property>
+  </object>
   <object class="GtkAdjustment" id="adjustmentED_DIST">
     <property name="upper">9999</property>
     <property name="step_increment">1</property>
@@ -442,6 +447,22 @@
                             <property name="position">1</property>
                           </packing>
                         </child>
+                        <child>
+                          <object class="GtkSpinButton" id="spinED_BLANK">
+                            <property name="visible">True</property>
+                            <property name="sensitive">False</property>
+                            <property name="can-focus">True</property>
+                            <property name="activates-default">True</property>
+                            <property name="truncate-multiline">True</property>
+                            <property name="adjustment">adjustment1</property>
+                            <property name="digits">1</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
@@ -520,6 +541,7 @@
       <widget name="spinED_BOTTOMDIST"/>
       <widget name="spinED_LINEDISTPERCENT"/>
       <widget name="spinED_LINEDISTMETRIC"/>
+      <widget name="spinED_BLANK"/>
     </widgets>
   </object>
 </interface>
diff --git a/solenv/sanitizers/ui/cui.suppr b/solenv/sanitizers/ui/cui.suppr
index ac34d70d0bce..1bbedb8ee184 100644
--- a/solenv/sanitizers/ui/cui.suppr
+++ b/solenv/sanitizers/ui/cui.suppr
@@ -139,6 +139,7 @@ 
cui/uiconfig/ui/paragalignpage.ui://GtkLabel[@id='labelST_LEFTALIGN_ASIAN'] orph
 cui/uiconfig/ui/paraindentspacing.ui://GtkLabel[@id='labelST_LINEDIST_ABS'] 
orphan-label
 cui/uiconfig/ui/paraindentspacing.ui://GtkComboBoxText[@id='comboLB_LINEDIST'] 
no-labelled-by
 cui/uiconfig/ui/paraindentspacing.ui://GtkLabel[@id='labelFT_LINEDIST'] 
orphan-label
+cui/uiconfig/ui/paraindentspacing.ui://GtkSpinButton[@id='spinED_BLANK'] 
no-labelled-by
 
cui/uiconfig/ui/paraindentspacing.ui://GtkSpinButton[@id='spinED_LINEDISTPERCENT']
 no-labelled-by
 
cui/uiconfig/ui/paraindentspacing.ui://GtkSpinButton[@id='spinED_LINEDISTMETRIC']
 no-labelled-by
 cui/uiconfig/ui/password.ui://GtkLabel[@id='label1'] orphan-label

Reply via email to