diff options
-rw-r--r-- | sw/inc/calbck.hxx | 6 | ||||
-rw-r--r-- | sw/source/core/attr/calbck.cxx | 32 | ||||
-rw-r--r-- | sw/source/core/attr/format.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/CntntIdxStore.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/docnode/node.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/edit/editsh.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/fields/reffld.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/layout/anchoredobject.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/layout/pagechg.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/layout/pagedesc.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/tox/tox.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/txtnode/atrfld.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/txtnode/atrftn.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/txtnode/atrref.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/txtnode/ndtxt.cxx | 18 | ||||
-rw-r--r-- | sw/source/core/txtnode/thints.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/txtnode/txtedt.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/unocore/unoobj.cxx | 2 |
18 files changed, 51 insertions, 63 deletions
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index ae4d3bd0b8fd..31df9791291b 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -189,11 +189,7 @@ public: : SwClient(), m_pWriterListeners(nullptr), m_bModifyLocked(false), m_bInCache(false), m_bInSwFntCache(false) {} - // broadcasting: send notifications to all clients - // DO NOT USE IN NEW CODE! use CallSwClientNotify instead. - void NotifyClients( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue ); - - // a more universal broadcasting mechanism + // broadcasting mechanism virtual void CallSwClientNotify( const SfxHint& rHint ) const; virtual ~SwModify() override; diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx index 7450afad6c3f..1c86c75fc992 100644 --- a/sw/source/core/attr/calbck.cxx +++ b/sw/source/core/attr/calbck.cxx @@ -161,7 +161,7 @@ SwModify::~SwModify() // notify all clients that they shall remove themselves SwPtrMsgPoolItem aDyObject( RES_OBJECTDYING, this ); - NotifyClients( &aDyObject, &aDyObject ); + SwModify::SwClientNotify(*this, sw::LegacyModifyHint(&aDyObject, &aDyObject)); const bool hasListenersOnDeath = m_pWriterListeners; (void)hasListenersOnDeath; @@ -173,24 +173,6 @@ SwModify::~SwModify() assert(!hasListenersOnDeath); } -void SwModify::NotifyClients( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue ) -{ - DBG_TESTSOLARMUTEX(); - if ( IsInCache() || IsInSwFntCache() ) - { - const sal_uInt16 nWhich = pOldValue ? pOldValue->Which() : - pNewValue ? pNewValue->Which() : 0; - CheckCaching( nWhich ); - } - - if ( !m_pWriterListeners || IsModifyLocked() ) - return; - - LockModify(); - CallSwClientNotify( sw::LegacyModifyHint{ pOldValue, pNewValue } ); - UnlockModify(); -} - bool SwModify::GetInfo( SfxPoolItem& rInfo ) const { if(!m_pWriterListeners) @@ -368,7 +350,17 @@ sw::ClientIteratorBase* sw::ClientIteratorBase::s_pClientIters = nullptr; void SwModify::SwClientNotify(const SwModify&, const SfxHint& rHint) { if(auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint)) - NotifyClients(pLegacyHint->m_pOld, pLegacyHint->m_pNew); + { + DBG_TESTSOLARMUTEX(); + if(IsInCache() || IsInSwFntCache()) + CheckCaching(pLegacyHint->GetWhich()); + if(IsModifyLocked()) + return; + + LockModify(); + CallSwClientNotify(rHint); + UnlockModify(); + } } void SwModify::CallSwClientNotify( const SfxHint& rHint ) const diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index 1f83d913be38..6e0f55ef8da0 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -320,7 +320,7 @@ void SwFormat::SwClientNotify(const SwModify&, const SfxHint& rHint) } } if(bPassToDepends) - NotifyClients(aDependArgs.first, aDependArgs.second); + SwModify::SwClientNotify(*this, sw::LegacyModifyHint(aDependArgs.first, aDependArgs.second)); } bool SwFormat::SetDerivedFrom(SwFormat *pDerFrom) diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx index c37221e189e8..989fae5b4abe 100644 --- a/sw/source/core/doc/CntntIdxStore.cxx +++ b/sw/source/core/doc/CntntIdxStore.cxx @@ -393,9 +393,9 @@ void ContentIdxStoreImpl::RestoreFlys(SwDoc& rDoc, updater_t const & rUpdater, b } else if( bAuto ) { - SwFrameFormat *pFrameFormat = (*pSpz)[ aEntry.m_nIdx ]; - SfxPoolItem const *pAnchor = &pFrameFormat->GetAnchor(); - pFrameFormat->NotifyClients( pAnchor, pAnchor ); + SwFrameFormat* pFrameFormat = (*pSpz)[ aEntry.m_nIdx ]; + const SfxPoolItem* pAnchor = &pFrameFormat->GetAnchor(); + pFrameFormat->CallSwClientNotify(sw::LegacyModifyHint(pAnchor, pAnchor)); } } } diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 2ed5ff85a3c4..2fb5e255148e 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -1178,7 +1178,7 @@ void SwContentNode::SwClientNotify( const SwModify&, const SfxHint& rHint) AttrSetHandleHelper::SetParent(mpAttrSet, *this, pFormatColl, pFormatColl); if(bCalcHidden) static_cast<SwTextNode*>(this)->SetCalcHiddenCharFlags(); - NotifyClients(pLegacyHint->m_pOld, pLegacyHint->m_pNew); + CallSwClientNotify(rHint); } else if (auto pModifyChangedHint = dynamic_cast<const sw::ModifyChangedHint*>(&rHint)) { @@ -1904,7 +1904,7 @@ void SwContentNode::SetCondFormatColl(SwFormatColl* pColl) { SwFormatChg aTmp1(pOldColl ? pOldColl : GetFormatColl()); SwFormatChg aTmp2(pColl ? pColl : GetFormatColl()); - NotifyClients(&aTmp1, &aTmp2); + CallSwClientNotify(sw::LegacyModifyHint(&aTmp1, &aTmp2)); } if(IsInCache()) { diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index c956c2544c44..60a0b7eea389 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -329,7 +329,7 @@ void SwEditShell::SetGraphicPolygon( const tools::PolyPolygon *pPoly ) pNd->SetContour( pPoly ); SwFlyFrame *pFly = static_cast<SwFlyFrame*>(pNd->getLayoutFrame(GetLayout())->GetUpper()); const SwFormatSurround &rSur = pFly->GetFormat()->GetSurround(); - pFly->GetFormat()->NotifyClients( &rSur, &rSur ); + pFly->GetFormat()->CallSwClientNotify(sw::LegacyModifyHint(&rSur, &rSur)); GetDoc()->getIDocumentState().SetModified(); EndAllAction(); } @@ -344,7 +344,7 @@ void SwEditShell::ClearAutomaticContour() pNd->SetContour( nullptr ); SwFlyFrame *pFly = static_cast<SwFlyFrame*>(pNd->getLayoutFrame(GetLayout())->GetUpper()); const SwFormatSurround &rSur = pFly->GetFormat()->GetSurround(); - pFly->GetFormat()->NotifyClients( &rSur, &rSur ); + pFly->GetFormat()->CallSwClientNotify(sw::LegacyModifyHint(&rSur, &rSur)); GetDoc()->getIDocumentState().SetModified(); EndAllAction(); } diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index a6c6185c28af..10008bdd73ac 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -1090,7 +1090,7 @@ void SwGetRefFieldType::UpdateGetReferences() // #i81002# pGRef->UpdateField(pFormatField->GetTextField()); } - NotifyClients(nullptr, nullptr); + CallSwClientNotify(sw::LegacyModifyHint(nullptr, nullptr)); } void SwGetRefFieldType::SwClientNotify(const SwModify&, const SfxHint& rHint) @@ -1105,7 +1105,7 @@ void SwGetRefFieldType::SwClientNotify(const SwModify&, const SfxHint& rHint) UpdateGetReferences(); else // forward to text fields, they "expand" the text - NotifyClients(pLegacy->m_pOld, pLegacy->m_pNew); + CallSwClientNotify(rHint); } namespace sw { diff --git a/sw/source/core/layout/anchoredobject.cxx b/sw/source/core/layout/anchoredobject.cxx index eb2ef8016a22..70c836c68645 100644 --- a/sw/source/core/layout/anchoredobject.cxx +++ b/sw/source/core/layout/anchoredobject.cxx @@ -615,9 +615,10 @@ void SwAnchoredObject::SetObjLeft( const SwTwips _nLeft) at the anchor frame and all following anchored objects on the page frame are invalidated. */ + void SwAnchoredObject::UpdateObjInSortedList() { - if ( !GetAnchorFrame() ) + if(!GetAnchorFrame()) return; if ( GetFrameFormat().getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) @@ -626,11 +627,10 @@ void SwAnchoredObject::UpdateObjInSortedList() if ( GetAnchorFrame()->GetDrawObjs() ) { const SwSortedObjs* pObjs = GetAnchorFrame()->GetDrawObjs(); - // determine start index - for (auto it = pObjs->begin(); it != pObjs->end(); ++it) + for(auto it = pObjs->begin(); it != pObjs->end(); ++it) { SwAnchoredObject* pAnchoredObj = *it; - if ( pAnchoredObj->ConsiderObjWrapInfluenceOnObjPos() ) + if(pAnchoredObj->ConsiderObjWrapInfluenceOnObjPos()) pAnchoredObj->InvalidateObjPosForConsiderWrapInfluence(); else pAnchoredObj->InvalidateObjPos(); diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 95321684de87..1bc8d05a8167 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -1700,12 +1700,12 @@ void SwRootFrame::AssertPageFlys( SwPageFrame *pPage ) // It can move by itself. Just send a modify to its anchor attribute. #if OSL_DEBUG_LEVEL > 1 const size_t nCnt = pPage->GetSortedObjs()->size(); - rFormat.NotifyClients( nullptr, &rAnch ); + rFormat.CallSwClientNotify(sw::LegacyModifyHint(nullptr, &rAnch)); OSL_ENSURE( !pPage->GetSortedObjs() || nCnt != pPage->GetSortedObjs()->size(), "Object couldn't be reattached!" ); #else - rFormat.NotifyClients( nullptr, &rAnch ); + rFormat.CallSwClientNotify(sw::LegacyModifyHint(nullptr, &rAnch)); #endif // Do not increment index, in this case continue; diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx index 2f7c9e0047bd..3fd05a3d70ae 100644 --- a/sw/source/core/layout/pagedesc.cxx +++ b/sw/source/core/layout/pagedesc.cxx @@ -269,7 +269,7 @@ void SwPageDesc::SwClientNotify(const SwModify& rModify, const SfxHint& rHint) : pLegacyHint->m_pNew ? pLegacyHint->m_pNew->Which() : 0; - NotifyClients(pLegacyHint->m_pOld, pLegacyHint->m_pNew); + CallSwClientNotify(rHint); if((RES_ATTRSET_CHG == nWhich) || (RES_FMT_CHG == nWhich) || isCHRATR(nWhich) diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx index f201578a84e0..466b7d6acdd9 100644 --- a/sw/source/core/tox/tox.cxx +++ b/sw/source/core/tox/tox.cxx @@ -156,7 +156,7 @@ void SwTOXMark::Notify(const SfxHint& rHint) { if (auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint)) { - NotifyClients(pLegacyHint->m_pOld, pLegacyHint->m_pNew); + CallSwClientNotify(rHint); if (pLegacyHint->m_pOld && (RES_REMOVE_UNO_OBJECT == pLegacyHint->m_pOld->Which())) SetXTOXMark(css::uno::Reference<css::text::XDocumentIndexMark>(nullptr)); } else if (auto pCollectHint = dynamic_cast<const sw::CollectTextMarksHint*>(&rHint)) diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index aa4dab94b8e5..f8f326fc8f8f 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -294,7 +294,7 @@ void SwFormatField::UpdateTextNode(const SfxPoolItem* pOld, const SfxPoolItem* p { // invalidate cached UNO object m_wXTextField = nullptr; // ??? why does this Modify method not already do this? - NotifyClients(pOld, pNew); + CallSwClientNotify(sw::LegacyModifyHint(pOld, pNew)); return; } diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx index 5ec1f6f93a01..02188cf011de 100644 --- a/sw/source/core/txtnode/atrftn.cxx +++ b/sw/source/core/txtnode/atrftn.cxx @@ -165,7 +165,7 @@ void SwFormatFootnote::InvalidateFootnote() { SwPtrMsgPoolItem const item(RES_REMOVE_UNO_OBJECT, &static_cast<sw::BroadcastingModify&>(*this)); // cast to base class (void*) - NotifyClients(&item, &item); + CallSwClientNotify(sw::LegacyModifyHint(&item, &item)); } void SwFormatFootnote::SetEndNote( bool b ) diff --git a/sw/source/core/txtnode/atrref.cxx b/sw/source/core/txtnode/atrref.cxx index fdea6ce5dad7..8b11c4e525c7 100644 --- a/sw/source/core/txtnode/atrref.cxx +++ b/sw/source/core/txtnode/atrref.cxx @@ -68,7 +68,7 @@ void SwFormatRefMark::InvalidateRefMark() { SwPtrMsgPoolItem const item(RES_REMOVE_UNO_OBJECT, &static_cast<sw::BroadcastingModify&>(*this)); // cast to base class (void*) - NotifyClients(&item, &item); + CallSwClientNotify(sw::LegacyModifyHint(&item, &item)); } // attribute for content references in the text diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 10c2eb393fdd..99331779c4c5 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -397,7 +397,7 @@ void MoveMergedFlysAndFootnotes(std::vector<SwTextFrame*> const& rFrames, if (rFirstNode.GetIndex() < rAnchor.GetContentAnchor()->nNode.GetIndex()) { // move it to the new frame of "this" - rFormat.NotifyClients(&rAnchor, &rAnchor); + rFormat.CallSwClientNotify(sw::LegacyModifyHint(&rAnchor, &rAnchor)); // note pObjs will be deleted if it becomes empty assert(!pFrame->GetDrawObjs() || !pObjs->Contains(*pObj)); } @@ -2279,7 +2279,7 @@ OUString SwTextNode::InsertText( const OUString & rStr, const SwIndex & rIdx, if ( HasWriterListeners() ) { // send this before messing with hints, which will send RES_UPDATE_ATTR SwInsText aHint( aPos, nLen ); - NotifyClients( nullptr, &aHint ); + CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aHint)); } if ( HasHints() ) @@ -2709,12 +2709,12 @@ void SwTextNode::EraseText(const SwIndex &rIdx, const sal_Int32 nCount, if( 1 == nCnt ) { SwDelChr aHint( nStartIdx ); - NotifyClients( nullptr, &aHint ); + CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aHint)); } else { SwDelText aHint( nStartIdx, nCnt ); - NotifyClients( nullptr, &aHint ); + CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aHint)); } OSL_ENSURE(rIdx.GetIndex() == nStartIdx, "huh? start index has changed?"); @@ -2766,9 +2766,9 @@ void SwTextNode::GCAttr() nMax, 0); - NotifyClients( nullptr, &aHint ); + CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aHint)); SwFormatChg aNew( GetTextColl() ); - NotifyClients( nullptr, &aNew ); + CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aNew)); } } @@ -2840,7 +2840,7 @@ void SwTextNode::NumRuleChgd() // Important note: { SvxLRSpaceItem& rLR = const_cast<SvxLRSpaceItem&>(GetSwAttrSet().GetLRSpace()); - NotifyClients( &rLR, &rLR ); + CallSwClientNotify(sw::LegacyModifyHint(&rLR, &rLR)); } SetWordCountDirty( true ); @@ -3709,12 +3709,12 @@ void SwTextNode::ReplaceText( const SwIndex& rStart, const sal_Int32 nDelLen, SetIgnoreDontExpand( bOldExpFlg ); SwDelText aDelHint( nStartPos, nDelLen ); - NotifyClients( nullptr, &aDelHint ); + CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aDelHint)); if (sInserted.getLength()) { SwInsText aHint( nStartPos, sInserted.getLength() ); - NotifyClients( nullptr, &aHint ); + CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aHint)); } } diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index a5626e71f053..6052754c8b46 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1709,7 +1709,7 @@ void SwTextNode::DeleteAttribute( SwTextAttr * const pAttr ) m_pSwpHints->Delete( pAttr ); SwTextAttr::Destroy( pAttr, GetDoc().GetAttrPool() ); - NotifyClients( nullptr, &aHint ); + CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aHint)); TryDeleteSwpHints(); } @@ -1785,7 +1785,7 @@ void SwTextNode::DeleteAttributes( m_pSwpHints->DeleteAtPos( nPos ); SwTextAttr::Destroy( pTextHt, GetDoc().GetAttrPool() ); - NotifyClients( nullptr, &aHint ); + CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aHint)); } } } @@ -2586,7 +2586,7 @@ void SwTextNode::FormatToTextAttr( SwTextNode* pNd ) if( aNdSet.Count() ) { SwFormatChg aTmp1( pNd->GetFormatColl() ); - pNd->NotifyClients( &aTmp1, &aTmp1 ); + pNd->CallSwClientNotify(sw::LegacyModifyHint(&aTmp1, &aTmp1)); } } } diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index edc0ac296d00..ba25c5fccba1 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -634,9 +634,9 @@ void SwTextNode::RstTextAttr( nMax, 0); - NotifyClients( nullptr, &aHint ); + CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aHint)); SwFormatChg aNew( GetFormatColl() ); - NotifyClients( nullptr, &aNew ); + CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aNew)); } static sal_Int32 clipIndexBounds(const OUString &rStr, sal_Int32 nPos) @@ -1983,10 +1983,10 @@ void SwTextNode::ReplaceTextOnly( sal_Int32 nPos, sal_Int32 nLen, // notify the layout! SwDelText aDelHint( nPos, nTLen ); - NotifyClients( nullptr, &aDelHint ); + CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aDelHint)); SwInsText aHint( nPos, nTLen ); - NotifyClients( nullptr, &aHint ); + CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aHint)); } // the return values allows us to see if we did the heavy- diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index bf0f89ac0bbe..964471ded48c 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -2483,7 +2483,7 @@ void SAL_CALL SwXTextCursor::invalidateMarkings(::sal_Int32 nType) if (fmtColl == nullptr) return; SwFormatChg aNew( fmtColl ); - txtNode->NotifyClients( nullptr, &aNew ); + txtNode->CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aNew)); } void SAL_CALL |