summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-07-20 12:08:29 +0200
committerMichael Stahl <mstahl@redhat.com>2012-07-26 14:30:10 +0200
commite7cda38616c967bcc8c07f94d32342ccd1b629c5 (patch)
treeaee4511f29b4beba37260bc8e7d34b8006a8d95d
parent74fdac012e33d84f24080381103e63bb0466ade7 (diff)
Convert SV_DECL_VARARR(SwRects) to std::vector
Change-Id: I7fa9380fad92d6667ccd9a635b2d26f700aa780e
-rw-r--r--sw/inc/swregion.hxx8
-rw-r--r--sw/source/core/bastyp/swregion.cxx78
-rw-r--r--sw/source/core/crsr/crsrsh.cxx12
-rw-r--r--sw/source/core/crsr/viscrs.cxx45
-rw-r--r--sw/source/core/doc/notxtfrm.cxx6
-rw-r--r--sw/source/core/layout/layact.cxx15
-rw-r--r--sw/source/core/layout/paintfrm.cxx50
-rw-r--r--sw/source/core/layout/trvlfrm.cxx7
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx16
-rw-r--r--sw/source/core/text/txtfly.cxx6
-rw-r--r--sw/source/core/view/viewsh.cxx26
11 files changed, 123 insertions, 146 deletions
diff --git a/sw/inc/swregion.hxx b/sw/inc/swregion.hxx
index b0f63f805e74..b4c18faafa24 100644
--- a/sw/inc/swregion.hxx
+++ b/sw/inc/swregion.hxx
@@ -28,17 +28,17 @@
#ifndef _SWREGION_HXX
#define _SWREGION_HXX
-#include <svl/svarray.hxx>
+#include <vector>
#include "swrect.hxx"
-SV_DECL_VARARR( SwRects, SwRect, 20 )
+typedef std::vector<SwRect> SwRects;
class SwRegionRects : public SwRects
{
SwRect aOrigin; // Copy of StartRect.
- inline void InsertRect( const SwRect &rRect, const sal_uInt16 nPos, sal_Bool &rDel);
+ inline void InsertRect( const SwRect &rRect, const sal_uInt16 nPos, bool &rDel);
public:
SwRegionRects( const SwRect& rStartRect, sal_uInt16 nInit = 20 );
@@ -50,7 +50,7 @@ public:
void Invert();
// Combine adjacent rectangles.
- void Compress( sal_Bool bFuzzy = sal_True );
+ void Compress( bool bFuzzy = true );
inline const SwRect &GetOrigin() const { return aOrigin; }
inline void ChangeOrigin( const SwRect &rRect ) { aOrigin = rRect; }
diff --git a/sw/source/core/bastyp/swregion.cxx b/sw/source/core/bastyp/swregion.cxx
index 06206b8c3bca..f745f4bd2e7b 100644
--- a/sw/source/core/bastyp/swregion.cxx
+++ b/sw/source/core/bastyp/swregion.cxx
@@ -30,29 +30,27 @@
#include "swregion.hxx"
#include "swtypes.hxx"
-SV_IMPL_VARARR( SwRects, SwRect );
-
SwRegionRects::SwRegionRects( const SwRect &rStartRect, sal_uInt16 nInit ) :
- SwRects( (sal_uInt8)nInit ),
+ SwRects(),
aOrigin( rStartRect )
{
- Insert( aOrigin, 0 );
+ reserve(nInit);
+ push_back( aOrigin );
}
// If <rDel> is sal_True then this Rect will be overwritten by <rRect> at
// position <nPos>. Otherwise <rRect> is attached at the end.
inline void SwRegionRects::InsertRect( const SwRect &rRect,
- const sal_uInt16 nPos, sal_Bool &rDel )
+ const sal_uInt16 nPos, bool &rDel )
{
if( rDel )
{
- pData = (SwRect*)pData; // looks weird but seems to help gcc ->i78417
- *(pData+nPos) = rRect;
- rDel = sal_False;
+ (*this)[nPos] = rRect;
+ rDel = false;
}
else
{
- Insert( rRect, Count() );
+ push_back( rRect );
}
}
@@ -64,18 +62,18 @@ inline void SwRegionRects::InsertRect( const SwRect &rRect,
*/
void SwRegionRects::operator-=( const SwRect &rRect )
{
- sal_uInt16 nMax = Count();
+ sal_uInt16 nMax = size();
for ( sal_uInt16 i = 0; i < nMax; ++i )
{
- if ( rRect.IsOver( *(pData+i) ) )
+ if ( rRect.IsOver( (*this)[i] ) )
{
- SwRect aTmp( *(pData+i) );
+ SwRect aTmp( (*this)[i] );
SwRect aInter( aTmp );
aInter._Intersection( rRect );
// The first Rect that should be inserted takes position of i.
// This avoids one Delete() call.
- sal_Bool bDel = sal_True;
+ bool bDel = true;
// now split; only those rectangles should be left over that are in
// the "old" but not in the "new" area; hence, not in intersection.
@@ -108,7 +106,7 @@ void SwRegionRects::operator-=( const SwRect &rRect )
if( bDel )
{
- Remove( i );
+ erase( begin() + i );
--i; // so that we don't forget any
--nMax; // so that we don't check too much
}
@@ -132,24 +130,12 @@ void SwRegionRects::Invert()
// To avoid unnecessary memory requirements, create a "useful" initial size:
// Number of rectangles in this area * 2 + 2 for the special case of a
// single hole (so four Rects in the inverse case).
- SwRegionRects aInvRegion( aOrigin, Count()*2+2 );
- const SwRect *pDat = GetData();
- for( sal_uInt16 i = 0; i < Count(); ++pDat, ++i )
- aInvRegion -= *pDat;
+ SwRegionRects aInvRegion( aOrigin, size()*2+2 );
+ for( const_iterator it = begin(); it != end(); ++it )
+ aInvRegion -= *it;
- sal_uInt16 nCpy = Count(), nDel = 0;
- if( aInvRegion.Count() < Count() )
- {
- nDel = Count() - aInvRegion.Count();
- nCpy = aInvRegion.Count();
- }
// overwrite all existing
- memcpy( pData, aInvRegion.GetData(), nCpy * sizeof( SwRect ));
-
- if( nCpy < aInvRegion.Count() )
- Insert( &aInvRegion, nCpy, nCpy );
- else if( nDel )
- Remove( nCpy, nDel );
+ swap( aInvRegion );
}
inline SwTwips CalcArea( const SwRect &rRect )
@@ -158,23 +144,23 @@ inline SwTwips CalcArea( const SwRect &rRect )
}
// combine all adjacent rectangles
-void SwRegionRects::Compress( sal_Bool bFuzzy )
+void SwRegionRects::Compress( bool bFuzzy )
{
- for ( int i = 0; i < Count(); ++i )
+ for ( size_type i = 0; i < size(); ++i )
{
- for ( int j = i+1; j < Count(); ++j )
+ for ( size_type j = i+1; j < size(); ++j )
{
// If one rectangle contains a second completely than the latter
// does not need to be stored and can be deleted
- if ( (*(pData + i)).IsInside( *(pData + j) ) )
+ if ( (*this)[i].IsInside( (*this)[j] ) )
{
- Remove( static_cast<sal_uInt16>(j), 1 );
+ erase( begin() + j );
--j;
}
- else if ( (*(pData + j)).IsInside( *(pData + i) ) )
+ else if ( (*this)[j].IsInside( (*this)[i] ) )
{
- *(pData + i) = *(pData + j);
- Remove( static_cast<sal_uInt16>(j), 1 );
+ (*this)[i] = (*this)[j];
+ erase( begin() + j );
i = -1;
break;
}
@@ -187,16 +173,16 @@ void SwRegionRects::Compress( sal_Bool bFuzzy )
// ( 9622 * 141.5 = 1361513 ~= a quarter (1/4) centimeter wider
// than the width of a A4 page
const long nFuzzy = bFuzzy ? 1361513 : 0;
- SwRect aUnion( *(pData + i) );
- aUnion.Union( *(pData + j) );
- SwRect aInter( *(pData + i) );
- aInter.Intersection( *(pData + j));
- if ( (::CalcArea( *(pData + i) ) +
- ::CalcArea( *(pData + j) ) + nFuzzy) >=
+ SwRect aUnion( (*this)[i] );
+ aUnion.Union( (*this)[j] );
+ SwRect aInter( (*this)[i] );
+ aInter.Intersection( (*this)[j] );
+ if ( (::CalcArea( (*this)[i] ) +
+ ::CalcArea( (*this)[j] ) + nFuzzy) >=
(::CalcArea( aUnion ) - CalcArea( aInter )) )
{
- *(pData + i) = aUnion;
- Remove( static_cast<sal_uInt16>(j), 1 );
+ (*this)[i] = aUnion;
+ erase( begin() + j );
i = -1;
break;
}
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 31bd6dadb3ac..78544a8b9f28 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1851,8 +1851,8 @@ void SwCrsrShell::RefreshBlockCursor()
--pPam;
SwShellCrsr* pNew = new SwShellCrsr( *pCurCrsr );
- pNew->Insert( pCurCrsr, 0 );
- pCurCrsr->Remove( 0, pCurCrsr->Count() );
+ pNew->insert( pNew->begin(), pCurCrsr->begin(), pCurCrsr->end());
+ pCurCrsr->clear();
pCurCrsr->DeleteMark();
*pCurCrsr->GetPoint() = *(*pPam)->GetPoint(); // n-2, n-3, .., 2, 1
@@ -1868,8 +1868,8 @@ void SwCrsrShell::RefreshBlockCursor()
}
{
SwShellCrsr* pNew = new SwShellCrsr( *pCurCrsr );
- pNew->Insert( pCurCrsr, 0 );
- pCurCrsr->Remove( 0, pCurCrsr->Count() );
+ pNew->insert( pNew->begin(), pCurCrsr->begin(), pCurCrsr->end() );
+ pCurCrsr->clear();
pCurCrsr->DeleteMark();
}
pPam = aSelList.getEnd();
@@ -1937,8 +1937,8 @@ sal_Bool SwCrsrShell::Pop( sal_Bool bOldCrsr )
pOldStk->GetPtPos() == pCurCrsr->GetMkPos() )
{
// move "Selections Rectangles"
- pCurCrsr->Insert( pOldStk, 0 );
- pOldStk->Remove( 0, pOldStk->Count() );
+ pCurCrsr->insert( pCurCrsr->begin(), pOldStk->begin(), pOldStk->end() );
+ pOldStk->clear();
}
if( pOldStk->HasMark() )
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 139461ceed0d..22a4b7c3d4ac 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -265,7 +265,7 @@ void SwVisCrsr::_SetPosAndShow()
SwSelPaintRects::SwSelPaintRects( const SwCrsrShell& rCSh )
-: SwRects( 0 ),
+: SwRects(),
pCShell( &rCSh ),
mpCursorOverlay(0)
{
@@ -278,14 +278,7 @@ SwSelPaintRects::~SwSelPaintRects()
void SwSelPaintRects::swapContent(SwSelPaintRects& rSwap)
{
- SwRects aTempRects;
- aTempRects.Insert(this, 0);
-
- Remove(0, Count());
- Insert(&rSwap, 0);
-
- rSwap.Remove(0, rSwap.Count());
- rSwap.Insert(&aTempRects, 0);
+ SwRects::swap(rSwap);
// #i75172# also swap mpCursorOverlay
sdr::overlay::OverlayObject* pTempOverlay = getCursorOverlay();
@@ -301,7 +294,7 @@ void SwSelPaintRects::Hide()
mpCursorOverlay = 0;
}
- SwRects::Remove( 0, Count() );
+ SwRects::clear();
}
void SwSelPaintRects::Show()
@@ -311,13 +304,13 @@ void SwSelPaintRects::Show()
if(pView && pView->PaintWindowCount())
{
// reset rects
- SwRects::Remove( 0, SwRects::Count() );
+ SwRects::clear();
FillRects();
// get new rects
std::vector< basegfx::B2DRange > aNewRanges;
- for(sal_uInt16 a(0); a < Count(); a++)
+ for(sal_uInt16 a(0); a < size(); a++)
{
const SwRect aNextRect((*this)[a]);
const Rectangle aPntRect(aNextRect.SVRect());
@@ -339,7 +332,7 @@ void SwSelPaintRects::Show()
mpCursorOverlay = 0;
}
}
- else if(Count())
+ else if(!empty())
{
SdrPaintWindow* pCandidate = pView->GetPaintWindow(0);
rtl::Reference< ::sdr::overlay::OverlayManager > xTargetOverlay = pCandidate->GetOverlayManager();
@@ -382,31 +375,31 @@ void SwSelPaintRects::Show()
void SwSelPaintRects::Invalidate( const SwRect& rRect )
{
- sal_uInt16 nSz = Count();
+ sal_uInt16 nSz = size();
if( !nSz )
return;
SwRegionRects aReg( GetShell()->VisArea() );
- aReg.Remove( 0, aReg.Count() );
- aReg.Insert( this, 0 );
+ aReg.assign( begin(), end() );
aReg -= rRect;
- SwRects::Remove( 0, nSz );
- SwRects::Insert( &aReg, 0 );
+ SwRects::erase( begin(), begin() + nSz );
+ SwRects::insert( begin(), aReg.begin(), aReg.end() );
// If the selection is to the right or at the bottom, outside the
// visible area, it is never aligned on one pixel at the right/bottom.
// This has to be determined here and if that is the case the
// rectangle has to be expanded.
- if( GetShell()->bVisPortChgd && 0 != ( nSz = Count()) )
+ if( GetShell()->bVisPortChgd && 0 != ( nSz = size()) )
{
SwSelPaintRects::Get1PixelInLogic( *GetShell() );
- SwRect* pRect = (SwRect*)GetData();
- for( ; nSz--; ++pRect )
+ iterator it = begin();
+ for( ; nSz--; ++it )
{
- if( pRect->Right() == GetShell()->aOldRBPos.X() )
- pRect->Right( pRect->Right() + nPixPtX );
- if( pRect->Bottom() == GetShell()->aOldRBPos.Y() )
- pRect->Bottom( pRect->Bottom() + nPixPtY );
+ SwRect& rRectIt = *it;
+ if( rRectIt.Right() == GetShell()->aOldRBPos.X() )
+ rRectIt.Right( rRectIt.Right() + nPixPtX );
+ if( rRectIt.Bottom() == GetShell()->aOldRBPos.Y() )
+ rRectIt.Bottom( rRectIt.Bottom() + nPixPtY );
}
}
}
@@ -680,7 +673,7 @@ void SwShellTableCrsr::FillRects()
}
}
aReg.Invert();
- Insert( &aReg, 0 );
+ insert( begin(), aReg.begin(), aReg.end() );
}
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index e9e7ab889e06..a04eaaeb6332 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -210,18 +210,18 @@ void lcl_ClearArea( const SwFrm &rFrm,
SwRegionRects aRegion( rPtArea, 4 );
aRegion -= rGrfArea;
- if ( aRegion.Count() )
+ if ( !aRegion.empty() )
{
const SvxBrushItem *pItem; const Color *pCol; SwRect aOrigRect;
if ( rFrm.GetBackgroundBrush( pItem, pCol, aOrigRect, sal_False ) )
- for( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for( sal_uInt16 i = 0; i < aRegion.size(); ++i )
::DrawGraphic( pItem, &rOut, aOrigRect, aRegion[i] );
else
{
rOut.Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
rOut.SetFillColor( rFrm.getRootFrm()->GetCurrShell()->Imp()->GetRetoucheColor());
rOut.SetLineColor();
- for( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for( sal_uInt16 i = 0; i < aRegion.size(); ++i )
rOut.DrawRect( aRegion[i].SVRect() );
rOut.Pop();
}
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 123f4cbd7578..adeda9d9f70f 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -210,7 +210,7 @@ sal_Bool SwLayAction::PaintWithoutFlys( const SwRect &rRect, const SwCntntFrm *p
const SwFlyFrm *pSelfFly = pCnt->FindFlyFrm();
sal_uInt16 i;
- for ( i = 0; i < rObjs.Count() && aTmp.Count(); ++i )
+ for ( i = 0; i < rObjs.Count() && !aTmp.empty(); ++i )
{
SdrObject *pO = rObjs[i]->DrawObj();
if ( !pO->ISA(SwVirtFlyDrawObj) )
@@ -279,9 +279,8 @@ sal_Bool SwLayAction::PaintWithoutFlys( const SwRect &rRect, const SwCntntFrm *p
}
sal_Bool bRetPaint = sal_False;
- const SwRect *pData = aTmp.GetData();
- for ( i = 0; i < aTmp.Count(); ++pData, ++i )
- bRetPaint |= pImp->GetShell()->AddPaintRect( *pData );
+ for ( SwRects::const_iterator it = aTmp.begin(); it != aTmp.end(); ++it )
+ bRetPaint |= pImp->GetShell()->AddPaintRect( *it );
return bRetPaint;
}
@@ -1421,13 +1420,13 @@ sal_Bool SwLayAction::FormatLayout( SwLayoutFrm *pLay, sal_Bool bAddRect )
SwRegionRects aRegion( aOldRect );
aRegion -= aPaint;
- for ( i = 0; i < aRegion.Count(); ++i )
+ for ( i = 0; i < aRegion.size(); ++i )
pImp->GetShell()->AddPaintRect( aRegion[i] );
aRegion.ChangeOrigin( aPaint );
- aRegion.Remove( 0, aRegion.Count() );
- aRegion.Insert( aPaint, 0 );
+ aRegion.clear();
+ aRegion.push_back( aPaint );
aRegion -= aOldRect;
- for ( i = 0; i < aRegion.Count(); ++i )
+ for ( i = 0; i < aRegion.size(); ++i )
pImp->GetShell()->AddPaintRect( aRegion[i] );
}
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index ba913024e813..e2995ab8fecd 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1494,7 +1494,7 @@ void lcl_SubtractFlys( const SwFrm *pFrm, const SwPageFrm *pPage,
if ( !pRetoucheFly )
pRetoucheFly = pRetoucheFly2;
- for ( sal_uInt16 j = 0; (j < rObjs.Count()) && rRegion.Count(); ++j )
+ for ( sal_uInt16 j = 0; (j < rObjs.Count()) && !rRegion.empty(); ++j )
{
const SwAnchoredObject* pAnchoredObj = rObjs[j];
const SdrObject* pSdrObj = pAnchoredObj->GetDrawObj();
@@ -2104,7 +2104,7 @@ void DrawGraphic( const SvxBrushItem *pBrush,
else
bGrfBackgrdAlreadyDrawn = true;
/// loop rectangles of background region, which has to be drawn
- for( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for( sal_uInt16 i = 0; i < aRegion.size(); ++i )
{
pOutDev->DrawRect( aRegion[i].SVRect() );
}
@@ -4035,12 +4035,12 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
{
pOut->SetClipRegion( aPoly );
}
- for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
PaintBackground( aRegion[i], pPage, rAttrs, sal_False, sal_True );
pOut->Pop();
}
else
- for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
PaintBackground( aRegion[i], pPage, rAttrs, sal_False, sal_True );
}
@@ -4232,21 +4232,21 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
/// OD 06.08.2002 #99657# - draw full shadow rectangle
aOut.Top( aOut.Top() + nHeight );
aOut.Left( aOut.Left() + nWidth );
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
}
else
{
aOut.Top ( aOut.Bottom() - nHeight );
aOut.Left( aOut.Left() + nWidth );
if ( bBottom )
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
aOut.Left( aOut.Right() - nWidth );
aOut.Top ( rOutRect.Top() + nHeight );
if ( bBottom )
aOut.Bottom( aOut.Bottom() - nHeight );
if ( bCnt && (!bTop || !bBottom) )
::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
}
rOutRect.Right ( rOutRect.Right() - nWidth );
@@ -4260,21 +4260,21 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
/// OD 06.08.2002 #99657# - draw full shadow rectangle
aOut.Bottom( aOut.Bottom() - nHeight );
aOut.Right( aOut.Right() - nWidth );
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
}
else
{
aOut.Bottom( aOut.Top() + nHeight );
aOut.Right ( aOut.Right() - nWidth );
if ( bTop )
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
aOut.Right ( aOut.Left() + nWidth );
aOut.Bottom( rOutRect.Bottom() - nHeight );
if ( bTop )
aOut.Top( aOut.Top() + nHeight );
if ( bCnt && (!bBottom || !bTop) )
::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
}
rOutRect.Left( rOutRect.Left() + nWidth );
@@ -4288,21 +4288,21 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
/// OD 06.08.2002 #99657# - draw full shadow rectangle
aOut.Bottom( aOut.Bottom() - nHeight);
aOut.Left( aOut.Left() + nWidth );
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
}
else
{
aOut.Bottom( aOut.Top() + nHeight );
aOut.Left ( aOut.Left()+ nWidth );
if ( bTop )
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
aOut.Left ( aOut.Right() - nWidth );
aOut.Bottom( rOutRect.Bottom() - nHeight );
if ( bTop )
aOut.Top( aOut.Top() + nHeight );
if ( bCnt && (!bBottom || bTop) )
::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
}
rOutRect.Right( rOutRect.Right() - nWidth );
@@ -4316,21 +4316,21 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
/// OD 06.08.2002 #99657# - draw full shadow rectangle
aOut.Top( aOut.Top() + nHeight );
aOut.Right( aOut.Right() - nWidth );
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
}
else
{
aOut.Top ( aOut.Bottom()- nHeight );
aOut.Right( aOut.Right() - nWidth );
if ( bBottom )
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
aOut.Right( aOut.Left() + nWidth );
aOut.Top( rOutRect.Top() + nHeight );
if ( bBottom )
aOut.Bottom( aOut.Bottom() - nHeight );
if ( bCnt && (!bTop || !bBottom) )
::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
}
rOutRect.Left( rOutRect.Left() + nWidth );
@@ -4346,7 +4346,7 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
sal_uLong nOldDrawMode = pOut->GetDrawMode();
Color aShadowColor( rShadow.GetColor() );
- if( aRegion.Count() && pGlobalShell->GetWin() &&
+ if( !aRegion.empty() && pGlobalShell->GetWin() &&
Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
{
// Is heigh contrast mode, the output device has already set the
@@ -4362,7 +4362,7 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
pOut->SetDrawMode( nOldDrawMode );
- for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
{
SwRect &rOut = aRegion[i];
aOut = rOut;
@@ -4415,7 +4415,7 @@ void SwFrm::PaintBorderLine( const SwRect& rRect,
{
SwRegionRects aRegion( aOut, 4 );
::lcl_SubtractFlys( this, pPage, aOut, aRegion );
- for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
pLines->AddLineRect( aRegion[i], pColor, nStyle, pTab, nSubCol );
}
else
@@ -5583,14 +5583,14 @@ void SwPageFrm::PaintMarginArea( const SwRect& _rOutputRect,
const SwPageFrm* pPage = static_cast<const SwPageFrm*>(this);
if ( pPage->GetSortedObjs() )
::lcl_SubtractFlys( this, pPage, aPgRect, aPgRegion );
- if ( aPgRegion.Count() )
+ if ( !aPgRegion.empty() )
{
OutputDevice *pOut = _pViewShell->GetOut();
if ( pOut->GetFillColor() != aGlobalRetoucheColor )
pOut->SetFillColor( aGlobalRetoucheColor );
- for ( sal_uInt16 i = 0; i < aPgRegion.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < aPgRegion.size(); ++i )
{
- if ( 1 < aPgRegion.Count() )
+ if ( 1 < aPgRegion.size() )
{
::SwAlignRect( aPgRegion[i], pGlobalShell );
if( !aPgRegion[i].HasArea() )
@@ -6142,9 +6142,9 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
/// --> Status Quo: background transparency have to be
/// considered for fly frames
const sal_Bool bConsiderBackgroundTransparency = IsFlyFrm();
- for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
{
- if ( 1 < aRegion.Count() )
+ if ( 1 < aRegion.size() )
{
::SwAlignRect( aRegion[i], pGlobalShell );
if( !aRegion[i].HasArea() )
@@ -6898,7 +6898,7 @@ void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const
// #i16816# tagged pdf support
SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *pSh->GetOut() );
- for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
{
SwRect &rRetouche = aRegion[i];
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index e32f8ac60e15..3f7cc79cbe13 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -2097,8 +2097,8 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
SwRect aTmp( pCell->Prt() );
aTmp.Pos() += pCell->Frm().Pos();
aRegion.ChangeOrigin( aTmp );
- aRegion.Remove( 0, aRegion.Count() );
- aRegion.Insert( aTmp, 0 );
+ aRegion.clear();
+ aRegion.push_back( aTmp);
}
else
{
@@ -2675,8 +2675,7 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
Sub( aRegion, aDropRect );
}
- rCrsr.Remove( 0, rCrsr.Count() );
- rCrsr.Insert( &aRegion, 0 );
+ rCrsr.assign( aRegion.begin(), aRegion.end() );
}
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index d9b3def8e04a..3d1e6d957dad 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1703,8 +1703,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
// Note: We make a copy of the rectangles, because they may
// be deleted again in JumpToSwMark.
SwRects aTmp;
- aTmp.Insert( mrSh.SwCrsrShell::_GetCrsr(), 0 );
- OSL_ENSURE( aTmp.Count() > 0, "Enhanced pdf export - rectangles are missing" );
+ aTmp.insert( aTmp.begin(), mrSh.SwCrsrShell::_GetCrsr()->begin(), mrSh.SwCrsrShell::_GetCrsr()->end() );
+ OSL_ENSURE( !aTmp.empty(), "Enhanced pdf export - rectangles are missing" );
// Create the destination for internal links:
sal_Int32 nDestId = -1;
@@ -1732,7 +1732,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
const bool bHeaderFooter = pDoc->IsInHeaderFooter( aPos.nNode );
// Create links for all selected rectangles:
- const sal_uInt16 nNumOfRects = aTmp.Count();
+ const sal_uInt16 nNumOfRects = aTmp.size();
for ( sal_uInt16 i = 0; i < nNumOfRects; ++i )
{
// Link Rectangle
@@ -1865,8 +1865,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
// Link Rectangles
SwRects aTmp;
- aTmp.Insert( mrSh.SwCrsrShell::_GetCrsr(), 0 );
- OSL_ENSURE( aTmp.Count() > 0, "Enhanced pdf export - rectangles are missing" );
+ aTmp.insert( aTmp.begin(), mrSh.SwCrsrShell::_GetCrsr()->begin(), mrSh.SwCrsrShell::_GetCrsr()->end() );
+ OSL_ENSURE( !aTmp.empty(), "Enhanced pdf export - rectangles are missing" );
mrSh.SwCrsrShell::ClearMark();
@@ -1890,7 +1890,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
const bool bHeaderFooter = pDoc->IsInHeaderFooter( aPos.nNode );
// Create links for all selected rectangles:
- const sal_uInt16 nNumOfRects = aTmp.Count();
+ const sal_uInt16 nNumOfRects = aTmp.size();
for ( sal_uInt16 i = 0; i < nNumOfRects; ++i )
{
// Link rectangle
@@ -1954,8 +1954,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
// Link Rectangle
SwRects aTmp;
- aTmp.Insert( mrSh.SwCrsrShell::_GetCrsr(), 0 );
- OSL_ENSURE( aTmp.Count() > 0, "Enhanced pdf export - rectangles are missing" );
+ aTmp.insert( aTmp.begin(), mrSh.SwCrsrShell::_GetCrsr()->begin(), mrSh.SwCrsrShell::_GetCrsr()->end() );
+ OSL_ENSURE( !aTmp.empty(), "Enhanced pdf export - rectangles are missing" );
const SwRect aLinkRect( aTmp[ 0 ] );
mrSh._GetCrsr()->RestoreSavePos();
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index f8ed3b58c413..adbdff3534e9 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -589,11 +589,11 @@ sal_Bool SwTxtFly::DrawTextOpaque( SwDrawTextInfo &rInf )
rInf.SetPos( rOld );
return sal_False;
}
- else if( aRegion.Count() )
+ else if( !aRegion.empty() )
{
// What a huge effort ...
SwSaveClip aClipVout( rInf.GetpOut() );
- for( MSHORT i = 0; i < aRegion.Count(); ++i )
+ for( MSHORT i = 0; i < aRegion.size(); ++i )
{
SwRect &rRect = aRegion[i];
if( rRect != aRegion.GetOrigin() )
@@ -659,7 +659,7 @@ void SwTxtFly::DrawFlyRect( OutputDevice* pOut, const SwRect &rRect,
}
}
- for( MSHORT i = 0; i < aRegion.Count(); ++i )
+ for( MSHORT i = 0; i < aRegion.size(); ++i )
{
if ( bNoGraphic )
pOut->DrawRect( aRegion[i].SVRect() );
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 60b7bc313c9e..fb9de45b0524 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -294,10 +294,10 @@ void ViewShell::ImplEndAction( const sal_Bool bIdleEnd )
pRegion->Compress();
VirtualDevice *pVout = 0;
- while ( pRegion->Count() )
+ while ( !pRegion->empty() )
{
- SwRect aRect( (*pRegion)[ pRegion->Count() - 1 ] );
- pRegion->Remove( pRegion->Count() - 1 );
+ SwRect aRect( pRegion->back() );
+ pRegion->pop_back();
sal_Bool bPaint = sal_True;
if ( IsEndActionByVirDev() )
@@ -1501,18 +1501,18 @@ void ViewShell::PaintDesktop( const SwRect &rRect )
}
pPage = pPage->GetNext();
}
- aRegion.Remove( 0, aRegion.Count() );
+ aRegion.clear();
if ( aLeft.HasArea() )
- aRegion.Insert( aLeft, 0 );
+ aRegion.push_back( aLeft );
if ( aRight.HasArea() )
- aRegion.Insert( aRight, 1 );
+ aRegion.push_back( aRight );
}
else
{
const SwFrm *pPage = Imp()->GetFirstVisPage();
const SwTwips nBottom = rRect.Bottom();
//const SwTwips nRight = rRect.Right();
- while ( pPage && aRegion.Count() &&
+ while ( pPage && !aRegion.empty() &&
(pPage->Frm().Top() <= nBottom) ) // PAGES01 && (pPage->Frm().Left() <= nRight))
{
SwRect aPageRect( pPage->Frm() );
@@ -1533,7 +1533,7 @@ void ViewShell::PaintDesktop( const SwRect &rRect )
pPage = pPage->GetNext();
}
}
- if ( aRegion.Count() )
+ if ( !aRegion.empty() )
_PaintDesktop( aRegion );
}
@@ -1545,7 +1545,7 @@ void ViewShell::_PaintDesktop( const SwRegionRects &rRegion )
GetOut()->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
GetOut()->SetLineColor();
- for ( sal_uInt16 i = 0; i < rRegion.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < rRegion.size(); ++i )
{
const Rectangle aRectangle(rRegion[i].SVRect());
@@ -1634,7 +1634,7 @@ sal_Bool ViewShell::CheckInvalidForPaint( const SwRect &rRect )
//Nur dann interessant, wenn sich im sichtbaren Bereich etwas
//veraendert hat.
sal_Bool bStop = sal_True;
- for ( sal_uInt16 i = 0; i < pRegion->Count(); ++i )
+ for ( sal_uInt16 i = 0; i < pRegion->size(); ++i )
{
const SwRect &rTmp = (*pRegion)[i];
if ( sal_False == (bStop = rTmp.IsOver( VisArea() )) )
@@ -1653,10 +1653,10 @@ sal_Bool ViewShell::CheckInvalidForPaint( const SwRect &rRect )
pRegion->Invert();
pRegion->Compress();
bRet = sal_False;
- if ( pRegion->Count() )
+ if ( !pRegion->empty() )
{
SwRegionRects aRegion( rRect );
- for ( sal_uInt16 i = 0; i < pRegion->Count(); ++i )
+ for ( sal_uInt16 i = 0; i < pRegion->size(); ++i )
{ const SwRect &rTmp = (*pRegion)[i];
if ( !rRect.IsInside( rTmp ) )
{
@@ -1669,7 +1669,7 @@ sal_Bool ViewShell::CheckInvalidForPaint( const SwRect &rRect )
}
if ( bRet )
{
- for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
GetWin()->Invalidate( aRegion[i].SVRect() );
if ( rRect != VisArea() )