[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - cui/source include/vcl sc/source vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu May 9 09:11:38 UTC 2019


 cui/source/inc/paragrph.hxx       |   28 ++++++++--------------------
 cui/source/tabpages/paragrph.cxx  |   20 --------------------
 include/vcl/weld.hxx              |   12 ++++++++++++
 sc/source/ui/attrdlg/tabpages.cxx |   20 --------------------
 sc/source/ui/inc/tabpages.hxx     |   20 ++++----------------
 vcl/source/app/salvtables.cxx     |   20 ++++++++++++++++++++
 6 files changed, 44 insertions(+), 76 deletions(-)

New commits:
commit 70bb74f2ef9bc81aa1141b6ab35ffb2a411bb656
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed May 8 12:26:39 2019 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu May 9 11:10:15 2019 +0200

    merge duplicated TriStateEnabled class
    
    Change-Id: I1c10010eb7fd33a03f477af0cba03ae74859b174
    Reviewed-on: https://gerrit.libreoffice.org/71999
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
index 183dbba699dc..b741934754ef 100644
--- a/cui/source/inc/paragrph.hxx
+++ b/cui/source/inc/paragrph.hxx
@@ -184,18 +184,6 @@ public:
     virtual void            PageCreated(const SfxAllItemSet& aSet) override;
 };
 
