sw/source/ui/table/tabledlg.cxx    |   14 ++++++++++++++
 sw/source/uibase/inc/prcntfld.hxx  |    2 ++
 sw/source/uibase/table/tablepg.hxx |    7 +++++++
 3 files changed, 23 insertions(+)

New commits:
commit e385eed90f797fc915a74f51d7f8c846b80e20fa
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Aug 5 14:59:23 2020 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Aug 5 21:43:54 2020 +0200

    tdf#134914 reset table width/left/right range to initial conditions
    
    so the reset buttons can restore back to the dialogs starting position
    
    Change-Id: I7af1db23d1080e0f57a2ac1db54aca7d56c426f1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100174
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index c56168448f6d..9e2259e6ad65 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -91,6 +91,10 @@ SwFormatTablePage::SwFormatTablePage(weld::Container* pPage, 
weld::DialogControl
     , m_xTextDirectionLB(new 
svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("textdirection")))
     , m_xProperties(m_xBuilder->weld_widget("properties"))
 {
+    m_xWidthMF->GetMetricFieldRange(m_nOrigWidthMin, m_nOrigWidthMax);
+    m_xLeftMF->GetMetricFieldRange(m_nOrigLeftMin, m_nOrigLeftMax);
+    m_xRightMF->GetMetricFieldRange(m_nOrigRightMin, m_nOrigRightMax);
+
     //lock these to initial sizes so they don't change on percent to non 
percent change
     Size aPrefSize(m_xLeftMF->get()->get_preferred_size());
     m_xLeftMF->get()->set_size_request(aPrefSize.Width(), aPrefSize.Height());
@@ -439,6 +443,16 @@ void  SwFormatTablePage::Reset( const SfxItemSet* )
         m_xBottomMF->hide();
         m_xFreeBtn->set_sensitive(false);
     }
+
+    // set back to original state
+    m_xRelWidthCB->set_active(false);
+    m_xWidthMF->ShowPercent(false);
+    m_xLeftMF->ShowPercent(false);
+    m_xRightMF->ShowPercent(false);
+    m_xWidthMF->SetMetricFieldRange(m_nOrigWidthMin, m_nOrigWidthMax);
+    m_xLeftMF->SetMetricFieldRange(m_nOrigLeftMin, m_nOrigLeftMax);
+    m_xRightMF->SetMetricFieldRange(m_nOrigRightMin, m_nOrigRightMax);
+
     FieldUnit aMetric = ::GetDfltMetric(bHtmlMode);
     m_xWidthMF->SetMetric(aMetric);
     m_xRightMF->SetMetric(aMetric);
diff --git a/sw/source/uibase/inc/prcntfld.hxx 
b/sw/source/uibase/inc/prcntfld.hxx
index f9e682c5194c..bd39d2841b96 100644
--- a/sw/source/uibase/inc/prcntfld.hxx
+++ b/sw/source/uibase/inc/prcntfld.hxx
@@ -57,6 +57,8 @@ public:
     void set_accessible_name(const OUString& rStr) { 
m_pField->set_accessible_name(rStr); }
     void SetMetricFieldMin(int nNewMin) { m_pField->set_min(nNewMin, 
FieldUnit::NONE); }
     void SetMetricFieldMax(int nNewMax) { m_pField->set_max(nNewMax, 
FieldUnit::NONE); }
+    void SetMetricFieldRange(int nNewMin, int nNewMax) { 
m_pField->set_range(nNewMin, nNewMax, FieldUnit::NONE); }
+    void GetMetricFieldRange(int &rOldMin, int& rOldMax) const { 
m_pField->get_range(rOldMin, rOldMax, FieldUnit::NONE); }
 
     void set_value(int nNewValue, FieldUnit eInUnit = FieldUnit::NONE);
     int get_value(FieldUnit eOutUnit = FieldUnit::NONE);
diff --git a/sw/source/uibase/table/tablepg.hxx 
b/sw/source/uibase/table/tablepg.hxx
index 438926aa1152..60e8938e6b39 100644
--- a/sw/source/uibase/table/tablepg.hxx
+++ b/sw/source/uibase/table/tablepg.hxx
@@ -61,6 +61,13 @@ class SwFormatTablePage : public SfxTabPage
     std::unique_ptr<svx::FrameDirectionListBox> m_xTextDirectionLB;
     std::unique_ptr<weld::Widget> m_xProperties;
 
+    int m_nOrigWidthMin;
+    int m_nOrigWidthMax;
+    int m_nOrigLeftMin;
+    int m_nOrigLeftMax;
+    int m_nOrigRightMin;
+    int m_nOrigRightMax;
+
     void        Init();
     void        ModifyHdl(const weld::MetricSpinButton& rEdit);
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to