summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2020-11-01 17:39:30 +0100
committerBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2020-11-01 20:56:54 +0100
commit63076928d41d95d6c0bc86580ba8a5a985b1f415 (patch)
tree3ff3ca4f9661d020c16992529afc5294a3926a6f /sw
parent14f9dac4fbaeb0e13ad4875f77960c4019d8f229 (diff)
Make SwClient::ModifyNotification non-virtual
Change-Id: Ic34b0b7a3ad906da5f25103f32a28e2a3efd82fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105150 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/calbck.hxx8
-rw-r--r--sw/inc/node.hxx4
-rw-r--r--sw/source/core/attr/calbck.cxx7
-rw-r--r--sw/source/core/docnode/swbaslnk.cxx8
4 files changed, 15 insertions, 12 deletions
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 020697b285b8..19c7c0b1125a 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -144,7 +144,10 @@ public:
// should be called only from SwModify the client is registered in
// mba: IMHO this method should be pure virtual
// DO NOT USE IN NEW CODE! use SwClientNotify instead.
- virtual void Modify(const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue);
+ virtual void Modify(const SfxPoolItem*, const SfxPoolItem*);
+ // controlled access to Modify method
+ // mba: this is still considered a hack and it should be fixed; the name makes grep-ing easier
+ void ModifyNotification(const SfxPoolItem*, const SfxPoolItem*);
// when overriding this, you MUST call SwClient::SwClientModify() in the override!
virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) override;
@@ -152,9 +155,6 @@ public:
// its SwClient objects can decide to get registered to the latter instead by calling this method
std::unique_ptr<sw::ModifyChangedHint> CheckRegistration( const SfxPoolItem* pOldValue );
- // controlled access to Modify method
- // mba: this is still considered a hack and it should be fixed; the name makes grep-ing easier
- virtual void ModifyNotification( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue ) { Modify ( pOldValue, pNewValue ); }
void SwClientNotifyCall( const SwModify& rModify, const SfxHint& rHint ) { SwClientNotify( rModify, rHint ); }
const SwModify* GetRegisteredIn() const { return m_pRegisteredIn; }
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index 3708e82f1c5c..7aa3fe8525bb 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -480,10 +480,6 @@ public:
// Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const;
- virtual void ModifyNotification(const SfxPoolItem* pOld, const SfxPoolItem* pNew) override
- {
- SwClientNotify(*this, sw::LegacyModifyHint(pOld, pNew));
- }
void UpdateAttr(const SwUpdateAttr&);
private:
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index c3eda1a29e64..917efa340bbd 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -113,6 +113,13 @@ void SwClient::SwClientNotify(const SwModify&, const SfxHint& rHint)
}
};
+void SwClient::ModifyNotification(const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue)
+{
+ SwModify aFallbackMod;
+ auto pMod = dynamic_cast<SwModify*>(this);
+ SwClientNotify(pMod ? *pMod : aFallbackMod, sw::LegacyModifyHint(pOldValue, pNewValue));
+}
+
void SwClient::StartListeningToSameModifyAs(const SwClient& other)
{
if(other.m_pRegisteredIn)
diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx
index 2d297445bd41..3ab59b95932c 100644
--- a/sw/source/core/docnode/swbaslnk.cxx
+++ b/sw/source/core/docnode/swbaslnk.cxx
@@ -61,14 +61,14 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
// them haven't a loaded Graphic.
rGrfNd.LockModify();
{
- SwIterator<SwClient,SwGrfNode> aIter(rGrfNd);
- for(SwClient* pLast = aIter.First(); pLast; pLast = aIter.Next())
- if(dynamic_cast<const SwContentFrame*>( pLast) == nullptr)
+ SwIterator<SwModify,SwGrfNode> aIter(rGrfNd);
+ for(SwModify* pLast = aIter.First(); pLast; pLast = aIter.Next())
+ if(dynamic_cast<const SwContentFrame*>(pLast) == nullptr)
pLast->ModifyNotification(&rItem, &rItem);
}
{
SwIterator<SwContentFrame,SwGrfNode> aIter(rGrfNd);
- for(SwClient* pLast = aIter.First(); pLast; pLast = aIter.Next())
+ for(SwContentFrame* pLast = aIter.First(); pLast; pLast = aIter.Next())
pLast->ModifyNotification(&rItem, &rItem);
}
rGrfNd.UnlockModify();