diff options
author | Vladimir Glazunov <vg@openoffice.org> | 2010-11-01 16:40:46 +0100 |
---|---|---|
committer | Vladimir Glazunov <vg@openoffice.org> | 2010-11-01 16:40:46 +0100 |
commit | 27f4278c4547115aabd83347d5ffa015b69a0d9a (patch) | |
tree | 9ff3022fdcb889df50c89301550c3f8fc3fc4ebf /editeng/source | |
parent | 174393915bf795ce53ba861f78141ed41e03d9ec (diff) | |
parent | c2a023ea84107f6505fb4a474178e25653587efe (diff) |
CWS-TOOLING: integrate CWS svarray
Diffstat (limited to 'editeng/source')
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.hxx | 7 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc2.cxx | 10 | ||||
-rwxr-xr-x | editeng/source/editeng/impedit2.cxx | 74 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 6 | ||||
-rwxr-xr-x | editeng/source/editeng/impedit4.cxx | 16 | ||||
-rw-r--r-- | editeng/source/misc/txtrange.cxx | 22 | ||||
-rw-r--r-- | editeng/source/rtf/makefile.mk | 2 | ||||
-rw-r--r-- | editeng/source/rtf/rtfitem.cxx | 18 | ||||
-rw-r--r-- | editeng/source/rtf/svxrtf.cxx | 50 |
10 files changed, 104 insertions, 105 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 9ac179a2a47f..a8b9efd1fff7 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -255,10 +255,6 @@ USHORT aV5Map[] = { }; SV_IMPL_PTRARR( DummyContentList, ContentNode* ); -SV_IMPL_VARARR( ScriptTypePosInfos, ScriptTypePosInfo ); -SV_IMPL_VARARR( WritingDirectionInfos, WritingDirectionInfo ); -// SV_IMPL_VARARR( ExtraCharInfos, ExtraCharInfo ); - int SAL_CALL CompareStart( const void* pFirst, const void* pSecond ) { diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx index bf2e3d01852b..16b4da6f8429 100644 --- a/editeng/source/editeng/editdoc.hxx +++ b/editeng/source/editeng/editdoc.hxx @@ -40,6 +40,8 @@ #include <svl/itempool.hxx> #include <tools/table.hxx> +#include <deque> + class ImpEditEngine; class SvxTabStop; class SvtCTLOptions; @@ -96,7 +98,7 @@ struct ScriptTypePosInfo } }; -SV_DECL_VARARR( ScriptTypePosInfos, ScriptTypePosInfo, 0, 4 ) +typedef std::deque< ScriptTypePosInfo > ScriptTypePosInfos; struct WritingDirectionInfo { @@ -112,7 +114,8 @@ struct WritingDirectionInfo } }; -SV_DECL_VARARR( WritingDirectionInfos, WritingDirectionInfo, 0, 4 ) + +typedef std::deque< WritingDirectionInfo > WritingDirectionInfos; typedef EditCharAttrib* EditCharAttribPtr; SV_DECL_PTRARR( CharAttribArray, EditCharAttribPtr, 0, 4 ) diff --git a/editeng/source/editeng/editdoc2.cxx b/editeng/source/editeng/editdoc2.cxx index b2a83ffd6274..3610423ba3c0 100644 --- a/editeng/source/editeng/editdoc2.cxx +++ b/editeng/source/editeng/editdoc2.cxx @@ -238,9 +238,8 @@ void ParaPortion::MarkInvalid( USHORT nStart, short nDiff ) } } bInvalid = TRUE; - aScriptInfos.Remove( 0, aScriptInfos.Count() ); - aWritingDirectionInfos.Remove( 0, aWritingDirectionInfos.Count() ); -// aExtraCharInfos.Remove( 0, aExtraCharInfos.Count() ); + aScriptInfos.clear(); + aWritingDirectionInfos.clear(); } void ParaPortion::MarkSelectionInvalid( USHORT nStart, USHORT /* nEnd */ ) @@ -258,9 +257,8 @@ void ParaPortion::MarkSelectionInvalid( USHORT nStart, USHORT /* nEnd */ ) nInvalidDiff = 0; bInvalid = TRUE; bSimple = FALSE; - aScriptInfos.Remove( 0, aScriptInfos.Count() ); - aWritingDirectionInfos.Remove( 0, aWritingDirectionInfos.Count() ); -// aExtraCharInfos.Remove( 0, aExtraCharInfos.Count() ); + aScriptInfos.clear(); + aWritingDirectionInfos.clear(); } USHORT ParaPortion::GetLineNumber( USHORT nIndex ) diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 148ca08816ae..fe20464eb905 100755 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -1719,9 +1719,7 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara ) { ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; - rTypes.Remove( 0, rTypes.Count() ); - -// pParaPortion->aExtraCharInfos.Remove( 0, pParaPortion->aExtraCharInfos.Count() ); + rTypes.clear(); ContentNode* pNode = pParaPortion->GetNode(); if ( pNode->Len() ) @@ -1770,19 +1768,19 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara ) sal_Int32 nPos = 0; short nScriptType = _xBI->getScriptType( aOUText, nPos ); - rTypes.Insert( ScriptTypePosInfo( nScriptType, (USHORT)nPos, nTextLen ), rTypes.Count() ); + rTypes.push_back( ScriptTypePosInfo( nScriptType, (USHORT)nPos, nTextLen ) ); nPos = _xBI->endOfScript( aOUText, nPos, nScriptType ); while ( ( nPos != (-1) ) && ( nPos < nTextLen ) ) { - rTypes[rTypes.Count()-1].nEndPos = (USHORT)nPos; + rTypes.back().nEndPos = (USHORT)nPos; nScriptType = _xBI->getScriptType( aOUText, nPos ); long nEndPos = _xBI->endOfScript( aOUText, nPos, nScriptType ); - if ( ( nScriptType == i18n::ScriptType::WEAK ) || ( nScriptType == rTypes[rTypes.Count()-1].nScriptType ) ) + if ( ( nScriptType == i18n::ScriptType::WEAK ) || ( nScriptType == rTypes.back().nScriptType ) ) { // Expand last ScriptTypePosInfo, don't create weak or unecessary portions - rTypes[rTypes.Count()-1].nEndPos = (USHORT)nEndPos; + rTypes.back().nEndPos = (USHORT)nEndPos; } else { @@ -1793,26 +1791,26 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara ) case U_ENCLOSING_MARK: case U_COMBINING_SPACING_MARK: --nPos; - rTypes[rTypes.Count()-1].nEndPos--; + rTypes.back().nEndPos--; break; } } - rTypes.Insert( ScriptTypePosInfo( nScriptType, (USHORT)nPos, nTextLen ), rTypes.Count() ); + rTypes.push_back( ScriptTypePosInfo( nScriptType, (USHORT)nPos, nTextLen ) ); } nPos = nEndPos; } if ( rTypes[0].nScriptType == i18n::ScriptType::WEAK ) - rTypes[0].nScriptType = ( rTypes.Count() > 1 ) ? rTypes[1].nScriptType : GetI18NScriptTypeOfLanguage( GetDefaultLanguage() ); + rTypes[0].nScriptType = ( rTypes.size() > 1 ) ? rTypes[1].nScriptType : GetI18NScriptTypeOfLanguage( GetDefaultLanguage() ); // create writing direction information: - if ( !pParaPortion->aWritingDirectionInfos.Count() ) + if ( pParaPortion->aWritingDirectionInfos.empty() ) InitWritingDirections( nPara ); // i89825: Use CTL font for numbers embedded into an RTL run: WritingDirectionInfos& rDirInfos = pParaPortion->aWritingDirectionInfos; - for ( USHORT n = 0; n < rDirInfos.Count(); ++n ) + for ( size_t n = 0; n < rDirInfos.size(); ++n ) { const xub_StrLen nStart = rDirInfos[n].nStartPos; const xub_StrLen nEnd = rDirInfos[n].nEndPos; @@ -1821,30 +1819,30 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara ) if ( nCurrDirType % 2 == UBIDI_RTL || // text in RTL run ( nCurrDirType > UBIDI_LTR && !lcl_HasStrongLTR( aText, nStart, nEnd ) ) ) // non-strong text in embedded LTR run { - USHORT nIdx = 0; + size_t nIdx = 0; // Skip entries in ScriptArray which are not inside the RTL run: - while ( nIdx < rTypes.Count() && rTypes[nIdx].nStartPos < nStart ) + while ( nIdx < rTypes.size() && rTypes[nIdx].nStartPos < nStart ) ++nIdx; // Remove any entries *inside* the current run: - while ( nIdx < rTypes.Count() && rTypes[nIdx].nEndPos <= nEnd ) - rTypes.Remove( nIdx ); + while ( nIdx < rTypes.size() && rTypes[nIdx].nEndPos <= nEnd ) + rTypes.erase( rTypes.begin()+nIdx ); // special case: - if(nIdx < rTypes.Count() && rTypes[nIdx].nStartPos < nStart && rTypes[nIdx].nEndPos > nEnd) + if(nIdx < rTypes.size() && rTypes[nIdx].nStartPos < nStart && rTypes[nIdx].nEndPos > nEnd) { - rTypes.Insert( ScriptTypePosInfo( rTypes[nIdx].nScriptType, (USHORT)nEnd, rTypes[nIdx].nEndPos ), nIdx ); + rTypes.insert( rTypes.begin()+nIdx, ScriptTypePosInfo( rTypes[nIdx].nScriptType, (USHORT)nEnd, rTypes[nIdx].nEndPos ) ); rTypes[nIdx].nEndPos = nStart; } if( nIdx ) rTypes[nIdx - 1].nEndPos = nStart; - rTypes.Insert( ScriptTypePosInfo( i18n::ScriptType::COMPLEX, (USHORT)nStart, (USHORT)nEnd), nIdx ); + rTypes.insert( rTypes.begin()+nIdx, ScriptTypePosInfo( i18n::ScriptType::COMPLEX, (USHORT)nStart, (USHORT)nEnd) ); ++nIdx; - if( nIdx < rTypes.Count() ) + if( nIdx < rTypes.size() ) rTypes[nIdx].nStartPos = nEnd; } } @@ -1853,7 +1851,7 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara ) USHORT nDebugStt = 0; USHORT nDebugEnd = 0; short nDebugType = 0; - for ( USHORT n = 0; n < rTypes.Count(); ++n ) + for ( size_t n = 0; n < rTypes.size(); ++n ) { nDebugStt = rTypes[n].nStartPos; nDebugEnd = rTypes[n].nEndPos; @@ -1874,12 +1872,12 @@ USHORT ImpEditEngine::GetScriptType( const EditPaM& rPaM, USHORT* pEndPos ) cons { USHORT nPara = GetEditDoc().GetPos( rPaM.GetNode() ); ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); - if ( !pParaPortion->aScriptInfos.Count() ) + if ( pParaPortion->aScriptInfos.empty() ) ((ImpEditEngine*)this)->InitScriptTypes( nPara ); ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; USHORT nPos = rPaM.GetIndex(); - for ( USHORT n = 0; n < rTypes.Count(); n++ ) + for ( size_t n = 0; n < rTypes.size(); n++ ) { if ( ( rTypes[n].nStartPos <= nPos ) && ( rTypes[n].nEndPos >= nPos ) ) { @@ -1906,7 +1904,7 @@ USHORT ImpEditEngine::GetScriptType( const EditSelection& rSel ) const for ( USHORT nPara = nStartPara; nPara <= nEndPara; nPara++ ) { ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); - if ( !pParaPortion->aScriptInfos.Count() ) + if ( pParaPortion->aScriptInfos.empty() ) ((ImpEditEngine*)this)->InitScriptTypes( nPara ); ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; @@ -1916,7 +1914,7 @@ USHORT ImpEditEngine::GetScriptType( const EditSelection& rSel ) const // well as with just moving the cursor from char to char. USHORT nS = ( nPara == nStartPara ) ? aSel.Min().GetIndex() : 0; USHORT nE = ( nPara == nEndPara ) ? aSel.Max().GetIndex() : pParaPortion->GetNode()->Len(); - for ( USHORT n = 0; n < rTypes.Count(); n++ ) + for ( size_t n = 0; n < rTypes.size(); n++ ) { if (rTypes[n].nStartPos <= nS && nE <= rTypes[n].nEndPos) { @@ -1947,12 +1945,12 @@ BOOL ImpEditEngine::IsScriptChange( const EditPaM& rPaM ) const { USHORT nPara = GetEditDoc().GetPos( rPaM.GetNode() ); ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); - if ( !pParaPortion->aScriptInfos.Count() ) + if ( pParaPortion->aScriptInfos.empty() ) ((ImpEditEngine*)this)->InitScriptTypes( nPara ); ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; USHORT nPos = rPaM.GetIndex(); - for ( USHORT n = 0; n < rTypes.Count(); n++ ) + for ( size_t n = 0; n < rTypes.size(); n++ ) { if ( rTypes[n].nStartPos == nPos ) { @@ -1969,11 +1967,11 @@ BOOL ImpEditEngine::HasScriptType( USHORT nPara, USHORT nType ) const BOOL bTypeFound = FALSE; ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); - if ( !pParaPortion->aScriptInfos.Count() ) + if ( pParaPortion->aScriptInfos.empty() ) ((ImpEditEngine*)this)->InitScriptTypes( nPara ); ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; - for ( USHORT n = rTypes.Count(); n && !bTypeFound; ) + for ( size_t n = rTypes.size(); n && !bTypeFound; ) { if ( rTypes[--n].nScriptType == nType ) bTypeFound = TRUE; @@ -1985,11 +1983,11 @@ void ImpEditEngine::InitWritingDirections( USHORT nPara ) { ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); WritingDirectionInfos& rInfos = pParaPortion->aWritingDirectionInfos; - rInfos.Remove( 0, rInfos.Count() ); + rInfos.clear(); BOOL bCTL = FALSE; ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; - for ( USHORT n = 0; n < rTypes.Count(); n++ ) + for ( size_t n = 0; n < rTypes.size(); n++ ) { if ( rTypes[n].nScriptType == i18n::ScriptType::COMPLEX ) { @@ -2014,16 +2012,16 @@ void ImpEditEngine::InitWritingDirections( USHORT nPara ) ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(aText.GetBuffer()), aText.Len(), nBidiLevel, NULL, &nError ); // UChar != sal_Unicode in MinGW nError = U_ZERO_ERROR; - long nCount = ubidi_countRuns( pBidi, &nError ); + size_t nCount = ubidi_countRuns( pBidi, &nError ); int32_t nStart = 0; int32_t nEnd; UBiDiLevel nCurrDir; - for ( USHORT nIdx = 0; nIdx < nCount; ++nIdx ) + for ( size_t nIdx = 0; nIdx < nCount; ++nIdx ) { ubidi_getLogicalRun( pBidi, nStart, &nEnd, &nCurrDir ); - rInfos.Insert( WritingDirectionInfo( nCurrDir, (USHORT)nStart, (USHORT)nEnd ), rInfos.Count() ); + rInfos.push_back( WritingDirectionInfo( nCurrDir, (USHORT)nStart, (USHORT)nEnd ) ); nStart = nEnd; } @@ -2031,8 +2029,8 @@ void ImpEditEngine::InitWritingDirections( USHORT nPara ) } // No infos mean no CTL and default dir is L2R... - if ( !rInfos.Count() ) - rInfos.Insert( WritingDirectionInfo( 0, 0, (USHORT)pParaPortion->GetNode()->Len() ), rInfos.Count() ); + if ( rInfos.empty() ) + rInfos.push_back( WritingDirectionInfo( 0, 0, (USHORT)pParaPortion->GetNode()->Len() ) ); } @@ -2096,12 +2094,12 @@ BYTE ImpEditEngine::GetRightToLeft( USHORT nPara, USHORT nPos, USHORT* pStart, U if ( pNode && pNode->Len() ) { ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); - if ( !pParaPortion->aWritingDirectionInfos.Count() ) + if ( pParaPortion->aWritingDirectionInfos.empty() ) InitWritingDirections( nPara ); // BYTE nType = 0; WritingDirectionInfos& rDirInfos = pParaPortion->aWritingDirectionInfos; - for ( USHORT n = 0; n < rDirInfos.Count(); n++ ) + for ( size_t n = 0; n < rDirInfos.size(); n++ ) { if ( ( rDirInfos[n].nStartPos <= nPos ) && ( rDirInfos[n].nEndPos >= nPos ) ) { diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 08f50a0da884..14f3f35c66b1 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -2294,15 +2294,15 @@ void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& r } aPositions.Insert( pNode->Len() ); - if ( !pParaPortion->aScriptInfos.Count() ) + if ( pParaPortion->aScriptInfos.empty() ) ((ImpEditEngine*)this)->InitScriptTypes( GetParaPortions().GetPos( pParaPortion ) ); const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; - for ( USHORT nT = 0; nT < rTypes.Count(); nT++ ) + for ( size_t nT = 0; nT < rTypes.size(); nT++ ) aPositions.Insert( rTypes[nT].nStartPos ); const WritingDirectionInfos& rWritingDirections = pParaPortion->aWritingDirectionInfos; - for ( USHORT nD = 0; nD < rWritingDirections.Count(); nD++ ) + for ( size_t nD = 0; nD < rWritingDirections.size(); nD++ ) aPositions.Insert( rWritingDirections[nD].nStartPos ); if ( mpIMEInfos && mpIMEInfos->nLen && mpIMEInfos->pAttribs && ( mpIMEInfos->aPos.GetNode() == pNode ) ) diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 46a0668394f2..b5225751a8cb 100755 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -397,8 +397,8 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) else if ( nScriptType == 2 ) nWhich = EE_CHAR_FONTINFO_CTL; - sal_uInt16 i = 0; - SvxFontItem* pFontItem = (SvxFontItem*)aEditDoc.GetItemPool().GetItem( nWhich, i ); + sal_uInt32 i = 0; + SvxFontItem* pFontItem = (SvxFontItem*)aEditDoc.GetItemPool().GetItem2( nWhich, i ); while ( pFontItem ) { bool bAlreadyExist = false; @@ -411,7 +411,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) if ( !bAlreadyExist ) aFontTable.Insert( aFontTable.Count(), new SvxFontItem( *pFontItem ) ); - pFontItem = (SvxFontItem*)aEditDoc.GetItemPool().GetItem( nWhich, ++i ); + pFontItem = (SvxFontItem*)aEditDoc.GetItemPool().GetItem2( nWhich, ++i ); } } @@ -467,17 +467,17 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) // ColorList rausschreiben... SvxColorList aColorList; - sal_uInt16 i = 0; - SvxColorItem* pColorItem = (SvxColorItem*)aEditDoc.GetItemPool().GetItem( EE_CHAR_COLOR, i ); + sal_uInt32 i = 0; + SvxColorItem* pColorItem = (SvxColorItem*)aEditDoc.GetItemPool().GetItem2( EE_CHAR_COLOR, i ); while ( pColorItem ) { - USHORT nPos = i; + sal_uInt32 nPos = i; if ( pColorItem->GetValue() == COL_AUTO ) nPos = 0; aColorList.Insert( new SvxColorItem( *pColorItem ), nPos ); - pColorItem = (SvxColorItem*)aEditDoc.GetItemPool().GetItem( EE_CHAR_COLOR, ++i ); + pColorItem = (SvxColorItem*)aEditDoc.GetItemPool().GetItem2( EE_CHAR_COLOR, ++i ); } - aColorList.Insert( new SvxColorItem( (const SvxColorItem&)aEditDoc.GetItemPool().GetDefaultItem( EE_CHAR_COLOR) ), (sal_uInt32)i ); + aColorList.Insert( new SvxColorItem( (const SvxColorItem&)aEditDoc.GetItemPool().GetDefaultItem( EE_CHAR_COLOR) ), i ); rOutput << '{' << OOO_STRING_SVTOOLS_RTF_COLORTBL; for ( j = 0; j < aColorList.Count(); j++ ) diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx index 61e4a5253ced..a69fd59439c2 100644 --- a/editeng/source/misc/txtrange.cxx +++ b/editeng/source/misc/txtrange.cxx @@ -196,7 +196,7 @@ public: SvxBoundArgs::SvxBoundArgs( TextRanger* pRanger, SvLongs *pLong, const Range& rRange ) - : aBoolArr( 4, 4 ), pLongArr( pLong ), pTextRanger( pRanger ), + : pLongArr( pLong ), pTextRanger( pRanger ), nTop( rRange.Min() ), nBottom( rRange.Max() ), bInner( pRanger->IsInner() ), bMultiple( bInner || !pRanger->IsSimple() ), bConcat( FALSE ), bRotate( pRanger->IsVertical() ) @@ -291,7 +291,7 @@ void SvxBoundArgs::NoteRange( BOOL bToggle ) bToggle = FALSE; USHORT nIdx = 0; USHORT nCount = pLongArr->Count(); - DBG_ASSERT( nCount == 2 * aBoolArr.Count(), "NoteRange: Incompatible Sizes" ); + DBG_ASSERT( nCount == 2 * aBoolArr.size(), "NoteRange: Incompatible Sizes" ); while( nIdx < nCount && (*pLongArr)[ nIdx ] < nMin ) ++nIdx; BOOL bOdd = nIdx % 2 ? TRUE : FALSE; @@ -300,7 +300,7 @@ void SvxBoundArgs::NoteRange( BOOL bToggle ) { // Dann wird ein neues eingefuegt ... pLongArr->Insert( nMin, nIdx ); pLongArr->Insert( nMax, nIdx + 1 ); - aBoolArr.Insert( bToggle, nIdx / 2 ); + aBoolArr.insert( aBoolArr.begin() + nIdx / 2, bToggle ); } else { // ein vorhandes Intervall erweitern ... @@ -332,9 +332,9 @@ void SvxBoundArgs::NoteRange( BOOL bToggle ) USHORT nStop = nMaxIdx + nDiff; for( USHORT i = nMaxIdx; i < nStop; ++i ) bToggle ^= aBoolArr[ i ]; - aBoolArr.Remove( nMaxIdx, nDiff ); + aBoolArr.erase( aBoolArr.begin() + nMaxIdx, aBoolArr.begin() + (nMaxIdx + nDiff) ); } - DBG_ASSERT( nMaxIdx < aBoolArr.Count(), "NoteRange: Too much deleted" ); + DBG_ASSERT( nMaxIdx < aBoolArr.size(), "NoteRange: Too much deleted" ); aBoolArr[ nMaxIdx ] ^= bToggle; } } @@ -479,13 +479,13 @@ void SvxBoundArgs::Calc( const PolyPolygon& rPoly ) void SvxBoundArgs::Add() { USHORT nLongIdx = 1; - USHORT nCount = aBoolArr.Count(); + size_t nCount = aBoolArr.size(); if( nCount && ( !bInner || !pTextRanger->IsSimple() ) ) { - BOOL bDelete = aBoolArr[ 0 ]; + BOOL bDelete = aBoolArr.front(); if( bInner ) bDelete = !bDelete; - for( USHORT nBoolIdx = 1; nBoolIdx < nCount; ++nBoolIdx ) + for( size_t nBoolIdx = 1; nBoolIdx < nCount; ++nBoolIdx ) { if( bDelete ) { @@ -497,7 +497,7 @@ void SvxBoundArgs::Add() next /= 2; nBoolIdx = nBoolIdx - next; nCount = nCount - next; - aBoolArr.Remove( nBoolIdx, next ); + aBoolArr.erase( aBoolArr.begin() + nBoolIdx, aBoolArr.begin() + (nBoolIdx + next) ); if( nBoolIdx ) aBoolArr[ nBoolIdx - 1 ] = FALSE; #if OSL_DEBUG_LEVEL > 1 @@ -508,7 +508,7 @@ void SvxBoundArgs::Add() bDelete = nBoolIdx < nCount && aBoolArr[ nBoolIdx ]; nLongIdx += 2; DBG_ASSERT( nLongIdx == 2*nBoolIdx+1, "BoundArgs: Array-Idx Confusion" ); - DBG_ASSERT( aBoolArr.Count()*2 == pLongArr->Count(), + DBG_ASSERT( aBoolArr.size()*2 == pLongArr->Count(), "BoundArgs: Array-Count: Confusion" ); } } @@ -538,7 +538,7 @@ void SvxBoundArgs::Concat( const PolyPolygon* pPoly ) DBG_ASSERT( pPoly, "Nothing to do?" ); SvLongs *pOld = pLongArr; pLongArr = new SvLongs( 2, 8 ); - aBoolArr.Remove( 0, aBoolArr.Count() ); + aBoolArr.clear(); bInner = FALSE; Calc( *pPoly ); USHORT nCount = pLongArr->Count(); diff --git a/editeng/source/rtf/makefile.mk b/editeng/source/rtf/makefile.mk index ef1c5f44b196..38b2ef7b45bc 100644 --- a/editeng/source/rtf/makefile.mk +++ b/editeng/source/rtf/makefile.mk @@ -38,11 +38,11 @@ TARGET=rtf # --- Files -------------------------------------------------------- EXCEPTIONSFILES= \ + $(SLO)$/rtfitem.obj \ $(SLO)$/svxrtf.obj SLOFILES= \ $(EXCEPTIONSFILES) \ - $(SLO)$/rtfitem.obj \ $(SLO)$/rtfgrf.obj # ========================================================================== diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx index 89b44be23ba8..3141ab20afcd 100644 --- a/editeng/source/rtf/rtfitem.cxx +++ b/editeng/source/rtf/rtfitem.cxx @@ -228,7 +228,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) RTF_CharTypeDef eCharType = NOTDEF_CHARTYPE; USHORT nFontAlign; - int bChkStkPos = !bNewGroup && aAttrStack.Top(); + int bChkStkPos = !bNewGroup && aAttrStack.back(); while( bWeiter && IsParserWorking() ) // solange bekannte Attribute erkannt werden { @@ -250,7 +250,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) if( !bChkStkPos ) break; - SvxRTFItemStackType* pAkt = aAttrStack.Top(); + SvxRTFItemStackType* pAkt = aAttrStack.back(); if( !pAkt || (pAkt->pSttNd->GetIdx() == pInsPos->GetNodeIdx() && pAkt->nSttCnt == pInsPos->GetCntIdx() )) break; @@ -269,10 +269,10 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) // alle bis hierher gueltigen Attribute "setzen" AttrGroupEnd(); - pAkt = aAttrStack.Top(); // can be changed after AttrGroupEnd! + pAkt = aAttrStack.back(); // can be changed after AttrGroupEnd! pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 ); - aAttrStack.Push( pNew ); + aAttrStack.push_back( pNew ); pAkt = pNew; } else @@ -305,7 +305,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) nStyleNo = -1 == nTokenValue ? 0 : USHORT(nTokenValue); // setze am akt. auf dem AttrStack stehenden Style die // StyleNummer - SvxRTFItemStackType* pAkt = aAttrStack.Top(); + SvxRTFItemStackType* pAkt = aAttrStack.back(); if( !pAkt ) break; @@ -1869,9 +1869,9 @@ void SvxRTFParser::ReadBackgroundAttr( int nToken, SfxItemSet& rSet, // pard / plain abarbeiten void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet ) { - if( !bNewGroup && aAttrStack.Top() ) // nicht am Anfang einer neuen Gruppe + if( !bNewGroup && aAttrStack.back() ) // not at the beginning of a new group { - SvxRTFItemStackType* pAkt = aAttrStack.Top(); + SvxRTFItemStackType* pAkt = aAttrStack.back(); int nLastToken = GetStackPtr(-1)->nTokenId; int bNewStkEntry = TRUE; @@ -1887,9 +1887,9 @@ void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet ) // alle bis hierher gueltigen Attribute "setzen" AttrGroupEnd(); - pAkt = aAttrStack.Top(); // can be changed after AttrGroupEnd! + pAkt = aAttrStack.back(); // can be changed after AttrGroupEnd! pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 ); - aAttrStack.Push( pNew ); + aAttrStack.push_back( pNew ); pAkt = pNew; } else diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index 61ae8e256c67..14b17807a0ea 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -55,7 +55,6 @@ using namespace ::com::sun::star; -SV_IMPL_PTRARR( SvxRTFColorTbl, ColorPtr ) SV_IMPL_PTRARR( SvxRTFItemStackList, SvxRTFItemStackType* ) CharSet lcl_GetDefaultTextEncodingForRTF() @@ -83,7 +82,6 @@ SvxRTFParser::SvxRTFParser( SfxItemPool& rPool, SvStream& rIn, int bReadNewDoc ) : SvRTFParser( rIn, 5 ), rStrm(rIn), - aColorTbl( 16, 4 ), aFontTbl( 16, 4 ), pInsPos( 0 ), pAttrPool( &rPool ), @@ -124,13 +122,13 @@ void SvxRTFParser::ResetPard() SvxRTFParser::~SvxRTFParser() { - if( aColorTbl.Count() ) + if( !aColorTbl.empty() ) ClearColorTbl(); if( aFontTbl.Count() ) ClearFontTbl(); if( aStyleTbl.Count() ) ClearStyleTbl(); - if( aAttrStack.Count() ) + if( !aAttrStack.empty() ) ClearAttrStack(); delete pRTFDefaults; @@ -149,18 +147,18 @@ void SvxRTFParser::SetInsPos( const SvxPosition& rNew ) SvParserState SvxRTFParser::CallParser() { - DBG_ASSERT( pInsPos, "keine Einfuegeposition" ); + DBG_ASSERT( pInsPos, "no insertion" ); if( !pInsPos ) return SVPAR_ERROR; - if( aColorTbl.Count() ) + if( !aColorTbl.empty() ) ClearColorTbl(); if( aFontTbl.Count() ) ClearFontTbl(); if( aStyleTbl.Count() ) ClearStyleTbl(); - if( aAttrStack.Count() ) + if( !aAttrStack.empty() ) ClearAttrStack(); bIsSetDfltTab = FALSE; @@ -488,10 +486,10 @@ void SvxRTFParser::ReadColorTable() // eine Farbe ist Fertig, in die Tabelle eintragen // versuche die Werte auf SV interne Namen zu mappen ColorPtr pColor = new Color( nRed, nGreen, nBlue ); - if( !aColorTbl.Count() && + if( aColorTbl.empty() && BYTE(-1) == nRed && BYTE(-1) == nGreen && BYTE(-1) == nBlue ) pColor->SetColor( COL_AUTO ); - aColorTbl.Insert( pColor, aColorTbl.Count() ); + aColorTbl.push_back( pColor ); nRed = 0, nGreen = 0, nBlue = 0; // Color konnte vollstaendig gelesen werden, @@ -818,7 +816,11 @@ void SvxRTFParser::ReadInfo( const sal_Char* pChkForVerNo ) void SvxRTFParser::ClearColorTbl() { - aColorTbl.DeleteAndDestroy( 0, aColorTbl.Count() ); + while ( !aColorTbl.empty() ) + { + delete aColorTbl.back(); + aColorTbl.pop_back(); + } } void SvxRTFParser::ClearFontTbl() @@ -836,9 +838,10 @@ void SvxRTFParser::ClearStyleTbl() void SvxRTFParser::ClearAttrStack() { SvxRTFItemStackType* pTmp; - for( ULONG nCnt = aAttrStack.Count(); nCnt; --nCnt ) + for( size_t nCnt = aAttrStack.size(); nCnt; --nCnt ) { - pTmp = aAttrStack.Pop(); + pTmp = aAttrStack.back(); + aAttrStack.pop_back(); delete pTmp; } } @@ -872,7 +875,7 @@ const Font& SvxRTFParser::GetFont( USHORT nId ) SvxRTFItemStackType* SvxRTFParser::_GetAttrSet( int bCopyAttr ) { - SvxRTFItemStackType* pAkt = aAttrStack.Top(); + SvxRTFItemStackType* pAkt = aAttrStack.back(); SvxRTFItemStackType* pNew; if( pAkt ) pNew = new SvxRTFItemStackType( *pAkt, *pInsPos, bCopyAttr ); @@ -881,7 +884,7 @@ SvxRTFItemStackType* SvxRTFParser::_GetAttrSet( int bCopyAttr ) *pInsPos ); pNew->SetRTFDefaults( GetRTFDefaults() ); - aAttrStack.Push( pNew ); + aAttrStack.push_back( pNew ); bNewGroup = FALSE; return pNew; } @@ -936,10 +939,11 @@ void SvxRTFParser::_ClearStyleAttr( SvxRTFItemStackType& rStkType ) void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen { - if( aAttrStack.Count() ) + if( !aAttrStack.empty() ) { - SvxRTFItemStackType *pOld = aAttrStack.Pop(); - SvxRTFItemStackType *pAkt = aAttrStack.Top(); + SvxRTFItemStackType *pOld = aAttrStack.back(); + aAttrStack.pop_back(); + SvxRTFItemStackType *pAkt = aAttrStack.back(); do { // middle check loop ULONG nOldSttNdIdx = pOld->pSttNd->GetIdx(); @@ -1114,9 +1118,9 @@ void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen // alle bis hierher gueltigen Attribute "setzen" AttrGroupEnd(); - pAkt = aAttrStack.Top(); // can be changed after AttrGroupEnd! + pAkt = aAttrStack.back(); // can be changed after AttrGroupEnd! pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 ); - aAttrStack.Push( pNew ); + aAttrStack.push_back( pNew ); pAkt = pNew; } } @@ -1144,8 +1148,8 @@ void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen void SvxRTFParser::SetAllAttrOfStk() // end all Attr. and set it into doc { - // noch alle Attrbute vom Stack holen !! - while( aAttrStack.Count() ) + // repeat until all attributes will be taken from stack + while( !aAttrStack.empty() ) AttrGroupEnd(); for( USHORT n = aAttrSetList.Count(); n; ) @@ -1174,10 +1178,10 @@ void SvxRTFParser::SetAttrSet( SvxRTFItemStackType &rSet ) SetAttrSet( *(*rSet.pChildList)[ n ] ); } - // wurde noch kein Text eingefuegt ? (SttPos vom obersten StackEintrag!) + // Is text wasn't inserted? (Get SttPos from the top of stack!) int SvxRTFParser::IsAttrSttPos() { - SvxRTFItemStackType* pAkt = aAttrStack.Top(); + SvxRTFItemStackType* pAkt = aAttrStack.back(); return !pAkt || (pAkt->pSttNd->GetIdx() == pInsPos->GetNodeIdx() && pAkt->nSttCnt == pInsPos->GetCntIdx()); } |