diff options
Diffstat (limited to 'sw/source/core/layout')
-rw-r--r-- | sw/source/core/layout/anchoredobject.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/layout/layouter.cxx | 15 | ||||
-rw-r--r-- | sw/source/core/layout/objstmpconsiderwrapinfl.cxx | 27 | ||||
-rw-r--r-- | sw/source/core/layout/objstmpconsiderwrapinfl.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/layout/ssfrm.cxx | 5 |
5 files changed, 38 insertions, 19 deletions
diff --git a/sw/source/core/layout/anchoredobject.cxx b/sw/source/core/layout/anchoredobject.cxx index 36d24d31a0b7..be13b3cd86f8 100644 --- a/sw/source/core/layout/anchoredobject.cxx +++ b/sw/source/core/layout/anchoredobject.cxx @@ -749,7 +749,14 @@ void SwAnchoredObject::SetTmpConsiderWrapInfluence( const bool _bTmpConsiderWrap } } - +void SwAnchoredObject::ClearTmpConsiderWrapInfluence() +{ + mbTmpConsiderWrapInfluence = false; + mbClearedEnvironment = false; + SetClearedEnvironment( false ); + SwLayouter::RemoveObjForTmpConsiderWrapInfluence( *(GetFrameFormat().GetDoc()), + *this ); +} void SwAnchoredObject::SetTmpConsiderWrapInfluenceOfOtherObjs() { const SwSortedObjs* pObjs = GetAnchorFrame()->GetDrawObjs(); diff --git a/sw/source/core/layout/layouter.cxx b/sw/source/core/layout/layouter.cxx index 18efbe1ac51f..41fefd385021 100644 --- a/sw/source/core/layout/layouter.cxx +++ b/sw/source/core/layout/layouter.cxx @@ -402,6 +402,7 @@ void SwLayouter::ClearObjsTmpConsiderWrapInfluence( const SwDoc& _rDoc ) _rDoc.getIDocumentLayoutAccess().GetLayouter()->mpObjsTmpConsiderWrapInfl->Clear(); } } + void SwLayouter::InsertObjForTmpConsiderWrapInfluence( const SwDoc& _rDoc, SwAnchoredObject& _rAnchoredObj ) @@ -420,6 +421,20 @@ void SwLayouter::InsertObjForTmpConsiderWrapInfluence( _rDoc.getIDocumentLayoutAccess().GetLayouter()->mpObjsTmpConsiderWrapInfl->Insert( _rAnchoredObj ); } +void SwLayouter::RemoveObjForTmpConsiderWrapInfluence( + const SwDoc& _rDoc, + SwAnchoredObject& _rAnchoredObj ) +{ + if ( !_rDoc.getIDocumentLayoutAccess().GetLayouter() ) + return; + + if ( !_rDoc.getIDocumentLayoutAccess().GetLayouter()->mpObjsTmpConsiderWrapInfl ) + return; + + _rDoc.getIDocumentLayoutAccess().GetLayouter()->mpObjsTmpConsiderWrapInfl->Remove( _rAnchoredObj ); +} + + void LOOPING_LOUIE_LIGHT( bool bCondition, const SwTextFrame& rTextFrame ) { if ( bCondition ) diff --git a/sw/source/core/layout/objstmpconsiderwrapinfl.cxx b/sw/source/core/layout/objstmpconsiderwrapinfl.cxx index 214fe5693e3b..83d1a183c3c4 100644 --- a/sw/source/core/layout/objstmpconsiderwrapinfl.cxx +++ b/sw/source/core/layout/objstmpconsiderwrapinfl.cxx @@ -31,23 +31,18 @@ SwObjsMarkedAsTmpConsiderWrapInfluence::~SwObjsMarkedAsTmpConsiderWrapInfluence( void SwObjsMarkedAsTmpConsiderWrapInfluence::Insert( SwAnchoredObject& _rAnchoredObj ) { + auto it = std::find(maObjsTmpConsiderWrapInfl.begin(), maObjsTmpConsiderWrapInfl.end(), &_rAnchoredObj); + if (it != maObjsTmpConsiderWrapInfl.end()) + return; + maObjsTmpConsiderWrapInfl.push_back( &_rAnchoredObj ); +} - bool bAlreadyInserted( false ); - std::vector< SwAnchoredObject* >::const_iterator aIter = maObjsTmpConsiderWrapInfl.begin(); - for ( ; aIter != maObjsTmpConsiderWrapInfl.end(); ++aIter ) - { - const SwAnchoredObject* pAnchoredObj = *(aIter); - if ( pAnchoredObj == &_rAnchoredObj ) - { - bAlreadyInserted = true; - break; - } - } - - if ( !bAlreadyInserted ) - { - maObjsTmpConsiderWrapInfl.push_back( &_rAnchoredObj ); - } +void SwObjsMarkedAsTmpConsiderWrapInfluence::Remove( SwAnchoredObject& _rAnchoredObj ) +{ + auto it = std::find(maObjsTmpConsiderWrapInfl.begin(), maObjsTmpConsiderWrapInfl.end(), &_rAnchoredObj); + if (it == maObjsTmpConsiderWrapInfl.end()) + return; + maObjsTmpConsiderWrapInfl.erase(it); } void SwObjsMarkedAsTmpConsiderWrapInfluence::Clear() diff --git a/sw/source/core/layout/objstmpconsiderwrapinfl.hxx b/sw/source/core/layout/objstmpconsiderwrapinfl.hxx index fcf495e72a50..28b6acf9de1c 100644 --- a/sw/source/core/layout/objstmpconsiderwrapinfl.hxx +++ b/sw/source/core/layout/objstmpconsiderwrapinfl.hxx @@ -33,6 +33,7 @@ class SwObjsMarkedAsTmpConsiderWrapInfluence ~SwObjsMarkedAsTmpConsiderWrapInfluence(); void Insert( SwAnchoredObject& _rAnchoredObj ); + void Remove( SwAnchoredObject& _rAnchoredObj ); void Clear(); }; diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index 58ea1e491a8a..6adadd54890f 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -471,9 +471,10 @@ void SwLayoutFrame::DestroyImpl() const size_t nCnt = pFrame->GetDrawObjs()->size(); // #i28701# SwAnchoredObject* pAnchoredObj = (*pFrame->GetDrawObjs())[0]; - if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr ) + pAnchoredObj->ClearTmpConsiderWrapInfluence(); + if (SwFlyFrame* pFlyFrame = dynamic_cast<SwFlyFrame*>(pAnchoredObj)) { - SwFrame::DestroyFrame(static_cast<SwFlyFrame*>(pAnchoredObj)); + SwFrame::DestroyFrame(pFlyFrame); assert(!pFrame->GetDrawObjs() || nCnt > pFrame->GetDrawObjs()->size()); } else |