diff options
-rw-r--r-- | sw/inc/anchoredobject.hxx | 7 | ||||
-rw-r--r-- | sw/source/core/inc/layfrm.hxx | 14 | ||||
-rw-r--r-- | sw/source/core/layout/anchoredobject.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/layout/ssfrm.cxx | 8 |
4 files changed, 36 insertions, 5 deletions
diff --git a/sw/inc/anchoredobject.hxx b/sw/inc/anchoredobject.hxx index cc5edbfb17b0..ff4b88ada644 100644 --- a/sw/inc/anchoredobject.hxx +++ b/sw/inc/anchoredobject.hxx @@ -269,15 +269,12 @@ class SW_DLLPUBLIC SwAnchoredObject // accessors to data of position calculation: // frame vertical position is orient at - inline const SwLayoutFrm* GetVertPosOrientFrm() const + const SwLayoutFrm* GetVertPosOrientFrm() const { return mpVertPosOrientFrm; } // method to clear member <mpVertPosOrientFrm> - inline void ClearVertPosOrientFrm() - { - mpVertPosOrientFrm = 0L; - } + void ClearVertPosOrientFrm(); /** check anchor character rectangle and top of line diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx index fdd6b7cb034e..d17b6e526473 100644 --- a/sw/source/core/inc/layfrm.hxx +++ b/sw/source/core/inc/layfrm.hxx @@ -21,6 +21,7 @@ #include "frame.hxx" +class SwAnchoredObject; class SwCntntFrm; class SwFlowFrm; class SwFmtCol; @@ -53,6 +54,7 @@ protected: virtual void MakeAll(); SwFrm *pLower; + std::vector<SwAnchoredObject*> aVertPosOrientFrmsFor; virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); virtual SwTwips GrowFrm ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); @@ -164,6 +166,18 @@ public: inline SwFrm* GetLastLower(); virtual void PaintBreak() const; + + void SetVertPosOrientFrmFor(SwAnchoredObject *pObj) + { + aVertPosOrientFrmsFor.push_back(pObj); + } + + void ClearVertPosOrientFrmFor(SwAnchoredObject *pObj) + { + aVertPosOrientFrmsFor.erase( + std::remove(aVertPosOrientFrmsFor.begin(), + aVertPosOrientFrmsFor.end(), pObj), aVertPosOrientFrmsFor.end()); + } }; //Um doppelte Implementierung zu sparen wird hier ein bischen gecasted diff --git a/sw/source/core/layout/anchoredobject.cxx b/sw/source/core/layout/anchoredobject.cxx index ab4a193a5673..77cf548f6428 100644 --- a/sw/source/core/layout/anchoredobject.cxx +++ b/sw/source/core/layout/anchoredobject.cxx @@ -107,8 +107,18 @@ SwAnchoredObject::SwAnchoredObject() : { } +void SwAnchoredObject::ClearVertPosOrientFrm() +{ + if (mpVertPosOrientFrm) + { + const_cast<SwLayoutFrm*>(mpVertPosOrientFrm)->ClearVertPosOrientFrmFor(this); + mpVertPosOrientFrm = NULL; + } +} + SwAnchoredObject::~SwAnchoredObject() { + ClearVertPosOrientFrm(); } // ============================================================================= @@ -238,6 +248,8 @@ void SwAnchoredObject::SetVertPosOrientFrm( const SwLayoutFrm& _rVertPosOrientFr { mpVertPosOrientFrm = &_rVertPosOrientFrm; + const_cast<SwLayoutFrm*>(mpVertPosOrientFrm)->SetVertPosOrientFrmFor(this); + // #i28701# - take over functionality of deleted method // <SwFlyAtCntFrm::AssertPage()>: assure for at-paragraph and at-character // an anchored object, that it is registered at the correct page frame diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index 4ae962ef751b..1fc5ff0fdcf3 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -557,6 +557,14 @@ void SwCntntFrm::DelFrms( const SwCntntNode& rNode ) void SwLayoutFrm::Destroy() { + while (!aVertPosOrientFrmsFor.empty()) + { + SwAnchoredObject *pObj = *aVertPosOrientFrmsFor.begin(); + pObj->ClearVertPosOrientFrm(); + } + + assert(aVertPosOrientFrmsFor.empty()); + SwFrm *pFrm = pLower; if( GetFmt() && !GetFmt()->GetDoc()->IsInDtor() ) |