diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-08-19 22:54:57 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-08-20 16:40:15 +0200 |
commit | e7c96f3e8f2c2f6bf31ec21fe0d1fbaecb07c3f9 (patch) | |
tree | 1187507c132ce5ee588e5a4c5ed738f76184bfc9 /sw | |
parent | b684cd4b071be9b26dd35e3104450135ffbfea98 (diff) |
i#107771: sw: make SwXReferenceMark a client of its format poolitem
In other words, stop registering at SwDoc's "UnoCallBack"
Change-Id: I9e08966cf8e2d2a373867d81549c8887f73993c8
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/fmtrfmrk.hxx | 8 | ||||
-rw-r--r-- | sw/inc/hintids.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/attr/calbck.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/docnode/nodes.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/inc/unorefmark.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/txtnode/atrref.cxx | 25 | ||||
-rw-r--r-- | sw/source/core/txtnode/thints.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/unocore/unocoll.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/unocore/unoportenum.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unorefmk.cxx | 25 |
10 files changed, 42 insertions, 36 deletions
diff --git a/sw/inc/fmtrfmrk.hxx b/sw/inc/fmtrfmrk.hxx index 88e7861008ec..d8e807d18381 100644 --- a/sw/inc/fmtrfmrk.hxx +++ b/sw/inc/fmtrfmrk.hxx @@ -22,11 +22,15 @@ #include <rtl/ustring.hxx> #include <svl/poolitem.hxx> +#include <calbck.hxx> + class SwTxtRefMark; // ATT_REFMARK -class SwFmtRefMark : public SfxPoolItem +class SwFmtRefMark + : public SfxPoolItem + , public SwModify { friend class SwTxtRefMark; SwTxtRefMark* pTxtAttr; @@ -44,6 +48,8 @@ public: virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE; virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const SAL_OVERRIDE; + void InvalidateRefMark(); + const SwTxtRefMark *GetTxtRefMark() const { return pTxtAttr; } SwTxtRefMark *GetTxtRefMark() { return pTxtAttr; } diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 8ca47b7828c5..80408ced54ff 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -330,7 +330,6 @@ RES_MSG_BEGIN = RES_FMT_END, RES_FINDNEARESTNODE, RES_CONTENT_VISIBLE, RES_FOOTNOTE_DELETED, - RES_REFMARK_DELETED, RES_GRAPHIC_SWAPIN, RES_FIELD_DELETED, RES_NAME_CHANGED, diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx index 0d3a5bad3878..f66494352ed5 100644 --- a/sw/source/core/attr/calbck.cxx +++ b/sw/source/core/attr/calbck.cxx @@ -174,7 +174,6 @@ void SwModify::NotifyClients( const SfxPoolItem* pOldValue, const SfxPoolItem* p break; case RES_FOOTNOTE_DELETED: - case RES_REFMARK_DELETED: case RES_FIELD_DELETED: bLockClientList = false; break; diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 9806cbaec87f..3dc6ff6b41ae 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -39,6 +39,7 @@ #include <frame.hxx> #include <txtatr.hxx> #include <tox.hxx> +#include <fmtrfmrk.hxx> #include <docsh.hxx> #include <svl/smplhint.hxx> @@ -303,7 +304,8 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz, break; case RES_TXTATR_REFMARK: - nDelMsg = RES_REFMARK_DELETED; + static_cast<SwFmtRefMark&>(pAttr->GetAttr()) + .InvalidateRefMark(); break; case RES_TXTATR_META: diff --git a/sw/source/core/inc/unorefmark.hxx b/sw/source/core/inc/unorefmark.hxx index 75db5eee9fbc..78dac4b0207c 100644 --- a/sw/source/core/inc/unorefmark.hxx +++ b/sw/source/core/inc/unorefmark.hxx @@ -55,10 +55,10 @@ private: public: - SwXReferenceMark(SwDoc *const pDoc, const SwFmtRefMark *const pMark); + SwXReferenceMark(SwDoc *const pDoc, SwFmtRefMark *const pMark); static SwXReferenceMark * - CreateXReferenceMark(SwDoc & rDoc, SwFmtRefMark const& rMarkFmt); + CreateXReferenceMark(SwDoc & rDoc, SwFmtRefMark & rMarkFmt); /// may return 0 static SwXReferenceMark * GetReferenceMark(SwModify const& rUnoCB, SwFmtRefMark const& rMarkFmt); diff --git a/sw/source/core/txtnode/atrref.cxx b/sw/source/core/txtnode/atrref.cxx index 8628b1b283d4..1b9fe63d0413 100644 --- a/sw/source/core/txtnode/atrref.cxx +++ b/sw/source/core/txtnode/atrref.cxx @@ -17,9 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <fmtrfmrk.hxx> + #include <hintids.hxx> +#include <hints.hxx> #include <txtrfmrk.hxx> -#include <fmtrfmrk.hxx> #include <swfont.hxx> SwFmtRefMark::~SwFmtRefMark( ) @@ -27,16 +29,18 @@ SwFmtRefMark::~SwFmtRefMark( ) } SwFmtRefMark::SwFmtRefMark( const OUString& rName ) - : SfxPoolItem( RES_TXTATR_REFMARK ), - pTxtAttr( 0 ), - aRefName( rName ) + : SfxPoolItem(RES_TXTATR_REFMARK) + , SwModify(0) + , pTxtAttr(0) + , aRefName(rName) { } SwFmtRefMark::SwFmtRefMark( const SwFmtRefMark& rAttr ) - : SfxPoolItem( RES_TXTATR_REFMARK ), - pTxtAttr( 0 ), - aRefName( rAttr.aRefName ) + : SfxPoolItem(RES_TXTATR_REFMARK) + , SwModify(0) + , pTxtAttr(0) + , aRefName(rAttr.aRefName) { } @@ -51,6 +55,13 @@ SfxPoolItem* SwFmtRefMark::Clone( SfxItemPool* ) const return new SwFmtRefMark( *this ); } +void SwFmtRefMark::InvalidateRefMark() +{ + SwPtrMsgPoolItem const item(RES_REMOVE_UNO_OBJECT, + &static_cast<SwModify&>(*this)); // cast to base class (void*) + NotifyClients(&item, &item); +} + // Attribut fuer Inhalts-/Positions-Referenzen im Text SwTxtRefMark::SwTxtRefMark( SwFmtRefMark& rAttr, diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 4b327f73ca0c..d98790aa7ba0 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -32,6 +32,7 @@ #include <txtinet.hxx> #include <txtflcnt.hxx> #include <fmtfld.hxx> +#include <fmtrfmrk.hxx> #include <fmtanchr.hxx> #include <fmtinfmt.hxx> #include <txtatr.hxx> @@ -1185,7 +1186,7 @@ void SwTxtNode::DestroyAttr( SwTxtAttr* pAttr ) break; case RES_TXTATR_REFMARK: - nDelMsg = RES_REFMARK_DELETED; + static_cast<SwFmtRefMark&>(pAttr->GetAttr()).InvalidateRefMark(); break; case RES_TXTATR_META: diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index 584293d1618a..50810227ca92 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -1988,7 +1988,8 @@ SwXReferenceMark* SwXReferenceMarks::GetObject( SwDoc* pDoc, const SwFmtRefMark* { SolarMutexGuard aGuard; - return SwXReferenceMark::CreateXReferenceMark(*pDoc, *pMark); + return SwXReferenceMark::CreateXReferenceMark( + *pDoc, *const_cast<SwFmtRefMark*>(pMark)); } void SwUnoCollection::Invalidate() diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index e021622d2c96..3b5cba4d6a68 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -491,8 +491,8 @@ lcl_CreateRefMarkPortion( const SwTxtAttr & rAttr, const bool bEnd) { SwDoc* pDoc = pUnoCrsr->GetDoc(); - const SwFmtRefMark& rRefMark = - static_cast<const SwFmtRefMark&>(rAttr.GetAttr()); + SwFmtRefMark& rRefMark = const_cast<SwFmtRefMark&>( + static_cast<const SwFmtRefMark&>(rAttr.GetAttr())); Reference<XTextContent> xContent; if (!xContent.is()) { diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx index 5817d90c004c..abcb746843ce 100644 --- a/sw/source/core/unocore/unorefmk.cxx +++ b/sw/source/core/unocore/unorefmk.cxx @@ -53,8 +53,8 @@ public: OUString m_sMarkName; Impl( SwXReferenceMark & rThis, - SwDoc *const pDoc, SwFmtRefMark const*const pRefMark) - : SwClient((pDoc) ? pDoc->GetUnoCallBack() : 0) + SwDoc *const pDoc, SwFmtRefMark *const pRefMark) + : SwClient(pRefMark) , m_rThis(rThis) , m_EventListeners(m_Mutex) , m_bIsDescriptor(0 == pRefMark) @@ -96,23 +96,10 @@ void SwXReferenceMark::Impl::Modify( const SfxPoolItem* pOld, const SfxPoolItem { Invalidate(); } - else if (pOld) - { - switch (pOld->Which()) - { - case RES_REFMARK_DELETED: - if (static_cast<const void*>(m_pMarkFmt) == - static_cast<const SwPtrMsgPoolItem *>(pOld)->pObject) - { - Invalidate(); - } - break; - } - } } SwXReferenceMark::SwXReferenceMark( - SwDoc *const pDoc, SwFmtRefMark const*const pRefMark) + SwDoc *const pDoc, SwFmtRefMark *const pRefMark) : m_pImpl( new SwXReferenceMark::Impl(*this, pDoc, pRefMark) ) { } @@ -133,10 +120,10 @@ SwXReferenceMark::GetReferenceMark( SwXReferenceMark * SwXReferenceMark::CreateXReferenceMark( - SwDoc & rDoc, SwFmtRefMark const& rMarkFmt) + SwDoc & rDoc, SwFmtRefMark & rMarkFmt) { SwXReferenceMark *const pXMark( - GetReferenceMark(*rDoc.GetUnoCallBack(), rMarkFmt) ); + GetReferenceMark(rMarkFmt, rMarkFmt) ); return (pXMark) ? pXMark : new SwXReferenceMark(&rDoc, &rMarkFmt); @@ -266,7 +253,7 @@ void SwXReferenceMark::Impl::InsertRefMark(SwPaM& rPam, m_pMarkFmt = &pTxtAttr->GetRefMark(); - pDoc2->GetUnoCallBack()->Add(this); + const_cast<SwFmtRefMark*>(m_pMarkFmt)->Add(this); } void SAL_CALL |