sw/inc/calbck.hxx | 92 ++++++++++++------------ sw/source/core/attr/calbck.cxx | 83 +++++++++------------ sw/source/core/attr/format.cxx | 18 ++-- sw/source/core/crsr/crstrvl.cxx | 2 sw/source/core/doc/DocumentFieldsManager.cxx | 6 - sw/source/core/doc/DocumentStylePoolManager.cxx | 6 - sw/source/core/doc/doc.cxx | 2 sw/source/core/doc/docfmt.cxx | 10 +- sw/source/core/doc/doctxm.cxx | 8 +- sw/source/core/docnode/ndtbl.cxx | 10 +- sw/source/core/docnode/node.cxx | 8 +- sw/source/core/docnode/nodes.cxx | 2 sw/source/core/docnode/section.cxx | 10 +- sw/source/core/edit/edfld.cxx | 2 sw/source/core/fields/ddefld.cxx | 2 sw/source/core/fields/docufld.cxx | 2 sw/source/core/fields/expfld.cxx | 6 - sw/source/core/fields/reffld.cxx | 4 - sw/source/core/fields/tblcalc.cxx | 2 sw/source/core/frmedt/fecopy.cxx | 4 - sw/source/core/graphic/ndgrf.cxx | 2 sw/source/core/layout/atrfrm.cxx | 2 sw/source/core/layout/tabfrm.cxx | 4 - sw/source/core/para/paratr.cxx | 2 sw/source/core/table/swtable.cxx | 10 +- sw/source/core/txtnode/ndtxt.cxx | 12 +-- sw/source/core/txtnode/thints.cxx | 4 - sw/source/core/undo/untbl.cxx | 4 - sw/source/core/unocore/unochart.cxx | 2 sw/source/core/view/viewsh.cxx | 2 sw/source/filter/basflt/shellio.cxx | 2 sw/source/ui/fldui/fldref.cxx | 2 sw/source/uibase/app/docstyle.cxx | 2 sw/source/uibase/config/uinums.cxx | 2 sw/source/uibase/uno/unotxdoc.cxx | 6 - 35 files changed, 165 insertions(+), 172 deletions(-)
New commits: commit 1c52db40236ae264d41530ed1fba47f9b44e6a77 Author: Bjoern Michaelsen <[email protected]> Date: Tue Mar 24 15:27:10 2015 +0100 assert hard on misguided removal Change-Id: I2b72a76336f7c8b4af4ac06467c416f35400d90e diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx index c0bb422..d958bd6 100644 --- a/sw/source/core/attr/calbck.cxx +++ b/sw/source/core/attr/calbck.cxx @@ -184,45 +184,38 @@ void SwModify::Add( SwClient* pDepend ) SwClient* SwModify::Remove( SwClient* pDepend ) { - if ( m_bInDocDTOR ) + if(m_bInDocDTOR) return nullptr; - if( pDepend->pRegisteredIn == this ) - { - // SwClient is my listener - // remove it from my list - ::sw::WriterListener* pR = pDepend->m_pRight; - ::sw::WriterListener* pL = pDepend->m_pLeft; - if( m_pWriterListeners == pDepend ) - m_pWriterListeners = pL ? pL : pR; + assert(pDepend->pRegisteredIn == this); - if( pL ) - pL->m_pRight = pR; - if( pR ) - pR->m_pLeft = pL; + // SwClient is my listener + // remove it from my list + ::sw::WriterListener* pR = pDepend->m_pRight; + ::sw::WriterListener* pL = pDepend->m_pLeft; + if( m_pWriterListeners == pDepend ) + m_pWriterListeners = pL ? pL : pR; - // update ClientIterators - if(sw::ClientIteratorBase::our_pClientIters) + if( pL ) + pL->m_pRight = pR; + if( pR ) + pR->m_pLeft = pL; + + // update ClientIterators + if(sw::ClientIteratorBase::our_pClientIters) + { + for(auto& rIter : sw::ClientIteratorBase::our_pClientIters->GetRingContainer()) { - for(auto& rIter : sw::ClientIteratorBase::our_pClientIters->GetRingContainer()) + if( rIter.m_pCurrent == pDepend || rIter.m_pPosition == pDepend ) { - if( rIter.m_pCurrent == pDepend || rIter.m_pPosition == pDepend ) - { - // if object being removed is the current or next object in an - // iterator, advance this iterator - rIter.m_pPosition = static_cast<SwClient*>(pR); - } + // if object being removed is the current or next object in an + // iterator, advance this iterator + rIter.m_pPosition = static_cast<SwClient*>(pR); } } - pDepend->m_pLeft = nullptr; - pDepend->m_pRight = nullptr; } - else - { - OSL_FAIL( "SwModify::Remove(): could not find pDepend" ); - } - - // disconnect client from me + pDepend->m_pLeft = nullptr; + pDepend->m_pRight = nullptr; pDepend->pRegisteredIn = nullptr; return pDepend; } commit be3dc27fbfd5c27590ef136e2d37a2dcbf2f660b Author: Bjoern Michaelsen <[email protected]> Date: Tue Mar 24 15:25:52 2015 +0100 update docs Change-Id: I94ceaafd34caba48965ee58c1fcd9a88bce416f8 diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index 101baf4f..04cd54b 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -51,14 +51,11 @@ class SfxHint; SwClient objects. The SwDepend class allows to handle their notifications in the same notification callback as it forwards the Modify() calls it receives to a "master" SwClient implementation. - The SwClientIter class allows to iterate over the SwClient objects registered at an + The SwIterator class allows to iterate over the SwClient objects registered at an SwModify. For historical reasons its ability to use TypeInfo to restrict this iteration to objects of a particular type created a lot of code that misuses SwClient-SwModify - relationships that basically should be used only for Modify() callbacks. + relationships that basically should be used only for Modify/Notify callbacks. This is still subject to refactoring. - Until this gets resolved, new SwClientIter base code should be reduced to the absolute - minimum and it also should be wrapped by SwIterator templates that prevent that the - code gets polluted by pointer casts (see switerator.hxx). */ class SwModify; commit 2c47eb3df9c6fe8e77bf8f4f4a04f8e5a3224368 Author: Bjoern Michaelsen <[email protected]> Date: Tue Mar 24 14:52:44 2015 +0100 code convention: member names Conflicts: sw/inc/calbck.hxx Change-Id: I0322261240bee8795e23669306fb846da0ea706f diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index 9b03614..101baf4f 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -156,12 +156,12 @@ class SW_DLLPUBLIC SwModify: public SwClient { friend class sw::ClientIteratorBase; template<typename E, typename S> friend class SwIterator; - sw::WriterListener* pRoot; // the start of the linked list of clients - bool bModifyLocked : 1; // don't broadcast changes now + sw::WriterListener* m_pWriterListeners; // the start of the linked list of clients + bool m_bModifyLocked : 1; // don't broadcast changes now bool bLockClientList : 1; // may be set when this instance notifies its clients - bool bInDocDTOR : 1; // workaround for problems when a lot of objects are destroyed - bool bInCache : 1; - bool bInSwFntCache : 1; + bool m_bInDocDTOR : 1; // workaround for problems when a lot of objects are destroyed + bool m_bInCache : 1; + bool m_bInSwFntCache : 1; // mba: IMHO this method should be pure virtual // DO NOT USE IN NEW CODE! use CallSwClientNotify instead. @@ -170,10 +170,10 @@ class SW_DLLPUBLIC SwModify: public SwClient public: SwModify() - : SwClient(nullptr), pRoot(nullptr), bModifyLocked(false), bLockClientList(false), bInDocDTOR(false), bInCache(false), bInSwFntCache(false) + : SwClient(nullptr), m_pWriterListeners(nullptr), m_bModifyLocked(false), bLockClientList(false), m_bInDocDTOR(false), m_bInCache(false), m_bInSwFntCache(false) {} explicit SwModify( SwModify* pToRegisterIn ) - : SwClient(pToRegisterIn), pRoot(nullptr), bModifyLocked(false), bLockClientList(false), bInDocDTOR(false), bInCache(false), bInSwFntCache(false) + : SwClient(pToRegisterIn), m_pWriterListeners(nullptr), m_bModifyLocked(false), bLockClientList(false), m_bInDocDTOR(false), m_bInCache(false), m_bInSwFntCache(false) {} // broadcasting: send notifications to all clients @@ -182,7 +182,7 @@ public: // DO NOT USE IN NEW CODE! use CallSwClientNotify instead. void ModifyBroadcast( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue) { CallSwClientNotify( sw::LegacyModifyHint{ pOldValue, pNewValue } ); }; - // the same, but without setting bModifyLocked or checking for any of the flags + // the same, but without setting m_bModifyLocked or checking for any of the flags // mba: it would be interesting to know why this is necessary // also allows to limit callback to certain type (HACK) // DO NOT USE IN NEW CODE! use CallSwClientNotify instead. @@ -195,23 +195,23 @@ public: void Add(SwClient *pDepend); SwClient* Remove(SwClient *pDepend); - bool HasWriterListeners() const { return pRoot; } + bool HasWriterListeners() const { return m_pWriterListeners; } // get information about attribute virtual bool GetInfo( SfxPoolItem& ) const SAL_OVERRIDE; - void LockModify() { bModifyLocked = true; } - void UnlockModify() { bModifyLocked = false; } - void SetInCache( bool bNew ) { bInCache = bNew; } - void SetInSwFntCache( bool bNew ) { bInSwFntCache = bNew; } - void SetInDocDTOR() { bInDocDTOR = true; } - bool IsModifyLocked() const { return bModifyLocked; } - bool IsInDocDTOR() const { return bInDocDTOR; } - bool IsInCache() const { return bInCache; } - bool IsInSwFntCache() const { return bInSwFntCache; } + void LockModify() { m_bModifyLocked = true; } + void UnlockModify() { m_bModifyLocked = false; } + void SetInCache( bool bNew ) { m_bInCache = bNew; } + void SetInSwFntCache( bool bNew ) { m_bInSwFntCache = bNew; } + void SetInDocDTOR() { m_bInDocDTOR = true; } + bool IsModifyLocked() const { return m_bModifyLocked; } + bool IsInDocDTOR() const { return m_bInDocDTOR; } + bool IsInCache() const { return m_bInCache; } + bool IsInSwFntCache() const { return m_bInSwFntCache; } void CheckCaching( const sal_uInt16 nWhich ); - bool IsLastDepend() { return pRoot && pRoot->IsLast(); } + bool IsLastDepend() { return m_pWriterListeners && m_pWriterListeners->IsLast(); } }; // SwDepend @@ -265,13 +265,13 @@ namespace sw { MoveTo(our_pClientIters); our_pClientIters = this; - m_pCurrent = m_pPosition = const_cast<WriterListener*>(m_rRoot.pRoot); + m_pCurrent = m_pPosition = const_cast<WriterListener*>(m_rRoot.m_pWriterListeners); } WriterListener* GetLeftOfPos() { return m_pPosition->m_pLeft; } WriterListener* GetRightOfPos() { return m_pPosition->m_pRight; } WriterListener* GoStart() { - if((m_pPosition = const_cast<WriterListener*>(m_rRoot.pRoot))) + if((m_pPosition = const_cast<WriterListener*>(m_rRoot.m_pWriterListeners))) while( m_pPosition->m_pLeft ) m_pPosition = m_pPosition->m_pLeft; return m_pCurrent = m_pPosition; @@ -309,7 +309,7 @@ public: TElementType* Last() { if(!m_pPosition) - m_pPosition = const_cast<sw::WriterListener*>(m_rRoot.pRoot); + m_pPosition = const_cast<sw::WriterListener*>(m_rRoot.m_pWriterListeners); if(!m_pPosition) return static_cast<TElementType*>(Sync()); while(GetRightOfPos()) @@ -346,7 +346,7 @@ public: SwClient* Last() { if(!m_pPosition) - m_pPosition = const_cast<sw::WriterListener*>(m_rRoot.pRoot); + m_pPosition = const_cast<sw::WriterListener*>(m_rRoot.m_pWriterListeners); if(!m_pPosition) return m_pCurrent = nullptr; while(GetRightOfPos()) diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx index bd82655..c0bb422 100644 --- a/sw/source/core/attr/calbck.cxx +++ b/sw/source/core/attr/calbck.cxx @@ -66,7 +66,7 @@ SwModify::~SwModify() if ( IsInSwFntCache() ) pSwFontCache->Delete( this ); - if( pRoot ) + if( m_pWriterListeners ) { // there are depending objects if( IsInDocDTOR() ) @@ -86,8 +86,8 @@ SwModify::~SwModify() // remove all clients that have not done themselves // mba: possibly a hotfix for forgotten base class calls?! - while( pRoot ) - static_cast<SwClient*>(pRoot)->CheckRegistration( &aDyObject, &aDyObject ); + while( m_pWriterListeners ) + static_cast<SwClient*>(m_pWriterListeners)->CheckRegistration( &aDyObject, &aDyObject ); } } } @@ -101,7 +101,7 @@ void SwModify::NotifyClients( const SfxPoolItem* pOldValue, const SfxPoolItem* p CheckCaching( nWhich ); } - if ( !pRoot || IsModifyLocked() ) + if ( !m_pWriterListeners || IsModifyLocked() ) return; LockModify(); @@ -132,7 +132,7 @@ void SwModify::NotifyClients( const SfxPoolItem* pOldValue, const SfxPoolItem* p bool SwModify::GetInfo( SfxPoolItem& rInfo ) const { - if(!pRoot) + if(!m_pWriterListeners) return true; SwIterator<SwClient,SwModify> aIter(*this); for(SwClient* pClient = aIter.First(); pClient; pClient = aIter.Next()) @@ -152,7 +152,7 @@ void SwModify::Add( SwClient* pDepend ) { for(auto& rIter : sw::ClientIteratorBase::our_pClientIters->GetRingContainer()) { - OSL_ENSURE( &rIter.m_rRoot != pRoot, "Client added to active ClientIter" ); + OSL_ENSURE( &rIter.m_rRoot != m_pWriterListeners, "Client added to active ClientIter" ); } } #endif @@ -160,19 +160,19 @@ void SwModify::Add( SwClient* pDepend ) if( pDepend->pRegisteredIn != nullptr ) pDepend->pRegisteredIn->Remove( pDepend ); - if( !pRoot ) + if( !m_pWriterListeners ) { // first client added - pRoot = pDepend; - pRoot->m_pLeft = nullptr; - pRoot->m_pRight = nullptr; + m_pWriterListeners = pDepend; + m_pWriterListeners->m_pLeft = nullptr; + m_pWriterListeners->m_pRight = nullptr; } else { // append client - pDepend->m_pRight = pRoot->m_pRight; - pRoot->m_pRight = pDepend; - pDepend->m_pLeft = pRoot; + pDepend->m_pRight = m_pWriterListeners->m_pRight; + m_pWriterListeners->m_pRight = pDepend; + pDepend->m_pLeft = m_pWriterListeners; if( pDepend->m_pRight ) pDepend->m_pRight->m_pLeft = pDepend; } @@ -184,7 +184,7 @@ void SwModify::Add( SwClient* pDepend ) SwClient* SwModify::Remove( SwClient* pDepend ) { - if ( bInDocDTOR ) + if ( m_bInDocDTOR ) return nullptr; if( pDepend->pRegisteredIn == this ) @@ -193,8 +193,8 @@ SwClient* SwModify::Remove( SwClient* pDepend ) // remove it from my list ::sw::WriterListener* pR = pDepend->m_pRight; ::sw::WriterListener* pL = pDepend->m_pLeft; - if( pRoot == pDepend ) - pRoot = pL ? pL : pR; + if( m_pWriterListeners == pDepend ) + m_pWriterListeners = pL ? pL : pR; if( pL ) pL->m_pRight = pR; commit b8d5647180db0f6c7e23d7ca9e14ab95fa4aa557 Author: Bjoern Michaelsen <[email protected]> Date: Tue Mar 24 13:02:36 2015 +0100 rename GetDepends->HasWriterListener and make it a bool Change-Id: Idc090c9e105f24ef91ef123db03db6d6e67ed1d4 diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index f97774d..9b03614 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -154,6 +154,8 @@ public: // class has a doubly linked list for dependencies class SW_DLLPUBLIC SwModify: public SwClient { + friend class sw::ClientIteratorBase; + template<typename E, typename S> friend class SwIterator; sw::WriterListener* pRoot; // the start of the linked list of clients bool bModifyLocked : 1; // don't broadcast changes now bool bLockClientList : 1; // may be set when this instance notifies its clients @@ -193,7 +195,7 @@ public: void Add(SwClient *pDepend); SwClient* Remove(SwClient *pDepend); - const sw::WriterListener* GetDepends() const { return pRoot; } + bool HasWriterListeners() const { return pRoot; } // get information about attribute virtual bool GetInfo( SfxPoolItem& ) const SAL_OVERRIDE; @@ -263,13 +265,13 @@ namespace sw { MoveTo(our_pClientIters); our_pClientIters = this; - m_pCurrent = m_pPosition = const_cast<WriterListener*>(m_rRoot.GetDepends()); + m_pCurrent = m_pPosition = const_cast<WriterListener*>(m_rRoot.pRoot); } WriterListener* GetLeftOfPos() { return m_pPosition->m_pLeft; } WriterListener* GetRightOfPos() { return m_pPosition->m_pRight; } WriterListener* GoStart() { - if((m_pPosition = const_cast<WriterListener*>(m_rRoot.GetDepends()))) + if((m_pPosition = const_cast<WriterListener*>(m_rRoot.pRoot))) while( m_pPosition->m_pLeft ) m_pPosition = m_pPosition->m_pLeft; return m_pCurrent = m_pPosition; @@ -307,7 +309,7 @@ public: TElementType* Last() { if(!m_pPosition) - m_pPosition = const_cast<sw::WriterListener*>(m_rRoot.GetDepends()); + m_pPosition = const_cast<sw::WriterListener*>(m_rRoot.pRoot); if(!m_pPosition) return static_cast<TElementType*>(Sync()); while(GetRightOfPos()) @@ -344,7 +346,7 @@ public: SwClient* Last() { if(!m_pPosition) - m_pPosition = const_cast<sw::WriterListener*>(m_rRoot.GetDepends()); + m_pPosition = const_cast<sw::WriterListener*>(m_rRoot.pRoot); if(!m_pPosition) return m_pCurrent = nullptr; while(GetRightOfPos()) diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx index ee78693..bd82655 100644 --- a/sw/source/core/attr/calbck.cxx +++ b/sw/source/core/attr/calbck.cxx @@ -28,8 +28,8 @@ TYPEINIT0( SwClient ); SwClient::~SwClient() { - OSL_ENSURE( !pRegisteredIn || pRegisteredIn->GetDepends(), "SwModify still known, but Client already disconnected!" ); - if( pRegisteredIn && pRegisteredIn->GetDepends() ) + OSL_ENSURE( !pRegisteredIn || pRegisteredIn->HasWriterListeners(), "SwModify still known, but Client already disconnected!" ); + if( pRegisteredIn && pRegisteredIn->HasWriterListeners() ) pRegisteredIn->Remove( this ); } diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index 0cca34c..a71c982 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -223,7 +223,7 @@ SwFmt::~SwFmt() { // This happens at a ObjectDying message. Thus put all dependent // ones on DerivedFrom. - if( GetDepends() ) + if( HasWriterListeners() ) { OSL_ENSURE( DerivedFrom(), "SwFmt::~SwFmt: Def dependents!" ); @@ -532,7 +532,7 @@ bool SwFmt::SetFmtAttr( const SfxPoolItem& rAttr ) // but call Modify always for FrmFmts const sal_uInt16 nFmtWhich = Which(); if( IsModifyLocked() || - ( !GetDepends() && + ( !HasWriterListeners() && (RES_GRFFMTCOLL == nFmtWhich || RES_TXTFMTCOLL == nFmtWhich ) ) ) { @@ -637,7 +637,7 @@ bool SwFmt::SetFmtAttr( const SfxItemSet& rSet ) // but call Modify always for FrmFmts const sal_uInt16 nFmtWhich = Which(); if ( IsModifyLocked() || - ( !GetDepends() && + ( !HasWriterListeners() && ( RES_GRFFMTCOLL == nFmtWhich || RES_TXTFMTCOLL == nFmtWhich ) ) ) { diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index bc86353..239faa8 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -651,7 +651,7 @@ bool SwCrsrShell::MoveFldType( if ( pFldType ) { - if( RES_INPUTFLD != pFldType->Which() && !pFldType->GetDepends() ) + if( RES_INPUTFLD != pFldType->Which() && !pFldType->HasWriterListeners() ) { return false; } diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index 8cb4308..0dbe47a 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -310,7 +310,7 @@ void DocumentFieldsManager::RemoveFldType(sal_uInt16 nFld) mpUpdtFlds->RemoveFldType( *pTmp ); // no break; case RES_DDEFLD: - if( pTmp->GetDepends() && !m_rDoc.IsUsed( *pTmp ) ) + if( pTmp->HasWriterListeners() && !m_rDoc.IsUsed( *pTmp ) ) { if( RES_SETEXPFLD == nWhich ) static_cast<SwSetExpFieldType*>(pTmp)->SetDeleted( true ); @@ -325,7 +325,7 @@ void DocumentFieldsManager::RemoveFldType(sal_uInt16 nFld) if( nWhich ) { - OSL_ENSURE( !pTmp->GetDepends(), "Dependent fields present!" ); + OSL_ENSURE( !pTmp->HasWriterListeners(), "Dependent fields present!" ); // delete field type delete pTmp; } @@ -1567,7 +1567,7 @@ bool DocumentFieldsManager::containsUpdatableFields() void DocumentFieldsManager::GCFieldTypes() { for( sal_uInt16 n = mpFldTypes->size(); n > INIT_FLDTYPES; ) - if( !(*mpFldTypes)[ --n ]->GetDepends() ) + if( !(*mpFldTypes)[ --n ]->HasWriterListeners() ) RemoveFldType( n ); } diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx index f9cb786..8d9c8e7 100644 --- a/sw/source/core/doc/DocumentStylePoolManager.cxx +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -2104,7 +2104,7 @@ bool DocumentStylePoolManager::IsPoolTxtCollUsed( sal_uInt16 nId ) const bFnd = true; } - if( !bFnd || !pNewColl->GetDepends() ) + if( !bFnd || !pNewColl->HasWriterListeners() ) return false; SwAutoFmtGetDocNode aGetHt( &m_rDoc.GetNodes() ); @@ -2148,7 +2148,7 @@ bool DocumentStylePoolManager::IsPoolFmtUsed( sal_uInt16 nId ) const } // Not found or no dependencies? - if( bFnd && pNewFmt->GetDepends() ) + if( bFnd && pNewFmt->HasWriterListeners() ) { // Check if we have dependent ContentNodes in the Nodes array // (also indirect ones for derived Formats) @@ -2176,7 +2176,7 @@ bool DocumentStylePoolManager::IsPoolPageDescUsed( sal_uInt16 nId ) const } // Not found or no dependencies? - if( !bFnd || !pNewPgDsc->GetDepends() ) // ?????? + if( !bFnd || !pNewPgDsc->HasWriterListeners() ) // ?????? return false; // Check if we have dependent ContentNodes in the Nodes array diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index e6f5d92..bff85d0 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -553,7 +553,7 @@ bool sw_GetPostIts( SwFieldType* pFldType = pIDFA->GetSysFldType( RES_POSTITFLD ); OSL_ENSURE( pFldType, "no PostItType ? "); - if( pFldType->GetDepends() ) + if( pFldType->HasWriterListeners() ) { // Found modify object; insert all fields into the array SwIterator<SwFmtFld,SwFieldType> aIter( *pFldType ); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index fd633be..0abbacb 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -608,7 +608,7 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) pItem = aIter.NextItem(); } - if( aNew.Count() && aCallMod.GetDepends() ) + if( aNew.Count() && aCallMod.HasWriterListeners() ) { if (GetIDocumentUndoRedo().DoesUndo()) { @@ -645,7 +645,7 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) } } - if( aNew.Count() && aCallMod.GetDepends() ) + if( aNew.Count() && aCallMod.HasWriterListeners() ) { SwAttrSetChg aChgOld( aOld, aOld ); SwAttrSetChg aChgNew( aNew, aNew ); diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 9654b26..150c9f2 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -760,7 +760,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr, const bool _bNewTOX ) { const SwSectionNode* pSectNd; - if( !SwTOXBase::GetRegisteredIn()->GetDepends() || + if( !SwTOXBase::GetRegisteredIn()->HasWriterListeners() || !GetFmt() || 0 == (pSectNd = GetFmt()->GetSectionNode() ) || !pSectNd->GetNodes().IsDocNodes() || IsHiddenFlag() ) @@ -1141,7 +1141,7 @@ void SwTOXBaseSection::UpdateMarks( const SwTOXInternational& rIntl, const SwTxtNode* pOwnChapterNode ) { const SwTOXType* pType = static_cast<SwTOXType*>( SwTOXBase::GetRegisteredIn() ); - if( !pType->GetDepends() ) + if( !pType->HasWriterListeners() ) return; SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc(); @@ -1163,7 +1163,7 @@ void SwTOXBaseSection::UpdateMarks( const SwTOXInternational& rIntl, // If selected use marks from the same chapter only if( pTOXSrc->GetNodes().IsDocNodes() && - pTOXSrc->GetTxt().getLength() && pTOXSrc->GetDepends() && + pTOXSrc->GetTxt().getLength() && pTOXSrc->HasWriterListeners() && pTOXSrc->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) && (!IsFromChapter() || ::lcl_FindChapterNode( *pTOXSrc, 0 ) == pOwnChapterNode ) && !pTOXSrc->HasHiddenParaField() && @@ -1220,7 +1220,7 @@ void SwTOXBaseSection::UpdateOutline( const SwTxtNode* pOwnChapterNode ) { ::SetProgressState( 0, pDoc->GetDocShell() ); SwTxtNode* pTxtNd = rOutlNds[ n ]->GetTxtNode(); - if( pTxtNd && pTxtNd->Len() && pTxtNd->GetDepends() && + if( pTxtNd && pTxtNd->Len() && pTxtNd->HasWriterListeners() && sal_uInt16( pTxtNd->GetAttrOutlineLevel()) <= GetLevel() && pTxtNd->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) && !pTxtNd->HasHiddenParaField() && diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index d4d650a..972001f 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -523,7 +523,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, nWidth = (*pColArr)[ i + 1 ] - (*pColArr)[ i ]; if( pBoxF->GetFrmSize().GetWidth() != nWidth ) { - if( pBoxF->GetDepends() ) // Create new Format + if( pBoxF->HasWriterListeners() ) // Create new Format { SwTableBoxFmt *pNewFmt = MakeTableBoxFmt(); *pNewFmt = *pBoxF; @@ -732,7 +732,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, rNdTbl.SetRowsToRepeat(nRowsToRepeat); bool bUseBoxFmt = false; - if( !pBoxFmt->GetDepends() ) + if( !pBoxFmt->HasWriterListeners() ) { // The Box's Formats already have the right size, we must only set // the right Border/AutoFmt. @@ -976,7 +976,7 @@ lcl_SetTableBoxWidths(SwTable & rTable, size_t const nMaxBoxes, } // propagate size upwards from format, so the table gets the right size - SAL_WARN_IF(rBoxFmt.GetDepends(), "sw.core", + SAL_WARN_IF(rBoxFmt.HasWriterListeners(), "sw.core", "who is still registered in the format?"); rBoxFmt.SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nLastPos )); } @@ -1214,7 +1214,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > SwTable& rNdTbl = pTblNd->GetTable(); - if( !pBoxFmt->GetDepends() ) + if( !pBoxFmt->HasWriterListeners() ) { // The Box's Formats already have the right size, we must only set // the right Border/AutoFmt. @@ -2330,7 +2330,7 @@ SwTabFrm *SwTableNode::MakeFrm( SwFrm* pSib ) */ void SwTableNode::MakeFrms(const SwNodeIndex & rIdx ) { - if( !GetTable().GetFrmFmt()->GetDepends()) // Do we actually have Frame? + if( !GetTable().GetFrmFmt()->HasWriterListeners()) // Do we actually have Frame? return; SwFrm *pFrm; diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 578e268..25e6a9f 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -1277,7 +1277,7 @@ void SwCntntNode::MakeFrms( SwCntntNode& rNode ) OSL_ENSURE( &rNode != this, "No ContentNode or CopyNode and new Node identical." ); - if( !GetDepends() || &rNode == this ) // Do we actually have Frames? + if( !HasWriterListeners() || &rNode == this ) // Do we actually have Frames? return; SwFrm *pFrm; @@ -1318,7 +1318,7 @@ void SwCntntNode::MakeFrms( SwCntntNode& rNode ) */ void SwCntntNode::DelFrms( bool bIsDisposeAccTable ) { - if( !GetDepends() ) + if( !HasWriterListeners() ) return; SwIterator<SwCntntFrm,SwCntntNode> aIter( *this ); @@ -1437,7 +1437,7 @@ bool SwCntntNode::SetAttr(const SfxPoolItem& rAttr ) bool bRet = false; // If Modify is locked, we do not send any Modifys if( IsModifyLocked() || - ( !GetDepends() && RES_PARATR_NUMRULE != rAttr.Which() )) + ( !HasWriterListeners() && RES_PARATR_NUMRULE != rAttr.Which() )) { bRet = 0 != AttrSetHandleHelper::Put( mpAttrSet, *this, rAttr ); } @@ -1511,7 +1511,7 @@ bool SwCntntNode::SetAttr( const SfxItemSet& rSet ) bool bRet = false; // If Modify is locked, do not send any Modifys if ( IsModifyLocked() || - ( !GetDepends() && + ( !HasWriterListeners() && SfxItemState::SET != rSet.GetItemState( RES_PARATR_NUMRULE, false ) ) ) { // Some special treatment for Attributes diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index de051b9..587e748 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -365,7 +365,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz, OSL_ENSURE( false, "here, something wrong happened" ); aFrmNdIdx = rNds.GetEndOfContent(); pFrmNd = rNds.GoPrevSection( &aFrmNdIdx, true, false ); - if( pFrmNd && !static_cast<SwCntntNode*>(pFrmNd)->GetDepends() ) + if( pFrmNd && !static_cast<SwCntntNode*>(pFrmNd)->HasWriterListeners() ) pFrmNd = 0; OSL_ENSURE( pFrmNd, "ChgNode() - no FrameNode found" ); } diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index f9d708c..0ba5f72 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -257,7 +257,7 @@ SwSection::~SwSection() // If the Section is the last Client in the Format we can delete it SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, pFmt ); pFmt->ModifyNotification( &aMsgHint, &aMsgHint ); - if( !pFmt->GetDepends() ) + if( !pFmt->HasWriterListeners() ) { // Do not add to the Undo. This should've happened earlier. ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); @@ -744,7 +744,7 @@ void SwSectionFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) switch( nWhich ) { case RES_ATTRSET_CHG: - if (GetDepends() && pOld && pNew) + if (HasWriterListeners() && pOld && pNew) { SfxItemSet* pNewSet = const_cast<SwAttrSetChg*>(static_cast<const SwAttrSetChg*>(pNew))->GetChgSet(); SfxItemSet* pOldSet = const_cast<SwAttrSetChg*>(static_cast<const SwAttrSetChg*>(pOld))->GetChgSet(); @@ -804,7 +804,7 @@ void SwSectionFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) case RES_PROTECT: case RES_EDIT_IN_READONLY: // edit in readonly sections // Pass through these Messages until the End of the tree! - if( GetDepends() ) + if( HasWriterListeners() ) { ModifyBroadcast( pOld, pNew ); } @@ -902,7 +902,7 @@ sal_uInt16 SwSectionFmt::GetChildSections( SwSections& rArr, { rArr.clear(); - if( GetDepends() ) + if( HasWriterListeners() ) { SwIterator<SwSectionFmt,SwSectionFmt> aIter(*this); const SwNodeIndex* pIdx; @@ -942,7 +942,7 @@ bool SwSectionFmt::IsInNodesArr() const // Parent was changed void SwSectionFmt::UpdateParent() { - if( !GetDepends() ) + if( !HasWriterListeners() ) return; SwSection* pSection = 0; diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx index 0d973e1..3cb493a 100644 --- a/sw/source/core/edit/edfld.cxx +++ b/sw/source/core/edit/edfld.cxx @@ -171,7 +171,7 @@ void SwEditShell::RemoveFldType(sal_uInt16 nResId, const OUString& rStr) void SwEditShell::FieldToText( SwFieldType* pType ) { - if( !pType->GetDepends() ) + if( !pType->HasWriterListeners() ) return; SET_CURR_SHELL( this ); diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx index 9a2e0b3..dd89ca6 100644 --- a/sw/source/core/fields/ddefld.cxx +++ b/sw/source/core/fields/ddefld.cxx @@ -96,7 +96,7 @@ public: OSL_ENSURE( rFldType.GetDoc(), "no pDoc" ); // no dependencies left? - if( rFldType.GetDepends() && !rFldType.IsModifyLocked() && !ChkNoDataFlag() ) + if( rFldType.HasWriterListeners() && !rFldType.IsModifyLocked() && !ChkNoDataFlag() ) { SwViewShell* pSh = rFldType.GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); SwEditShell* pESh = rFldType.GetDoc()->GetEditShell(); diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 7da9b37..2da0ac3 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -2057,7 +2057,7 @@ SwFieldType* SwRefPageGetFieldType::Copy() const void SwRefPageGetFieldType::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) { // update all GetReference fields - if( !pNew && !pOld && GetDepends() ) + if( !pNew && !pOld && HasWriterListeners() ) { // first collect all SetPageRefFields _SetGetExpFlds aTmpLst; diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index 80b9ace..c799c81 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -525,7 +525,7 @@ void SwSetExpFieldType::SetSeqFormat(sal_uLong nFmt) sal_uLong SwSetExpFieldType::GetSeqFormat() { - if( !GetDepends() ) + if( !HasWriterListeners() ) return SVX_NUM_ARABIC; const SwField *pFld = SwIterator<SwFmtFld,SwSetExpFieldType>(*this).First()->GetField(); @@ -534,7 +534,7 @@ sal_uLong SwSetExpFieldType::GetSeqFormat() sal_uInt16 SwSetExpFieldType::SetSeqRefNo( SwSetExpField& rFld ) { - if( !GetDepends() || !(nsSwGetSetExpType::GSE_SEQ & nType) ) + if( !HasWriterListeners() || !(nsSwGetSetExpType::GSE_SEQ & nType) ) return USHRT_MAX; std::vector<sal_uInt16> aArr; diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 18bcf2a..b4c40f1 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -837,7 +837,7 @@ SwTxtNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const OUString& rRefMark, case REF_SEQUENCEFLD: { SwFieldType* pFldType = pDoc->getIDocumentFieldsAccess().GetFldType( RES_SETEXPFLD, rRefMark, false ); - if( pFldType && pFldType->GetDepends() && + if( pFldType && pFldType->HasWriterListeners() && nsSwGetSetExpType::GSE_SEQ & static_cast<SwSetExpFieldType*>(pFldType)->GetType() ) { SwIterator<SwFmtFld,SwFieldType> aIter( *pFldType ); @@ -1092,7 +1092,7 @@ void SwGetRefFieldType::MergeWithOtherDoc( SwDoc& rDestDoc ) { // when copying _to_ clipboard, expectation is that no fields exist // so no re-mapping is required to avoid collisions - assert(!rDestDoc.getIDocumentFieldsAccess().GetSysFldType(RES_GETREFFLD)->GetDepends()); + assert(!rDestDoc.getIDocumentFieldsAccess().GetSysFldType(RES_GETREFFLD)->HasWriterListeners()); return; // don't modify the fields in the source doc } diff --git a/sw/source/core/fields/tblcalc.cxx b/sw/source/core/fields/tblcalc.cxx index 738152b..07e5fa3 100644 --- a/sw/source/core/fields/tblcalc.cxx +++ b/sw/source/core/fields/tblcalc.cxx @@ -78,7 +78,7 @@ OUString SwTblField::GetFieldName() const /// search TextNode containing this field const SwNode* SwTblField::GetNodeOfFormula() const { - if( !GetTyp()->GetDepends() ) + if( !GetTyp()->HasWriterListeners() ) return 0; SwIterator<SwFmtFld,SwFieldType> aIter( *GetTyp() ); diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index 38513d4..bf37b08 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -643,7 +643,7 @@ bool SwFEShell::Copy( SwFEShell* pDestShell, const Point& rSttPt, mpDoc->SetCopyIsMove( bCopyIsMove ); // have new table formules been inserted? - if( pTblFldTyp->GetDepends() ) + if( pTblFldTyp->HasWriterListeners() ) { // finish old actions: the table frames are created and // a selection can be made @@ -1104,7 +1104,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames ) GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_INSGLOSSARY, NULL ); // have new table formulas been inserted? - if( pTblFldTyp->GetDepends() ) + if( pTblFldTyp->HasWriterListeners() ) { // finish old action: table-frames have been created // a selection can be made now diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index 1693add..3394767 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -317,7 +317,7 @@ SwGrfNode::~SwGrfNode() // inside one document has to be implemented. } //#39289# delete frames already here since the Frms' dtor needs the graphic for its StopAnimation - if( GetDepends() ) + if( HasWriterListeners() ) DelFrms(); } diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index c9aa0520..7efebc1 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -145,7 +145,7 @@ void DelHFFormat( SwClient *pToRemove, SwFrmFmt *pFmt ) while ( aIdx < nEnd ) { if ( pNode->IsCntntNode() && - static_cast<SwCntntNode*>(pNode)->GetDepends() ) + static_cast<SwCntntNode*>(pNode)->HasWriterListeners() ) { SwCrsrShell *pShell = SwIterator<SwCrsrShell,SwCntntNode>( *static_cast<SwCntntNode*>(pNode) ).First(); if( pShell ) diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index e5b89cb..a319c55 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -3523,7 +3523,7 @@ SwRowFrm::~SwRowFrm() if( pMod ) { pMod->Remove( this ); // remove, - if( !pMod->GetDepends() ) + if( !pMod->HasWriterListeners() ) delete pMod; // and delete } } @@ -4422,7 +4422,7 @@ SwCellFrm::~SwCellFrm() } pMod->Remove( this ); // remove, - if( !pMod->GetDepends() ) + if( !pMod->HasWriterListeners() ) delete pMod; // and delete } } diff --git a/sw/source/core/para/paratr.cxx b/sw/source/core/para/paratr.cxx index 9459002..9fa8446 100644 --- a/sw/source/core/para/paratr.cxx +++ b/sw/source/core/para/paratr.cxx @@ -92,7 +92,7 @@ void SwFmtDrop::Modify( const SfxPoolItem*, const SfxPoolItem * ) { if( !pDefinedIn->ISA( SwFmt )) pDefinedIn->ModifyNotification( this, this ); - else if( pDefinedIn->GetDepends() && + else if( pDefinedIn->HasWriterListeners() && !pDefinedIn->IsModifyLocked() ) { // Notify those who are dependent on the format on our own. diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index 100745d..77e0035 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -291,7 +291,7 @@ SwTable::~SwTable() SwTableFmt* pFmt = static_cast<SwTableFmt*>(GetFrmFmt()); pFmt->Remove( this ); // remove - if( !pFmt->GetDepends() ) + if( !pFmt->HasWriterListeners() ) pFmt->GetDoc()->DelTblFrmFmt( pFmt ); // and delete // Delete the pointers from the SortArray of the boxes. The objects @@ -1523,7 +1523,7 @@ SwTableLine::~SwTableLine() // the TabelleLine can be deleted if it's the last client of the FrameFormat SwModify* pMod = GetFrmFmt(); pMod->Remove( this ); // remove, - if( !pMod->GetDepends() ) + if( !pMod->HasWriterListeners() ) delete pMod; // and delete } @@ -1600,7 +1600,7 @@ void SwTableLine::ChgFrmFmt( SwTableLineFmt *pNewFmt ) // Now, re-register self. pNewFmt->Add( this ); - if ( !pOld->GetDepends() ) + if ( !pOld->HasWriterListeners() ) delete pOld; } @@ -1717,7 +1717,7 @@ SwTableBox::~SwTableBox() // the TabelleBox can be deleted if it's the last client of the FrameFormat SwModify* pMod = GetFrmFmt(); pMod->Remove( this ); // remove, - if( !pMod->GetDepends() ) + if( !pMod->HasWriterListeners() ) delete pMod; // and delete delete pImpl; @@ -1817,7 +1817,7 @@ void SwTableBox::ChgFrmFmt( SwTableBoxFmt* pNewFmt ) // Now, re-register self. pNewFmt->Add( this ); - if( !pOld->GetDepends() ) + if( !pOld->HasWriterListeners() ) delete pOld; } diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 17b3992..7af5ef1 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -266,7 +266,7 @@ SwTxtNode::~SwTxtNode() InitSwParaStatistics( false ); - if (GetDepends()) + if (HasWriterListeners()) { DelFrms_TxtNodePart(); } @@ -400,7 +400,7 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos ) ResetAttr( RES_PARATR_LIST_LEVEL ); } - if ( GetDepends() && !m_Text.isEmpty() && (nTxtLen / 2) < nSplitPos ) + if ( HasWriterListeners() && !m_Text.isEmpty() && (nTxtLen / 2) < nSplitPos ) { // optimization for SplitNode: If a split is at the end of a node then // move the frames from the current to the new one and create new ones @@ -578,7 +578,7 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos ) SetSmartTags( pList2, false ); } - if ( GetDepends() ) + if ( HasWriterListeners() ) { MakeFrms( *pNode ); // neue Frames anlegen. } @@ -591,7 +591,7 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos ) //zu weiteren Folgefehlern, die mit Laufzeitkosten geloest werden //muesten. #56977# #55001# #56135# const SfxPoolItem *pItem; - if( GetDepends() && SfxItemState::SET == pNode->GetSwAttrSet(). + if( HasWriterListeners() && SfxItemState::SET == pNode->GetSwAttrSet(). GetItemState( RES_PAGEDESC, true, &pItem ) ) { pNode->ModifyNotification( (SfxPoolItem*)pItem, (SfxPoolItem*)pItem ); @@ -2009,7 +2009,7 @@ OUString SwTxtNode::InsertText( const OUString & rStr, const SwIndex & rIdx, TryDeleteSwpHints(); } - if ( GetDepends() ) + if ( HasWriterListeners() ) { SwInsTxt aHint( aPos, nLen ); NotifyClients( 0, &aHint ); @@ -2779,7 +2779,7 @@ SwCntntNode* SwTxtNode::AppendNode( const SwPosition & rPos ) AddToList(); } - if( GetDepends() ) + if( HasWriterListeners() ) MakeFrms( *pNew ); return pNew; } diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index bdba213..6d4f283 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -3187,7 +3187,7 @@ bool SwpHints::TryInsertHint( CHECK; #endif // ... und die Abhaengigen benachrichtigen - if(rNode.GetDepends()) + if(rNode.HasWriterListeners()) { SwUpdateAttr aHint( nHtStart, @@ -3271,7 +3271,7 @@ bool SwpHints::TryInsertHint( } // ... und die Abhaengigen benachrichtigen - if ( rNode.GetDepends() ) + if ( rNode.HasWriterListeners() ) { SwUpdateAttr aHint( nHtStart, diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 9bcf55e..fd07513 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -1126,7 +1126,7 @@ void _SaveTable::NewFrmFmt( const SwTableLine* pTblLn, const SwTableBox* pTblBx, pFmt->ModifyNotification( (SfxPoolItem*)&rOld, (SfxPoolItem*)&rNew ); } - if( !pOldFmt->GetDepends() ) + if( !pOldFmt->HasWriterListeners() ) delete pOldFmt; } @@ -1345,7 +1345,7 @@ void _SaveBox::CreateNew( SwTable& rTbl, SwTableLine& rParent, _SaveTable& rSTbl { SwFrmFmt* pOld = pBox->GetFrmFmt(); pBox->RegisterToFormat( *pFmt ); - if( !pOld->GetDepends() ) + if( !pOld->HasWriterListeners() ) delete pOld; pBox->setRowSpan( nRowSpan ); diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 0c501d5..8f34f15 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -2462,7 +2462,7 @@ void SAL_CALL SwChartDataSequence::dispose( ) //SwChartDataSequence::Dispose(), release the relationship //here... SwModify* pLclRegisteredIn = GetRegisteredInNonConst(); - if (pLclRegisteredIn && pLclRegisteredIn->GetDepends()) + if (pLclRegisteredIn && pLclRegisteredIn->HasWriterListeners()) { pLclRegisteredIn->Remove(this); pTblCrsr = NULL; diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index cf37dbe..4fdf00b 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -2019,7 +2019,7 @@ void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt ) { SwHiddenParaFieldType* pFldType = static_cast<SwHiddenParaFieldType*>(GetDoc()-> getIDocumentFieldsAccess().GetSysFldType(RES_HIDDENPARAFLD)); - if( pFldType && pFldType->GetDepends() ) + if( pFldType && pFldType->HasWriterListeners() ) { SwMsgPoolItem aHnt( RES_HIDDENPARA_PRINT ); pFldType->ModifyNotification( &aHnt, 0); diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index f174d2d..d7fa97a 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -270,7 +270,7 @@ sal_uLong SwReader::Read( const Reader& rOptions ) pDoc->GetIDocumentUndoRedo().DoUndo(false); pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE ); } - if( pFrmFmt->GetDepends() ) + if( pFrmFmt->HasWriterListeners() ) { // Draw-Objects create a Frame when being inserted; thus delete them pFrmFmt->DelFrms(); diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx index 09464e69..247dda1 100644 --- a/sw/source/ui/fldui/fldref.cxx +++ b/sw/source/ui/fldui/fldref.cxx @@ -192,7 +192,7 @@ void SwFldRefPage::Reset(const SfxItemSet* ) { SwSetExpFieldType* pType = static_cast<SwSetExpFieldType*>(pSh->GetFldType(n, RES_SETEXPFLD)); - if ((nsSwGetSetExpType::GSE_SEQ & pType->GetType()) && pType->GetDepends() && pSh->IsUsed(*pType)) + if ((nsSwGetSetExpType::GSE_SEQ & pType->GetType()) && pType->HasWriterListeners() && pSh->IsUsed(*pType)) { nPos = m_pTypeLB->InsertEntry(pType->GetName()); m_pTypeLB->SetEntryData(nPos, reinterpret_cast<void*>((sal_uIntPtr)(REFFLDFLAG | n))); diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index 9fd73cc..90e7a99 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -1360,7 +1360,7 @@ void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet, SwCondCollCondChg aMsg( pColl ); pColl->ModifyNotification( &aMsg, &aMsg ); } - else if( pCondItem && !pColl->GetDepends() ) + else if( pCondItem && !pColl->HasWriterListeners() ) { // no conditional template, then first create and adopt // all important values diff --git a/sw/source/uibase/config/uinums.cxx b/sw/source/uibase/config/uinums.cxx index fa79923..1f00241 100644 --- a/sw/source/uibase/config/uinums.cxx +++ b/sw/source/uibase/config/uinums.cxx @@ -261,7 +261,7 @@ void SwNumRulesWithName::_SwNumFmtGlobal::ChgNumFmt( SwWrtShell& rSh, else pFmt = rSh.GetCharFmtFromPool( nCharPoolId ); - if( !pFmt->GetDepends() ) // set attributes + if( !pFmt->HasWriterListeners() ) // set attributes for( sal_uInt16 n = aItems.size(); n; ) pFmt->SetFmtAttr( aItems[ --n ] ); } diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 36eeeab..d9d01b7 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -4078,11 +4078,11 @@ SwViewOptionAdjust_Impl::AdjustViewOptions(SwPrintData const*const pPrtOptions) // below should only change if necessary, that is if respective content is present const bool bContainsHiddenChars = m_pShell->GetDoc()->ContainsHiddenChars(); const SwFieldType* pFldType = m_pShell->GetDoc()->getIDocumentFieldsAccess().GetSysFldType( RES_HIDDENTXTFLD ); - const bool bContainsHiddenFields = pFldType && pFldType->GetDepends(); + const bool bContainsHiddenFields = pFldType && pFldType->HasWriterListeners(); pFldType = m_pShell->GetDoc()->getIDocumentFieldsAccess().GetSysFldType( RES_HIDDENPARAFLD ); - const bool bContainsHiddenParagraphs = pFldType && pFldType->GetDepends(); + const bool bContainsHiddenParagraphs = pFldType && pFldType->HasWriterListeners(); pFldType = m_pShell->GetDoc()->getIDocumentFieldsAccess().GetSysFldType( RES_JUMPEDITFLD ); - const bool bContainsPlaceHolders = pFldType && pFldType->GetDepends(); + const bool bContainsPlaceHolders = pFldType && pFldType->HasWriterListeners(); const bool bContainsFields = m_pShell->IsAnyFieldInDoc(); SwViewOption aRenderViewOptions( m_aOldViewOptions ); commit 4da56c0cea4da68a0707b24ad286765400cce0be Author: Bjoern Michaelsen <[email protected]> Date: Tue Mar 24 12:10:52 2015 +0100 these can be moved out of the loop Change-Id: Ic2e743e664e6fe62606639c68a17ba81776cc58d diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index e8c4c2d..0cca34c 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -238,11 +238,11 @@ SwFmt::~SwFmt() } else { + SwFmtChg aOldFmt( this ); + SwFmtChg aNewFmt( pParentFmt ); SwIterator<SwClient,SwFmt> aIter(*this); for(SwClient* pClient = aIter.First(); pClient && pParentFmt; pClient = aIter.Next()) { - SwFmtChg aOldFmt( this ); - SwFmtChg aNewFmt( pParentFmt ); pParentFmt->Add( pClient ); pClient->ModifyNotification( &aOldFmt, &aNewFmt ); } commit a65e98af992d966ef0a9c4b2f197ab2893fcf47e Author: Bjoern Michaelsen <[email protected]> Date: Mon Mar 23 23:12:39 2015 +0100 Revert "Revert "make ClientIteratorBase only know about WriterListener"" This reverts commit 5fb7f222f51b93a9dfffa0fe211a5b3e0c83757e. Conflicts: sw/inc/calbck.hxx Change-Id: If25df4d2bbb77328cbb59c003d56eb0f88c73c67 diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index c5f83bc..f97774d 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -98,6 +98,7 @@ class SW_DLLPUBLIC SwClient : ::sw::WriterListener // avoids making the details of the linked list and the callback method public friend class SwModify; friend class sw::ClientIteratorBase; + template<typename E, typename S> friend class SwIterator; SwModify *pRegisteredIn; ///< event source @@ -192,7 +193,7 @@ public: void Add(SwClient *pDepend); SwClient* Remove(SwClient *pDepend); - const SwClient* GetDepends() const { return static_cast<SwClient*>(pRoot); } + const sw::WriterListener* GetDepends() const { return pRoot; } // get information about attribute virtual bool GetInfo( SfxPoolItem& ) const SAL_OVERRIDE; @@ -250,11 +251,11 @@ namespace sw protected: const SwModify& m_rRoot; // the current object in an iteration - SwClient* m_pCurrent; + WriterListener* m_pCurrent; // in case the current object is already removed, the next object in the list // is marked down to become the current object in the next step // this is necessary because iteration requires access to members of the current object - SwClient* m_pPosition; + WriterListener* m_pPosition; static SW_DLLPUBLIC ClientIteratorBase* our_pClientIters; ClientIteratorBase( const SwModify& rModify ) @@ -262,15 +263,15 @@ namespace sw { MoveTo(our_pClientIters); our_pClientIters = this; - m_pCurrent = m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends()); + m_pCurrent = m_pPosition = const_cast<WriterListener*>(m_rRoot.GetDepends()); } - SwClient* GetLeftOfPos() { return static_cast<SwClient*>(m_pPosition->m_pLeft); } - SwClient* GetRightOfPos() { return static_cast<SwClient*>(m_pPosition->m_pRight); } - SwClient* GoStart() + WriterListener* GetLeftOfPos() { return m_pPosition->m_pLeft; } + WriterListener* GetRightOfPos() { return m_pPosition->m_pRight; } + WriterListener* GoStart() { - if((m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends()))) + if((m_pPosition = const_cast<WriterListener*>(m_rRoot.GetDepends()))) while( m_pPosition->m_pLeft ) - m_pPosition = static_cast<SwClient*>(m_pPosition->m_pLeft); + m_pPosition = m_pPosition->m_pLeft; return m_pCurrent = m_pPosition; } ~ClientIteratorBase() SAL_OVERRIDE @@ -285,7 +286,7 @@ namespace sw // SwModify::Add() asserts this bool IsChanged() const { return m_pPosition != m_pCurrent; } // ensures the iterator to point at a current client - SwClient* Sync() { return m_pCurrent = m_pPosition; } + WriterListener* Sync() { return m_pCurrent = m_pPosition; } }; } @@ -306,12 +307,12 @@ public: TElementType* Last() { if(!m_pPosition) - m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends()); + m_pPosition = const_cast<sw::WriterListener*>(m_rRoot.GetDepends()); if(!m_pPosition) return static_cast<TElementType*>(Sync()); while(GetRightOfPos()) m_pPosition = GetRightOfPos(); - if(m_pPosition->IsA(TYPE(TElementType))) + if(static_cast<SwClient*>(m_pPosition)->IsA(TYPE(TElementType))) return static_cast<TElementType*>(Sync()); return Previous(); } @@ -319,14 +320,14 @@ public: { if(!IsChanged()) m_pPosition = GetRightOfPos(); - while(m_pPosition && !m_pPosition->IsA( TYPE(TElementType) ) ) + while(m_pPosition && !static_cast<SwClient*>(m_pPosition)->IsA( TYPE(TElementType) ) ) m_pPosition = GetRightOfPos(); return static_cast<TElementType*>(Sync()); } TElementType* Previous() { m_pPosition = GetLeftOfPos(); - while(m_pPosition && !m_pPosition->IsA( TYPE(TElementType) ) ) + while(m_pPosition && !static_cast<SwClient*>(m_pPosition)->IsA( TYPE(TElementType) ) ) m_pPosition = GetLeftOfPos(); return static_cast<TElementType*>(Sync()); } @@ -339,27 +340,27 @@ template< typename TSource > class SwIterator<SwClient, TSource> SAL_FINAL : pri public: SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} SwClient* First() - { return GoStart(); } + { return static_cast<SwClient*>(GoStart()); } SwClient* Last() { if(!m_pPosition) - m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends()); + m_pPosition = const_cast<sw::WriterListener*>(m_rRoot.GetDepends()); if(!m_pPosition) return m_pCurrent = nullptr; while(GetRightOfPos()) m_pPosition = GetRightOfPos(); - return Sync(); + return static_cast<SwClient*>(Sync()); } SwClient* Next() { if(!IsChanged()) m_pPosition = GetRightOfPos(); - return Sync(); + return static_cast<SwClient*>(Sync()); } SwClient* Previous() { m_pPosition = GetLeftOfPos(); - return Sync(); + return static_cast<SwClient*>(Sync()); } using sw::ClientIteratorBase::IsChanged; }; diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index 24ba569..80b9ace 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -528,7 +528,7 @@ sal_uLong SwSetExpFieldType::GetSeqFormat() if( !GetDepends() ) return SVX_NUM_ARABIC; - const SwField *pFld = static_cast<const SwFmtFld*>(GetDepends())->GetField(); + const SwField *pFld = SwIterator<SwFmtFld,SwSetExpFieldType>(*this).First()->GetField(); return pFld->GetFormat(); } commit 1e120b0bf6968b39f2a1e834489f021ebdb27e33 Author: Bjoern Michaelsen <[email protected]> Date: Tue Mar 24 12:08:54 2015 +0100 remove use of GetDepends to access clients Change-Id: If607addea5042a2539cd8b03ee6dae9e7833b879 diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index 45ac2d3..e8c4c2d 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -238,13 +238,13 @@ SwFmt::~SwFmt() } else { - while( GetDepends() && pParentFmt) + SwIterator<SwClient,SwFmt> aIter(*this); + for(SwClient* pClient = aIter.First(); pClient && pParentFmt; pClient = aIter.Next()) { SwFmtChg aOldFmt( this ); SwFmtChg aNewFmt( pParentFmt ); - SwClient* pDepend = (SwClient*)GetDepends(); - pParentFmt->Add( pDepend ); - pDepend->ModifyNotification( &aOldFmt, &aNewFmt ); + pParentFmt->Add( pClient ); + pClient->ModifyNotification( &aOldFmt, &aNewFmt ); } } } diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 8cec8bc..fd633be 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -653,9 +653,9 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) } // remove the default formats from the object again - SwClient* pDep; - while( 0 != ( pDep = (SwClient*)aCallMod.GetDepends()) ) - aCallMod.Remove( pDep ); + SwIterator<SwClient, SwModify> aClientIter(aCallMod); + for(SwClient* pClient = aClientIter.First(); pClient; pClient = aClientIter.Next()) + aCallMod.Remove( pClient ); getIDocumentState().SetModified(); } commit 32caa37352d30b5e9fbf7a9113640bd098efb626 Author: Bjoern Michaelsen <[email protected]> Date: Mon Mar 23 22:38:54 2015 +0100 PTR_CAST isnt actually needed here Change-Id: Id0792a164aea33d0c5d3c71b840e9601d75e4f33 diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index 6a121ef..c5f83bc 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -308,11 +308,11 @@ public: if(!m_pPosition) m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends()); if(!m_pPosition) - return PTR_CAST(TElementType,Sync()); + return static_cast<TElementType*>(Sync()); while(GetRightOfPos()) m_pPosition = GetRightOfPos(); if(m_pPosition->IsA(TYPE(TElementType))) - return PTR_CAST(TElementType,Sync()); + return static_cast<TElementType*>(Sync()); return Previous(); } TElementType* Next() @@ -321,14 +321,14 @@ public: m_pPosition = GetRightOfPos(); while(m_pPosition && !m_pPosition->IsA( TYPE(TElementType) ) ) m_pPosition = GetRightOfPos(); - return PTR_CAST(TElementType,Sync()); + return static_cast<TElementType*>(Sync()); } TElementType* Previous() { m_pPosition = GetLeftOfPos(); while(m_pPosition && !m_pPosition->IsA( TYPE(TElementType) ) ) m_pPosition = GetLeftOfPos(); - return PTR_CAST(TElementType,Sync()); + return static_cast<TElementType*>(Sync()); } using sw::ClientIteratorBase::IsChanged; }; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
