[Libreoffice-commits] core.git: sw/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Thu May 13 07:14:01 UTC 2021


 sw/source/core/inc/sectfrm.hxx    |   13 ++++++++++++-
 sw/source/core/layout/sectfrm.cxx |   26 +++++++++++++-------------
 2 files changed, 25 insertions(+), 14 deletions(-)

New commits:
commit f970338902f6ebeebdf125833fad814dca7f8a24
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed May 12 20:41:19 2021 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu May 13 09:13:20 2021 +0200

    Introduce SwSectionFrameInvFlags to replace magic numbers in ...
    
    ... SwSectionFrame::SwClientNotify()
    
    SwSectionFrame::UpdateAttr_() is not yet updated to produce these.
    
    Change-Id: I2eba563916420fa78d77b9656898ce333abce6e8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115507
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx
index 47e7f27424be..276819dff7bf 100644
--- a/sw/source/core/inc/sectfrm.hxx
+++ b/sw/source/core/inc/sectfrm.hxx
@@ -33,6 +33,17 @@ enum class SwFindMode
     None = 0, EndNote = 1, LastCnt = 2, MyLast = 4
 };
 
+enum class SwSectionFrameInvFlags : sal_uInt8
+{
+    NONE = 0x00,
+    InvalidateSize = 0x01,
+    SetCompletePaint = 0x10,
+};
+
+namespace o3tl {
+    template<> struct typed_flags<SwSectionFrameInvFlags> : is_typed_flags<SwSectionFrameInvFlags, 0x0011> {};
+}
+
 class SwSectionFrame final: public SwLayoutFrame, public SwFlowFrame
 {
     SwSection* m_pSection;
@@ -42,7 +53,7 @@ class SwSectionFrame final: public SwLayoutFrame, public SwFlowFrame
     bool m_bOwnFootnoteNum; // special numbering of footnotes
     bool m_bFootnoteLock; // ftn, don't leave this section bwd
 
-    void UpdateAttr_( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
+    void UpdateAttr_( const SfxPoolItem*, const SfxPoolItem*, SwSectionFrameInvFlags &,
                       SwAttrSetChg *pa = nullptr, SwAttrSetChg *pb = nullptr );
     void Cut_( bool bRemove );
     // Is there a FootnoteContainer?
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 7f738bbc3d5e..a8c585fb30f8 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -2570,7 +2570,7 @@ void SwSectionFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
 {
     if(const auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
     {
-        sal_uInt8 nInvFlags = 0;
+        SwSectionFrameInvFlags eInvFlags = SwSectionFrameInvFlags::NONE;
         if(pLegacy->m_pNew && RES_ATTRSET_CHG == pLegacy->m_pNew->Which())
         {
             auto& rOldSetChg = *static_cast<const SwAttrSetChg*>(pLegacy->m_pOld);
@@ -2583,7 +2583,7 @@ void SwSectionFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
             SwAttrSetChg aNewSet(rNewSetChg);
             do
             {
-                UpdateAttr_(pOItem, pNItem, nInvFlags, &aOldSet, &aNewSet);
+                UpdateAttr_(pOItem, pNItem, eInvFlags, &aOldSet, &aNewSet);
                 pNItem = aNIter.NextItem();
                 pOItem = aOIter.NextItem();
             } while (pNItem);
@@ -2591,13 +2591,13 @@ void SwSectionFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
                 SwLayoutFrame::SwClientNotify(rMod, sw::LegacyModifyHint(&aOldSet, &aNewSet));
         }
         else
-            UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, nInvFlags);
+            UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, eInvFlags);
 
-        if(nInvFlags != 0)
+        if (eInvFlags != SwSectionFrameInvFlags::NONE)
         {
-            if(nInvFlags & 0x01)
+            if(eInvFlags & SwSectionFrameInvFlags::InvalidateSize)
                 InvalidateSize();
-            if(nInvFlags & 0x10)
+            if(eInvFlags & SwSectionFrameInvFlags::SetCompletePaint)
                 SetCompletePaint();
         }
     }
@@ -2613,7 +2613,7 @@ void SwSectionFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
 }
 
 void SwSectionFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
-                            sal_uInt8 &rInvFlags,
+                            SwSectionFrameInvFlags &rInvFlags,
                             SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet )
 {
     bool bClear = true;
@@ -2648,9 +2648,9 @@ void SwSectionFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pN
                           ( bChgEndn != IsEndnAtEnd() ) ||
                           ( bChgMyEndn != IsEndnoteAtMyEnd() );
                 ChgColumns( aCol, rNewCol, bChgFootnote );
-                rInvFlags |= 0x10;
+                rInvFlags |= static_cast<SwSectionFrameInvFlags>(0x10);
             }
-            rInvFlags |= 0x01;
+            rInvFlags |= static_cast<SwSectionFrameInvFlags>(0x01);
             bClear = false;
         }
             break;
@@ -2662,7 +2662,7 @@ void SwSectionFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pN
                 if (pOld && pNew)
                 {
                     ChgColumns( *static_cast<const SwFormatCol*>(pOld), *static_cast<const SwFormatCol*>(pNew) );
-                    rInvFlags |= 0x11;
+                    rInvFlags |= static_cast<SwSectionFrameInvFlags>(0x11);
                 }
             }
             break;
@@ -2676,7 +2676,7 @@ void SwSectionFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pN
                 {
                     const SwFormatCol& rNewCol = GetFormat()->GetCol();
                     ChgColumns( rNewCol, rNewCol, true );
-                    rInvFlags |= 0x01;
+                    rInvFlags |= static_cast<SwSectionFrameInvFlags>(0x01);
                 }
             }
             break;
@@ -2691,12 +2691,12 @@ void SwSectionFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pN
                 {
                     const SwFormatCol& rNewCol = GetFormat()->GetCol();
                     ChgColumns( rNewCol, rNewCol, true );
-                    rInvFlags |= 0x01;
+                    rInvFlags |= static_cast<SwSectionFrameInvFlags>(0x01);
                 }
             }
             break;
         case RES_COLUMNBALANCE:
-            rInvFlags |= 0x01;
+            rInvFlags |= static_cast<SwSectionFrameInvFlags>(0x01);
             break;
 
         case RES_FRAMEDIR :


More information about the Libreoffice-commits mailing list