diff options
author | Maciej Rumianowski <maciej.rumianowski@gmail.com> | 2012-02-25 15:34:30 +0100 |
---|---|---|
committer | Ivan Timofeev <timofeev.i.s@gmail.com> | 2012-03-05 17:19:43 +0400 |
commit | bf12ddb08f60aa261f83e1688c5d589a69eea0dd (patch) | |
tree | 38df4146d6f5eb595a670693449c6559bca7f9f5 /svtools/source/edit | |
parent | cf2fbadf90c1cb255e39529b856df3eaef1e0226 (diff) |
Replace VARARR TEWritingDirectionInfos with std::vector
Diffstat (limited to 'svtools/source/edit')
-rw-r--r-- | svtools/source/edit/textdat2.hxx | 8 | ||||
-rw-r--r-- | svtools/source/edit/textdata.cxx | 5 | ||||
-rw-r--r-- | svtools/source/edit/texteng.cxx | 35 |
3 files changed, 24 insertions, 24 deletions
diff --git a/svtools/source/edit/textdat2.hxx b/svtools/source/edit/textdat2.hxx index 945fd2336ca2..c34f5ec42ab3 100644 --- a/svtools/source/edit/textdat2.hxx +++ b/svtools/source/edit/textdat2.hxx @@ -35,6 +35,8 @@ #include <vcl/virdev.hxx> #include <vcl/cursor.hxx> +#include <vector> + class TextNode; class TextView; @@ -117,8 +119,6 @@ struct TEWritingDirectionInfo } }; -SV_DECL_VARARR( TEWritingDirectionInfos, TEWritingDirectionInfo, 0 ) - class TextLine { private: @@ -202,7 +202,7 @@ private: TextLines maLines; TETextPortionList maTextPortions; - TEWritingDirectionInfos maWritingDirectionInfos; + std::vector<TEWritingDirectionInfo> maWritingDirectionInfos; sal_uInt16 mnInvalidPosStart; @@ -233,7 +233,7 @@ public: TextNode* GetNode() const { return mpNode; } TextLines& GetLines() { return maLines; } TETextPortionList& GetTextPortions() { return maTextPortions; } - TEWritingDirectionInfos& GetWritingDirectionInfos() { return maWritingDirectionInfos; } + std::vector<TEWritingDirectionInfo>& GetWritingDirectionInfos() { return maWritingDirectionInfos; } sal_uInt16 GetLineNumber( sal_uInt16 nIndex, sal_Bool bInclEnd ); diff --git a/svtools/source/edit/textdata.cxx b/svtools/source/edit/textdata.cxx index 4023c869a9f3..894887d3e81b 100644 --- a/svtools/source/edit/textdata.cxx +++ b/svtools/source/edit/textdata.cxx @@ -33,7 +33,6 @@ #include <tools/debug.hxx> SV_IMPL_PTRARR( TextLines, TextLinePtr ); -SV_IMPL_VARARR( TEWritingDirectionInfos, TEWritingDirectionInfo ); // ------------------------------------------------------------------------- @@ -173,7 +172,7 @@ void TEParaPortion::MarkInvalid( sal_uInt16 nStart, short nDiff ) } } - maWritingDirectionInfos.Remove( 0, maWritingDirectionInfos.Count() ); + maWritingDirectionInfos.clear(); mbInvalid = sal_True; } @@ -191,7 +190,7 @@ void TEParaPortion::MarkSelectionInvalid( sal_uInt16 nStart, sal_uInt16 /*nEnd*/ // nInvalidPosEnd = pNode->Len(); } - maWritingDirectionInfos.Remove( 0, maWritingDirectionInfos.Count() ); + maWritingDirectionInfos.clear(); mnInvalidDiff = 0; mbInvalid = sal_True; diff --git a/svtools/source/edit/texteng.cxx b/svtools/source/edit/texteng.cxx index f727de22e5cd..6baf8a9c4eb1 100644 --- a/svtools/source/edit/texteng.cxx +++ b/svtools/source/edit/texteng.cxx @@ -65,6 +65,7 @@ #include <unicode/ubidi.h> #include <set> +#include <vector> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -1835,9 +1836,9 @@ void TextEngine::CreateTextPortions( sal_uLong nPara, sal_uInt16 nStartPos ) } aPositions.insert( pNode->GetText().Len() ); - const TEWritingDirectionInfos& rWritingDirections = pTEParaPortion->GetWritingDirectionInfos(); - for ( sal_uInt16 nD = 0; nD < rWritingDirections.Count(); nD++ ) - aPositions.insert( rWritingDirections[nD].nStartPos ); + const std::vector<TEWritingDirectionInfo>& rWritingDirections = pTEParaPortion->GetWritingDirectionInfos(); + for ( std::vector<TEWritingDirectionInfo>::const_iterator it = rWritingDirections.begin(); it != rWritingDirections.end(); ++it ) + aPositions.insert( (*it).nStartPos ); if ( mpIMEInfos && mpIMEInfos->pAttribs && ( mpIMEInfos->aPos.GetPara() == nPara ) ) { @@ -2252,10 +2253,10 @@ sal_Bool TextEngine::CreateLines( sal_uLong nPara ) const sal_uInt16 nInvalidEnd = nInvalidStart + Abs( nInvalidDiff ); sal_Bool bQuickFormat = sal_False; - if ( !pTEParaPortion->GetWritingDirectionInfos().Count() ) + if ( pTEParaPortion->GetWritingDirectionInfos().empty() ) ImpInitWritingDirections( nPara ); - if ( pTEParaPortion->GetWritingDirectionInfos().Count() == 1 ) + if ( pTEParaPortion->GetWritingDirectionInfos().size() == 1 ) { if ( pTEParaPortion->IsSimpleInvalid() && ( nInvalidDiff > 0 ) ) { @@ -3015,8 +3016,8 @@ void TextEngine::SetRightToLeft( sal_Bool bR2L ) void TextEngine::ImpInitWritingDirections( sal_uLong nPara ) { TEParaPortion* pParaPortion = mpTEParaPortions->GetObject( nPara ); - TEWritingDirectionInfos& rInfos = pParaPortion->GetWritingDirectionInfos(); - rInfos.Remove( 0, rInfos.Count() ); + std::vector<TEWritingDirectionInfo>& rInfos = pParaPortion->GetWritingDirectionInfos(); + rInfos.clear(); if ( pParaPortion->GetNode()->GetText().Len() ) { @@ -3042,7 +3043,7 @@ void TextEngine::ImpInitWritingDirections( sal_uLong nPara ) for ( sal_uInt16 nIdx = 0; nIdx < nCount; ++nIdx ) { ubidi_getLogicalRun( pBidi, nStart, &nEnd, &nCurrDir ); - rInfos.Insert( TEWritingDirectionInfo( nCurrDir, (sal_uInt16)nStart, (sal_uInt16)nEnd ), rInfos.Count() ); + rInfos.push_back( TEWritingDirectionInfo( nCurrDir, (sal_uInt16)nStart, (sal_uInt16)nEnd ) ); nStart = nEnd; } @@ -3050,8 +3051,8 @@ void TextEngine::ImpInitWritingDirections( sal_uLong nPara ) } // No infos mean no CTL and default dir is L2R... - if ( !rInfos.Count() ) - rInfos.Insert( TEWritingDirectionInfo( 0, 0, (sal_uInt16)pParaPortion->GetNode()->GetText().Len() ), rInfos.Count() ); + if ( rInfos.empty() ) + rInfos.push_back( TEWritingDirectionInfo( 0, 0, (sal_uInt16)pParaPortion->GetNode()->GetText().Len() ) ); } @@ -3063,19 +3064,19 @@ sal_uInt8 TextEngine::ImpGetRightToLeft( sal_uLong nPara, sal_uInt16 nPos, sal_u if ( pNode && pNode->GetText().Len() ) { TEParaPortion* pParaPortion = mpTEParaPortions->GetObject( nPara ); - if ( !pParaPortion->GetWritingDirectionInfos().Count() ) + if ( pParaPortion->GetWritingDirectionInfos().empty() ) ImpInitWritingDirections( nPara ); - TEWritingDirectionInfos& rDirInfos = pParaPortion->GetWritingDirectionInfos(); - for ( sal_uInt16 n = 0; n < rDirInfos.Count(); n++ ) + std::vector<TEWritingDirectionInfo>& rDirInfos = pParaPortion->GetWritingDirectionInfos(); + for ( std::vector<TEWritingDirectionInfo>::const_iterator rDirInfosIt = rDirInfos.begin(); rDirInfosIt != rDirInfos.end(); ++rDirInfosIt ) { - if ( ( rDirInfos[n].nStartPos <= nPos ) && ( rDirInfos[n].nEndPos >= nPos ) ) + if ( ( (*rDirInfosIt).nStartPos <= nPos ) && ( (*rDirInfosIt).nEndPos >= nPos ) ) { - nRightToLeft = rDirInfos[n].nType; + nRightToLeft = (*rDirInfosIt).nType; if ( pStart ) - *pStart = rDirInfos[n].nStartPos; + *pStart = (*rDirInfosIt).nStartPos; if ( pEnd ) - *pEnd = rDirInfos[n].nEndPos; + *pEnd = (*rDirInfosIt).nEndPos; break; } } |