sw/inc/calbck.hxx | 18 +-------- sw/inc/hintids.hxx | 1 sw/inc/pagedesc.hxx | 4 ++ sw/qa/core/uwriter.cxx | 7 +++ sw/source/core/attr/format.cxx | 4 +- sw/source/core/doc/DocumentContentOperationsManager.cxx | 8 +--- sw/source/core/doc/docdesc.cxx | 18 ++------- sw/source/core/doc/docfmt.cxx | 18 ++------- sw/source/core/doc/tblrwcl.cxx | 2 - sw/source/core/fields/ddefld.cxx | 2 - sw/source/core/fields/ddetbl.cxx | 2 - sw/source/core/inc/pagefrm.hxx | 1 sw/source/core/layout/colfrm.cxx | 2 - sw/source/core/layout/pagechg.cxx | 29 +++++++++------- sw/source/core/txtnode/atrfld.cxx | 2 - 15 files changed, 51 insertions(+), 67 deletions(-)
New commits: commit b4c3a2bd2373edd90fe9e38703e498c4df417f60 Author: Bjoern Michaelsen <bjoern.michael...@canonical.com> Date: Wed Mar 25 00:50:45 2015 +0100 remove typed Modify for good Change-Id: I53105b9a8a832affd0545fcd69774fad116a2a3c diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index e64d7ca..ab91b51 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -176,14 +176,10 @@ public: // broadcasting: send notifications to all clients // DO NOT USE IN NEW CODE! use CallSwClientNotify instead. void NotifyClients( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue ); + // the same, but without setting m_bModifyLocked or checking for any of the flags // 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 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. - inline void ModifyBroadcast( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue, TypeId nType ); // a more universal broadcasting mechanism inline void CallSwClientNotify( const SfxHint& rHint ) const; @@ -371,16 +367,6 @@ SwClient::SwClient( SwModify* pToRegisterIn ) pToRegisterIn->Add(this); } -void SwModify::ModifyBroadcast( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue, TypeId nType) -{ - SwIterator<SwClient,SwModify> aIter(*this); - for(SwClient* pClient = aIter.First(); pClient; pClient = aIter.Next()) - { - if(pClient->IsA(nType)) - pClient->Modify( pOldValue, pNewValue ); - } -} - void SwModify::CallSwClientNotify( const SfxHint& rHint ) const { SwIterator<SwClient,SwModify> aIter(*this); commit 0085d2f3fac063883306818affdd8e268db7b4ee Author: Bjoern Michaelsen <bjoern.michael...@canonical.com> Date: Wed Mar 25 00:49:47 2015 +0100 kill a typed Modify use Change-Id: I713501f7ac31a5188932432adff626279432f305 diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 4b37b04..b2c13c2 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -2366,12 +2366,8 @@ bool DocumentContentOperationsManager::Overwrite( const SwPaM &rRg, const OUStri ? pNode->GetpSwpHints()->Count() : 0; if( nOldAttrCnt != nNewAttrCnt ) { - SwUpdateAttr aHint( - 0, - 0, - 0); - - pNode->ModifyBroadcast( 0, &aHint, TYPE( SwCrsrShell ) ); + SwUpdateAttr aHint(0,0,0); + pNode->ModifyBroadcast(nullptr, &aHint); } if (!m_rDoc.GetIDocumentUndoRedo().DoesUndo() && commit 760e94cdf16031b8fcd44ea3d32380a4103d0484 Author: Bjoern Michaelsen <bjoern.michael...@canonical.com> Date: Wed Mar 25 00:20:12 2015 +0100 kill a typed Modify use Change-Id: I7a33f95348093b9227b7620d08f77ceb560039eb diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index a71c982..ba6a742 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -322,8 +322,8 @@ void SwFmt::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue ) // mba: move the code that ignores this event to the clients // pass Hint only to dependent formats (no Frames) - ModifyBroadcast( pOldValue, pNewValue, TYPE(SwFmt) ); - bContinue = false; + //ModifyBroadcast( pOldValue, pNewValue, TYPE(SwFmt) ); + //bContinue = false; } break; default: commit 9e83083fcdc84b7191ed3e0a5d406e95da57ac33 Author: Bjoern Michaelsen <bjoern.michael...@canonical.com> Date: Wed Mar 25 00:04:34 2015 +0100 kill a typed Modify use Change-Id: I2d526ecb0f11281ad695d6ce158fcb5a3ef739cb diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index ecfd937..f98b103 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -306,7 +306,6 @@ RES_MSG_BEGIN = RES_FMT_END, RES_DEL_CHR, RES_DEL_TXT, RES_UPDATE_ATTR, - RES_PAGEDESC_FTNINFO, RES_REFMARKFLD_UPDATE, RES_DOCPOS_UPDATE, RES_TABLEFML_UPDATE, diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx index c4af052..2743a6b 100644 --- a/sw/inc/pagedesc.hxx +++ b/sw/inc/pagedesc.hxx @@ -341,6 +341,10 @@ public: operator SwPageDesc() const; // #i7983# }; +namespace sw { + class PageFootnoteHint SAL_FINAL : public SfxHint {}; +} + #endif // INCLUDED_SW_INC_PAGEDESC_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 0c29eb4..d5015fe 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -509,19 +509,11 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged ) if( !(rDesc.GetFtnInfo() == rChged.GetFtnInfo()) ) { rDesc.SetFtnInfo( rChged.GetFtnInfo() ); - SwMsgPoolItem aInfo( RES_PAGEDESC_FTNINFO ); - { - rDesc.GetMaster().ModifyBroadcast( &aInfo, 0, TYPE(SwFrm) ); - } - { - rDesc.GetLeft().ModifyBroadcast( &aInfo, 0, TYPE(SwFrm) ); - } - { - rDesc.GetFirstMaster().ModifyBroadcast( &aInfo, 0, TYPE(SwFrm) ); - } - { - rDesc.GetFirstLeft().ModifyBroadcast( &aInfo, 0, TYPE(SwFrm) ); - } + sw::PageFootnoteHint aHint; + rDesc.GetMaster().CallSwClientNotify(aHint); + rDesc.GetLeft().CallSwClientNotify(aHint); + rDesc.GetFirstMaster().CallSwClientNotify(aHint); + rDesc.GetFirstLeft().CallSwClientNotify(aHint); } getIDocumentState().SetModified(); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 0abbacb..fd6f4fe 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1507,20 +1507,12 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, // If foot notes change the pages have to be triggered if( !(rDstDesc.GetFtnInfo() == rSrcDesc.GetFtnInfo()) ) { + sw::PageFootnoteHint aHint; rDstDesc.SetFtnInfo( rSrcDesc.GetFtnInfo() ); - SwMsgPoolItem aInfo( RES_PAGEDESC_FTNINFO ); - { - rDstDesc.GetMaster().ModifyBroadcast( &aInfo, 0, TYPE(SwFrm) ); - } - { - rDstDesc.GetLeft().ModifyBroadcast( &aInfo, 0, TYPE(SwFrm) ); - } - { - rDstDesc.GetFirstMaster().ModifyBroadcast( &aInfo, 0, TYPE(SwFrm) ); - } - { - rDstDesc.GetFirstLeft().ModifyBroadcast( &aInfo, 0, TYPE(SwFrm) ); - } + rDstDesc.GetMaster().CallSwClientNotify(aHint); + rDstDesc.GetLeft().CallSwClientNotify(aHint); + rDstDesc.GetFirstMaster().CallSwClientNotify(aHint); + rDstDesc.GetFirstLeft().CallSwClientNotify(aHint); } } diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx index f98ad4f..ad3894e 100644 --- a/sw/source/core/inc/pagefrm.hxx +++ b/sw/source/core/inc/pagefrm.hxx @@ -104,6 +104,7 @@ class SwPageFrm: public SwFtnBossFrm protected: virtual void MakeAll() SAL_OVERRIDE; virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE; + virtual void SwClientNotify(const SwModify&, const SfxHint&) SAL_OVERRIDE; public: DECL_FIXEDMEMPOOL_NEWDEL(SwPageFrm) diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index ac888b8..90fdc81 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -525,6 +525,24 @@ void SwPageFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew ) } } + +void SwPageFrm::SwClientNotify(const SwModify& rModify, const SfxHint& rHint) +{ + if(typeid(sw::PageFootnoteHint) == typeid(rHint)) + { + // currently the savest way: + static_cast<SwRootFrm*>(GetUpper())->SetSuperfluous(); + SetMaxFtnHeight(pDesc->GetFtnInfo().GetHeight()); + if(!GetMaxFtnHeight()) + SetMaxFtnHeight(LONG_MAX); + SetColMaxFtnHeight(); + // here, the page might be destroyed: + static_cast<SwRootFrm*>(GetUpper())->RemoveFtns(0, false, true); + } + else + SwClient::SwClientNotify(rModify, rHint); +} + void SwPageFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, sal_uInt8 &rInvFlags, SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet ) @@ -632,17 +650,6 @@ void SwPageFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, case RES_TEXTGRID: rInvFlags |= 0x60; break; - - case RES_PAGEDESC_FTNINFO: - // currently the savest way: - static_cast<SwRootFrm*>(GetUpper())->SetSuperfluous(); - SetMaxFtnHeight( pDesc->GetFtnInfo().GetHeight() ); - if ( !GetMaxFtnHeight() ) - SetMaxFtnHeight( LONG_MAX ); - SetColMaxFtnHeight(); - // here, the page might be destroyed: - static_cast<SwRootFrm*>(GetUpper())->RemoveFtns( 0, false, true ); - break; case RES_FRAMEDIR : CheckDirChange(); break; commit d677599025090867fa7d4f418cd3f402ecb19e2b Author: Bjoern Michaelsen <bjoern.michael...@canonical.com> Date: Tue Mar 24 23:03:09 2015 +0100 also test HasOnlyOneListener and HasWriterListeners Change-Id: Iad352a07aa0bb04c031a16fe89d6a83e2502bcf1 diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 1e0f985..6b2bd19 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -1431,12 +1431,19 @@ void SwDocTest::testClientModify() TestClient aClient1, aClient2; OtherTestClient aOtherClient1; // test client registration + CPPUNIT_ASSERT(!aMod.HasWriterListeners()); + CPPUNIT_ASSERT(!aMod.HasOnlyOneListener()); CPPUNIT_ASSERT_EQUAL(aClient1.GetRegisteredIn(),static_cast<SwModify*>(nullptr)); CPPUNIT_ASSERT_EQUAL(aClient2.GetRegisteredIn(),static_cast<SwModify*>(nullptr)); + CPPUNIT_ASSERT_EQUAL(aClient2.GetRegisteredIn(),static_cast<SwModify*>(nullptr)); aMod.Add(&aClient1); + CPPUNIT_ASSERT(aMod.HasWriterListeners()); + CPPUNIT_ASSERT(aMod.HasOnlyOneListener()); aMod.Add(&aClient2); CPPUNIT_ASSERT_EQUAL(aClient1.GetRegisteredIn(),static_cast<SwModify*>(&aMod)); CPPUNIT_ASSERT_EQUAL(aClient2.GetRegisteredIn(),static_cast<SwModify*>(&aMod)); + CPPUNIT_ASSERT(aMod.HasWriterListeners()); + CPPUNIT_ASSERT(!aMod.HasOnlyOneListener()); // test broadcast aMod.ModifyBroadcast(nullptr, nullptr); CPPUNIT_ASSERT_EQUAL(aClient1.m_nModifyCount,1); commit abb863a3320d07b0b1616f81e4c2e2ec082245b7 Author: Bjoern Michaelsen <bjoern.michael...@canonical.com> Date: Tue Mar 24 22:50:34 2015 +0100 rename IsLastDepend HasOnlyOneListener Change-Id: Ibb2a3ee596402661f2c593754061deb8c54a2f76 diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index 04cd54b..e64d7ca 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -208,7 +208,7 @@ public: bool IsInSwFntCache() const { return m_bInSwFntCache; } void CheckCaching( const sal_uInt16 nWhich ); - bool IsLastDepend() { return m_pWriterListeners && m_pWriterListeners->IsLast(); } + bool HasOnlyOneListener() { return m_pWriterListeners && m_pWriterListeners->IsLast(); } }; // SwDepend diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 1e3eaac..ceef574 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -4449,7 +4449,7 @@ void SwShareBoxFmts::ChangeFrmFmt( SwTableBox* pBox, SwTableLine* pLn, pOld->Add( &aCl ); pLn->ChgFrmFmt( static_cast<SwTableLineFmt*>(&rFmt) ); } - if( pOld && pOld->IsLastDepend() ) + if( pOld && pOld->HasOnlyOneListener() ) { RemoveFormat( *pOld ); delete pOld; diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx index dd89ca6..025ecc3 100644 --- a/sw/source/core/fields/ddefld.cxx +++ b/sw/source/core/fields/ddefld.cxx @@ -378,7 +378,7 @@ SwDDEField::SwDDEField( SwDDEFieldType* pInitType ) SwDDEField::~SwDDEField() { - if( GetTyp()->IsLastDepend() ) + if( GetTyp()->HasOnlyOneListener() ) static_cast<SwDDEFieldType*>(GetTyp())->Disconnect(); } diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx index 277438e..268f248 100644 --- a/sw/source/core/fields/ddetbl.cxx +++ b/sw/source/core/fields/ddetbl.cxx @@ -71,7 +71,7 @@ SwDDETable::~SwDDETable() pFldTyp->DecRefCnt(); // If it is the last dependent of the "deleted field" than delete it finally - if( pFldTyp->IsDeleted() && pFldTyp->IsLastDepend() ) + if( pFldTyp->IsDeleted() && pFldTyp->HasOnlyOneListener() ) { pFldTyp->Remove( &aDepend ); delete pFldTyp; diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx index e139895..c012fea 100644 --- a/sw/source/core/layout/colfrm.cxx +++ b/sw/source/core/layout/colfrm.cxx @@ -45,7 +45,7 @@ SwColumnFrm::~SwColumnFrm() { SwFrmFmt *pFmt = GetFmt(); SwDoc *pDoc; - if ( !(pDoc = pFmt->GetDoc())->IsInDtor() && pFmt->IsLastDepend() ) + if ( !(pDoc = pFmt->GetDoc())->IsInDtor() && pFmt->HasOnlyOneListener() ) { //I'm the only one, delete the format. //Get default format before, so the base class can cope with it. diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index 34aee5e..b3a3b31 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -123,7 +123,7 @@ SwFmtFld::~SwFmtFld() delete mpField; // bei einige FeldTypen muessen wir den FeldTypen noch loeschen - if( pType && pType->IsLastDepend() ) + if( pType && pType->HasOnlyOneListener() ) { bool bDel = false; switch( pType->Which() ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits