diff options
author | Oliver Specht <os@openoffice.org> | 2000-10-16 09:31:56 +0000 |
---|---|---|
committer | Oliver Specht <os@openoffice.org> | 2000-10-16 09:31:56 +0000 |
commit | 3d93f9f3ece035cff5b4744f9a9005e922876212 (patch) | |
tree | 4ef3b2709256a9fd025f4bff698ab335aa6eb593 /sw | |
parent | d93f3a7bb77c0913fd0132d635a1ff004f3562b5 (diff) |
#79422# SwXDocumentIndexMark: invalidation uses SwUnoCallBack
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/unoidx.hxx | 8 | ||||
-rw-r--r-- | sw/source/core/undo/rolbck.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/unocore/unoclbck.cxx | 42 | ||||
-rw-r--r-- | sw/source/core/unocore/unoidx.cxx | 29 |
4 files changed, 79 insertions, 12 deletions
diff --git a/sw/inc/unoidx.hxx b/sw/inc/unoidx.hxx index ec211a034fcd..6f67d79dc6f3 100644 --- a/sw/inc/unoidx.hxx +++ b/sw/inc/unoidx.hxx @@ -2,9 +2,9 @@ * * $RCSfile: unoidx.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:14:29 $ + * last change: $Author: os $ $Date: 2000-10-16 10:30:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -189,6 +189,7 @@ class SwXDocumentIndexMark : public cppu::WeakImplHelper4 public SwClient { SwEventListenerContainer aLstnrCntnr; + SwDepend aTypeDepend; SwDoc* m_pDoc; const SwTOXMark* m_pTOXMark; const SfxItemPropertyMap* _pMap; @@ -247,11 +248,12 @@ public: void attachToRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange)throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); - SwTOXType* GetTOXType() const {return (SwTOXType*)GetRegisteredIn();} + SwTOXType* GetTOXType() const {return (SwTOXType*)aTypeDepend.GetRegisteredIn();} const SwTOXMark* GetTOXMark() const {return m_pTOXMark;} static SwXDocumentIndexMark* GetObject(SwTOXType* pType, const SwTOXMark* pMark, SwDoc* pDoc); + void Invalidate(); }; /* -----------------05.05.99 12:27------------------- * diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index 3c180b7523d7..ffa8c9bdc3d3 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -2,9 +2,9 @@ * * $RCSfile: rolbck.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-19 00:08:27 $ + * last change: $Author: os $ $Date: 2000-10-16 10:31:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1069,8 +1069,14 @@ void SwHistory::Add( const SwTxtAttr* pHint, ULONG nNodeIdx, BOOL bNewAttr ) pHt = new SwSetTxtFldHint( (SwTxtFld*)pHint, nNodeIdx ); break; case RES_TXTATR_TOXMARK: + { pHt = new SwSetTOXMarkHint( (SwTxtTOXMark*)pHint, nNodeIdx ); - break; + const SwDoc* pDoc = ((SwTxtTOXMark*)pHint)->GetTxtNode().GetDoc(); + SwModify* pCallBack = pDoc->GetUnoCallBack(); + SwPtrMsgPoolItem aMsgHint( RES_TOXMARK_DELETED, (void*)pHint ); + pCallBack->Modify(&aMsgHint, &aMsgHint ); + } + break; case RES_TXTATR_REFMARK: { pHt = new SwSetRefMarkHint( (SwTxtRefMark*)pHint, nNodeIdx ); diff --git a/sw/source/core/unocore/unoclbck.cxx b/sw/source/core/unocore/unoclbck.cxx index 0b0f0eaf74cb..a34e201e8688 100644 --- a/sw/source/core/unocore/unoclbck.cxx +++ b/sw/source/core/unocore/unoclbck.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unoclbck.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-19 00:08:28 $ + * last change: $Author: os $ $Date: 2000-10-16 10:31:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,6 +77,12 @@ #ifndef _UNOOBJ_HXX #include <unoobj.hxx> #endif +#ifndef _UNOIDX_HXX +#include <unoidx.hxx> +#endif +#ifndef _TOX_HXX +#include <tox.hxx> +#endif #ifndef _UNOCLBCK_HXX #include <unoclbck.hxx> #endif @@ -168,6 +174,35 @@ void SwUnoCallBack::Modify( SfxPoolItem *pOldValue, SfxPoolItem *pNewValue ) } break; + case RES_TOXMARK_DELETED: + { + SwClientIter aIter( *this ); + SwXDocumentIndexMark* pxIdxMark = (SwXDocumentIndexMark*)aIter.First( TYPE( SwXDocumentIndexMark )); + while(pxIdxMark) + { + SwTOXType* pToxType = pxIdxMark->GetTOXType(); + if(pToxType) + { + const SwTOXMark* pTOXMark = pxIdxMark->GetTOXMark(); + if(!pTOXMark) + pxIdxMark->Invalidate(); + else + { + const SwTxtTOXMark* pTxtTOXMark = pTOXMark ? pTOXMark->GetTxtTOXMark() : 0; + if(pTxtTOXMark && (void*)pTxtTOXMark == ((SwPtrMsgPoolItem *)pOldValue)->pObject) + { + pxIdxMark->Invalidate(); + break; + } + } + } + else + pxIdxMark->Invalidate(); + pxIdxMark = (SwXDocumentIndexMark*)aIter.Next( ); + } + + } + break; } } /* -----------------------------01.09.00 12:03-------------------------------- @@ -213,6 +248,9 @@ SwXFootnote* SwUnoCallBack::GetFootnote(const SwFmtFtn& rMark) /*------------------------------------------------------------------------ $Log: not supported by cvs2svn $ + Revision 1.1.1.1 2000/09/19 00:08:28 hr + initial import + Revision 1.4 2000/09/18 16:04:31 willem.vandorp OpenOffice header added. diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index 9e3c26a50d46..65089638eb52 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unoidx.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: jp $ $Date: 2000-10-05 12:10:09 $ + * last change: $Author: os $ $Date: 2000-10-16 10:31:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1284,6 +1284,7 @@ Sequence< OUString > SwXDocumentIndexMark::getSupportedServiceNames(void) throw( -----------------------------------------------------------------------*/ SwXDocumentIndexMark::SwXDocumentIndexMark(TOXTypes eToxType) : + aTypeDepend(this, 0), m_pDoc(0), aLstnrCntnr( (text::XTextContent*)this), m_pTOXMark(0), @@ -1299,7 +1300,7 @@ SwXDocumentIndexMark::SwXDocumentIndexMark(TOXTypes eToxType) : SwXDocumentIndexMark::SwXDocumentIndexMark(const SwTOXType* pType, const SwTOXMark* pMark, SwDoc* pDc) : - SwClient((SwTOXType*)pType), + aTypeDepend(this, (SwTOXType*)pType), aLstnrCntnr( (text::XTextContent*)this), m_pDoc(pDc), m_pTOXMark(pMark), @@ -1307,6 +1308,7 @@ SwXDocumentIndexMark::SwXDocumentIndexMark(const SwTOXType* pType, eType(pType->GetType()), bIsDescriptor(sal_False) { + m_pDoc->GetUnoCallBack()->Add(this); InitMap(eType); } /*-- 14.12.98 10:25:44--------------------------------------------------- @@ -1467,7 +1469,8 @@ void SwXDocumentIndexMark::attachToRange(const Reference< text::XTextRange > & x } if(!pTOXType) throw IllegalArgumentException(); - ((SwTOXType*)pTOXType)->Add(this); + pDoc->GetUnoCallBack()->Add(this); + ((SwTOXType*)pTOXType)->Add(&aTypeDepend); SwUnoInternalPaM aPam(*pDoc); //das muss jetzt sal_True liefern @@ -1832,6 +1835,21 @@ void SwXDocumentIndexMark::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew) if(!GetRegisteredIn()) aLstnrCntnr.Disposing(); } +/* -----------------------------16.10.00 11:24-------------------------------- + + ---------------------------------------------------------------------------*/ +void SwXDocumentIndexMark::Invalidate() +{ + if(GetRegisteredIn()) + { + ((SwModify*)GetRegisteredIn())->Remove(this); + if(aTypeDepend.GetRegisteredIn()) + ((SwModify*)aTypeDepend.GetRegisteredIn())->Remove(&aTypeDepend); + aLstnrCntnr.Disposing(); + m_pTOXMark = 0; + m_pDoc = 0; + } +} /* -----------------------------06.04.00 15:08-------------------------------- ---------------------------------------------------------------------------*/ @@ -2529,6 +2547,9 @@ sal_Bool SwXIndexTokenAccess_Impl::hasElements(void) throw( RuntimeException ) /*------------------------------------------------------------------------ $Log: not supported by cvs2svn $ + Revision 1.2 2000/10/05 12:10:09 jp + should change: remove image + Revision 1.1.1.1 2000/09/19 00:08:28 hr initial import |