1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_basegfx.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <com/sun/star/geometry/RealSize2D.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/geometry/RealPoint2D.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/geometry/RealRectangle2D.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/geometry/RealRectangle3D.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/geometry/RealBezierSegment2D.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/geometry/AffineMatrix2D.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/geometry/AffineMatrix3D.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/geometry/Matrix2D.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/geometry/IntegerSize2D.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/geometry/IntegerPoint2D.hpp>
41*cdf0e10cSrcweir #include <com/sun/star/geometry/IntegerRectangle2D.hpp>
42*cdf0e10cSrcweir #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
43*cdf0e10cSrcweir #include <com/sun/star/rendering/XGraphicDevice.hpp>
44*cdf0e10cSrcweir #include <com/sun/star/awt/Size.hpp>
45*cdf0e10cSrcweir #include <com/sun/star/awt/Point.hpp>
46*cdf0e10cSrcweir #include <com/sun/star/awt/Rectangle.hpp>
47*cdf0e10cSrcweir #include <basegfx/tools/unopolypolygon.hxx>
48*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
49*cdf0e10cSrcweir #include <basegfx/matrix/b3dhommatrix.hxx>
50*cdf0e10cSrcweir #include <basegfx/vector/b2dsize.hxx>
51*cdf0e10cSrcweir #include <basegfx/point/b2dpoint.hxx>
52*cdf0e10cSrcweir #include <basegfx/range/b2drectangle.hxx>
53*cdf0e10cSrcweir #include <basegfx/range/b3drange.hxx>
54*cdf0e10cSrcweir #include <basegfx/vector/b2isize.hxx>
55*cdf0e10cSrcweir #include <basegfx/point/b2ipoint.hxx>
56*cdf0e10cSrcweir #include <basegfx/range/b2irectangle.hxx>
57*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
58*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygon.hxx>
59*cdf0e10cSrcweir #include <basegfx/tools/canvastools.hxx>
60*cdf0e10cSrcweir #include <limits>
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir using namespace ::com::sun::star;
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir namespace basegfx
65*cdf0e10cSrcweir {
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir     namespace unotools
68*cdf0e10cSrcweir     {
69*cdf0e10cSrcweir         namespace
70*cdf0e10cSrcweir         {
71*cdf0e10cSrcweir             uno::Sequence< geometry::RealBezierSegment2D > bezierSequenceFromB2DPolygon(const ::basegfx::B2DPolygon& rPoly)
72*cdf0e10cSrcweir             {
73*cdf0e10cSrcweir                 const sal_uInt32 nPointCount(rPoly.count());
74*cdf0e10cSrcweir                 uno::Sequence< geometry::RealBezierSegment2D > outputSequence(nPointCount);
75*cdf0e10cSrcweir                 geometry::RealBezierSegment2D* pOutput = outputSequence.getArray();
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir 				// fill sequences and imply clodes polygon on this implementation layer
78*cdf0e10cSrcweir 				for(sal_uInt32 a(0); a < nPointCount; a++)
79*cdf0e10cSrcweir 				{
80*cdf0e10cSrcweir                     const basegfx::B2DPoint aStart(rPoly.getB2DPoint(a));
81*cdf0e10cSrcweir                     const basegfx::B2DPoint aControlA(rPoly.getNextControlPoint(a));
82*cdf0e10cSrcweir                     const basegfx::B2DPoint aControlB(rPoly.getPrevControlPoint((a + 1) % nPointCount));
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir 					pOutput[a] = geometry::RealBezierSegment2D(
85*cdf0e10cSrcweir 						aStart.getX(), aStart.getY(),
86*cdf0e10cSrcweir 						aControlA.getX(), aControlA.getY(),
87*cdf0e10cSrcweir 						aControlB.getX(), aControlB.getY());
88*cdf0e10cSrcweir 				}
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir                 return outputSequence;
91*cdf0e10cSrcweir             }
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir             uno::Sequence< geometry::RealPoint2D > pointSequenceFromB2DPolygon( const ::basegfx::B2DPolygon& rPoly )
94*cdf0e10cSrcweir             {
95*cdf0e10cSrcweir                 const sal_uInt32 nNumPoints( rPoly.count() );
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir                 uno::Sequence< geometry::RealPoint2D > outputSequence( nNumPoints );
98*cdf0e10cSrcweir                 geometry::RealPoint2D* pOutput = outputSequence.getArray();
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir                 // fill sequence from polygon
101*cdf0e10cSrcweir                 sal_uInt32 i;
102*cdf0e10cSrcweir                 for( i=0; i<nNumPoints; ++i )
103*cdf0e10cSrcweir                 {
104*cdf0e10cSrcweir                     const ::basegfx::B2DPoint 	aPoint( rPoly.getB2DPoint(i) );
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir                     pOutput[i] = geometry::RealPoint2D( aPoint.getX(),
107*cdf0e10cSrcweir                                                         aPoint.getY() );
108*cdf0e10cSrcweir                 }
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir                 return outputSequence;
111*cdf0e10cSrcweir             }
112*cdf0e10cSrcweir         }
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir         //---------------------------------------------------------------------------------------
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir         uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > > bezierSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly )
117*cdf0e10cSrcweir         {
118*cdf0e10cSrcweir             const sal_uInt32 nNumPolies( rPolyPoly.count() );
119*cdf0e10cSrcweir             sal_uInt32 i;
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir             uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > > outputSequence( nNumPolies );
122*cdf0e10cSrcweir             uno::Sequence< geometry::RealBezierSegment2D >* pOutput = outputSequence.getArray();
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir             for( i=0; i<nNumPolies; ++i )
125*cdf0e10cSrcweir             {
126*cdf0e10cSrcweir                 pOutput[i] = bezierSequenceFromB2DPolygon( rPolyPoly.getB2DPolygon(i) );
127*cdf0e10cSrcweir             }
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir             return outputSequence;
130*cdf0e10cSrcweir         }
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir         //---------------------------------------------------------------------------------------
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir         uno::Sequence< uno::Sequence< geometry::RealPoint2D > > pointSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly	 )
135*cdf0e10cSrcweir         {
136*cdf0e10cSrcweir             const sal_uInt32 nNumPolies( rPolyPoly.count() );
137*cdf0e10cSrcweir             sal_uInt32 i;
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir             uno::Sequence< uno::Sequence< geometry::RealPoint2D > > outputSequence( nNumPolies );
140*cdf0e10cSrcweir             uno::Sequence< geometry::RealPoint2D >* pOutput = outputSequence.getArray();
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir             for( i=0; i<nNumPolies; ++i )
143*cdf0e10cSrcweir             {
144*cdf0e10cSrcweir                 pOutput[i] = pointSequenceFromB2DPolygon( rPolyPoly.getB2DPolygon(i) );
145*cdf0e10cSrcweir             }
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir             return outputSequence;
148*cdf0e10cSrcweir         }
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir         //---------------------------------------------------------------------------------------
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir         uno::Reference< rendering::XPolyPolygon2D > xPolyPolygonFromB2DPolygon( const uno::Reference< rendering::XGraphicDevice >& 	xGraphicDevice,
153*cdf0e10cSrcweir                                                                                 const ::basegfx::B2DPolygon&						rPoly	 )
154*cdf0e10cSrcweir         {
155*cdf0e10cSrcweir             uno::Reference< rendering::XPolyPolygon2D > xRes;
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir             if( !xGraphicDevice.is() )
158*cdf0e10cSrcweir                 return xRes;
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir             if( rPoly.areControlPointsUsed() )
161*cdf0e10cSrcweir             {
162*cdf0e10cSrcweir                 uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > > outputSequence( 1 );
163*cdf0e10cSrcweir                 outputSequence[0] = bezierSequenceFromB2DPolygon( rPoly );
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir                 xRes.set( xGraphicDevice->createCompatibleBezierPolyPolygon( outputSequence ),
166*cdf0e10cSrcweir                           uno::UNO_QUERY );
167*cdf0e10cSrcweir             }
168*cdf0e10cSrcweir             else
169*cdf0e10cSrcweir             {
170*cdf0e10cSrcweir                 uno::Sequence< uno::Sequence< geometry::RealPoint2D > > outputSequence( 1 );
171*cdf0e10cSrcweir                 outputSequence[0] = pointSequenceFromB2DPolygon( rPoly );
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir                 xRes.set( xGraphicDevice->createCompatibleLinePolyPolygon( outputSequence ),
174*cdf0e10cSrcweir                           uno::UNO_QUERY );
175*cdf0e10cSrcweir             }
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir             if( xRes.is() && rPoly.isClosed() )
178*cdf0e10cSrcweir                 xRes->setClosed( 0, sal_True );
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir             return xRes;
181*cdf0e10cSrcweir         }
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir         //---------------------------------------------------------------------------------------
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir         uno::Reference< rendering::XPolyPolygon2D > xPolyPolygonFromB2DPolyPolygon( const uno::Reference< rendering::XGraphicDevice >& 	xGraphicDevice,
186*cdf0e10cSrcweir                                                                                     const ::basegfx::B2DPolyPolygon&					rPolyPoly	 )
187*cdf0e10cSrcweir         {
188*cdf0e10cSrcweir             uno::Reference< rendering::XPolyPolygon2D > xRes;
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir             if( !xGraphicDevice.is() )
191*cdf0e10cSrcweir                 return xRes;
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir             const sal_uInt32 nNumPolies( rPolyPoly.count() );
194*cdf0e10cSrcweir             sal_uInt32 i;
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir             if( rPolyPoly.areControlPointsUsed() )
197*cdf0e10cSrcweir             {
198*cdf0e10cSrcweir                 xRes.set( xGraphicDevice->createCompatibleBezierPolyPolygon(
199*cdf0e10cSrcweir                               bezierSequenceSequenceFromB2DPolyPolygon( rPolyPoly ) ),
200*cdf0e10cSrcweir                           uno::UNO_QUERY );
201*cdf0e10cSrcweir             }
202*cdf0e10cSrcweir             else
203*cdf0e10cSrcweir             {
204*cdf0e10cSrcweir                 xRes.set( xGraphicDevice->createCompatibleLinePolyPolygon(
205*cdf0e10cSrcweir                               pointSequenceSequenceFromB2DPolyPolygon( rPolyPoly ) ),
206*cdf0e10cSrcweir                           uno::UNO_QUERY );
207*cdf0e10cSrcweir             }
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir             for( i=0; i<nNumPolies; ++i )
210*cdf0e10cSrcweir             {
211*cdf0e10cSrcweir 	            xRes->setClosed( i, rPolyPoly.getB2DPolygon(i).isClosed() );
212*cdf0e10cSrcweir             }
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir             return xRes;
215*cdf0e10cSrcweir         }
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir         //---------------------------------------------------------------------------------------
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir         ::basegfx::B2DPolygon polygonFromPoint2DSequence( const uno::Sequence< geometry::RealPoint2D >& points )
220*cdf0e10cSrcweir         {
221*cdf0e10cSrcweir             const sal_Int32 nCurrSize( points.getLength() );
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir             ::basegfx::B2DPolygon aPoly;
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir             for( sal_Int32 nCurrPoint=0; nCurrPoint<nCurrSize; ++nCurrPoint )
226*cdf0e10cSrcweir                 aPoly.append( b2DPointFromRealPoint2D( points[nCurrPoint] ) );
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir             return aPoly;
229*cdf0e10cSrcweir         }
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir         //---------------------------------------------------------------------------------------
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir         ::basegfx::B2DPolyPolygon polyPolygonFromPoint2DSequenceSequence( const uno::Sequence< uno::Sequence< geometry::RealPoint2D > >& points )
234*cdf0e10cSrcweir         {
235*cdf0e10cSrcweir             ::basegfx::B2DPolyPolygon aRes;
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir             for( sal_Int32 nCurrPoly=0; nCurrPoly<points.getLength(); ++nCurrPoly )
238*cdf0e10cSrcweir             {
239*cdf0e10cSrcweir                 aRes.append( polygonFromPoint2DSequence( points[nCurrPoly] ) );
240*cdf0e10cSrcweir             }
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir             return aRes;
243*cdf0e10cSrcweir         }
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir         //---------------------------------------------------------------------------------------
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir         ::basegfx::B2DPolygon polygonFromBezier2DSequence( const uno::Sequence< geometry::RealBezierSegment2D >& curves )
248*cdf0e10cSrcweir         {
249*cdf0e10cSrcweir             const sal_Int32 nSize(curves.getLength());
250*cdf0e10cSrcweir 			basegfx::B2DPolygon aRetval;
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir 			if(nSize)
253*cdf0e10cSrcweir 			{
254*cdf0e10cSrcweir 				// prepare start with providing a start point. Use the first point from
255*cdf0e10cSrcweir 				// the sequence for this
256*cdf0e10cSrcweir 				const geometry::RealBezierSegment2D& rFirstSegment(curves[0]); // #i79917# first segment, not last
257*cdf0e10cSrcweir 				aRetval.append(basegfx::B2DPoint(rFirstSegment.Px, rFirstSegment.Py));
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir 				for(sal_Int32 a(0); a < nSize; a++)
260*cdf0e10cSrcweir 				{
261*cdf0e10cSrcweir 					const geometry::RealBezierSegment2D& rCurrSegment(curves[a]);
262*cdf0e10cSrcweir 					const geometry::RealBezierSegment2D& rNextSegment(curves[(a + 1) % nSize]);
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir 					// append curved edge with the control points and the next point
265*cdf0e10cSrcweir 					aRetval.appendBezierSegment(
266*cdf0e10cSrcweir 						basegfx::B2DPoint(rCurrSegment.C1x, rCurrSegment.C1y),
267*cdf0e10cSrcweir 						basegfx::B2DPoint(rCurrSegment.C2x, rCurrSegment.C2y), // #i79917# Argh! An x for an y!!
268*cdf0e10cSrcweir 						basegfx::B2DPoint(rNextSegment.Px, rNextSegment.Py));
269*cdf0e10cSrcweir 				}
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir 				// rescue the control point and remove the now double-added point
272*cdf0e10cSrcweir 				aRetval.setPrevControlPoint(0, aRetval.getPrevControlPoint(aRetval.count() - 1));
273*cdf0e10cSrcweir 				aRetval.remove(aRetval.count() - 1);
274*cdf0e10cSrcweir 			}
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir 			return aRetval;
277*cdf0e10cSrcweir         }
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir         //---------------------------------------------------------------------------------------
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir         ::basegfx::B2DPolyPolygon polyPolygonFromBezier2DSequenceSequence( const uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > >& curves )
282*cdf0e10cSrcweir         {
283*cdf0e10cSrcweir             ::basegfx::B2DPolyPolygon aRes;
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir             for( sal_Int32 nCurrPoly=0; nCurrPoly<curves.getLength(); ++nCurrPoly )
286*cdf0e10cSrcweir             {
287*cdf0e10cSrcweir                 aRes.append( polygonFromBezier2DSequence( curves[nCurrPoly] ) );
288*cdf0e10cSrcweir             }
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir             return aRes;
291*cdf0e10cSrcweir         }
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir         //---------------------------------------------------------------------------------------
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir         ::basegfx::B2DPolyPolygon b2DPolyPolygonFromXPolyPolygon2D( const uno::Reference< rendering::XPolyPolygon2D >& xPoly )
296*cdf0e10cSrcweir         {
297*cdf0e10cSrcweir             ::basegfx::unotools::UnoPolyPolygon* pPolyImpl =
298*cdf0e10cSrcweir                 dynamic_cast< ::basegfx::unotools::UnoPolyPolygon* >( xPoly.get() );
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir             if( pPolyImpl )
301*cdf0e10cSrcweir             {
302*cdf0e10cSrcweir                 return pPolyImpl->getPolyPolygon();
303*cdf0e10cSrcweir             }
304*cdf0e10cSrcweir             else
305*cdf0e10cSrcweir             {
306*cdf0e10cSrcweir                 // not a known implementation object - try data source
307*cdf0e10cSrcweir                 // interfaces
308*cdf0e10cSrcweir                 const sal_Int32 nPolys( xPoly->getNumberOfPolygons() );
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir                 uno::Reference< rendering::XBezierPolyPolygon2D > xBezierPoly(
311*cdf0e10cSrcweir                     xPoly,
312*cdf0e10cSrcweir                     uno::UNO_QUERY );
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir                 if( xBezierPoly.is() )
315*cdf0e10cSrcweir                 {
316*cdf0e10cSrcweir                     return ::basegfx::unotools::polyPolygonFromBezier2DSequenceSequence(
317*cdf0e10cSrcweir                         xBezierPoly->getBezierSegments( 0,
318*cdf0e10cSrcweir                                                         nPolys,
319*cdf0e10cSrcweir                                                         0,
320*cdf0e10cSrcweir                                                         -1 ) );
321*cdf0e10cSrcweir                 }
322*cdf0e10cSrcweir                 else
323*cdf0e10cSrcweir                 {
324*cdf0e10cSrcweir                     uno::Reference< rendering::XLinePolyPolygon2D > xLinePoly(
325*cdf0e10cSrcweir                         xPoly,
326*cdf0e10cSrcweir                         uno::UNO_QUERY );
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir                     // no implementation class and no data provider
329*cdf0e10cSrcweir                     // found - contract violation.
330*cdf0e10cSrcweir                     if( !xLinePoly.is() )
331*cdf0e10cSrcweir                     {
332*cdf0e10cSrcweir                         throw lang::IllegalArgumentException(
333*cdf0e10cSrcweir                             ::rtl::OUString::createFromAscii(
334*cdf0e10cSrcweir                                     "basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(): Invalid input"
335*cdf0e10cSrcweir                                     "poly-polygon, cannot retrieve vertex data"),
336*cdf0e10cSrcweir                             uno::Reference< uno::XInterface >(),
337*cdf0e10cSrcweir                             0 );
338*cdf0e10cSrcweir                     }
339*cdf0e10cSrcweir 
340*cdf0e10cSrcweir                     return ::basegfx::unotools::polyPolygonFromPoint2DSequenceSequence(
341*cdf0e10cSrcweir                         xLinePoly->getPoints( 0,
342*cdf0e10cSrcweir                                               nPolys,
343*cdf0e10cSrcweir                                               0,
344*cdf0e10cSrcweir                                               -1 ));
345*cdf0e10cSrcweir                 }
346*cdf0e10cSrcweir             }
347*cdf0e10cSrcweir         }
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir         //---------------------------------------------------------------------------------------
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir         ::basegfx::B2DHomMatrix& homMatrixFromAffineMatrix( ::basegfx::B2DHomMatrix&		output,
352*cdf0e10cSrcweir                                                             const geometry::AffineMatrix2D&	input )
353*cdf0e10cSrcweir         {
354*cdf0e10cSrcweir             // ensure last row is [0,0,1] (and optimized away)
355*cdf0e10cSrcweir             output.identity();
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir             output.set(0,0, input.m00);
358*cdf0e10cSrcweir             output.set(0,1, input.m01);
359*cdf0e10cSrcweir             output.set(0,2, input.m02);
360*cdf0e10cSrcweir             output.set(1,0, input.m10);
361*cdf0e10cSrcweir             output.set(1,1, input.m11);
362*cdf0e10cSrcweir             output.set(1,2, input.m12);
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir             return output;
365*cdf0e10cSrcweir         }
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir         ::basegfx::B2DHomMatrix homMatrixFromAffineMatrix( const geometry::AffineMatrix2D& input )
368*cdf0e10cSrcweir         {
369*cdf0e10cSrcweir             ::basegfx::B2DHomMatrix output;
370*cdf0e10cSrcweir 
371*cdf0e10cSrcweir             output.set(0,0, input.m00);
372*cdf0e10cSrcweir             output.set(0,1, input.m01);
373*cdf0e10cSrcweir             output.set(0,2, input.m02);
374*cdf0e10cSrcweir             output.set(1,0, input.m10);
375*cdf0e10cSrcweir             output.set(1,1, input.m11);
376*cdf0e10cSrcweir             output.set(1,2, input.m12);
377*cdf0e10cSrcweir 
378*cdf0e10cSrcweir             return output;
379*cdf0e10cSrcweir         }
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir 		::basegfx::B3DHomMatrix homMatrixFromAffineMatrix3D( const ::com::sun::star::geometry::AffineMatrix3D& input )
382*cdf0e10cSrcweir 		{
383*cdf0e10cSrcweir             ::basegfx::B3DHomMatrix output;
384*cdf0e10cSrcweir 
385*cdf0e10cSrcweir             output.set(0,0, input.m00);
386*cdf0e10cSrcweir             output.set(0,1, input.m01);
387*cdf0e10cSrcweir             output.set(0,2, input.m02);
388*cdf0e10cSrcweir             output.set(0,3, input.m03);
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir             output.set(1,0, input.m10);
391*cdf0e10cSrcweir             output.set(1,1, input.m11);
392*cdf0e10cSrcweir             output.set(1,2, input.m12);
393*cdf0e10cSrcweir             output.set(1,3, input.m13);
394*cdf0e10cSrcweir 
395*cdf0e10cSrcweir             output.set(2,0, input.m20);
396*cdf0e10cSrcweir             output.set(2,1, input.m21);
397*cdf0e10cSrcweir             output.set(2,2, input.m22);
398*cdf0e10cSrcweir             output.set(2,3, input.m23);
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir             return output;
401*cdf0e10cSrcweir 		}
402*cdf0e10cSrcweir 
403*cdf0e10cSrcweir         geometry::AffineMatrix2D& affineMatrixFromHomMatrix( geometry::AffineMatrix2D&		output,
404*cdf0e10cSrcweir                                                              const ::basegfx::B2DHomMatrix&	input)
405*cdf0e10cSrcweir         {
406*cdf0e10cSrcweir             output.m00 = input.get(0,0);
407*cdf0e10cSrcweir             output.m01 = input.get(0,1);
408*cdf0e10cSrcweir             output.m02 = input.get(0,2);
409*cdf0e10cSrcweir             output.m10 = input.get(1,0);
410*cdf0e10cSrcweir             output.m11 = input.get(1,1);
411*cdf0e10cSrcweir             output.m12 = input.get(1,2);
412*cdf0e10cSrcweir 
413*cdf0e10cSrcweir             return output;
414*cdf0e10cSrcweir         }
415*cdf0e10cSrcweir 
416*cdf0e10cSrcweir         geometry::AffineMatrix3D& affineMatrixFromHomMatrix3D(
417*cdf0e10cSrcweir 			geometry::AffineMatrix3D& output,
418*cdf0e10cSrcweir 			const ::basegfx::B3DHomMatrix&	input)
419*cdf0e10cSrcweir         {
420*cdf0e10cSrcweir             output.m00 = input.get(0,0);
421*cdf0e10cSrcweir             output.m01 = input.get(0,1);
422*cdf0e10cSrcweir             output.m02 = input.get(0,2);
423*cdf0e10cSrcweir             output.m03 = input.get(0,3);
424*cdf0e10cSrcweir 
425*cdf0e10cSrcweir 			output.m10 = input.get(1,0);
426*cdf0e10cSrcweir             output.m11 = input.get(1,1);
427*cdf0e10cSrcweir             output.m12 = input.get(1,2);
428*cdf0e10cSrcweir             output.m13 = input.get(1,3);
429*cdf0e10cSrcweir 
430*cdf0e10cSrcweir 			output.m20 = input.get(2,0);
431*cdf0e10cSrcweir             output.m21 = input.get(2,1);
432*cdf0e10cSrcweir             output.m22 = input.get(2,2);
433*cdf0e10cSrcweir             output.m23 = input.get(2,3);
434*cdf0e10cSrcweir 
435*cdf0e10cSrcweir             return output;
436*cdf0e10cSrcweir         }
437*cdf0e10cSrcweir 
438*cdf0e10cSrcweir         //---------------------------------------------------------------------------------------
439*cdf0e10cSrcweir 
440*cdf0e10cSrcweir         ::basegfx::B2DHomMatrix& homMatrixFromMatrix( ::basegfx::B2DHomMatrix&	output,
441*cdf0e10cSrcweir                                                       const geometry::Matrix2D& input )
442*cdf0e10cSrcweir         {
443*cdf0e10cSrcweir             // ensure last row is [0,0,1] (and optimized away)
444*cdf0e10cSrcweir             output.identity();
445*cdf0e10cSrcweir 
446*cdf0e10cSrcweir             output.set(0,0, input.m00);
447*cdf0e10cSrcweir             output.set(0,1, input.m01);
448*cdf0e10cSrcweir             output.set(1,0, input.m10);
449*cdf0e10cSrcweir             output.set(1,1, input.m11);
450*cdf0e10cSrcweir 
451*cdf0e10cSrcweir             return output;
452*cdf0e10cSrcweir         }
453*cdf0e10cSrcweir 
454*cdf0e10cSrcweir         //---------------------------------------------------------------------------------------
455*cdf0e10cSrcweir 
456*cdf0e10cSrcweir         geometry::RealSize2D size2DFromB2DSize( const ::basegfx::B2DVector& rVec )
457*cdf0e10cSrcweir         {
458*cdf0e10cSrcweir             return geometry::RealSize2D( rVec.getX(),
459*cdf0e10cSrcweir                                          rVec.getY() );
460*cdf0e10cSrcweir         }
461*cdf0e10cSrcweir 
462*cdf0e10cSrcweir         geometry::RealPoint2D point2DFromB2DPoint( const ::basegfx::B2DPoint& rPoint )
463*cdf0e10cSrcweir         {
464*cdf0e10cSrcweir             return geometry::RealPoint2D( rPoint.getX(),
465*cdf0e10cSrcweir                                           rPoint.getY() );
466*cdf0e10cSrcweir         }
467*cdf0e10cSrcweir 
468*cdf0e10cSrcweir         geometry::RealRectangle2D rectangle2DFromB2DRectangle( const ::basegfx::B2DRange& rRect )
469*cdf0e10cSrcweir         {
470*cdf0e10cSrcweir             return geometry::RealRectangle2D( rRect.getMinX(),
471*cdf0e10cSrcweir                                               rRect.getMinY(),
472*cdf0e10cSrcweir                                               rRect.getMaxX(),
473*cdf0e10cSrcweir                                               rRect.getMaxY() );
474*cdf0e10cSrcweir         }
475*cdf0e10cSrcweir 
476*cdf0e10cSrcweir         geometry::RealRectangle3D rectangle3DFromB3DRectangle( const ::basegfx::B3DRange& rRect )
477*cdf0e10cSrcweir         {
478*cdf0e10cSrcweir             return geometry::RealRectangle3D( rRect.getMinX(),
479*cdf0e10cSrcweir                                               rRect.getMinY(),
480*cdf0e10cSrcweir                                               rRect.getMinZ(),
481*cdf0e10cSrcweir                                               rRect.getMaxX(),
482*cdf0e10cSrcweir                                               rRect.getMaxY(),
483*cdf0e10cSrcweir 											  rRect.getMaxZ());
484*cdf0e10cSrcweir         }
485*cdf0e10cSrcweir 
486*cdf0e10cSrcweir         ::basegfx::B2DVector b2DSizeFromRealSize2D( const geometry::RealSize2D& rSize )
487*cdf0e10cSrcweir         {
488*cdf0e10cSrcweir             return ::basegfx::B2DVector( rSize.Width,
489*cdf0e10cSrcweir                                          rSize.Height );
490*cdf0e10cSrcweir         }
491*cdf0e10cSrcweir 
492*cdf0e10cSrcweir         ::basegfx::B2DPoint b2DPointFromRealPoint2D( const geometry::RealPoint2D& rPoint )
493*cdf0e10cSrcweir         {
494*cdf0e10cSrcweir             return ::basegfx::B2DPoint( rPoint.X,
495*cdf0e10cSrcweir                                         rPoint.Y );
496*cdf0e10cSrcweir         }
497*cdf0e10cSrcweir 
498*cdf0e10cSrcweir         ::basegfx::B2DRange b2DRectangleFromRealRectangle2D( const geometry::RealRectangle2D& rRect )
499*cdf0e10cSrcweir         {
500*cdf0e10cSrcweir             return ::basegfx::B2DRange( rRect.X1,
501*cdf0e10cSrcweir                                         rRect.Y1,
502*cdf0e10cSrcweir                                         rRect.X2,
503*cdf0e10cSrcweir                                         rRect.Y2 );
504*cdf0e10cSrcweir         }
505*cdf0e10cSrcweir 
506*cdf0e10cSrcweir         ::basegfx::B3DRange b3DRectangleFromRealRectangle3D( const geometry::RealRectangle3D& rRect )
507*cdf0e10cSrcweir         {
508*cdf0e10cSrcweir             return ::basegfx::B3DRange( rRect.X1,
509*cdf0e10cSrcweir                                         rRect.Y1,
510*cdf0e10cSrcweir                                         rRect.Z1,
511*cdf0e10cSrcweir                                         rRect.X2,
512*cdf0e10cSrcweir                                         rRect.Y2,
513*cdf0e10cSrcweir 										rRect.Z2);
514*cdf0e10cSrcweir         }
515*cdf0e10cSrcweir 
516*cdf0e10cSrcweir         geometry::IntegerSize2D integerSize2DFromB2ISize( const ::basegfx::B2IVector& rSize )
517*cdf0e10cSrcweir         {
518*cdf0e10cSrcweir             return geometry::IntegerSize2D( rSize.getX(),
519*cdf0e10cSrcweir                                             rSize.getY() );
520*cdf0e10cSrcweir         }
521*cdf0e10cSrcweir 
522*cdf0e10cSrcweir         geometry::IntegerPoint2D integerPoint2DFromB2IPoint( const ::basegfx::B2IPoint& rPoint )
523*cdf0e10cSrcweir         {
524*cdf0e10cSrcweir             return geometry::IntegerPoint2D( rPoint.getX(),
525*cdf0e10cSrcweir                                              rPoint.getY() );
526*cdf0e10cSrcweir         }
527*cdf0e10cSrcweir 
528*cdf0e10cSrcweir         geometry::IntegerRectangle2D integerRectangle2DFromB2IRectangle( const ::basegfx::B2IRange& rRectangle )
529*cdf0e10cSrcweir         {
530*cdf0e10cSrcweir             return geometry::IntegerRectangle2D( rRectangle.getMinX(), rRectangle.getMinY(),
531*cdf0e10cSrcweir                                                  rRectangle.getMaxX(), rRectangle.getMaxY() );
532*cdf0e10cSrcweir         }
533*cdf0e10cSrcweir 
534*cdf0e10cSrcweir         ::basegfx::B2IVector b2ISizeFromIntegerSize2D( const geometry::IntegerSize2D& rSize )
535*cdf0e10cSrcweir         {
536*cdf0e10cSrcweir             return ::basegfx::B2IVector( rSize.Width,
537*cdf0e10cSrcweir                                          rSize.Height );
538*cdf0e10cSrcweir         }
539*cdf0e10cSrcweir 
540*cdf0e10cSrcweir         ::basegfx::B2IPoint b2IPointFromIntegerPoint2D( const geometry::IntegerPoint2D& rPoint )
541*cdf0e10cSrcweir         {
542*cdf0e10cSrcweir             return ::basegfx::B2IPoint( rPoint.X,
543*cdf0e10cSrcweir                                         rPoint.Y );
544*cdf0e10cSrcweir         }
545*cdf0e10cSrcweir 
546*cdf0e10cSrcweir         ::basegfx::B2IRange b2IRectangleFromIntegerRectangle2D( const geometry::IntegerRectangle2D& rRectangle )
547*cdf0e10cSrcweir         {
548*cdf0e10cSrcweir             return ::basegfx::B2IRange( rRectangle.X1, rRectangle.Y1,
549*cdf0e10cSrcweir                                         rRectangle.X2, rRectangle.Y2 );
550*cdf0e10cSrcweir         }
551*cdf0e10cSrcweir 
552*cdf0e10cSrcweir         awt::Size awtSizeFromB2ISize( const ::basegfx::B2IVector& rVec )
553*cdf0e10cSrcweir         {
554*cdf0e10cSrcweir             return awt::Size( rVec.getX(),
555*cdf0e10cSrcweir                               rVec.getY() );
556*cdf0e10cSrcweir         }
557*cdf0e10cSrcweir 
558*cdf0e10cSrcweir         awt::Point awtPointFromB2IPoint( const ::basegfx::B2IPoint& rPoint )
559*cdf0e10cSrcweir         {
560*cdf0e10cSrcweir             return awt::Point( rPoint.getX(),
561*cdf0e10cSrcweir                                rPoint.getY() );
562*cdf0e10cSrcweir         }
563*cdf0e10cSrcweir 
564*cdf0e10cSrcweir         awt::Rectangle awtRectangleFromB2IRectangle( const ::basegfx::B2IRange& rRect )
565*cdf0e10cSrcweir         {
566*cdf0e10cSrcweir             OSL_ENSURE( rRect.getWidth() < ::std::numeric_limits< sal_Int32 >::max() &&
567*cdf0e10cSrcweir                         rRect.getWidth() > ::std::numeric_limits< sal_Int32 >::min(),
568*cdf0e10cSrcweir                         "awtRectangleFromB2IRectangle(): width overflow" );
569*cdf0e10cSrcweir             OSL_ENSURE( rRect.getHeight() < ::std::numeric_limits< sal_Int32 >::max() &&
570*cdf0e10cSrcweir                         rRect.getHeight() > ::std::numeric_limits< sal_Int32 >::min(),
571*cdf0e10cSrcweir                         "awtRectangleFromB2IRectangle(): height overflow" );
572*cdf0e10cSrcweir 
573*cdf0e10cSrcweir             return awt::Rectangle( rRect.getMinX(),
574*cdf0e10cSrcweir                                    rRect.getMinY(),
575*cdf0e10cSrcweir                                    static_cast< sal_Int32 >(rRect.getWidth()),
576*cdf0e10cSrcweir                                    static_cast< sal_Int32 >(rRect.getHeight()) );
577*cdf0e10cSrcweir         }
578*cdf0e10cSrcweir 
579*cdf0e10cSrcweir         ::basegfx::B2IVector b2ISizeFromAwtSize( const awt::Size& rSize )
580*cdf0e10cSrcweir         {
581*cdf0e10cSrcweir             return ::basegfx::B2IVector( rSize.Width,
582*cdf0e10cSrcweir                                          rSize.Height );
583*cdf0e10cSrcweir         }
584*cdf0e10cSrcweir 
585*cdf0e10cSrcweir         ::basegfx::B2IPoint b2IPointFromAwtPoint( const awt::Point& rPoint )
586*cdf0e10cSrcweir         {
587*cdf0e10cSrcweir             return ::basegfx::B2IPoint( rPoint.X,
588*cdf0e10cSrcweir                                         rPoint.Y );
589*cdf0e10cSrcweir         }
590*cdf0e10cSrcweir 
591*cdf0e10cSrcweir         ::basegfx::B2IRange b2IRectangleFromAwtRectangle( const awt::Rectangle& rRect )
592*cdf0e10cSrcweir         {
593*cdf0e10cSrcweir             return ::basegfx::B2IRange( rRect.X,
594*cdf0e10cSrcweir                                         rRect.Y,
595*cdf0e10cSrcweir                                         rRect.X + rRect.Width,
596*cdf0e10cSrcweir                                         rRect.Y + rRect.Height );
597*cdf0e10cSrcweir         }
598*cdf0e10cSrcweir 
599*cdf0e10cSrcweir         ::basegfx::B2IRange b2ISurroundingRangeFromB2DRange( const ::basegfx::B2DRange& rRange )
600*cdf0e10cSrcweir         {
601*cdf0e10cSrcweir             return ::basegfx::B2IRange( static_cast<sal_Int32>( floor(rRange.getMinX()) ),
602*cdf0e10cSrcweir                                         static_cast<sal_Int32>( floor(rRange.getMinY()) ),
603*cdf0e10cSrcweir                                         static_cast<sal_Int32>( ceil(rRange.getMaxX()) ),
604*cdf0e10cSrcweir                                         static_cast<sal_Int32>( ceil(rRange.getMaxY()) ) );
605*cdf0e10cSrcweir         }
606*cdf0e10cSrcweir 
607*cdf0e10cSrcweir         ::basegfx::B2DRange b2DSurroundingIntegerRangeFromB2DRange( const ::basegfx::B2DRange& rRange )
608*cdf0e10cSrcweir         {
609*cdf0e10cSrcweir             return ::basegfx::B2DRange( floor(rRange.getMinX()),
610*cdf0e10cSrcweir                                         floor(rRange.getMinY()),
611*cdf0e10cSrcweir                                         ceil(rRange.getMaxX()),
612*cdf0e10cSrcweir                                         ceil(rRange.getMaxY()) );
613*cdf0e10cSrcweir         }
614*cdf0e10cSrcweir 
615*cdf0e10cSrcweir         // Geometry comparisons
616*cdf0e10cSrcweir         // ===================================================================
617*cdf0e10cSrcweir 
618*cdf0e10cSrcweir 		bool RealSize2DAreEqual( const ::com::sun::star::geometry::RealSize2D& rA, const ::com::sun::star::geometry::RealSize2D& rB )
619*cdf0e10cSrcweir 		{
620*cdf0e10cSrcweir 			return (rA.Width == rB.Width && rA.Height == rB.Height);
621*cdf0e10cSrcweir 		}
622*cdf0e10cSrcweir 
623*cdf0e10cSrcweir 		bool RealPoint2DAreEqual( const ::com::sun::star::geometry::RealPoint2D& rA, const ::com::sun::star::geometry::RealPoint2D& rB )
624*cdf0e10cSrcweir 		{
625*cdf0e10cSrcweir 			return (rA.X == rB.X && rA.Y == rB.Y);
626*cdf0e10cSrcweir 		}
627*cdf0e10cSrcweir 
628*cdf0e10cSrcweir 		bool RealRectangle2DAreEqual( const ::com::sun::star::geometry::RealRectangle2D& rA, const ::com::sun::star::geometry::RealRectangle2D& rB )
629*cdf0e10cSrcweir 		{
630*cdf0e10cSrcweir 			return (rA.X1 == rB.X1 && rA.Y1 == rB.Y1 && rA.X2 == rB.X2 && rA.Y2 == rB.Y2);
631*cdf0e10cSrcweir 		}
632*cdf0e10cSrcweir 
633*cdf0e10cSrcweir 		bool RealRectangle3DAreEqual( const ::com::sun::star::geometry::RealRectangle3D& rA, const ::com::sun::star::geometry::RealRectangle3D& rB )
634*cdf0e10cSrcweir 		{
635*cdf0e10cSrcweir 			return (rA.X1 == rB.X1 && rA.Y1 == rB.Y1 && rA.Z1 == rB.Z1 && rA.X2 == rB.X2 && rA.Y2 == rB.Y2 && rA.Z2 == rB.Z2);
636*cdf0e10cSrcweir 		}
637*cdf0e10cSrcweir 
638*cdf0e10cSrcweir 		bool AffineMatrix2DAreEqual( const ::com::sun::star::geometry::AffineMatrix2D& rA, const ::com::sun::star::geometry::AffineMatrix2D& rB )
639*cdf0e10cSrcweir 		{
640*cdf0e10cSrcweir 			return (rA.m00 == rB.m00 && rA.m01 == rB.m01 && rA.m02 == rB.m02 && rA.m10 == rB.m10 && rA.m11 == rB.m11 && rA.m12 == rB.m12);
641*cdf0e10cSrcweir 		}
642*cdf0e10cSrcweir 
643*cdf0e10cSrcweir 		bool IntegerSize2DAreEqual( const ::com::sun::star::geometry::IntegerSize2D& rA, const ::com::sun::star::geometry::IntegerSize2D& rB )
644*cdf0e10cSrcweir 		{
645*cdf0e10cSrcweir 			return (rA.Width == rB.Width && rA.Height == rB.Height);
646*cdf0e10cSrcweir 		}
647*cdf0e10cSrcweir 
648*cdf0e10cSrcweir 		bool IntegerPoint2DAreEqual( const ::com::sun::star::geometry::IntegerPoint2D& rA, const ::com::sun::star::geometry::IntegerPoint2D& rB )
649*cdf0e10cSrcweir 		{
650*cdf0e10cSrcweir 			return (rA.X == rB.X && rA.Y == rB.Y);
651*cdf0e10cSrcweir 		}
652*cdf0e10cSrcweir 
653*cdf0e10cSrcweir 		bool IntegerRectangle2DAreEqual( const ::com::sun::star::geometry::IntegerRectangle2D& rA, const ::com::sun::star::geometry::IntegerRectangle2D& rB )
654*cdf0e10cSrcweir 		{
655*cdf0e10cSrcweir 			return (rA.X1 == rB.X1 && rA.Y1 == rB.Y1 && rA.X2 == rB.X2 && rA.Y2 == rB.Y2);
656*cdf0e10cSrcweir 		}
657*cdf0e10cSrcweir 
658*cdf0e10cSrcweir 		bool awtSizeAreEqual( const ::com::sun::star::awt::Size& rA, const ::com::sun::star::awt::Size& rB )
659*cdf0e10cSrcweir 		{
660*cdf0e10cSrcweir 			return (rA.Width == rB.Width && rA.Height == rB.Height);
661*cdf0e10cSrcweir 		}
662*cdf0e10cSrcweir 
663*cdf0e10cSrcweir 		bool awtPointAreEqual( const ::com::sun::star::awt::Point& rA, const ::com::sun::star::awt::Point& rB )
664*cdf0e10cSrcweir 		{
665*cdf0e10cSrcweir 			return (rA.X == rB.X && rA.Y == rB.Y);
666*cdf0e10cSrcweir 		}
667*cdf0e10cSrcweir 
668*cdf0e10cSrcweir 		bool awtRectangleAreEqual( const ::com::sun::star::awt::Rectangle& rA, const ::com::sun::star::awt::Rectangle& rB )
669*cdf0e10cSrcweir 		{
670*cdf0e10cSrcweir 			return (rA.X == rB.X && rA.Y == rB.Y && rA.Width == rB.Width && rA.Height == rB.Height);
671*cdf0e10cSrcweir 		}
672*cdf0e10cSrcweir     } // namespace bgfxtools
673*cdf0e10cSrcweir 
674*cdf0e10cSrcweir } // namespace canvas
675