diff options
author | Daniel Di Marco <d.dimarco@gmx.de> | 2011-09-19 23:18:28 +0000 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2011-09-20 09:51:27 +0200 |
commit | a0a1c3f4fb730ed3614593c3d8ddb50c23204c29 (patch) | |
tree | 52ce44862678346b4855fec9e1fbb2099bfbc852 /sw/source | |
parent | 2c00d735d2859ca777f3d75e80f1737c6567421f (diff) |
replaced some SvUShorts with std::vector
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/crsr/findtxt.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/crsr/viscrs.cxx | 11 | ||||
-rw-r--r-- | sw/source/core/doc/tblrwcl.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/docnode/ndtbl.cxx | 43 | ||||
-rw-r--r-- | sw/source/core/inc/tblrwcl.hxx | 10 | ||||
-rw-r--r-- | sw/source/core/txtnode/ndtxt.cxx | 15 | ||||
-rw-r--r-- | sw/source/ui/app/docstyle.cxx | 20 |
7 files changed, 50 insertions, 64 deletions
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 3add53407f6c..9a86bac7ea84 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -32,9 +32,6 @@ #include <com/sun/star/util/SearchOptions.hpp> #include <com/sun/star/util/SearchFlags.hpp> -#define _SVSTDARR_USHORTS -#include <svl/svstdarr.hxx> - #include <vcl/svapp.hxx> #include <vcl/window.hxx> @@ -76,7 +73,7 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart, bool bNewHint = true; bool bNewSoftHyphen = true; const xub_StrLen nEnd = rEnde; - SvUShorts aReplaced; + std::vector<sal_uInt16> aReplaced; do { @@ -155,7 +152,7 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart, else { if ( bEmpty ) - aReplaced.Insert( nAkt, aReplaced.Count() ); + aReplaced.push_back( nAkt ); rRet.SetChar( nAkt, '\x7f' ); } } @@ -178,7 +175,7 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart, } while ( true ); - for( sal_uInt16 i = aReplaced.Count(); i; ) + for( sal_uInt16 i = aReplaced.size(); i; ) { const xub_StrLen nTmp = aReplaced[ --i ]; if( nTmp == rRet.Len() - 1 ) diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 3ec97b22fa87..8940ed209d91 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -30,11 +30,6 @@ #include "precompiled_sw.hxx" -#ifndef _SVSTDARR_HXX -#define _SVSTDARR_USHORTS -#include <svl/svstdarr.hxx> -#endif - #include <vcl/dialog.hxx> #include <vcl/msgbox.hxx> #include <vcl/wrkwin.hxx> @@ -560,21 +555,21 @@ short SwShellCrsr::MaxReplaceArived() { // Terminate old actions. The table-frames get constructed and // a SSelection can be created. - SvUShorts aArr; + std::vector<sal_uInt16> aArr; sal_uInt16 nActCnt; ViewShell *pShell = const_cast< SwCrsrShell* >( GetShell() ), *pSh = pShell; do { for( nActCnt = 0; pSh->ActionPend(); ++nActCnt ) pSh->EndAction(); - aArr.Insert( nActCnt, aArr.Count() ); + aArr.push_back( nActCnt ); } while( pShell != ( pSh = (ViewShell*)pSh->GetNext() ) ); { nRet = QueryBox( pDlg, SW_RES( MSG_COMCORE_ASKSEARCH )).Execute(); } - for( sal_uInt16 n = 0; n < aArr.Count(); ++n ) + for( sal_uInt16 n = 0; n < aArr.size(); ++n ) { for( nActCnt = aArr[n]; nActCnt--; ) pSh->StartAction(); diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 82fa926efcea..6ffb020064fa 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -111,7 +111,7 @@ struct CR_SetBoxWidth { SwSelBoxes aBoxes; SwSortTableLines aLines; - SvUShorts aLinesWidth; + std::vector<sal_uInt16> aLinesWidth; SwShareBoxFmts aShareFmts; SwTableNode* pTblNd; SwUndoTblNdsChg* pUndo; @@ -143,7 +143,7 @@ struct CR_SetBoxWidth bSplittBox( rCpy.bSplittBox ), bAnyBoxFnd( rCpy.bAnyBoxFnd ) { aLines.Insert( &rCpy.aLines ); - aLinesWidth.Insert( &rCpy.aLinesWidth, 0 ); + aLinesWidth = rCpy.aLinesWidth; } SwUndoTblNdsChg* CreateUndo( SwUndoId eUndoType ) @@ -161,7 +161,7 @@ struct CR_SetBoxWidth SwTableLinePtr p = (SwTableLine*)rBox.GetUpper(); sal_uInt16 nFndPos; if( aLines.Insert( p, nFndPos )) - aLinesWidth.Insert( nWidth, nFndPos ); + aLinesWidth.insert( aLinesWidth.begin()+nFndPos, nWidth ); else aLinesWidth[ nFndPos ] = aLinesWidth[ nFndPos ] + nWidth; } diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index ad98a5343bc0..eceaaa9ebce0 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -898,7 +898,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, new SwEndNode( rRange.aEnd, *pTblNd ); SwDoc* pDoc = GetDoc(); - SvUShorts aPosArr( 0, 16 ); + std::vector<sal_uInt16> aPosArr; SwTable * pTable = &pTblNd->GetTable(); SwTableLine* pLine; SwTableBox* pBox; @@ -927,17 +927,16 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, { if( *pTxt == cCh ) { - aPosArr.Insert( static_cast<sal_uInt16>( - aFInfo.GetCharPos( nChPos+1, sal_False )), - aPosArr.Count() ); + aPosArr.push_back( static_cast<sal_uInt16>( + aFInfo.GetCharPos( nChPos+1, sal_False )) ); } } - aPosArr.Insert( + aPosArr.push_back( static_cast<sal_uInt16>(aFInfo.GetFrm()->IsVertical() ? aFInfo.GetFrm()->Prt().Bottom() : - aFInfo.GetFrm()->Prt().Right()), - aPosArr.Count() ); + aFInfo.GetFrm()->Prt().Right()) ); + } } @@ -1046,15 +1045,15 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, // fehlen der 1. Line Boxen, dann kann man das Breiten Array // vergessen! if( !n ) - aPosArr.Remove( 0, aPosArr.Count() ); + aPosArr.clear(); } } - if( aPosArr.Count() ) + if( aPosArr.size() ) { SwTableLines& rLns = pTable->GetTabLines(); sal_uInt16 nLastPos = 0; - for( n = 0; n < aPosArr.Count(); ++n ) + for( n = 0; n < aPosArr.size(); ++n ) { SwTableBoxFmt *pNewFmt = pDoc->MakeTableBoxFmt(); pNewFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, @@ -1283,7 +1282,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, #endif SwDoc* pDoc = GetDoc(); - SvUShorts aPosArr( 0, 16 ); + std::vector<sal_uInt16> aPosArr; SwTable * pTable = &pTblNd->GetTable(); SwTableLine* pLine; SwTableBox* pBox; @@ -1369,11 +1368,11 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, // die Tabelle ausgleichen, leere Sections einfuegen sal_uInt16 n; - if( aPosArr.Count() ) + if( aPosArr.size() ) { SwTableLines& rLns = pTable->GetTabLines(); sal_uInt16 nLastPos = 0; - for( n = 0; n < aPosArr.Count(); ++n ) + for( n = 0; n < aPosArr.size(); ++n ) { SwTableBoxFmt *pNewFmt = pDoc->MakeTableBoxFmt(); pNewFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, @@ -2933,7 +2932,7 @@ void SwCollectTblLineBoxes::AddToUndoHistory( const SwCntntNode& rNd ) void SwCollectTblLineBoxes::AddBox( const SwTableBox& rBox ) { - aPosArr.Insert( nWidth, aPosArr.Count() ); + aPosArr.push_back(nWidth); SwTableBox* p = (SwTableBox*)&rBox; aBoxes.Insert( p, aBoxes.Count() ); nWidth = nWidth + (sal_uInt16)rBox.GetFrmFmt()->GetFrmSize().GetWidth(); @@ -2944,9 +2943,9 @@ const SwTableBox* SwCollectTblLineBoxes::GetBoxOfPos( const SwTableBox& rBox ) const SwTableBox* pRet = 0; sal_uInt16 n; - if( aPosArr.Count() ) + if( aPosArr.size() ) { - for( n = 0; n < aPosArr.Count(); ++n ) + for( n = 0; n < aPosArr.size(); ++n ) if( aPosArr[ n ] == nWidth ) break; else if( aPosArr[ n ] > nWidth ) @@ -2956,7 +2955,7 @@ const SwTableBox* SwCollectTblLineBoxes::GetBoxOfPos( const SwTableBox& rBox ) break; } - if( n >= aPosArr.Count() ) + if( n >= aPosArr.size() ) --n; nWidth = nWidth + (sal_uInt16)rBox.GetFrmFmt()->GetFrmSize().GetWidth(); @@ -2969,9 +2968,9 @@ sal_Bool SwCollectTblLineBoxes::Resize( sal_uInt16 nOffset, sal_uInt16 nOldWidth { sal_uInt16 n; - if( aPosArr.Count() ) + if( aPosArr.size() ) { - for( n = 0; n < aPosArr.Count(); ++n ) + for( n = 0; n < aPosArr.size(); ++n ) if( aPosArr[ n ] == nOffset ) break; else if( aPosArr[ n ] > nOffset ) @@ -2981,11 +2980,11 @@ sal_Bool SwCollectTblLineBoxes::Resize( sal_uInt16 nOffset, sal_uInt16 nOldWidth break; } - aPosArr.Remove( 0, n ); + aPosArr.clear(); aBoxes.Remove( 0, n ); // dann die Positionen der neuen Size anpassen - for( n = 0; n < aPosArr.Count(); ++n ) + for( n = 0; n < aPosArr.size(); ++n ) { sal_uLong nSize = nWidth; nSize *= ( aPosArr[ n ] - nOffset ); @@ -2993,7 +2992,7 @@ sal_Bool SwCollectTblLineBoxes::Resize( sal_uInt16 nOffset, sal_uInt16 nOldWidth aPosArr[ n ] = sal_uInt16( nSize ); } } - return 0 != aPosArr.Count(); + return 0 != aPosArr.size(); } sal_Bool lcl_Line_CollectBox( const SwTableLine*& rpLine, void* pPara ) diff --git a/sw/source/core/inc/tblrwcl.hxx b/sw/source/core/inc/tblrwcl.hxx index 23866a3c47e4..df93e44c27cc 100644 --- a/sw/source/core/inc/tblrwcl.hxx +++ b/sw/source/core/inc/tblrwcl.hxx @@ -27,10 +27,6 @@ ************************************************************************/ #ifndef _TBLRWCL_HXX #define _TBLRWCL_HXX -#ifndef _SVSTDARR_HXX -#define _SVSTDARR_USHORTS -#include <svl/svstdarr.hxx> -#endif #include <vector> #include <swtypes.hxx> #include <tblsel.hxx> @@ -87,7 +83,7 @@ SW_DLLPUBLIC void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo = 0 class SwCollectTblLineBoxes { - SvUShorts aPosArr; + std::vector<sal_uInt16> aPosArr; SwSelBoxes_SAR aBoxes; SwHistory* pHst; sal_uInt16 nMode, nWidth; @@ -96,7 +92,7 @@ class SwCollectTblLineBoxes public: SwCollectTblLineBoxes( sal_Bool bTop, sal_uInt16 nMd = 0, SwHistory* pHist=0 ) - : aPosArr( 16, 16 ), aBoxes( 16, 16 ), + : aBoxes( 16, 16 ), pHst( pHist ), nMode( nMd ), nWidth( 0 ), bGetFromTop( bTop ), bGetValues( sal_True ) @@ -111,7 +107,7 @@ public: { // hier wird die EndPos der Spalte benoetigt! if( pWidth ) - *pWidth = nPos+1 == aPosArr.Count() ? nWidth + *pWidth = nPos+1 == aPosArr.size() ? nWidth : aPosArr[ nPos+1 ]; return *aBoxes[ nPos ]; } diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 56ad4f480982..a38c2d15834f 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -3135,7 +3135,7 @@ const ModelToViewHelper::ConversionMap* XubString SwTxtNode::GetRedlineTxt( xub_StrLen nIdx, xub_StrLen nLen, sal_Bool bExpandFlds, sal_Bool bWithNum ) const { - SvUShorts aRedlArr; + std::vector<sal_uInt16> aRedlArr; const SwDoc* pDoc = GetDoc(); sal_uInt16 nRedlPos = pDoc->GetRedlinePos( *this, nsRedlineType_t::REDLINE_DELETE ); if( USHRT_MAX != nRedlPos ) @@ -3156,18 +3156,19 @@ XubString SwTxtNode::GetRedlineTxt( xub_StrLen nIdx, xub_StrLen nLen, else if( pREnd->nNode == nNdIdx ) { // von 0 bis nContent ist alles geloescht - aRedlArr.Insert( xub_StrLen(0), aRedlArr.Count() ); - aRedlArr.Insert( pREnd->nContent.GetIndex(), aRedlArr.Count() ); + aRedlArr.push_back( xub_StrLen(0) ); + aRedlArr.push_back( pREnd->nContent.GetIndex() ); } } else if( pRStt->nNode == nNdIdx ) { - aRedlArr.Insert( pRStt->nContent.GetIndex(), aRedlArr.Count() ); + //aRedlArr.Insert( pRStt->nContent.GetIndex(), aRedlArr.Count() ); + aRedlArr.push_back( pRStt->nContent.GetIndex() ); if( pREnd->nNode == nNdIdx ) - aRedlArr.Insert( pREnd->nContent.GetIndex(), aRedlArr.Count() ); + aRedlArr.push_back( pREnd->nContent.GetIndex() ); else { - aRedlArr.Insert( GetTxt().Len(), aRedlArr.Count() ); + aRedlArr.push_back( GetTxt().Len() ); break; // mehr kann nicht kommen } } @@ -3180,7 +3181,7 @@ XubString SwTxtNode::GetRedlineTxt( xub_StrLen nIdx, xub_StrLen nLen, XubString aTxt( GetTxt().Copy( nIdx, nLen ) ); xub_StrLen nTxtStt = nIdx, nIdxEnd = nIdx + aTxt.Len(); - for( sal_uInt16 n = 0; n < aRedlArr.Count(); n += 2 ) + for( sal_uInt16 n = 0; n < aRedlArr.size(); n += 2 ) { xub_StrLen nStt = aRedlArr[ n ], nEnd = aRedlArr[ n+1 ]; if( ( nIdx <= nStt && nStt <= nIdxEnd ) || diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx index b0f0734e289a..15abcb5bc1d4 100644 --- a/sw/source/ui/app/docstyle.cxx +++ b/sw/source/ui/app/docstyle.cxx @@ -29,8 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#define _SVSTDARR_USHORTS - #include <svl/smplhint.hxx> #include <hintids.hxx> #include <svl/itemiter.hxx> @@ -1445,30 +1443,30 @@ void lcl_DeleteInfoStyles( sal_uInt16 nFamily, SvPtrarr& rArr, SwDoc& rDoc ) { case SFX_STYLE_FAMILY_CHAR: { - SvUShorts aDelArr; + std::vector<sal_uInt16> aDelArr; const SwCharFmts& rTbl = *rDoc.GetCharFmts(); for( n = 0, nCnt = rTbl.Count(); n < nCnt; ++n ) { void* p = (void*)rTbl[ n ]; if( USHRT_MAX == rArr.GetPos( p )) - aDelArr.Insert( n, 0 ); + aDelArr.insert( aDelArr.begin(), n ); } - for( n = 0, nCnt = aDelArr.Count(); n < nCnt; ++n ) + for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n ) rDoc.DelCharFmt( aDelArr[ n ] ); } break; case SFX_STYLE_FAMILY_PARA : { - SvUShorts aDelArr; + std::vector<sal_uInt16> aDelArr; const SwTxtFmtColls& rTbl = *rDoc.GetTxtFmtColls(); for( n = 0, nCnt = rTbl.Count(); n < nCnt; ++n ) { void* p = (void*)rTbl[ n ]; if( USHRT_MAX == rArr.GetPos( p )) - aDelArr.Insert( n, 0 ); + aDelArr.insert( aDelArr.begin(), n ); } - for( n = 0, nCnt = aDelArr.Count(); n < nCnt; ++n ) + for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n ) rDoc.DelTxtFmtColl( aDelArr[ n ] ); } break; @@ -1490,15 +1488,15 @@ void lcl_DeleteInfoStyles( sal_uInt16 nFamily, SvPtrarr& rArr, SwDoc& rDoc ) case SFX_STYLE_FAMILY_PAGE: { - SvUShorts aDelArr; + std::vector<sal_uInt16> aDelArr; for( n = 0, nCnt = rDoc.GetPageDescCnt(); n < nCnt; ++n ) { void* p = (void*)&const_cast<const SwDoc &>(rDoc).GetPageDesc( n ); if( USHRT_MAX == rArr.GetPos( p )) - aDelArr.Insert( n, 0 ); + aDelArr.insert( aDelArr.begin(), n ); } - for( n = 0, nCnt = aDelArr.Count(); n < nCnt; ++n ) + for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n ) rDoc.DelPageDesc( aDelArr[ n ] ); } break; |