diff options
author | Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> | 2020-11-10 22:40:47 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> | 2020-11-12 00:11:29 +0100 |
commit | ab72e9fe38b5d30bd1a0393e1611ae969919908f (patch) | |
tree | c8569abfaf1bd7a5c8d2247a314c716996650213 | |
parent | 1abf4e6d07ca0ac31bc54f812df84efc82d2af1b (diff) |
Make SwClientNotifyCall protected
Change-Id: I1da6cd45c5039f2b36ae6d8a64febc69eda9c6d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105569
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
-rw-r--r-- | sw/inc/calbck.hxx | 10 | ||||
-rw-r--r-- | sw/source/core/attr/calbck.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/attr/format.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/crsr/callnk.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentFieldsManager.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentTimerManager.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docfmt.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/docnode/section.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/graphic/ndgrf.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/para/paratr.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/undo/untbl.cxx | 2 |
11 files changed, 22 insertions, 16 deletions
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index 8550a3be543f..8fbb2e87e0b2 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -136,6 +136,9 @@ protected: // write access to pRegisteredIn shall be granted only to the object itself (protected access) SwModify* GetRegisteredInNonConst() const { return m_pRegisteredIn; } + // when overriding this, you MUST call SwClient::SwClientModify() in the override! + virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) override; + public: SwClient() : m_pRegisteredIn(nullptr) {} SwClient(SwClient&&) noexcept; @@ -145,13 +148,16 @@ public: // mba: IMHO this method should be pure virtual // DO NOT USE IN NEW CODE! use SwClientNotify instead. virtual void Modify(const SfxPoolItem*, const SfxPoolItem*); - // when overriding this, you MUST call SwClient::SwClientModify() in the override! - virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) override; + // in case an SwModify object is destroyed that itself is registered in another SwModify, // 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 ); + // DO NOT USE IN NEW CODE! Used to directly call the event handler from + // outside the class. It is generally wrong to call the message handler + // directly: either it should be a proper stand-alone member function + // or by the observed object sending the hint properly itself. void SwClientNotifyCall( const SwModify& rModify, const SfxHint& rHint ) { SwClientNotify( rModify, rHint ); } const SwModify* GetRegisteredIn() const { return m_pRegisteredIn; } diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx index 999085404da1..675c4e54993b 100644 --- a/sw/source/core/attr/calbck.cxx +++ b/sw/source/core/attr/calbck.cxx @@ -46,7 +46,7 @@ namespace sw { auto pModifyChanged = CheckRegistration(pLegacyHint->m_pOld); if (pModifyChanged) - m_pToTell->SwClientNotify(rModify, *pModifyChanged); + m_pToTell->SwClientNotifyCall(rModify, *pModifyChanged); } else if (m_pToTell) m_pToTell->SwClientNotifyCall(rModify, rHint); @@ -378,6 +378,6 @@ void sw::ClientNotifyAttrChg(SwModify& rModify, const SwAttrSet& aSet, SwAttrSet const SwAttrSetChg aChgOld(aSet, aOld); const SwAttrSetChg aChgNew(aSet, aNew); const sw::LegacyModifyHint aHint(&aChgOld, &aChgNew); - rModify.SwClientNotify(rModify, aHint); + rModify.SwClientNotifyCall(rModify, aHint); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index 22430f84b125..459f66ccd3f2 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -236,7 +236,7 @@ SwFormat::~SwFormat() SAL_INFO("sw.core", "reparenting " << typeid(*pClient).name() << " at " << pClient << " from " << typeid(*this).name() << " at " << this << " to " << typeid(*pParentFormat).name() << " at " << pParentFormat); pParentFormat->Add( pClient ); const sw::LegacyModifyHint aHint(&aOldFormat, &aNewFormat); - pClient->SwClientNotify(*this, aHint); + pClient->SwClientNotifyCall(*this, aHint); } } } diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx index de888d63ab47..d44ff1c8ed19 100644 --- a/sw/source/core/crsr/callnk.cxx +++ b/sw/source/core/crsr/callnk.cxx @@ -87,7 +87,7 @@ static void lcl_notifyRow(const SwContentNode* pNode, SwCursorShell & rShell) SwFormatFrameSize aSize = pLine->GetFrameFormat()->GetFrameSize(); sw::BroadcastingModify aMod; - pRow->SwClientNotify(aMod, sw::LegacyModifyHint(nullptr, &aSize)); + pRow->SwClientNotifyCall(aMod, sw::LegacyModifyHint(nullptr, &aSize)); } SwCallLink::~SwCallLink() COVERITY_NOEXCEPT_FALSE diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index 2f3da10fbf97..bafe9c29fb00 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -182,7 +182,7 @@ namespace void lcl_SwClientNotify(sw::BroadcastingModify& rModify, const SfxPoolItem* pNew) { const sw::LegacyModifyHint aHint(nullptr, pNew); - rModify.SwClientNotify(rModify, aHint); + rModify.SwClientNotifyCall(rModify, aHint); } } diff --git a/sw/source/core/doc/DocumentTimerManager.cxx b/sw/source/core/doc/DocumentTimerManager.cxx index dde164bb142f..656c98055e72 100644 --- a/sw/source/core/doc/DocumentTimerManager.cxx +++ b/sw/source/core/doc/DocumentTimerManager.cxx @@ -195,7 +195,7 @@ IMPL_LINK_NOARG( DocumentTimerManager, DoIdleJobs, Timer*, void ) pShell->LockView( true ); auto pChapterFieldType = m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Chapter ); - pChapterFieldType->SwClientNotify(*pChapterFieldType, sw::LegacyModifyHint( nullptr, nullptr )); // ChapterField + pChapterFieldType->SwClientNotifyCall(*pChapterFieldType, sw::LegacyModifyHint( nullptr, nullptr )); // ChapterField m_rDoc.getIDocumentFieldsAccess().UpdateExpFields( nullptr, false ); // Updates ExpressionFields m_rDoc.getIDocumentFieldsAccess().UpdateTableFields(nullptr); // Tables m_rDoc.getIDocumentFieldsAccess().UpdateRefFields(); // References diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 2bcf4f2b0ce7..94f6416878c8 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -629,7 +629,7 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) { SwFormatChg aChgFormat( mpDfltCharFormat.get() ); // notify the frames - aCallMod.SwClientNotify(aCallMod, sw::LegacyModifyHint( &aChgFormat, &aChgFormat )); + aCallMod.SwClientNotifyCall(aCallMod, sw::LegacyModifyHint( &aChgFormat, &aChgFormat )); } } } @@ -638,7 +638,7 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) { SwAttrSetChg aChgOld( aOld, aOld ); SwAttrSetChg aChgNew( aNew, aNew ); - aCallMod.SwClientNotify(aCallMod, sw::LegacyModifyHint( &aChgOld, &aChgNew )); // all changed are sent + aCallMod.SwClientNotifyCall(aCallMod, sw::LegacyModifyHint( &aChgOld, &aChgNew )); // all changed are sent } // remove the default formats from the object again diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index c22469501045..a59b9cffaa71 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -70,7 +70,7 @@ namespace { void lcl_SwClientNotify(sw::BroadcastingModify& rModify, const SfxPoolItem* pOldNew) { const sw::LegacyModifyHint aHint(pOldNew, pOldNew); - rModify.SwClientNotify(rModify, aHint); + rModify.SwClientNotifyCall(rModify, aHint); } class SwIntrnlSectRefLink : public SwBaseLink diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index f4ab419cbff1..1f894a90de8c 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -58,7 +58,7 @@ namespace void lcl_SwClientNotify(sw::BroadcastingModify& rModify, const SfxPoolItem& rOldNew) { const sw::LegacyModifyHint aHint(&rOldNew, &rOldNew); - rModify.SwClientNotify(rModify, aHint); + rModify.SwClientNotifyCall(rModify, aHint); } } SwGrfNode::SwGrfNode( @@ -381,12 +381,12 @@ void SwGrfNode::TriggerGraphicArrived() SwIterator<sw::BroadcastingModify,SwGrfNode> aIter(*this); for(sw::BroadcastingModify* pLast = aIter.First(); pLast; pLast = aIter.Next()) if(dynamic_cast<const SwContentFrame*>(pLast) == nullptr) - pLast->SwClientNotify(*this, sw::LegacyModifyHint(&aMsgHint, &aMsgHint)); + pLast->SwClientNotifyCall(*this, sw::LegacyModifyHint(&aMsgHint, &aMsgHint)); } { SwIterator<SwContentFrame,SwGrfNode> aIter(*this); for(SwContentFrame* pLast = aIter.First(); pLast; pLast = aIter.Next()) - pLast->SwClientNotify(*this, sw::LegacyModifyHint(&aMsgHint, &aMsgHint)); + pLast->SwClientNotifyCall(*this, sw::LegacyModifyHint(&aMsgHint, &aMsgHint)); } UnlockModify(); } diff --git a/sw/source/core/para/paratr.cxx b/sw/source/core/para/paratr.cxx index 60df4bbdb5e7..08be02090f0d 100644 --- a/sw/source/core/para/paratr.cxx +++ b/sw/source/core/para/paratr.cxx @@ -77,7 +77,7 @@ void SwFormatDrop::SwClientNotify(const SwModify&, const SfxHint&) if(dynamic_cast<const SwFormat*>(m_pDefinedIn) == nullptr) { sw::BroadcastingModify aMod; - m_pDefinedIn->SwClientNotify(aMod, sw::LegacyModifyHint(this, this)); + m_pDefinedIn->SwClientNotifyCall(aMod, sw::LegacyModifyHint(this, this)); } else if(m_pDefinedIn->HasWriterListeners() && !m_pDefinedIn->IsModifyLocked()) { diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 8710d3148a5a..462ca92b0d20 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -1117,7 +1117,7 @@ void SaveTable::NewFrameFormat( const SwTableLine* pTableLn, const SwTableBox* p const SfxPoolItem& rOld = pOldFormat->GetFormatAttr( RES_BOXATR_FORMAT ), & rNew = pFormat->GetFormatAttr( RES_BOXATR_FORMAT ); if( rOld != rNew ) - pFormat->SwClientNotify(*pFormat, sw::LegacyModifyHint(&rOld, &rNew)); + pFormat->SwClientNotifyCall(*pFormat, sw::LegacyModifyHint(&rOld, &rNew)); } if( !pOldFormat->HasWriterListeners() ) |