[Libreoffice-commits] core.git: sw/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Wed Apr 28 07:17:24 UTC 2021
sw/source/core/inc/flyfrm.hxx | 20 +++++++++++++++-
sw/source/core/layout/fly.cxx | 51 ++++++++++++++++++++----------------------
2 files changed, 44 insertions(+), 27 deletions(-)
New commits:
commit 79dbcc09844d815fbd7361c954eb04ce6c6acda0
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Apr 27 20:03:14 2021 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Apr 28 09:16:34 2021 +0200
Introduce SwFlyFrameInvFlags to replace magic numbers in ...
... SwFlyFrame::SwClientNotify()
SwFlyFrame::UpdateAttr_() is not yet updated to produce these.
Change-Id: Ie29d900c1796c868d051ffd9c28600e44ff3b704
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114752
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx
index c64a7f9c667c..6072d7a4d033 100644
--- a/sw/source/core/inc/flyfrm.hxx
+++ b/sw/source/core/inc/flyfrm.hxx
@@ -53,6 +53,24 @@ const SwContentFrame *FindAnchor( const SwFrame *pOldAnch, const Point &rNew,
/** calculate rectangle in that the object can be moved or rather be resized */
bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove = true );
+enum class SwFlyFrameInvFlags : sal_uInt8
+{
+ NONE = 0x00,
+ InvalidatePos = 0x01,
+ InvalidateSize = 0x02,
+ InvalidatePrt = 0x04,
+ SetNotifyBack = 0x08,
+ SetCompletePaint = 0x10,
+ InvalidateBrowseWidth = 0x20,
+ ClearContourCache = 0x40,
+ UpdateObjInSortedList = 0x80,
+};
+
+namespace o3tl {
+ template<> struct typed_flags<SwFlyFrameInvFlags> : is_typed_flags<SwFlyFrameInvFlags, 0x00ff> {};
+}
+
+
/** general base class for all free-flowing frames
#i26791# - inherit also from <SwAnchoredFlyFrame>
@@ -67,7 +85,7 @@ class SW_DLLPUBLIC SwFlyFrame : public SwLayoutFrame, public SwAnchoredObject
void InitDrawObj(SwFrame const&); // these to methods are called in the
void FinitDrawObj(); // constructors
- void UpdateAttr_( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
+ void UpdateAttr_( const SfxPoolItem*, const SfxPoolItem*, SwFlyFrameInvFlags &,
SwAttrSetChg *pa = nullptr, SwAttrSetChg *pb = nullptr );
using SwLayoutFrame::CalcRel;
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 098ec611911c..09b8ee556c26 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -660,7 +660,7 @@ void SwFlyFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
{
if(auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
{
- sal_uInt8 nInvFlags = 0;
+ SwFlyFrameInvFlags eInvFlags = SwFlyFrameInvFlags::NONE;
if(pLegacy->m_pNew && pLegacy->m_pOld && RES_ATTRSET_CHG == pLegacy->m_pNew->Which())
{
SfxItemIter aNIter(*static_cast<const SwAttrSetChg*>(pLegacy->m_pNew)->GetChgSet());
@@ -671,7 +671,7 @@ void SwFlyFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
SwAttrSetChg aNewSet(*static_cast<const SwAttrSetChg*>(pLegacy->m_pNew));
do
{
- UpdateAttr_(pOItem, pNItem, nInvFlags, &aOldSet, &aNewSet);
+ UpdateAttr_(pOItem, pNItem, eInvFlags, &aOldSet, &aNewSet);
pNItem = aNIter.NextItem();
pOItem = aOIter.NextItem();
} while(pNItem);
@@ -679,37 +679,37 @@ void SwFlyFrame::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 == SwFlyFrameInvFlags::NONE)
return;
Invalidate_();
- if(nInvFlags & 0x01)
+ if(eInvFlags & SwFlyFrameInvFlags::InvalidatePos)
{
InvalidatePos_();
// #i68520#
InvalidateObjRectWithSpaces();
}
- if(nInvFlags & 0x02)
+ if(eInvFlags & SwFlyFrameInvFlags::InvalidateSize)
{
InvalidateSize_();
// #i68520#
InvalidateObjRectWithSpaces();
}
- if(nInvFlags & 0x04)
+ if(eInvFlags & SwFlyFrameInvFlags::InvalidatePrt)
InvalidatePrt_();
- if(nInvFlags & 0x08)
+ if(eInvFlags & SwFlyFrameInvFlags::SetNotifyBack)
SetNotifyBack();
- if(nInvFlags & 0x10)
+ if(eInvFlags & SwFlyFrameInvFlags::SetCompletePaint)
SetCompletePaint();
- if((nInvFlags & 0x40) && Lower() && Lower()->IsNoTextFrame())
+ if((eInvFlags & SwFlyFrameInvFlags::ClearContourCache) && Lower() && Lower()->IsNoTextFrame())
ClrContourCache( GetVirtDrawObj() );
SwRootFrame *pRoot;
- if(nInvFlags & 0x20 && nullptr != (pRoot = getRootFrame()))
+ if(eInvFlags & SwFlyFrameInvFlags::InvalidateBrowseWidth && nullptr != (pRoot = getRootFrame()))
pRoot->InvalidateBrowseWidth();
// #i28701#
- if(nInvFlags & 0x80)
+ if(eInvFlags & SwFlyFrameInvFlags::UpdateObjInSortedList)
{
// update sorted object lists, the Writer fly frame is registered at.
UpdateObjInSortedList();
@@ -733,7 +733,7 @@ void SwFlyFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
}
void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
- sal_uInt8 &rInvFlags,
+ SwFlyFrameInvFlags &rInvFlags,
SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet )
{
bool bClear = true;
@@ -747,21 +747,20 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
case RES_FOLLOW_TEXT_FLOW:
{
// ATTENTION: Always also change Action in ChgRePos()!
- rInvFlags |= 0x09;
+ rInvFlags |= static_cast<SwFlyFrameInvFlags>(0x09);
}
break;
// #i28701# - consider new option 'wrap influence on position'
case RES_WRAP_INFLUENCE_ON_OBJPOS:
{
- rInvFlags |= 0x89;
+ rInvFlags |= static_cast<SwFlyFrameInvFlags>(0x89);
}
break;
case RES_SURROUND:
{
//#i28701# - invalidate position on change of
// wrapping style.
- //rInvFlags |= 0x40;
- rInvFlags |= 0x41;
+ rInvFlags |= static_cast<SwFlyFrameInvFlags>(0x41);
// The background needs to be messaged and invalidated
const SwRect aTmp( GetObjRectWithSpaces() );
NotifyBackground( FindPageFrame(), aTmp, PrepareHint::FlyFrameAttributesChanged );
@@ -769,7 +768,7 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
// By changing the flow of frame-bound Frames, a vertical alignment
// can be activated/deactivated => MakeFlyPos
if( RndStdIds::FLY_AT_FLY == GetFormat()->GetAnchor().GetAnchorId() )
- rInvFlags |= 0x09;
+ rInvFlags |= static_cast<SwFlyFrameInvFlags>(0x09);
// Delete contour in the Node if necessary
if ( Lower() && Lower()->IsNoTextFrame() &&
@@ -781,7 +780,7 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
}
// #i28701# - perform reorder of object lists
// at anchor frame and at page frame.
- rInvFlags |= 0x80;
+ rInvFlags |= static_cast<SwFlyFrameInvFlags>(0x80);
}
break;
@@ -806,7 +805,7 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
const SwFormatFrameSize &rNew = GetFormat()->GetFrameSize();
if ( FrameSizeChg( rNew ) )
NotifyDrawObj();
- rInvFlags |= 0x1A;
+ rInvFlags |= static_cast<SwFlyFrameInvFlags>(0x1A);
}
break;
@@ -816,7 +815,7 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
const SwFormatFrameSize &rNew = GetFormat()->GetFrameSize();
if ( FrameSizeChg( rNew ) )
NotifyDrawObj();
- rInvFlags |= 0x7F;
+ rInvFlags |= static_cast<SwFlyFrameInvFlags>(0x7F);
if (pOld && RES_FMT_CHG == nWhich)
{
SwRect aNew( GetObjRectWithSpaces() );
@@ -907,14 +906,14 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
// #i28701# - perform reorder of object lists
// at anchor frame and at page frame.
- rInvFlags |= 0x80;
+ rInvFlags |= static_cast<SwFlyFrameInvFlags>(0x80);
break;
}
case RES_UL_SPACE:
case RES_LR_SPACE:
{
- rInvFlags |= 0x41;
+ rInvFlags |= static_cast<SwFlyFrameInvFlags>(0x41);
if( pSh && pSh->GetViewOptions()->getBrowseMode() )
getRootFrame()->InvalidateBrowseWidth();
SwRect aNew( GetObjRectWithSpaces() );
@@ -942,13 +941,13 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
case RES_TEXT_VERT_ADJUST:
{
InvalidateContentPos();
- rInvFlags |= 0x10;
+ rInvFlags |= static_cast<SwFlyFrameInvFlags>(0x10);
}
break;
case RES_BOX:
case RES_SHADOW:
- rInvFlags |= 0x17;
+ rInvFlags |= static_cast<SwFlyFrameInvFlags>(0x17);
break;
case RES_FRAMEDIR :
@@ -979,7 +978,7 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
}
// #i28701# - perform reorder of object lists
// at anchor frame and at page frame.
- rInvFlags |= 0x80;
+ rInvFlags |= static_cast<SwFlyFrameInvFlags>(0x80);
}
break;
More information about the Libreoffice-commits
mailing list