From ef46917ff3163d3fdd5152bda5d16c4503b6ab69 Mon Sep 17 00:00:00 2001 From: Norbert Thiebaud Date: Sun, 16 Aug 2015 16:45:12 -0500 Subject: Put Polygon from tools under tools:: namespace Polygon is one of these names that Clash with some system objects A similar work has been done earlier with PolyPolygon. Change-Id: Icf2217cb2906292b7275760f1a16be0e150312f5 Reviewed-on: https://gerrit.libreoffice.org/17789 Tested-by: Jenkins Reviewed-by: Norbert Thiebaud --- tools/inc/poly.h | 4 +- tools/source/generic/poly.cxx | 468 +++++++++++++++++++++-------------------- tools/source/generic/poly2.cxx | 46 ++-- 3 files changed, 262 insertions(+), 256 deletions(-) (limited to 'tools') diff --git a/tools/inc/poly.h b/tools/inc/poly.h index 0a202bca1615..78058734ba34 100644 --- a/tools/inc/poly.h +++ b/tools/inc/poly.h @@ -47,12 +47,14 @@ public: #define MAX_POLYGONS ((sal_uInt16)0x3FF0) +namespace tools { class Polygon; +} class SAL_WARN_UNUSED ImplPolyPolygon { public: - Polygon** mpPolyAry; + tools::Polygon** mpPolyAry; sal_uIntPtr mnRefCount; sal_uInt16 mnCount; sal_uInt16 mnSize; diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 7d14d409ec4b..4f4ee0493bc4 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -280,10 +280,224 @@ void ImplPolygon::ImplCreateFlagArray() } } +inline double ImplGetParameter( const Point& rCenter, const Point& rPt, double fWR, double fHR ) +{ + const long nDX = rPt.X() - rCenter.X(); + double fAngle = atan2( -rPt.Y() + rCenter.Y(), ( ( nDX == 0L ) ? 0.000000001 : nDX ) ); + + return atan2(fWR*sin(fAngle), fHR*cos(fAngle)); +} + +class ImplPointFilter +{ +public: + virtual void LastPoint() = 0; + virtual void Input( const Point& rPoint ) = 0; + +protected: + ~ImplPointFilter() {} +}; + +class ImplPolygonPointFilter : public ImplPointFilter +{ + std::unique_ptr mxPoly; + sal_uInt16 mnSize; +public: + explicit ImplPolygonPointFilter(sal_uInt16 nDestSize) + : mxPoly(new ImplPolygon(nDestSize)) + , mnSize(0) + { + } + + virtual ~ImplPolygonPointFilter() + { + } + + virtual void LastPoint() SAL_OVERRIDE; + virtual void Input( const Point& rPoint ) SAL_OVERRIDE; + + ImplPolygon* release() { return mxPoly.release(); } +}; + +void ImplPolygonPointFilter::Input( const Point& rPoint ) +{ + if ( !mnSize || (rPoint != mxPoly->mpPointAry[mnSize-1]) ) + { + mnSize++; + if ( mnSize > mxPoly->mnPoints ) + mxPoly->ImplSetSize( mnSize ); + mxPoly->mpPointAry[mnSize-1] = rPoint; + } +} + +void ImplPolygonPointFilter::LastPoint() +{ + if ( mnSize < mxPoly->mnPoints ) + mxPoly->ImplSetSize( mnSize ); +}; + +class ImplEdgePointFilter : public ImplPointFilter +{ + Point maFirstPoint; + Point maLastPoint; + ImplPointFilter& mrNextFilter; + const long mnLow; + const long mnHigh; + const int mnEdge; + int mnLastOutside; + bool mbFirst; + +public: + ImplEdgePointFilter( int nEdge, long nLow, long nHigh, + ImplPointFilter& rNextFilter ) : + mrNextFilter( rNextFilter ), + mnLow( nLow ), + mnHigh( nHigh ), + mnEdge( nEdge ), + mnLastOutside( 0 ), + mbFirst( true ) + { + } + + virtual ~ImplEdgePointFilter() {} + + Point EdgeSection( const Point& rPoint, int nEdge ) const; + int VisibleSide( const Point& rPoint ) const; + bool IsPolygon() const + { return maFirstPoint == maLastPoint; } + + virtual void Input( const Point& rPoint ) SAL_OVERRIDE; + virtual void LastPoint() SAL_OVERRIDE; +}; + +inline int ImplEdgePointFilter::VisibleSide( const Point& rPoint ) const +{ + if ( mnEdge & EDGE_HORZ ) + { + return rPoint.X() < mnLow ? EDGE_LEFT : + rPoint.X() > mnHigh ? EDGE_RIGHT : 0; + } + else + { + return rPoint.Y() < mnLow ? EDGE_TOP : + rPoint.Y() > mnHigh ? EDGE_BOTTOM : 0; + } +} + +Point ImplEdgePointFilter::EdgeSection( const Point& rPoint, int nEdge ) const +{ + long lx = maLastPoint.X(); + long ly = maLastPoint.Y(); + long md = rPoint.X() - lx; + long mn = rPoint.Y() - ly; + long nNewX; + long nNewY; + + if ( nEdge & EDGE_VERT ) + { + nNewY = (nEdge == EDGE_TOP) ? mnLow : mnHigh; + long dy = nNewY - ly; + if ( !md ) + nNewX = lx; + else if ( (LONG_MAX / std::abs(md)) >= std::abs(dy) ) + nNewX = (dy * md) / mn + lx; + else + { + BigInt ady = dy; + ady *= md; + if( ady.IsNeg() ) + if( mn < 0 ) + ady += mn/2; + else + ady -= (mn-1)/2; + else + if( mn < 0 ) + ady -= (mn+1)/2; + else + ady += mn/2; + ady /= mn; + nNewX = (long)ady + lx; + } + } + else + { + nNewX = (nEdge == EDGE_LEFT) ? mnLow : mnHigh; + long dx = nNewX - lx; + if ( !mn ) + nNewY = ly; + else if ( (LONG_MAX / std::abs(mn)) >= std::abs(dx) ) + nNewY = (dx * mn) / md + ly; + else + { + BigInt adx = dx; + adx *= mn; + if( adx.IsNeg() ) + if( md < 0 ) + adx += md/2; + else + adx -= (md-1)/2; + else + if( md < 0 ) + adx -= (md+1)/2; + else + adx += md/2; + adx /= md; + nNewY = (long)adx + ly; + } + } + + return Point( nNewX, nNewY ); +} + +void ImplEdgePointFilter::Input( const Point& rPoint ) +{ + int nOutside = VisibleSide( rPoint ); + + if ( mbFirst ) + { + maFirstPoint = rPoint; + mbFirst = false; + if ( !nOutside ) + mrNextFilter.Input( rPoint ); + } + else if ( rPoint == maLastPoint ) + return; + else if ( !nOutside ) + { + if ( mnLastOutside ) + mrNextFilter.Input( EdgeSection( rPoint, mnLastOutside ) ); + mrNextFilter.Input( rPoint ); + } + else if ( !mnLastOutside ) + mrNextFilter.Input( EdgeSection( rPoint, nOutside ) ); + else if ( nOutside != mnLastOutside ) + { + mrNextFilter.Input( EdgeSection( rPoint, mnLastOutside ) ); + mrNextFilter.Input( EdgeSection( rPoint, nOutside ) ); + } + + maLastPoint = rPoint; + mnLastOutside = nOutside; +} + +void ImplEdgePointFilter::LastPoint() +{ + if ( !mbFirst ) + { + int nOutside = VisibleSide( maFirstPoint ); + + if ( nOutside != mnLastOutside ) + Input( maFirstPoint ); + mrNextFilter.LastPoint(); + } +} + +namespace tools +{ -Polygon Polygon::SubdivideBezier( const Polygon& rPoly ) +tools::Polygon Polygon::SubdivideBezier( const tools::Polygon& rPoly ) { - Polygon aPoly; + tools::Polygon aPoly; // #100127# Use adaptive subdivide instead of fixed 25 segments rPoly.AdaptiveSubdivide( aPoly ); @@ -303,14 +517,6 @@ inline void Polygon::ImplMakeUnique() } } -inline double ImplGetParameter( const Point& rCenter, const Point& rPt, double fWR, double fHR ) -{ - const long nDX = rPt.X() - rCenter.X(); - double fAngle = atan2( -rPt.Y() + rCenter.Y(), ( ( nDX == 0L ) ? 0.000000001 : nDX ) ); - - return atan2(fWR*sin(fAngle), fHR*cos(fAngle)); -} - Polygon::Polygon() { mpImplPolygon = static_cast(&aStaticImplPolygon); @@ -334,7 +540,7 @@ Polygon::Polygon( sal_uInt16 nPoints, const Point* pPtAry, const sal_uInt8* pFla mpImplPolygon = static_cast(&aStaticImplPolygon); } -Polygon::Polygon( const Polygon& rPoly ) +Polygon::Polygon( const tools::Polygon& rPoly ) { DBG_ASSERT( rPoly.mpImplPolygon->mnRefCount < 0xFFFFFFFE, "Polygon: RefCount overflow" ); @@ -386,13 +592,13 @@ Polygon::Polygon( const Rectangle& rRect, sal_uIntPtr nHorzRound, sal_uIntPtr nV const Point aTR( aRect.Right() - nHorzRound, aRect.Top() + nVertRound ); const Point aBR( aRect.Right() - nHorzRound, aRect.Bottom() - nVertRound ); const Point aBL( aRect.Left() + nHorzRound, aRect.Bottom() - nVertRound ); - Polygon* pEllipsePoly = new Polygon( Point(), nHorzRound, nVertRound ); - sal_uInt16 i, nEnd, nSize4 = pEllipsePoly->GetSize() >> 2; + tools::Polygon* pEllipsePoly = new tools::Polygon( Point(), nHorzRound, nVertRound ); + sal_uInt16 i, nEnd, nSize4 = pEllipsePoly->GetSize() >> 2; mpImplPolygon = new ImplPolygon( pEllipsePoly->GetSize() + 1 ); - const Point* pSrcAry = pEllipsePoly->GetConstPointAry(); - Point* pDstAry = mpImplPolygon->mpPointAry; + const Point* pSrcAry = pEllipsePoly->GetConstPointAry(); + Point* pDstAry = mpImplPolygon->mpPointAry; for( i = 0, nEnd = nSize4; i < nEnd; i++ ) ( pDstAry[ i ] = pSrcAry[ i ] ) += aTR; @@ -717,9 +923,9 @@ void Polygon::Optimize( PolyOptimizeFlags nOptimizeFlags, const PolyOptimizeData } else if( nOptimizeFlags & ( PolyOptimizeFlags::REDUCE | PolyOptimizeFlags::NO_SAME ) ) { - Polygon aNewPoly; - const Point& rFirst = mpImplPolygon->mpPointAry[ 0 ]; - sal_uIntPtr nReduce; + tools::Polygon aNewPoly; + const Point& rFirst = mpImplPolygon->mpPointAry[ 0 ]; + sal_uIntPtr nReduce; if( nOptimizeFlags & ( PolyOptimizeFlags::REDUCE ) ) nReduce = pData ? pData->GetAbsValue() : 4UL; @@ -912,12 +1118,12 @@ void Polygon::AdaptiveSubdivide( Polygon& rResult, const double d ) const } // fill result polygon - rResult = Polygon( (sal_uInt16)aPoints.size() ); // ensure sufficient size for copy + rResult = tools::Polygon( (sal_uInt16)aPoints.size() ); // ensure sufficient size for copy ::std::copy(aPoints.begin(), aPoints.end(), rResult.mpImplPolygon->mpPointAry); } } -void Polygon::ImplReduceEdges( Polygon& rPoly, const double& rArea, sal_uInt16 nPercent ) +void Polygon::ImplReduceEdges( tools::Polygon& rPoly, const double& rArea, sal_uInt16 nPercent ) { const double fBound = 2000.0 * ( 100 - nPercent ) * 0.01; sal_uInt16 nNumNoChange = 0, @@ -926,8 +1132,8 @@ void Polygon::ImplReduceEdges( Polygon& rPoly, const double& rArea, sal_uInt16 n while( nNumNoChange < 2 ) { sal_uInt16 nPntCnt = rPoly.GetSize(), nNewPos = 0; - Polygon aNewPoly( nPntCnt ); - bool bChangeInThisRun = false; + tools::Polygon aNewPoly( nPntCnt ); + bool bChangeInThisRun = false; for( sal_uInt16 n = 0; n < nPntCnt; n++ ) { @@ -1084,210 +1290,6 @@ void Polygon::Rotate( const Point& rCenter, double fSin, double fCos ) } } -class ImplPointFilter -{ -public: - virtual void LastPoint() = 0; - virtual void Input( const Point& rPoint ) = 0; - -protected: - ~ImplPointFilter() {} -}; - -class ImplPolygonPointFilter : public ImplPointFilter -{ - std::unique_ptr mxPoly; - sal_uInt16 mnSize; -public: - explicit ImplPolygonPointFilter(sal_uInt16 nDestSize) - : mxPoly(new ImplPolygon(nDestSize)) - , mnSize(0) - { - } - - virtual ~ImplPolygonPointFilter() - { - } - - virtual void LastPoint() SAL_OVERRIDE; - virtual void Input( const Point& rPoint ) SAL_OVERRIDE; - - ImplPolygon* release() { return mxPoly.release(); } -}; - -void ImplPolygonPointFilter::Input( const Point& rPoint ) -{ - if ( !mnSize || (rPoint != mxPoly->mpPointAry[mnSize-1]) ) - { - mnSize++; - if ( mnSize > mxPoly->mnPoints ) - mxPoly->ImplSetSize( mnSize ); - mxPoly->mpPointAry[mnSize-1] = rPoint; - } -} - -void ImplPolygonPointFilter::LastPoint() -{ - if ( mnSize < mxPoly->mnPoints ) - mxPoly->ImplSetSize( mnSize ); -}; - -class ImplEdgePointFilter : public ImplPointFilter -{ - Point maFirstPoint; - Point maLastPoint; - ImplPointFilter& mrNextFilter; - const long mnLow; - const long mnHigh; - const int mnEdge; - int mnLastOutside; - bool mbFirst; - -public: - ImplEdgePointFilter( int nEdge, long nLow, long nHigh, - ImplPointFilter& rNextFilter ) : - mrNextFilter( rNextFilter ), - mnLow( nLow ), - mnHigh( nHigh ), - mnEdge( nEdge ), - mnLastOutside( 0 ), - mbFirst( true ) - { - } - - virtual ~ImplEdgePointFilter() {} - - Point EdgeSection( const Point& rPoint, int nEdge ) const; - int VisibleSide( const Point& rPoint ) const; - bool IsPolygon() const - { return maFirstPoint == maLastPoint; } - - virtual void Input( const Point& rPoint ) SAL_OVERRIDE; - virtual void LastPoint() SAL_OVERRIDE; -}; - -inline int ImplEdgePointFilter::VisibleSide( const Point& rPoint ) const -{ - if ( mnEdge & EDGE_HORZ ) - { - return rPoint.X() < mnLow ? EDGE_LEFT : - rPoint.X() > mnHigh ? EDGE_RIGHT : 0; - } - else - { - return rPoint.Y() < mnLow ? EDGE_TOP : - rPoint.Y() > mnHigh ? EDGE_BOTTOM : 0; - } -} - -Point ImplEdgePointFilter::EdgeSection( const Point& rPoint, int nEdge ) const -{ - long lx = maLastPoint.X(); - long ly = maLastPoint.Y(); - long md = rPoint.X() - lx; - long mn = rPoint.Y() - ly; - long nNewX; - long nNewY; - - if ( nEdge & EDGE_VERT ) - { - nNewY = (nEdge == EDGE_TOP) ? mnLow : mnHigh; - long dy = nNewY - ly; - if ( !md ) - nNewX = lx; - else if ( (LONG_MAX / std::abs(md)) >= std::abs(dy) ) - nNewX = (dy * md) / mn + lx; - else - { - BigInt ady = dy; - ady *= md; - if( ady.IsNeg() ) - if( mn < 0 ) - ady += mn/2; - else - ady -= (mn-1)/2; - else - if( mn < 0 ) - ady -= (mn+1)/2; - else - ady += mn/2; - ady /= mn; - nNewX = (long)ady + lx; - } - } - else - { - nNewX = (nEdge == EDGE_LEFT) ? mnLow : mnHigh; - long dx = nNewX - lx; - if ( !mn ) - nNewY = ly; - else if ( (LONG_MAX / std::abs(mn)) >= std::abs(dx) ) - nNewY = (dx * mn) / md + ly; - else - { - BigInt adx = dx; - adx *= mn; - if( adx.IsNeg() ) - if( md < 0 ) - adx += md/2; - else - adx -= (md-1)/2; - else - if( md < 0 ) - adx -= (md+1)/2; - else - adx += md/2; - adx /= md; - nNewY = (long)adx + ly; - } - } - - return Point( nNewX, nNewY ); -} - -void ImplEdgePointFilter::Input( const Point& rPoint ) -{ - int nOutside = VisibleSide( rPoint ); - - if ( mbFirst ) - { - maFirstPoint = rPoint; - mbFirst = false; - if ( !nOutside ) - mrNextFilter.Input( rPoint ); - } - else if ( rPoint == maLastPoint ) - return; - else if ( !nOutside ) - { - if ( mnLastOutside ) - mrNextFilter.Input( EdgeSection( rPoint, mnLastOutside ) ); - mrNextFilter.Input( rPoint ); - } - else if ( !mnLastOutside ) - mrNextFilter.Input( EdgeSection( rPoint, nOutside ) ); - else if ( nOutside != mnLastOutside ) - { - mrNextFilter.Input( EdgeSection( rPoint, mnLastOutside ) ); - mrNextFilter.Input( EdgeSection( rPoint, nOutside ) ); - } - - maLastPoint = rPoint; - mnLastOutside = nOutside; -} - -void ImplEdgePointFilter::LastPoint() -{ - if ( !mbFirst ) - { - int nOutside = VisibleSide( maFirstPoint ); - - if ( nOutside != mnLastOutside ) - Input( maFirstPoint ); - mrNextFilter.LastPoint(); - } -} - void Polygon::Clip( const Rectangle& rRect, bool bPolygon ) { // #105251# Justify rect before edge filtering @@ -1454,7 +1456,7 @@ void Polygon::Insert( sal_uInt16 nPos, const Point& rPt, PolyFlags eFlags ) } } -void Polygon::Insert( sal_uInt16 nPos, const Polygon& rPoly ) +void Polygon::Insert( sal_uInt16 nPos, const tools::Polygon& rPoly ) { const sal_uInt16 nInsertCount = rPoly.mpImplPolygon->mnPoints; @@ -1480,7 +1482,7 @@ Point& Polygon::operator[]( sal_uInt16 nPos ) return mpImplPolygon->mpPointAry[nPos]; } -Polygon& Polygon::operator=( const Polygon& rPoly ) +tools::Polygon& Polygon::operator=( const tools::Polygon& rPoly ) { DBG_ASSERT( rPoly.mpImplPolygon->mnRefCount < 0xFFFFFFFE, "Polygon: RefCount overflow" ); @@ -1502,7 +1504,7 @@ Polygon& Polygon::operator=( const Polygon& rPoly ) return *this; } -bool Polygon::operator==( const Polygon& rPoly ) const +bool Polygon::operator==( const tools::Polygon& rPoly ) const { if ( (rPoly.mpImplPolygon == mpImplPolygon) ) @@ -1511,7 +1513,7 @@ bool Polygon::operator==( const Polygon& rPoly ) const return false; } -bool Polygon::IsEqual( const Polygon& rPoly ) const +bool Polygon::IsEqual( const tools::Polygon& rPoly ) const { bool bIsEqual = true; sal_uInt16 i; @@ -1532,7 +1534,7 @@ bool Polygon::IsEqual( const Polygon& rPoly ) const return bIsEqual; } -SvStream& ReadPolygon( SvStream& rIStream, Polygon& rPoly ) +SvStream& ReadPolygon( SvStream& rIStream, tools::Polygon& rPoly ) { DBG_ASSERTWARNING( rIStream.GetVersion(), "Polygon::>> - Solar-Version not set on rIStream" ); @@ -1583,7 +1585,7 @@ SvStream& ReadPolygon( SvStream& rIStream, Polygon& rPoly ) return rIStream; } -SvStream& WritePolygon( SvStream& rOStream, const Polygon& rPoly ) +SvStream& WritePolygon( SvStream& rOStream, const tools::Polygon& rPoly ) { DBG_ASSERTWARNING( rOStream.GetVersion(), "Polygon::<< - Solar-Version not set on rOStream" ); @@ -1949,4 +1951,6 @@ Polygon::Polygon(const basegfx::B2DPolygon& rPolygon) } } +} // namespace tools + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx index 1d36c654d065..6d6b3d888a14 100644 --- a/tools/source/generic/poly2.cxx +++ b/tools/source/generic/poly2.cxx @@ -41,7 +41,7 @@ ImplPolyPolygon::ImplPolyPolygon( sal_uInt16 nInitSize ) mnCount = nInitSize; mnSize = nInitSize; mnResize = 16; - mpPolyAry = new Polygon*[ nInitSize ]; + mpPolyAry = new tools::Polygon*[ nInitSize ]; } ImplPolyPolygon::ImplPolyPolygon( const ImplPolyPolygon& rImplPolyPoly ) @@ -53,9 +53,9 @@ ImplPolyPolygon::ImplPolyPolygon( const ImplPolyPolygon& rImplPolyPoly ) if ( rImplPolyPoly.mpPolyAry ) { - mpPolyAry = new Polygon*[mnSize]; + mpPolyAry = new tools::Polygon*[mnSize]; for ( sal_uInt16 i = 0; i < mnCount; i++ ) - mpPolyAry[i] = new Polygon( *rImplPolyPoly.mpPolyAry[i] ); + mpPolyAry[i] = new tools::Polygon( *rImplPolyPoly.mpPolyAry[i] ); } else mpPolyAry = NULL; @@ -86,12 +86,12 @@ PolyPolygon::PolyPolygon( sal_uInt16 nInitSize, sal_uInt16 nResize ) mpImplPolyPolygon = new ImplPolyPolygon( nInitSize, nResize ); } -PolyPolygon::PolyPolygon( const Polygon& rPoly ) +PolyPolygon::PolyPolygon( const tools::Polygon& rPoly ) { if ( rPoly.GetSize() ) { mpImplPolyPolygon = new ImplPolyPolygon( 1 ); - mpImplPolyPolygon->mpPolyAry[0] = new Polygon( rPoly ); + mpImplPolyPolygon->mpPolyAry[0] = new tools::Polygon( rPoly ); } else mpImplPolyPolygon = new ImplPolyPolygon( 16, 16 ); @@ -113,7 +113,7 @@ PolyPolygon::~PolyPolygon() delete mpImplPolyPolygon; } -void PolyPolygon::Insert( const Polygon& rPoly, sal_uInt16 nPos ) +void PolyPolygon::Insert( const tools::Polygon& rPoly, sal_uInt16 nPos ) { if ( mpImplPolyPolygon->mnCount >= MAX_POLYGONS ) return; @@ -128,16 +128,16 @@ void PolyPolygon::Insert( const Polygon& rPoly, sal_uInt16 nPos ) nPos = mpImplPolyPolygon->mnCount; if ( !mpImplPolyPolygon->mpPolyAry ) - mpImplPolyPolygon->mpPolyAry = new Polygon*[mpImplPolyPolygon->mnSize]; + mpImplPolyPolygon->mpPolyAry = new tools::Polygon*[mpImplPolyPolygon->mnSize]; else if ( mpImplPolyPolygon->mnCount == mpImplPolyPolygon->mnSize ) { sal_uInt16 nOldSize = mpImplPolyPolygon->mnSize; sal_uInt16 nNewSize = nOldSize + mpImplPolyPolygon->mnResize; - Polygon** pNewAry; + tools::Polygon** pNewAry; if ( nNewSize >= MAX_POLYGONS ) nNewSize = MAX_POLYGONS; - pNewAry = new Polygon*[nNewSize]; + pNewAry = new tools::Polygon*[nNewSize]; memcpy( pNewAry, mpImplPolyPolygon->mpPolyAry, nPos*sizeof(Polygon*) ); memcpy( pNewAry+nPos+1, mpImplPolyPolygon->mpPolyAry+nPos, (nOldSize-nPos)*sizeof(Polygon*) ); @@ -152,7 +152,7 @@ void PolyPolygon::Insert( const Polygon& rPoly, sal_uInt16 nPos ) (mpImplPolyPolygon->mnCount-nPos)*sizeof(Polygon*) ); } - mpImplPolyPolygon->mpPolyAry[nPos] = new Polygon( rPoly ); + mpImplPolyPolygon->mpPolyAry[nPos] = new tools::Polygon( rPoly ); mpImplPolyPolygon->mnCount++; } @@ -173,7 +173,7 @@ void PolyPolygon::Remove( sal_uInt16 nPos ) (mpImplPolyPolygon->mnCount-nPos)*sizeof(Polygon*) ); } -void PolyPolygon::Replace( const Polygon& rPoly, sal_uInt16 nPos ) +void PolyPolygon::Replace( const tools::Polygon& rPoly, sal_uInt16 nPos ) { assert(nPos < Count() && "PolyPolygon::Replace(): nPos >= nSize"); @@ -184,10 +184,10 @@ void PolyPolygon::Replace( const Polygon& rPoly, sal_uInt16 nPos ) } delete mpImplPolyPolygon->mpPolyAry[nPos]; - mpImplPolyPolygon->mpPolyAry[nPos] = new Polygon( rPoly ); + mpImplPolyPolygon->mpPolyAry[nPos] = new tools::Polygon( rPoly ); } -const Polygon& PolyPolygon::GetObject( sal_uInt16 nPos ) const +const tools::Polygon& PolyPolygon::GetObject( sal_uInt16 nPos ) const { assert(nPos < Count() && "PolyPolygon::GetObject(): nPos >= nSize"); @@ -276,7 +276,7 @@ void PolyPolygon::Optimize( PolyOptimizeFlags nOptimizeFlags, const PolyOptimize if( bEdges ) { mpImplPolyPolygon->mpPolyAry[ i ]->Optimize( PolyOptimizeFlags::NO_SAME ); - Polygon::ImplReduceEdges( *( mpImplPolyPolygon->mpPolyAry[ i ] ), fArea, nPercent ); + tools::Polygon::ImplReduceEdges( *( mpImplPolyPolygon->mpPolyAry[ i ] ), fArea, nPercent ); } if( bool(nOptimizeFlags) ) @@ -290,7 +290,7 @@ void PolyPolygon::AdaptiveSubdivide( tools::PolyPolygon& rResult, const double d { rResult.Clear(); - Polygon aPolygon; + tools::Polygon aPolygon; for( sal_uInt16 i = 0; i < mpImplPolyPolygon->mnCount; i++ ) { @@ -304,7 +304,7 @@ tools::PolyPolygon PolyPolygon::SubdivideBezier( const tools::PolyPolygon& rPoly sal_uInt16 i, nPolys = rPolyPoly.Count(); tools::PolyPolygon aPolyPoly( nPolys ); for( i=0; impPolyAry[n]; + const tools::Polygon* pPoly = mpImplPolyPolygon->mpPolyAry[n]; const Point* pAry = pPoly->GetConstPointAry(); sal_uInt16 nPointCount = pPoly->GetSize(); @@ -553,7 +553,7 @@ SvStream& ReadPolyPolygon( SvStream& rIStream, tools::PolyPolygon& rPolyPoly ) { DBG_ASSERTWARNING( rIStream.GetVersion(), "PolyPolygon::>> - Solar-Version not set on rIStream" ); - Polygon* pPoly; + tools::Polygon* pPoly; sal_uInt16 nPolyCount(0); // Read number of polygons @@ -579,7 +579,7 @@ SvStream& ReadPolyPolygon( SvStream& rIStream, tools::PolyPolygon& rPolyPoly ) for ( sal_uInt16 i = 0; i < nPolyCount; i++ ) { - pPoly = new Polygon; + pPoly = new tools::Polygon; ReadPolygon( rIStream, *pPoly ); rPolyPoly.mpImplPolyPolygon->mpPolyAry[i] = pPoly; } @@ -611,7 +611,7 @@ void PolyPolygon::Read( SvStream& rIStream ) DBG_ASSERTWARNING( rIStream.GetVersion(), "PolyPolygon::>> - Solar-Version not set on rIStream" ); - Polygon* pPoly; + tools::Polygon* pPoly; sal_uInt16 nPolyCount(0); // Read number of polygons @@ -637,7 +637,7 @@ void PolyPolygon::Read( SvStream& rIStream ) for ( sal_uInt16 i = 0; i < nPolyCount; i++ ) { - pPoly = new Polygon; + pPoly = new tools::Polygon; pPoly->ImplRead( rIStream ); mpImplPolyPolygon->mpPolyAry[i] = pPoly; } @@ -668,7 +668,7 @@ basegfx::B2DPolyPolygon PolyPolygon::getB2DPolyPolygon() const for(sal_uInt16 a(0); a < mpImplPolyPolygon->mnCount; a++) { - Polygon* pCandidate = mpImplPolyPolygon->mpPolyAry[a]; + tools::Polygon* pCandidate = mpImplPolyPolygon->mpPolyAry[a]; aRetval.append(pCandidate->getB2DPolygon()); } @@ -689,7 +689,7 @@ PolyPolygon::PolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon) for(sal_uInt16 a(0); a < nCount; a++) { basegfx::B2DPolygon aCandidate(rPolyPolygon.getB2DPolygon(sal_uInt32(a))); - mpImplPolyPolygon->mpPolyAry[a] = new Polygon( aCandidate ); + mpImplPolyPolygon->mpPolyAry[a] = new tools::Polygon( aCandidate ); } } else -- cgit v1.2.3