[Libreoffice-commits] .: editeng/source
Nigel Hawkins
nhawkins at kemper.freedesktop.org
Tue Feb 22 05:04:42 PST 2011
editeng/source/misc/txtrange.cxx | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
New commits:
commit 3521ca68a0ff1a820665e3adf4c3f970128dea7c
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date: Tue Feb 22 12:00:38 2011 +0000
Remove SvBools from editeng
diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx
index 6166f37..f6c0483 100644
--- a/editeng/source/misc/txtrange.cxx
+++ b/editeng/source/misc/txtrange.cxx
@@ -36,6 +36,8 @@
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <vector>
+
#ifdef WIN
#pragma optimize ( "", off )
#endif
@@ -120,7 +122,7 @@ void TextRanger::SetVertical( BOOL bNew )
class SvxBoundArgs
{
- SvBools aBoolArr;
+ std::vector<bool> aBoolArr;
SvLongs *pLongArr;
TextRanger *pTextRanger;
long nMin;
@@ -173,7 +175,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() )
@@ -268,7 +270,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;
@@ -277,7 +279,7 @@ void SvxBoundArgs::NoteRange( BOOL bToggle )
{ // Then a new one is inserted ...
pLongArr->Insert( nMin, nIdx );
pLongArr->Insert( nMax, nIdx + 1 );
- aBoolArr.Insert( bToggle, nIdx / 2 );
+ aBoolArr.insert( aBoolArr.begin() + (nIdx/2), bToggle );
}
else
{ // expand an existing interval ...
@@ -307,10 +309,10 @@ 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" );
- aBoolArr[ nMaxIdx ] ^= bToggle;
+ DBG_ASSERT( nMaxIdx < aBoolArr.size(), "NoteRange: Too much deleted" );
+ aBoolArr[ nMaxIdx ] = aBoolArr[ nMaxIdx ] ^ bToggle;
}
}
@@ -453,18 +455,18 @@ void SvxBoundArgs::Calc( const PolyPolygon& rPoly )
void SvxBoundArgs::Add()
{
- USHORT nLongIdx = 1;
- USHORT nCount = aBoolArr.Count();
+ ULONG nLongIdx = 1;
+ ULONG nCount = aBoolArr.size();
if( nCount && ( !bInner || !pTextRanger->IsSimple() ) )
{
BOOL bDelete = aBoolArr[ 0 ];
if( bInner )
bDelete = !bDelete;
- for( USHORT nBoolIdx = 1; nBoolIdx < nCount; ++nBoolIdx )
+ for( ULONG nBoolIdx = 1; nBoolIdx < nCount; ++nBoolIdx )
{
if( bDelete )
{
- USHORT next = 2;
+ ULONG next = 2;
while( nBoolIdx < nCount && !aBoolArr[ nBoolIdx++ ] &&
(!bInner || nBoolIdx < nCount ) )
next += 2;
@@ -472,7 +474,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
@@ -483,7 +485,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" );
}
}
@@ -511,7 +513,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();
More information about the Libreoffice-commits
mailing list