diff options
author | Noel Grandin <noel@peralex.com> | 2012-06-25 15:05:31 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-07-04 23:23:20 +0200 |
commit | 6485258bc00de0bc1db9a0b146437a08c93970aa (patch) | |
tree | f2fcd1caa4c5e424b940ba58c2bccdfc5e6725b5 /sw | |
parent | 457a537bdb24ff67a9bfc3d7426678ac6829d821 (diff) |
Convert Svptrarr to std::deque<const SwTxtAttr*>
Change-Id: I527814582214401a1f7dd9c192e6aa96e45f7819
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/txatritr.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/txtnode/txatritr.cxx | 25 |
2 files changed, 14 insertions, 15 deletions
diff --git a/sw/inc/txatritr.hxx b/sw/inc/txatritr.hxx index 63c2020df659..fd2c2fec1d4b 100644 --- a/sw/inc/txatritr.hxx +++ b/sw/inc/txatritr.hxx @@ -21,9 +21,9 @@ #include <tools/solar.h> #include <sal/types.h> -#include <svl/svarray.hxx> #include <editeng/langitem.hxx> #include <hintids.hxx> +#include <deque> class String; class SwTxtNode; @@ -53,7 +53,7 @@ public: class SwTxtAttrIterator { SwScriptIterator aSIter; - SvPtrarr aStack; + std::deque<const SwTxtAttr*> aStack; const SwTxtNode& rTxtNd; const SfxPoolItem *pParaItem, *pCurItem; xub_StrLen nChgPos; diff --git a/sw/source/core/txtnode/txatritr.cxx b/sw/source/core/txtnode/txatritr.cxx index d51dbf532259..53912958df97 100644 --- a/sw/source/core/txtnode/txatritr.cxx +++ b/sw/source/core/txtnode/txatritr.cxx @@ -109,25 +109,25 @@ sal_Bool SwTxtAttrIterator::Next() if( nChgPos < aSIter.GetText().Len() ) { bRet = sal_True; - if( aStack.Count() ) + if( !aStack.empty() ) { do { - const SwTxtAttr* pHt = (SwTxtAttr*)aStack[ 0 ]; + const SwTxtAttr* pHt = aStack.front(); sal_uInt16 nEndPos = *pHt->GetEnd(); if( nChgPos >= nEndPos ) - aStack.Remove( 0 ); + aStack.pop_front(); else break; - } while( aStack.Count() ); + } while( !aStack.empty() ); } - if( aStack.Count() ) + if( !aStack.empty() ) { sal_uInt16 nSavePos = nAttrPos; SearchNextChg(); - if( aStack.Count() ) + if( !aStack.empty() ) { - const SwTxtAttr* pHt = (SwTxtAttr*)aStack[ 0 ]; + const SwTxtAttr* pHt = aStack.front(); sal_uInt16 nEndPos = *pHt->GetEnd(); if( nChgPos >= nEndPos ) { @@ -144,7 +144,7 @@ sal_Bool SwTxtAttrIterator::Next() else pCurItem = &pHt->GetAttr(); - aStack.Remove( 0 ); + aStack.pop_front(); } } } @@ -156,13 +156,12 @@ sal_Bool SwTxtAttrIterator::Next() void SwTxtAttrIterator::AddToStack( const SwTxtAttr& rAttr ) { - void* pAdd = (void*)&rAttr; sal_uInt16 nIns = 0, nEndPos = *rAttr.GetEnd(); - for( ; nIns < aStack.Count(); ++nIns ) - if( *((SwTxtAttr*)aStack[ nIns ] )->GetEnd() > nEndPos ) + for( ; nIns < aStack.size(); ++nIns ) + if( *aStack[ nIns ]->GetEnd() > nEndPos ) break; - aStack.Insert( pAdd, nIns ); + aStack.insert( aStack.begin() + nIns, &rAttr ); } void SwTxtAttrIterator::SearchNextChg() @@ -175,7 +174,7 @@ void SwTxtAttrIterator::SearchNextChg() nAttrPos = 0; // must be restart at the beginning, because // some attributes can start before or inside // the current scripttype! - aStack.Remove( 0, aStack.Count() ); + aStack.clear(); } if( !pParaItem ) { |