diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-03-30 23:32:21 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-03-30 23:34:50 +0200 |
commit | 46da0b6837bffa7d8a72624d2587159737e3d7e2 (patch) | |
tree | ebd8fcc775d31aadebf4fdb3116bbee0b6890996 /editeng | |
parent | Must call patch_libgnustl_shared() (diff) | |
download | core-46da0b6837bffa7d8a72624d2587159737e3d7e2.tar.gz core-46da0b6837bffa7d8a72624d2587159737e3d7e2.zip |
further sc/editeng unbreaking
this boost::ptr_vector idea is seriously broken
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 9 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.hxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc2.cxx | 8 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 7 |
4 files changed, 24 insertions, 4 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 51f011266222..c05e379c00d6 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -1816,7 +1816,7 @@ void EditDoc::InsertAttrib( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nE if ( pAttr ) { // Remove attribute.... - rAttrList.Remove(pAttr); + rAttrList.Release(pAttr); } // check whether 'the same' attribute exist at this place. @@ -2137,6 +2137,13 @@ void CharAttribList::Remove(size_t nPos) aAttribs.erase(aAttribs.begin()+nPos); } +void CharAttribList::Release(const EditCharAttrib* p) +{ + AttribsType::iterator it = std::find_if(aAttribs.begin(), aAttribs.end(), FindByAddress(p)); + if (it != aAttribs.end()) + aAttribs.release(it).release(); +} + void CharAttribList::SetHasEmptyAttribs(bool b) { bHasEmptyAttribs = b; diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx index bf00c76a7d88..609e2bd5d246 100644 --- a/editeng/source/editeng/editdoc.hxx +++ b/editeng/source/editeng/editdoc.hxx @@ -253,6 +253,7 @@ public: void Remove(const EditCharAttrib* p); void Remove(size_t nPos); + void Release(const EditCharAttrib* p); #if OSL_DEBUG_LEVEL > 2 // Debug: @@ -315,7 +316,10 @@ public: ContentNode* operator[](size_t nPos); void Insert(size_t nPos, ContentNode* p); + /// deletes void Remove(size_t nPos); + /// does not delete + void Release(size_t nPos); size_t Count() const; void Clear(); }; diff --git a/editeng/source/editeng/editdoc2.cxx b/editeng/source/editeng/editdoc2.cxx index b22c10bcbd4e..fc65c9c81dd4 100644 --- a/editeng/source/editeng/editdoc2.cxx +++ b/editeng/source/editeng/editdoc2.cxx @@ -419,6 +419,14 @@ void ContentList::Remove(size_t nPos) maContents.erase(maContents.begin() + nPos); } +void ContentList::Release(size_t nPos) +{ + if (nPos >= maContents.size()) + return; + + maContents.release(maContents.begin() + nPos).release(); +} + size_t ContentList::Count() const { return maContents.size(); diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index a4654f0848b9..9bab5db9673a 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -2192,7 +2192,7 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_uInt16 { // always aOldPositions.Min(), since Remove(). ParaPortion* pTmpPortion = GetParaPortions().Release(aOldPositions.Min()); - aEditDoc.Remove( (sal_uInt16)aOldPositions.Min() ); + aEditDoc.Release( (sal_uInt16)aOldPositions.Min() ); aTmpPortionList.Append(pTmpPortion); } @@ -2237,7 +2237,8 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_uInt16 if ( pRecalc4 ) CalcHeight( pRecalc4 ); - aTmpPortionList.Reset(); + while( aTmpPortionList.Count() > 0 ) + aTmpPortionList.Release( aTmpPortionList.Count() - 1 ); #if OSL_DEBUG_LEVEL > 2 GetParaPortions().DbgCheck(aEditDoc); @@ -2484,7 +2485,7 @@ void ImpEditEngine::ImpRemoveParagraph( sal_uInt16 nPara ) aDeletedNodes.Insert( pInf, aDeletedNodes.Count() ); // The node is managed by the undo and possibly destroyed! - aEditDoc.Remove( nPara ); + aEditDoc.Release( nPara ); GetParaPortions().Remove( nPara ); if ( IsCallParaInsertedOrDeleted() ) |