[Libreoffice-commits] .: binfilter/bf_svx binfilter/inc
Joseph Powers
jpowers at kemper.freedesktop.org
Thu Jan 20 22:01:11 PST 2011
binfilter/bf_svx/source/xoutdev/svx__xpoly.cxx | 444 +++++++++----------------
binfilter/inc/bf_svx/xpolyimp.hxx | 7
2 files changed, 173 insertions(+), 278 deletions(-)
New commits:
commit bdd055a9d247ce59a741868caa08c6ba9f052334
Author: Joseph Powers <jpowers27 at cox.net>
Date: Thu Jan 20 22:01:06 2011 -0800
Remove DECLARE_LIST( XPolygonList, XPolygon* )
diff --git a/binfilter/bf_svx/source/xoutdev/svx__xpoly.cxx b/binfilter/bf_svx/source/xoutdev/svx__xpoly.cxx
index b78e03e..d24c313 100644
--- a/binfilter/bf_svx/source/xoutdev/svx__xpoly.cxx
+++ b/binfilter/bf_svx/source/xoutdev/svx__xpoly.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -62,7 +62,7 @@ namespace binfilter {
/*N*/ nResize = nInResize;
/*N*/ nPoints = 0;
/*N*/ nRefCount = 1;
-/*N*/
+/*N*/
/*N*/ Resize( nInitSize );
/*N*/ }
@@ -79,7 +79,7 @@ namespace binfilter {
/*N*/ ImpXPolygon::ImpXPolygon( const ImpXPolygon& rImpXPoly )
/*N*/ {
/*N*/ ( (ImpXPolygon&) rImpXPoly ).CheckPointDelete();
-/*N*/
+/*N*/
/*N*/ pPointAry = NULL;
/*N*/ pFlagAry = NULL;
/*N*/ bDeleteOldPoints = FALSE;
@@ -87,9 +87,9 @@ namespace binfilter {
/*N*/ nResize = rImpXPoly.nResize;
/*N*/ nPoints = 0;
/*N*/ nRefCount = 1;
-/*N*/
+/*N*/
/*N*/ Resize( rImpXPoly.nSize );
-/*N*/
+/*N*/
/*N*/ // Kopieren
/*N*/ nPoints = rImpXPoly.nPoints;
/*N*/ memcpy( pPointAry, rImpXPoly.pPointAry, nSize*sizeof( Point ) );
@@ -152,13 +152,13 @@ namespace binfilter {
/*N*/ {
/*N*/ if( nNewSize == nSize )
/*N*/ return;
-/*N*/
+/*N*/
/*N*/ BYTE* pOldFlagAry = pFlagAry;
/*N*/ USHORT nOldSize = nSize;
-/*N*/
+/*N*/
/*N*/ CheckPointDelete();
/*N*/ pOldPointAry = pPointAry;
-/*N*/
+/*N*/
/*N*/ // Neue Groesse auf vielfaches von nResize runden, sofern Objekt
/*N*/ // nicht neu angelegt wurde (nSize != 0)
/*N*/ if ( nSize != 0 && nNewSize > nSize )
@@ -170,11 +170,11 @@ namespace binfilter {
/*N*/ nSize = nNewSize;
/*N*/ pPointAry = (Point*)new char[ nSize*sizeof( Point ) ];
/*N*/ memset( pPointAry, 0, nSize*sizeof( Point ) );
-/*N*/
+/*N*/
/*N*/ // Flag Array erzeugen
/*N*/ pFlagAry = new BYTE[ nSize ];
/*N*/ memset( pFlagAry, 0, nSize );
-/*N*/
+/*N*/
/*N*/ // Eventuell umkopieren
/*N*/ if( nOldSize )
/*N*/ {
@@ -187,7 +187,7 @@ namespace binfilter {
/*N*/ {
/*N*/ memcpy( pPointAry, pOldPointAry, nSize*sizeof( Point ) );
/*N*/ memcpy( pFlagAry, pOldFlagAry, nSize );
-/*N*/
+/*N*/
/*N*/ // Anzahl der gueltigen Punkte anpassen
/*N*/ if( nPoints > nSize )
/*N*/ nPoints = nSize;
@@ -212,14 +212,14 @@ namespace binfilter {
/*N*/ void ImpXPolygon::InsertSpace( USHORT nPos, USHORT nCount )
/*N*/ {
/*N*/ CheckPointDelete();
-/*N*/
+/*N*/
/*N*/ if ( nPos > nPoints )
/*N*/ nPos = nPoints;
-/*N*/
+/*N*/
/*N*/ // Wenn Polygon zu klein dann groesser machen
/*N*/ if( (nPoints + nCount) > nSize )
/*N*/ Resize( nPoints + nCount );
-/*N*/
+/*N*/
/*N*/ // Wenn nicht hinter dem letzten Punkt eingefuegt wurde,
/*N*/ // den Rest nach hinten schieben
/*N*/ if( nPos < nPoints )
@@ -231,7 +231,7 @@ namespace binfilter {
/*N*/ }
/*N*/ memset( &pPointAry[nPos], 0, nCount * sizeof( Point ) );
/*N*/ memset( &pFlagAry [nPos], 0, nCount );
-/*N*/
+/*N*/
/*N*/ nPoints += nCount;
/*N*/ }
@@ -249,11 +249,11 @@ namespace binfilter {
/*N*/ void ImpXPolygon::Remove( USHORT nPos, USHORT nCount )
/*N*/ {
/*N*/ CheckPointDelete();
-/*N*/
+/*N*/
/*N*/ if( (nPos + nCount) <= nPoints )
/*N*/ {
/*N*/ USHORT nMove = nPoints - nPos - nCount;
-/*N*/
+/*N*/
/*N*/ if( nMove )
/*N*/ {
/*?*/ memmove( &pPointAry[nPos], &pPointAry[nPos+nCount],
@@ -313,11 +313,11 @@ namespace binfilter {
/*N*/ XPolygon::XPolygon( const Polygon& rPoly )
/*N*/ {
/*N*/ DBG_CTOR(XPolygon,NULL);
-/*N*/
+/*N*/
/*N*/ USHORT nSize = rPoly.GetSize();
/*N*/ pImpXPolygon = new ImpXPolygon( nSize );
/*N*/ pImpXPolygon->nPoints = nSize;
-/*N*/
+/*N*/
/*N*/ for( USHORT i = 0; i < nSize; i++ )
/*N*/ {
/*N*/ pImpXPolygon->pPointAry[i] = rPoly[i];
@@ -341,22 +341,22 @@ namespace binfilter {
/*N*/ pImpXPolygon = new ImpXPolygon(17);
/*N*/ long nWh = (rRect.GetWidth() - 1) / 2;
/*N*/ long nHh = (rRect.GetHeight() - 1) / 2;
-/*N*/
+/*N*/
/*N*/ if ( nRx > nWh ) nRx = nWh;
/*N*/ if ( nRy > nHh ) nRy = nHh;
-/*N*/
+/*N*/
/*N*/ // Rx negativ, damit Umlauf im Uhrzeigersinn erfolgt
/*N*/ nRx = -nRx;
-/*N*/
+/*N*/
/*N*/ // Faktor fuer Kontrollpunkte der Bezierkurven: 8/3 * (sin(45g) - 0.5)
/*N*/ long nXHdl = (long)(0.552284749 * nRx);
/*N*/ long nYHdl = (long)(0.552284749 * nRy);
/*N*/ USHORT nPos = 0;
-/*N*/
+/*N*/
/*N*/ if ( nRx && nRy )
/*N*/ {
/*N*/ Point aCenter;
-/*N*/
+/*N*/
/*N*/ for (USHORT nQuad = 0; nQuad < 4; nQuad++)
/*N*/ {
/*N*/ switch ( nQuad )
@@ -410,17 +410,17 @@ namespace binfilter {
/*N*/ {
/*N*/ DBG_CTOR(XPolygon,NULL);
/*N*/ pImpXPolygon = new ImpXPolygon(17);
-/*N*/
+/*N*/
/*N*/ nStartAngle %= 3600;
/*N*/ if ( nEndAngle > 3600 ) nEndAngle %= 3600;
/*N*/ BOOL bFull = (nStartAngle == 0 && nEndAngle == 3600);
-/*N*/
+/*N*/
/*N*/ // Faktor fuer Kontrollpunkte der Bezierkurven: 8/3 * (sin(45g) - 0.5)
/*N*/ long nXHdl = (long)(0.552284749 * nRx);
/*N*/ long nYHdl = (long)(0.552284749 * nRy);
/*N*/ USHORT nPos = 0;
/*N*/ BOOL bLoopEnd = FALSE;
-/*N*/
+/*N*/
/*N*/ do
/*N*/ {
/*N*/ USHORT nA1, nA2;
@@ -431,13 +431,13 @@ namespace binfilter {
/*N*/ nPos += 3;
/*N*/ if ( !bLoopEnd )
/*N*/ pImpXPolygon->pFlagAry[nPos] = (BYTE) XPOLY_SMOOTH;
-/*N*/
+/*N*/
/*N*/ } while ( !bLoopEnd );
-/*N*/
+/*N*/
/*N*/ // Wenn kein Vollkreis, dann ggf. Enden mit Mittelpunkt verbinden
/*N*/ if ( !bFull && bClose )
/*N*/ pImpXPolygon->pPointAry[++nPos] = rCenter;
-/*N*/
+/*N*/
/*N*/ if ( bFull )
/*N*/ {
/*N*/ pImpXPolygon->pFlagAry[0 ] = (BYTE) XPOLY_SMOOTH;
@@ -525,10 +525,10 @@ namespace binfilter {
/*N*/ {
/*N*/ pImpXPolygon->CheckPointDelete();
/*N*/ CheckReference();
-/*N*/
+/*N*/
/*N*/ if( pImpXPolygon->nSize < nPoints )
/*?*/ pImpXPolygon->Resize( nPoints );
-/*N*/
+/*N*/
/*N*/ if ( nPoints < pImpXPolygon->nPoints )
/*N*/ {
/*N*/ USHORT nSize = pImpXPolygon->nPoints - nPoints;
@@ -625,9 +625,9 @@ namespace binfilter {
/*N*/ {
/*N*/ if ( !nHorzMove && !nVertMove )
/*N*/ return;
-/*N*/
+/*N*/
/*N*/ CheckReference();
-/*N*/
+/*N*/
/*N*/ // Punkte verschieben
/*N*/ USHORT nCount = pImpXPolygon->nPoints;
/*N*/ for ( USHORT i = 0; i < nCount; i++ )
@@ -651,7 +651,7 @@ namespace binfilter {
/*N*/ Rectangle XPolygon::GetBoundRect(OutputDevice *pOut) const
/*N*/ {
/*N*/ pImpXPolygon->CheckPointDelete();
-/*N*/
+/*N*/
/*N*/ Rectangle aRect(XOutCalcXPolyExtent(*this, pOut));
// USHORT nCount = pImpXPolygon->nPoints;
@@ -700,7 +700,7 @@ namespace binfilter {
/*N*/ const Point& XPolygon::operator[]( USHORT nPos ) const
/*N*/ {
/*N*/ DBG_ASSERT(nPos < pImpXPolygon->nPoints, "Ungueltiger Index bei const-Arrayzugriff auf XPolygon");
-/*N*/
+/*N*/
/*N*/ pImpXPolygon->CheckPointDelete();
/*N*/ return pImpXPolygon->pPointAry[nPos];
/*N*/ }
@@ -719,7 +719,7 @@ namespace binfilter {
/*N*/ {
/*N*/ pImpXPolygon->CheckPointDelete();
/*N*/ CheckReference();
-/*N*/
+/*N*/
/*N*/ if( nPos >= pImpXPolygon->nSize )
/*N*/ {
/*N*/ DBG_ASSERT(pImpXPolygon->nResize, "Ungueltiger Index bei Arrayzugriff auf XPolygon");
@@ -727,7 +727,7 @@ namespace binfilter {
/*N*/ }
/*N*/ if( nPos >= pImpXPolygon->nPoints )
/*N*/ pImpXPolygon->nPoints = nPos + 1;
-/*N*/
+/*N*/
/*N*/ return pImpXPolygon->pPointAry[nPos];
/*N*/ }
@@ -744,14 +744,14 @@ namespace binfilter {
/*N*/ XPolygon& XPolygon::operator=( const XPolygon& rXPoly )
/*N*/ {
/*N*/ pImpXPolygon->CheckPointDelete();
-/*N*/
+/*N*/
/*N*/ rXPoly.pImpXPolygon->nRefCount++;
-/*N*/
+/*N*/
/*N*/ if( pImpXPolygon->nRefCount > 1 )
/*N*/ pImpXPolygon->nRefCount--;
/*N*/ else
/*N*/ delete pImpXPolygon;
-/*N*/
+/*N*/
/*N*/ pImpXPolygon = rXPoly.pImpXPolygon;
/*N*/ return *this;
/*N*/ }
@@ -880,7 +880,7 @@ namespace binfilter {
/*N*/ double fU3 = fU * fU2;
/*N*/ USHORT nIdx = nPos;
/*N*/ short nPosInc, nIdxInc;
-/*N*/
+/*N*/
/*N*/ if ( bCalcFirst )
/*N*/ {
/*N*/ nPos += 3;
@@ -925,7 +925,7 @@ namespace binfilter {
/*N*/ Point* pPoints = pImpXPolygon->pPointAry;
/*N*/ pPoints[nFirst ] = rCenter;
/*N*/ pPoints[nFirst+3] = rCenter;
-/*N*/
+/*N*/
/*N*/ if ( nQuad == 1 || nQuad == 2 )
/*N*/ {
/*N*/ nRx = -nRx; nXHdl = -nXHdl;
@@ -934,7 +934,7 @@ namespace binfilter {
/*N*/ {
/*N*/ nRy = -nRy; nYHdl = -nYHdl;
/*N*/ }
-/*N*/
+/*N*/
/*N*/ if ( nQuad == 0 || nQuad == 2 )
/*N*/ {
/*N*/ pPoints[nFirst].X() += nRx; pPoints[nFirst+3].Y() += nRy;
@@ -945,7 +945,7 @@ namespace binfilter {
/*N*/ }
/*N*/ pPoints[nFirst+1] = pPoints[nFirst];
/*N*/ pPoints[nFirst+2] = pPoints[nFirst+3];
-/*N*/
+/*N*/
/*N*/ if ( nQuad == 0 || nQuad == 2 )
/*N*/ {
/*N*/ pPoints[nFirst+1].Y() += nYHdl; pPoints[nFirst+2].X() += nXHdl;
@@ -971,12 +971,12 @@ namespace binfilter {
/*N*/ USHORT nStPrev = nStart;
/*N*/ USHORT nMax = (nStart / 900 + 1) * 900;
/*N*/ USHORT nMin = nMax - 900;
-/*N*/
+/*N*/
/*N*/ if ( nEnd >= nMax || nEnd <= nStart ) nA2 = 900;
/*N*/ else nA2 = nEnd - nMin;
/*N*/ nA1 = nStart - nMin;
/*N*/ nStart = nMax;
-/*N*/
+/*N*/
/*N*/ // TRUE zurueck, falls letztes Segment berechnet wurde
/*N*/ return (nStPrev < nEnd && nStart >= nEnd);
/*N*/ }
@@ -1038,9 +1038,9 @@ namespace binfilter {
/*N*/ {
/*N*/ pImpXPolygon->CheckPointDelete();
/*N*/ CheckReference();
-/*N*/
+/*N*/
/*N*/ USHORT nPntCnt = pImpXPolygon->nPoints;
-/*N*/
+/*N*/
/*N*/ for (USHORT i = 0; i < nPntCnt; i++)
/*N*/ pImpXPolygon->pPointAry[i] += rTrans;
/*N*/ }
@@ -1060,16 +1060,16 @@ namespace binfilter {
/*N*/ {
/*N*/ pImpXPolygon->CheckPointDelete();
/*N*/ CheckReference();
-/*N*/
+/*N*/
/*N*/ long nX;
/*N*/ long nY;
/*N*/ long nNewX;
/*N*/ long nNewY;
/*N*/ long nCenterX = rCenter.X();
/*N*/ long nCenterY = rCenter.Y();
-/*N*/
+/*N*/
/*N*/ USHORT nPntCnt = pImpXPolygon->nPoints;
-/*N*/
+/*N*/
/*N*/ for (USHORT i = 0; i < nPntCnt; i++)
/*N*/ {
/*N*/ Point *pPt = &(pImpXPolygon->pPointAry[i]);
@@ -1079,7 +1079,7 @@ namespace binfilter {
/*N*/ nNewY = -(long)floor(fSin * nX - fCos * nY + 0.5);
/*N*/ pPt->X() = nNewX + nCenterX;
/*N*/ pPt->Y() = nNewY + nCenterY;
-/*N*/
+/*N*/
/* und so stand das in einem anderen File auf T:
dass ich am 29-11-1995 gegettet habe. Joe M.
USHORT nPntCnt = pImpXPolygon->nPoints;
@@ -1110,7 +1110,7 @@ namespace binfilter {
/*N*/ void XPolygon::Rotate(const Point& rCenter, USHORT nAngle)
/*N*/ {
/*N*/ nAngle %= 3600;
-/*N*/
+/*N*/
/*N*/ if ( nAngle != 0 )
/*N*/ {
/*N*/ double fAngle = F_PI * nAngle / 1800;
@@ -1134,9 +1134,9 @@ namespace binfilter {
/*N*/ {
/*N*/ pImpXPolygon->CheckPointDelete();
/*N*/ CheckReference();
-/*N*/
+/*N*/
/*N*/ USHORT nPntCnt = pImpXPolygon->nPoints;
-/*N*/
+/*N*/
/*N*/ for (USHORT i = 0; i < nPntCnt; i++)
/*N*/ {
/*N*/ Point& rPnt = pImpXPolygon->pPointAry[i];
@@ -1160,9 +1160,9 @@ namespace binfilter {
/*N*/ {
/*N*/ pImpXPolygon->CheckPointDelete();
/*N*/ CheckReference();
-/*N*/
+/*N*/
/*N*/ USHORT nPntCnt = pImpXPolygon->nPoints;
-/*N*/
+/*N*/
/*N*/ for (USHORT i = 0; i < nPntCnt; i++)
/*N*/ {
/*N*/ Point& rPnt = pImpXPolygon->pPointAry[i];
@@ -1222,7 +1222,7 @@ namespace binfilter {
/*N*/ SvStream& operator>>( SvStream& rIStream, XPolygon& rXPoly )
/*N*/ {
/*N*/ DBG_CHKOBJ( &rXPoly, XPolygon, NULL );
-/*N*/
+/*N*/
/*N*/ USHORT i;
/*N*/ USHORT nStart;
/*N*/ USHORT nCurPoints;
@@ -1233,9 +1233,9 @@ namespace binfilter {
/*N*/ short nShortY;
/*N*/ long nLongX;
/*N*/ long nLongY;
-/*N*/
+/*N*/
/*N*/ rXPoly.pImpXPolygon->CheckPointDelete();
-/*N*/
+/*N*/
/*N*/ // Anzahl der Punkte einlesen und Array erzeugen
/*N*/ rIStream >> nReadPoints;
/*N*/ nMerkPoints=nReadPoints;
@@ -1245,7 +1245,7 @@ namespace binfilter {
/*N*/ // dass beim Lesen Informationsverlusst aufgetreten ist !!!!!
/*N*/ }
/*N*/ rXPoly.pImpXPolygon->nPoints = nMerkPoints;
-/*N*/
+/*N*/
/*N*/ if ( rXPoly.pImpXPolygon->nRefCount != 1 )
/*N*/ {
/*?*/ if ( rXPoly.pImpXPolygon->nRefCount )
@@ -1254,7 +1254,7 @@ namespace binfilter {
/*N*/ }
/*N*/ else
/*N*/ rXPoly.pImpXPolygon->Resize( nMerkPoints );
-/*N*/
+/*N*/
/*N*/ // Je nach CompressMode das Polygon einlesen
/*N*/ if ( rIStream.GetCompressMode() == COMPRESSMODE_FULL )
/*N*/ {
@@ -1262,7 +1262,7 @@ namespace binfilter {
/*?*/ while ( i < nReadPoints )
/*?*/ {
/*?*/ rIStream >> bShort >> nCurPoints;
-/*?*/
+/*?*/
/*?*/ if ( bShort )
/*?*/ {
/*?*/ for ( nStart = i; i < nStart+nCurPoints; i++ )
@@ -1324,7 +1324,7 @@ namespace binfilter {
// Kontrollpunkte am Ende entfernen (kann auftreten bei truncate wg. 64k-Grenze!)
/*?*/ rXPoly.Remove(USHORT(rXPoly.GetPointCount()-1),1);
/*N*/ }
-/*N*/
+/*N*/
/*N*/ return rIStream;
/*N*/ }
@@ -1341,18 +1341,18 @@ namespace binfilter {
/*N*/ SvStream& operator<<( SvStream& rOStream, const XPolygon& rXPoly )
/*N*/ {
/*N*/ DBG_CHKOBJ( &rXPoly, XPolygon, NULL );
-/*N*/
+/*N*/
/*N*/ unsigned char bShort;
/*N*/ unsigned char bCurShort;
/*N*/ USHORT nStart;
/*N*/ USHORT i;
/*N*/ USHORT nPoints = rXPoly.GetPointCount();
-/*N*/
+/*N*/
/*N*/ rXPoly.pImpXPolygon->CheckPointDelete();
-/*N*/
+/*N*/
/*N*/ // Anzahl der Punkte rausschreiben
/*N*/ rOStream << nPoints;
-/*N*/
+/*N*/
/*N*/ // Je nach CompressMode das Polygon rausschreiben
/*N*/ if ( rOStream.GetCompressMode() == COMPRESSMODE_FULL )
/*N*/ {
@@ -1360,7 +1360,7 @@ namespace binfilter {
/*?*/ while ( i < nPoints )
/*?*/ {
/*?*/ nStart = i;
-/*?*/
+/*?*/
/*?*/ // Feststellen, welcher Typ geschrieben werden soll
/*?*/ if ( ((rXPoly.pImpXPolygon->pPointAry[nStart].X() >= SHRT_MIN) &&
/*?*/ (rXPoly.pImpXPolygon->pPointAry[nStart].X() <= SHRT_MAX)) &&
@@ -1379,7 +1379,7 @@ namespace binfilter {
/*?*/ bCurShort = TRUE;
/*?*/ else
/*?*/ bCurShort = FALSE;
-/*?*/
+/*?*/
/*?*/ // Wenn sich die Werte in einen anderen Bereich begeben,
/*?*/ // muessen wir neu rausschreiben
/*?*/ if ( bCurShort != bShort )
@@ -1387,12 +1387,12 @@ namespace binfilter {
/*?*/ bShort = bCurShort;
/*?*/ break;
/*?*/ }
-/*?*/
+/*?*/
/*?*/ i++;
/*?*/ }
-/*?*/
+/*?*/
/*?*/ rOStream << bShort << (USHORT)(i-nStart);
-/*?*/
+/*?*/
/*?*/ if ( bShort )
/*?*/ {
/*?*/ for( ; nStart < i; nStart++ )
@@ -1431,10 +1431,10 @@ namespace binfilter {
/*N*/ else if ( nPoints )
/*N*/ rOStream.Write( rXPoly.pImpXPolygon->pPointAry, nPoints*sizeof(Point) );
/*N*/ }
-/*N*/
+/*N*/
/*N*/ if ( nPoints )
/*N*/ rOStream.Write( rXPoly.pImpXPolygon->pFlagAry, nPoints );
-/*N*/
+/*N*/
/*N*/ return rOStream;
/*N*/ }
@@ -1453,19 +1453,13 @@ namespace binfilter {
|*
*************************************************************************/
-/*N*/ ImpXPolyPolygon::ImpXPolyPolygon( const ImpXPolyPolygon& rImpXPolyPoly ) :
-/*N*/ aXPolyList( rImpXPolyPoly.aXPolyList )
-/*N*/ {
-/*N*/ nRefCount = 1;
-/*N*/
-/*N*/ // Einzelne Elemente duplizieren
-/*N*/ XPolygon* pXPoly = aXPolyList.First();
-/*N*/ while ( pXPoly )
-/*N*/ {
-/*N*/ aXPolyList.Replace( new XPolygon( *(aXPolyList.GetCurObject()) ) );
-/*N*/ pXPoly = aXPolyList.Next();
-/*N*/ }
-/*N*/ }
+ImpXPolyPolygon::ImpXPolyPolygon( const ImpXPolyPolygon& rImpXPolyPoly )
+ : aXPolyList( rImpXPolyPoly.aXPolyList )
+{
+ nRefCount = 1;
+ for ( size_t i = 0, n = aXPolyList.size(); i < n; ++i )
+ aXPolyList[ i ] = new XPolygon( *aXPolyList[ i ] );
+}
/*************************************************************************
@@ -1478,26 +1472,12 @@ namespace binfilter {
|*
*************************************************************************/
-/*N*/ ImpXPolyPolygon::~ImpXPolyPolygon()
-/*N*/ {
-/*N*/ XPolygon* pXPoly = aXPolyList.First();
-/*N*/ while( pXPoly )
-/*N*/ {
-/*N*/ delete pXPoly;
-/*N*/ pXPoly = aXPolyList.Next();
-/*N*/ }
-/*N*/ }
-
-/*************************************************************************
-|*
-|* ImpXPolyPolygon::operator==()
-|*
-|* Ersterstellung Joe 26-09-95
-|* Letzte Aenderung
-|*
-*************************************************************************/
-
-
+ImpXPolyPolygon::~ImpXPolyPolygon()
+{
+ for (size_t i = 0, n = aXPolyList.size(); i < n; ++i )
+ delete aXPolyList[ i ];
+ aXPolyList.clear();
+}
/*************************************************************************
|*
@@ -1509,11 +1489,11 @@ namespace binfilter {
|*
*************************************************************************/
-/*N*/ XPolyPolygon::XPolyPolygon( USHORT nInitSize, USHORT nResize )
-/*N*/ {
-/*N*/ DBG_CTOR(XPolyPolygon,NULL);
-/*N*/ pImpXPolyPolygon = new ImpXPolyPolygon( nInitSize, nResize );
-/*N*/ }
+XPolyPolygon::XPolyPolygon( USHORT /* nInitSize */, USHORT /* nResize */ )
+{
+ DBG_CTOR(XPolyPolygon,NULL);
+ pImpXPolyPolygon = new ImpXPolyPolygon();
+}
/*************************************************************************
@@ -1530,7 +1510,7 @@ namespace binfilter {
/*N*/ {
/*N*/ DBG_CTOR(XPolyPolygon,NULL);
/*N*/ pImpXPolyPolygon = new ImpXPolyPolygon;
-/*N*/ pImpXPolyPolygon->aXPolyList.Insert( new XPolygon( rXPoly ) );
+/*N*/ pImpXPolyPolygon->aXPolyList.push_back( new XPolygon( rXPoly ) );
/*N*/ }
/*************************************************************************
@@ -1564,10 +1544,9 @@ namespace binfilter {
/*N*/ {
/*N*/ DBG_CTOR(XPolyPolygon,NULL);
/*N*/ pImpXPolyPolygon = new ImpXPolyPolygon;
-/*N*/
-/*N*/ for (USHORT i = 0; i < rPolyPoly.Count(); i++)
-/*N*/ pImpXPolyPolygon->aXPolyList.Insert(
-/*N*/ new XPolygon(rPolyPoly.GetObject(i)) );
+/*N*/
+/*N*/ for ( size_t i = 0; i < rPolyPoly.Count(); i++ )
+/*N*/ pImpXPolyPolygon->aXPolyList.push_back( new XPolygon( rPolyPoly[ i ] ) );
/*N*/ }
/*************************************************************************
@@ -1618,47 +1597,19 @@ namespace binfilter {
|*
*************************************************************************/
-/*N*/ void XPolyPolygon::Insert( const XPolygon& rXPoly, USHORT nPos )
-/*N*/ {
-/*N*/ CheckReference();
-/*N*/ XPolygon* pXPoly = new XPolygon( rXPoly );
-/*N*/ pImpXPolyPolygon->aXPolyList.Insert( pXPoly, nPos );
-/*N*/ }
-
-/*************************************************************************
-|*
-|* XPolyPolygon::Insert()
-|*
-|* saemtliche XPolygone aus einem XPolyPolygon einfuegen
-|* Ersterstellung 18.01.95 ESO
-|* Letzte Aenderung 18.01.95 ESO
-|*
-*************************************************************************/
-
-
-/*************************************************************************
-|*
-|* XPolyPolygon::Remove()
-|*
-|* Beschreibung POLY.SDW
-|* Ersterstellung CL 27.01.93
-|* Letzte Aenderung CL 27.01.93
-|*
-*************************************************************************/
-
-
-
-/*************************************************************************
-|*
-|* XPolyPolygon::Replace()
-|*
-|* Beschreibung POLY.SDW
-|* Ersterstellung CL 27.01.93
-|* Letzte Aenderung CL 27.01.93
-|*
-*************************************************************************/
-
-
+void XPolyPolygon::Insert( const XPolygon& rXPoly, USHORT nPos )
+{
+ CheckReference();
+ XPolygon* pXPoly = new XPolygon( rXPoly );
+ if ( nPos < pImpXPolyPolygon->aXPolyList.size() )
+ {
+ XPolygonList::iterator it = pImpXPolyPolygon->aXPolyList.begin();
+ ::std::advance( it, nPos );
+ pImpXPolyPolygon->aXPolyList.insert( it, pXPoly );
+ }
+ else
+ pImpXPolyPolygon->aXPolyList.push_back( pXPoly );
+}
/*************************************************************************
|*
@@ -1672,7 +1623,7 @@ namespace binfilter {
/*N*/ const XPolygon& XPolyPolygon::GetObject( USHORT nPos ) const
/*N*/ {
-/*N*/ return *(pImpXPolyPolygon->aXPolyList.GetObject( nPos ));
+/*N*/ return *( pImpXPolyPolygon->aXPolyList[ nPos ] );
/*N*/ }
@@ -1695,13 +1646,9 @@ namespace binfilter {
/*N*/ }
/*N*/ else
/*N*/ {
-/*N*/ XPolygon* pXPoly = pImpXPolyPolygon->aXPolyList.First();
-/*N*/ while( pXPoly )
-/*N*/ {
-/*N*/ delete pXPoly;
-/*N*/ pXPoly = pImpXPolyPolygon->aXPolyList.Next();
-/*N*/ }
-/*N*/ pImpXPolyPolygon->aXPolyList.Clear();
+ for ( size_t i = 0, n = pImpXPolyPolygon->aXPolyList.size(); i < n; ++i )
+ delete pImpXPolyPolygon->aXPolyList[ i ];
+ pImpXPolyPolygon->aXPolyList.clear();
/*N*/ }
/*N*/ }
@@ -1718,7 +1665,7 @@ namespace binfilter {
/*N*/ USHORT XPolyPolygon::Count() const
/*N*/ {
-/*N*/ return (USHORT)(pImpXPolyPolygon->aXPolyList.Count());
+/*N*/ return (USHORT)(pImpXPolyPolygon->aXPolyList.size());
/*N*/ }
@@ -1732,23 +1679,22 @@ namespace binfilter {
|*
*************************************************************************/
-/*N*/ void XPolyPolygon::Move( long nHorzMove, long nVertMove )
-/*N*/ {
-/*N*/ // Diese Abfrage sollte man fuer die DrawEngine durchfuehren
-/*N*/ if ( !nHorzMove && !nVertMove )
-/*N*/ return;
-/*N*/
-/*N*/ // Referenzcounter beruecksichtigen
-/*N*/ CheckReference();
-/*N*/
-/*N*/ // Punkte verschieben
-/*N*/ XPolygon* pXPoly = pImpXPolyPolygon->aXPolyList.First();
-/*N*/ while( pXPoly )
-/*N*/ {
-/*N*/ pXPoly->Move( nHorzMove, nVertMove );
-/*N*/ pXPoly = pImpXPolyPolygon->aXPolyList.Next();
-/*N*/ }
-/*N*/ }
+void XPolyPolygon::Move( long nHorzMove, long nVertMove )
+{
+ // Diese Abfrage sollte man fuer die DrawEngine durchfuehren
+ if ( !nHorzMove && !nVertMove )
+ return;
+
+ // Referenzcounter beruecksichtigen
+ CheckReference();
+
+ // Punkte verschieben
+ for ( size_t i = 0, n = pImpXPolyPolygon->aXPolyList.size(); i < n; ++i )
+ {
+ XPolygon* pXPoly = pImpXPolyPolygon->aXPolyList[ i ];
+ pXPoly->Move( nHorzMove, nVertMove );
+ }
+}
/*************************************************************************
|*
@@ -1762,16 +1708,15 @@ namespace binfilter {
/*N*/ Rectangle XPolyPolygon::GetBoundRect(OutputDevice* pOut) const
/*N*/ {
-/*N*/ USHORT nXPoly = (USHORT)pImpXPolyPolygon->aXPolyList.Count();
+/*N*/ size_t nXPoly = pImpXPolyPolygon->aXPolyList.size();
/*N*/ Rectangle aRect;
-/*N*/
-/*N*/ for ( USHORT n = 0; n < nXPoly; n++ )
+/*N*/
+/*N*/ for ( size_t n = 0; n < nXPoly; n++ )
/*N*/ {
-/*N*/ const XPolygon* pXPoly = pImpXPolyPolygon->aXPolyList.GetObject( n );
-/*N*/
+/*N*/ const XPolygon* pXPoly = pImpXPolyPolygon->aXPolyList[ n ];
/*N*/ aRect.Union( pXPoly->GetBoundRect(pOut) );
/*N*/ }
-/*N*/
+/*N*/
/*N*/ return aRect;
/*N*/ }
@@ -1789,7 +1734,7 @@ namespace binfilter {
/*N*/ XPolygon& XPolyPolygon::operator[]( USHORT nPos )
/*N*/ {
/*N*/ CheckReference();
-/*N*/ return *(pImpXPolyPolygon->aXPolyList.GetObject( nPos ));
+/*N*/ return *( pImpXPolyPolygon->aXPolyList[ nPos ] );
/*N*/ }
/*************************************************************************
@@ -1805,12 +1750,12 @@ namespace binfilter {
/*N*/ XPolyPolygon& XPolyPolygon::operator=( const XPolyPolygon& rXPolyPoly )
/*N*/ {
/*N*/ rXPolyPoly.pImpXPolyPolygon->nRefCount++;
-/*N*/
+/*N*/
/*N*/ if( pImpXPolyPolygon->nRefCount > 1 )
/*N*/ pImpXPolyPolygon->nRefCount--;
/*N*/ else
/*N*/ delete pImpXPolyPolygon;
-/*N*/
+/*N*/
/*N*/ pImpXPolyPolygon = rXPolyPoly.pImpXPolyPolygon;
/*N*/ return *this;
/*N*/ }
@@ -1852,9 +1797,9 @@ namespace binfilter {
/*N*/ void XPolyPolygon::Translate(const Point& rTrans)
/*N*/ {
/*N*/ CheckReference();
-/*N*/
+/*N*/
/*N*/ for (USHORT i = 0; i < Count(); i++)
-/*N*/ pImpXPolyPolygon->aXPolyList.GetObject(i)->Translate(rTrans);
+/*N*/ pImpXPolyPolygon->aXPolyList[ i ]->Translate(rTrans);
/*N*/ }
/*************************************************************************
@@ -1871,9 +1816,9 @@ namespace binfilter {
/*N*/ void XPolyPolygon::Rotate(const Point& rCenter, double fSin, double fCos)
/*N*/ {
/*N*/ CheckReference();
-/*N*/
+/*N*/
/*N*/ for (USHORT i = 0; i < Count(); i++)
-/*N*/ pImpXPolyPolygon->aXPolyList.GetObject(i)->Rotate(rCenter, fSin, fCos);
+/*N*/ pImpXPolyPolygon->aXPolyList[ i ]->Rotate(rCenter, fSin, fCos);
/*N*/ }
/*************************************************************************
@@ -1886,18 +1831,6 @@ namespace binfilter {
/*************************************************************************
|*
-|* XPolyPolygon::Rotate()
-|*
-|* Alle Poylgone um den Punkt rCenter mit dem Winkel nAngle drehen
-|* Winkel in 10tel Grad, Wertebereich 0 - 3600
-|* Ersterstellung ESO 25.01.95
-|* Letzte Aenderung ESO 25.01.95
-|*
-*************************************************************************/
-
-
-/*************************************************************************
-|*
|* XPolyPolygon::Scale()
|*
|* Alle Polygone in X- und/oder Y-Richtung skalieren
@@ -1909,9 +1842,9 @@ namespace binfilter {
/*N*/ void XPolyPolygon::Scale(double fSx, double fSy)
/*N*/ {
/*N*/ CheckReference();
-/*N*/
+/*N*/
/*N*/ for (USHORT i = 0; i < Count(); i++)
-/*N*/ pImpXPolyPolygon->aXPolyList.GetObject(i)->Scale(fSx, fSy);
+/*N*/ pImpXPolyPolygon->aXPolyList[ i ]->Scale(fSx, fSy);
/*N*/ }
/*************************************************************************
@@ -1928,43 +1861,13 @@ namespace binfilter {
/*N*/ void XPolyPolygon::SlantX(long nYRef, double fSin, double fCos)
/*N*/ {
/*N*/ CheckReference();
-/*N*/
+/*N*/
/*N*/ for (USHORT i = 0; i < Count(); i++)
-/*N*/ pImpXPolyPolygon->aXPolyList.GetObject(i)->SlantX(nYRef, fSin, fCos);
+/*N*/ pImpXPolyPolygon->aXPolyList[ i ]->SlantX(nYRef, fSin, fCos);
/*N*/ }
/*************************************************************************
|*
-|* XPolyPolygon::SlantY()
-|*
-|* Alle Polygone in Y-Richtung um einen beliebigen Winkel kippen,
-|* bezogen auf eine Referenz-X-Koordinate
-|* Ersterstellung ESO 01.02.95
-|* Letzte Aenderung ESO 01.02.95
-|*
-*************************************************************************/
-
-
-/*************************************************************************
-|*
-|* XPolygon::Distort()
-|*
-|* XPolygon verzerren, indem die Koordinaten relativ zu einem
-|* Referenzrechteck in ein beliebiges Viereck skaliert werden
-|* Zuordnung der Viereck-Punkte im Polygon zum Referenzrechteck:
-|* 0: links oben 0----1
-|* 1: rechts oben | |
-|* 2: rechts unten 3----2
-|* 3: links unten
-|* Ersterstellung ESO 07.07.95
-|* Letzte Aenderung ESO 07.07.95
-|*
-*************************************************************************/
-
-
-
-/*************************************************************************
-|*
|* XPolyPolygon::operator>>()
|*
|* Beschreibung Stream-Leseoperator
@@ -1976,23 +1879,23 @@ namespace binfilter {
/*N*/ SvStream& operator>>( SvStream& rIStream, XPolyPolygon& rXPolyPoly )
/*N*/ {
/*N*/ DBG_CHKOBJ( &rXPolyPoly, XPolyPolygon, NULL );
-/*N*/
+/*N*/
/*N*/ XPolygon* pXPoly;
-/*N*/
+/*N*/
/*N*/ // Anzahl der Polygone einlesen
/*N*/ USHORT nXPolyCount;
/*N*/ rIStream >> nXPolyCount;
-/*N*/
+/*N*/
/*N*/ bool bTruncated=FALSE;
/*N*/ ULONG nAllPointCount=0; // Gesamtanzahl der Punkte mitzaehlen
-/*N*/
+/*N*/
/*N*/ if ( rXPolyPoly.pImpXPolyPolygon->nRefCount > 1 ) {
/*?*/ rXPolyPoly.pImpXPolyPolygon->nRefCount--;
/*N*/ } else {
/*N*/ delete rXPolyPoly.pImpXPolyPolygon;
/*N*/ }
-/*N*/ rXPolyPoly.pImpXPolyPolygon = new ImpXPolyPolygon( nXPolyCount );
-/*N*/
+/*N*/ rXPolyPoly.pImpXPolyPolygon = new ImpXPolyPolygon();
+/*N*/
/*N*/ while (nXPolyCount>0) {
/*N*/ pXPoly = new XPolygon;
/*N*/ rIStream >> *pXPoly;
@@ -2004,17 +1907,12 @@ namespace binfilter {
/*?*/ pXPoly->Remove(nPos,nDel);
/*?*/ bTruncated=TRUE; // Alle nachfolgenden Polygone werden ignoriert
/*N*/ }
-/*N*/ rXPolyPoly.pImpXPolyPolygon->aXPolyList.Insert( pXPoly, LIST_APPEND );
+/*N*/ rXPolyPoly.pImpXPolyPolygon->aXPolyList.push_back( pXPoly );
/*N*/ } else {
/*?*/ delete pXPoly;
/*N*/ }
/*N*/ nXPolyCount--;
/*N*/ }
-/*N*/
-/*N*/ if (bTruncated) {
- // hier koennte man ein Flag am Stream setzen um zu vermerken
- // dass beim Lesen Informationsverlusst aufgetreten ist !!!!!
-/*N*/ }
/*N*/ return rIStream;
/*N*/ }
@@ -2029,25 +1927,21 @@ namespace binfilter {
|*
*************************************************************************/
-/*N*/ SvStream& operator<<( SvStream& rOStream, const XPolyPolygon& rXPolyPoly )
-/*N*/ {
-/*N*/ DBG_CHKOBJ( &rXPolyPoly, XPolyPolygon, NULL );
-/*N*/
-/*N*/ // Anzahl der Polygone rausschreiben
-/*N*/ rOStream << rXPolyPoly.Count();
-/*N*/
-/*N*/ // Die einzelnen Polygone ausgeben
-/*N*/ XPolygon* pXPoly = rXPolyPoly.pImpXPolyPolygon->aXPolyList.First();
-/*N*/
-/*N*/ while( pXPoly )
-/*N*/ {
-/*N*/ rOStream << *pXPoly;
-/*N*/ pXPoly = rXPolyPoly.pImpXPolyPolygon->aXPolyList.Next();
-/*N*/ }
-/*N*/
-/*N*/ return rOStream;
-/*N*/ }
+SvStream& operator<<( SvStream& rOStream, const XPolyPolygon& rXPolyPoly )
+{
+ DBG_CHKOBJ( &rXPolyPoly, XPolyPolygon, NULL );
+ // Anzahl der Polygone rausschreiben
+ rOStream << rXPolyPoly.Count();
+
+ // Die einzelnen Polygone ausgeben
+ for ( size_t i = 0, n = rXPolyPoly.Count(); i < n; ++i )
+ {
+ XPolygon* pXPoly = rXPolyPoly.pImpXPolyPolygon->aXPolyList[ i ];
+ rOStream << *pXPoly;
+ }
+ return rOStream;
+}
}
diff --git a/binfilter/inc/bf_svx/xpolyimp.hxx b/binfilter/inc/bf_svx/xpolyimp.hxx
index 3e61601..edbb7d0 100644
--- a/binfilter/inc/bf_svx/xpolyimp.hxx
+++ b/binfilter/inc/bf_svx/xpolyimp.hxx
@@ -31,6 +31,7 @@
#include <tools/gen.hxx>
#include <bf_svx/xpoly.hxx>
+#include <vector>
#ifdef _MSC_VER
#pragma hdrstop
@@ -90,7 +91,7 @@ public:
|* Letzte Aenderung Joe 26-09-1995
|*
*************************************************************************/
-DECLARE_LIST( XPolygonList, XPolygon* )//STRIP008 DECLARE_LIST( XPolygonList, XPolygon* );
+typedef ::std::vector< XPolygon* > XPolygonList;
class ImpXPolyPolygon
{
@@ -98,9 +99,9 @@ public:
XPolygonList aXPolyList;
USHORT nRefCount;
- ImpXPolyPolygon( USHORT nInitSize = 16, USHORT nResize = 16 ) :
- aXPolyList( 1024, nInitSize, nResize )
+ ImpXPolyPolygon()
{ nRefCount = 1; }
+
ImpXPolyPolygon( const ImpXPolyPolygon& rImpXPolyPoly );
~ImpXPolyPolygon();
More information about the Libreoffice-commits
mailing list