-struct TriStateEnabled
-{
-    TriState eState;
-    bool bTriStateEnabled;
-    TriStateEnabled()
-        : eState(TRISTATE_INDET)
-        , bTriStateEnabled(true)
-    {
-    }
-    void ButtonToggled(weld::ToggleButton& rToggle);
-};
-
 // class SvxExtParagraphTabPage ------------------------------------------
 /*
     [Description]
@@ -235,14 +223,14 @@ protected:
 private:
     SvxExtParagraphTabPage(TabPageParent pParent, const SfxItemSet& rSet);
 
-    TriStateEnabled aHyphenState;
-    TriStateEnabled aPageBreakState;
-    TriStateEnabled aApplyCollState;
-    TriStateEnabled aPageNumState;
-    TriStateEnabled aKeepTogetherState;
-    TriStateEnabled aKeepParaState;
-    TriStateEnabled aOrphanState;
-    TriStateEnabled aWidowState;
+    weld::TriStateEnabled aHyphenState;
+    weld::TriStateEnabled aPageBreakState;
+    weld::TriStateEnabled aApplyCollState;
+    weld::TriStateEnabled aPageNumState;
+    weld::TriStateEnabled aKeepTogetherState;
+    weld::TriStateEnabled aKeepParaState;
+    weld::TriStateEnabled aOrphanState;
+    weld::TriStateEnabled aWidowState;
 
     bool                bPageBreak;
     bool                bHtmlMode;
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index a8d9d8ab6003..35515175c760 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -2063,26 +2063,6 @@ IMPL_LINK(SvxExtParagraphTabPage, WidowHdl_Impl, weld::ToggleButton&, rToggle, v
     WidowHdl();
 }
 
-void TriStateEnabled::ButtonToggled(weld::ToggleButton& rToggle)
-{
-    if (bTriStateEnabled)
-    {
-        switch (eState)
-        {
-            case TRISTATE_INDET:
-                rToggle.set_state(TRISTATE_FALSE);
-                break;
-            case TRISTATE_TRUE:
-                rToggle.set_state(TRISTATE_INDET);
-                break;
-            case TRISTATE_FALSE:
-                rToggle.set_state(TRISTATE_TRUE);
-                break;
-        }
-    }
-    eState = rToggle.get_state();
-}
-
 IMPL_LINK(SvxExtParagraphTabPage, OrphanHdl_Impl, weld::ToggleButton&, rToggle, void)
 {
     aOrphanState.ButtonToggled(rToggle);
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 449829015054..a124cd09786d 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -627,6 +627,18 @@ public:
     virtual void connect_toggled(const Link<ToggleButton&, void>& rLink) { m_aToggleHdl = rLink; }
 };
 
+struct VCL_DLLPUBLIC TriStateEnabled
+{
+    TriState eState;
+    bool bTriStateEnabled;
+    TriStateEnabled()
+        : eState(TRISTATE_INDET)
+        , bTriStateEnabled(true)
+    {
+    }
+    void ButtonToggled(ToggleButton& rToggle);
+};
+
 class VCL_DLLPUBLIC MenuButton : virtual public ToggleButton
 {
 protected:
diff --git a/sc/source/ui/attrdlg/tabpages.cxx b/sc/source/ui/attrdlg/tabpages.cxx
index 6ce555b62085..8795514813aa 100644
--- a/sc/source/ui/attrdlg/tabpages.cxx
+++ b/sc/source/ui/attrdlg/tabpages.cxx
@@ -144,26 +144,6 @@ DeactivateRC ScTabPageProtection::DeactivatePage( SfxItemSet* pSetP )
     return DeactivateRC::LeavePage;
 }
 
-void TriStateEnabled::ButtonToggled(weld::ToggleButton& rToggle)
-{
-    if (bTriStateEnabled)
-    {
-        switch (eState)
-        {
-            case TRISTATE_INDET:
-                rToggle.set_state(TRISTATE_FALSE);
-                break;
-            case TRISTATE_TRUE:
-                rToggle.set_state(TRISTATE_INDET);
-                break;
-            case TRISTATE_FALSE:
-                rToggle.set_state(TRISTATE_TRUE);
-                break;
-        }
-    }
-    eState = rToggle.get_state();
-}
-
 IMPL_LINK(ScTabPageProtection, ProtectClickHdl, weld::ToggleButton&, rBox, void)
 {
     aProtectState.ButtonToggled(rBox);
diff --git a/sc/source/ui/inc/tabpages.hxx b/sc/source/ui/inc/tabpages.hxx
index 5d195bb3cde2..16046ab4f6bc 100644
--- a/sc/source/ui/inc/tabpages.hxx
+++ b/sc/source/ui/inc/tabpages.hxx
@@ -22,18 +22,6 @@
 
 #include <sfx2/tabdlg.hxx>
 
-struct TriStateEnabled
-{
-    TriState eState;
-    bool bTriStateEnabled;
-    TriStateEnabled()
-        : eState(TRISTATE_INDET)
-        , bTriStateEnabled(true)
-    {
-    }
-    void ButtonToggled(weld::ToggleButton& rToggle);
-};
-
 class ScTabPageProtection : public SfxTabPage
 {
     friend class VclPtr<ScTabPageProtection>;
@@ -62,10 +50,10 @@ private:
     bool            bHideCell;
     bool            bHidePrint;
 
-    TriStateEnabled aHideCellState;
-    TriStateEnabled aProtectState;
-    TriStateEnabled aHideFormulaState;
-    TriStateEnabled aHidePrintState;
+    weld::TriStateEnabled aHideCellState;
+    weld::TriStateEnabled aProtectState;
+    weld::TriStateEnabled aHideFormulaState;
+    weld::TriStateEnabled aHidePrintState;
 
     std::unique_ptr<weld::CheckButton> m_xBtnHideCell;
     std::unique_ptr<weld::CheckButton> m_xBtnProtect;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index bce3b3815f06..0f925613ac8e 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -3836,6 +3836,26 @@ namespace weld
             m_xContentArea->move(m_xRelocate.get(), m_xOrigParent.get());
         }
     }
+
+    void TriStateEnabled::ButtonToggled(weld::ToggleButton& rToggle)
+    {
+        if (bTriStateEnabled)
+        {
+            switch (eState)
+            {
+                case TRISTATE_INDET:
+                    rToggle.set_state(TRISTATE_FALSE);
+                    break;
+                case TRISTATE_TRUE:
+                    rToggle.set_state(TRISTATE_INDET);
+                    break;
+                case TRISTATE_FALSE:
+                    rToggle.set_state(TRISTATE_TRUE);
+                    break;
+            }
+        }
+        eState = rToggle.get_state();
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list