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_svx.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <svx/sdr/overlay/overlaytools.hxx>
32*cdf0e10cSrcweir #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
33*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
34*cdf0e10cSrcweir #include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
35*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
36*cdf0e10cSrcweir #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
37*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx>
38*cdf0e10cSrcweir #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
39*cdf0e10cSrcweir #include <drawinglayer/geometry/viewinformation2d.hxx>
40*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrixtools.hxx>
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir namespace drawinglayer
45*cdf0e10cSrcweir {
46*cdf0e10cSrcweir 	namespace primitive2d
47*cdf0e10cSrcweir 	{
48*cdf0e10cSrcweir         OverlayBitmapExPrimitive::OverlayBitmapExPrimitive(
49*cdf0e10cSrcweir 			const BitmapEx& rBitmapEx,
50*cdf0e10cSrcweir 			const basegfx::B2DPoint& rBasePosition,
51*cdf0e10cSrcweir 			sal_uInt16 nCenterX,
52*cdf0e10cSrcweir 			sal_uInt16 nCenterY)
53*cdf0e10cSrcweir 		:   DiscreteMetricDependentPrimitive2D(),
54*cdf0e10cSrcweir 			maBitmapEx(rBitmapEx),
55*cdf0e10cSrcweir 			maBasePosition(rBasePosition),
56*cdf0e10cSrcweir 			mnCenterX(nCenterX),
57*cdf0e10cSrcweir 			mnCenterY(nCenterY)
58*cdf0e10cSrcweir 		{}
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir 		Primitive2DSequence OverlayBitmapExPrimitive::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
61*cdf0e10cSrcweir 		{
62*cdf0e10cSrcweir             Primitive2DSequence aRetval;
63*cdf0e10cSrcweir 			const Size aBitmapSize(getBitmapEx().GetSizePixel());
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir             if(aBitmapSize.Width() && aBitmapSize.Height() && basegfx::fTools::more(getDiscreteUnit(), 0.0))
66*cdf0e10cSrcweir 			{
67*cdf0e10cSrcweir                 // calculate back from internal bitmap's extreme coordinates (the edges)
68*cdf0e10cSrcweir                 // to logical coordinates. Only use a unified scaling value (getDiscreteUnit(),
69*cdf0e10cSrcweir                 // the prepared one which expresses how many logic units form a discrete unit)
70*cdf0e10cSrcweir                 // for this step. This primitive is to be displayed always unscaled (in it's pixel size)
71*cdf0e10cSrcweir                 // and unrotated, more like a marker
72*cdf0e10cSrcweir                 const double fLeft(((0.0 - getCenterX()) * getDiscreteUnit()) + getBasePosition().getX());
73*cdf0e10cSrcweir                 const double fTop(((0.0 - getCenterY()) * getDiscreteUnit()) + getBasePosition().getY());
74*cdf0e10cSrcweir                 const double fRight((((aBitmapSize.getWidth() - 1.0) - getCenterX()) * getDiscreteUnit()) + getBasePosition().getX());
75*cdf0e10cSrcweir                 const double fBottom((((aBitmapSize.getHeight() - 1.0) - getCenterY()) * getDiscreteUnit()) + getBasePosition().getY());
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir                 // create a BitmapPrimitive2D using those positions
78*cdf0e10cSrcweir 				basegfx::B2DHomMatrix aTransform;
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir 				aTransform.set(0, 0, fRight - fLeft);
81*cdf0e10cSrcweir 				aTransform.set(1, 1, fBottom - fTop);
82*cdf0e10cSrcweir 				aTransform.set(0, 2, fLeft);
83*cdf0e10cSrcweir 				aTransform.set(1, 2, fTop);
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir                 const Primitive2DReference aPrimitive(new BitmapPrimitive2D(getBitmapEx(), aTransform));
86*cdf0e10cSrcweir                 aRetval = Primitive2DSequence(&aPrimitive, 1);
87*cdf0e10cSrcweir             }
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir             return aRetval;
90*cdf0e10cSrcweir 		}
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir 		bool OverlayBitmapExPrimitive::operator==( const BasePrimitive2D& rPrimitive ) const
93*cdf0e10cSrcweir 		{
94*cdf0e10cSrcweir 			if(DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
95*cdf0e10cSrcweir 			{
96*cdf0e10cSrcweir 				const OverlayBitmapExPrimitive& rCompare = static_cast< const OverlayBitmapExPrimitive& >(rPrimitive);
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir 				return (getBitmapEx() == rCompare.getBitmapEx()
99*cdf0e10cSrcweir 					&& getBasePosition() == rCompare.getBasePosition()
100*cdf0e10cSrcweir 					&& getCenterX() == rCompare.getCenterX()
101*cdf0e10cSrcweir 					&& getCenterY() == rCompare.getCenterY());
102*cdf0e10cSrcweir 			}
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir 			return false;
105*cdf0e10cSrcweir 		}
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(OverlayBitmapExPrimitive, PRIMITIVE2D_ID_OVERLAYBITMAPEXPRIMITIVE)
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 	} // end of namespace primitive2d
110*cdf0e10cSrcweir } // end of namespace drawinglayer
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir namespace drawinglayer
115*cdf0e10cSrcweir {
116*cdf0e10cSrcweir 	namespace primitive2d
117*cdf0e10cSrcweir 	{
118*cdf0e10cSrcweir         OverlayCrosshairPrimitive::OverlayCrosshairPrimitive(
119*cdf0e10cSrcweir             const basegfx::B2DPoint& rBasePosition,
120*cdf0e10cSrcweir 			const basegfx::BColor& rRGBColorA,
121*cdf0e10cSrcweir 			const basegfx::BColor& rRGBColorB,
122*cdf0e10cSrcweir 			double fDiscreteDashLength)
123*cdf0e10cSrcweir         :   ViewportDependentPrimitive2D(),
124*cdf0e10cSrcweir 			maBasePosition(rBasePosition),
125*cdf0e10cSrcweir 			maRGBColorA(rRGBColorA),
126*cdf0e10cSrcweir 			maRGBColorB(rRGBColorB),
127*cdf0e10cSrcweir 			mfDiscreteDashLength(fDiscreteDashLength)
128*cdf0e10cSrcweir         {}
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir 		Primitive2DSequence OverlayCrosshairPrimitive::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
131*cdf0e10cSrcweir 		{
132*cdf0e10cSrcweir             // use the prepared Viewport information accessible using getViewport()
133*cdf0e10cSrcweir             Primitive2DSequence aRetval;
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir             if(!getViewport().isEmpty())
136*cdf0e10cSrcweir             {
137*cdf0e10cSrcweir                 aRetval.realloc(2);
138*cdf0e10cSrcweir                 basegfx::B2DPolygon aPolygon;
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir                 aPolygon.append(basegfx::B2DPoint(getViewport().getMinX(), getBasePosition().getY()));
141*cdf0e10cSrcweir                 aPolygon.append(basegfx::B2DPoint(getViewport().getMaxX(), getBasePosition().getY()));
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir                 aRetval[0] = Primitive2DReference(
144*cdf0e10cSrcweir                     new PolygonMarkerPrimitive2D(
145*cdf0e10cSrcweir                         aPolygon,
146*cdf0e10cSrcweir                         getRGBColorA(),
147*cdf0e10cSrcweir                         getRGBColorB(),
148*cdf0e10cSrcweir                         getDiscreteDashLength()));
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir                 aPolygon.clear();
151*cdf0e10cSrcweir                 aPolygon.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMinY()));
152*cdf0e10cSrcweir                 aPolygon.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMaxY()));
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir                 aRetval[1] = Primitive2DReference(
155*cdf0e10cSrcweir                     new PolygonMarkerPrimitive2D(
156*cdf0e10cSrcweir                         aPolygon,
157*cdf0e10cSrcweir                         getRGBColorA(),
158*cdf0e10cSrcweir                         getRGBColorB(),
159*cdf0e10cSrcweir                         getDiscreteDashLength()));
160*cdf0e10cSrcweir             }
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir             return aRetval;
163*cdf0e10cSrcweir 		}
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir 		bool OverlayCrosshairPrimitive::operator==( const BasePrimitive2D& rPrimitive ) const
166*cdf0e10cSrcweir 		{
167*cdf0e10cSrcweir 			if(ViewportDependentPrimitive2D::operator==(rPrimitive))
168*cdf0e10cSrcweir 			{
169*cdf0e10cSrcweir 				const OverlayCrosshairPrimitive& rCompare = static_cast< const OverlayCrosshairPrimitive& >(rPrimitive);
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 				return (getBasePosition() == rCompare.getBasePosition()
172*cdf0e10cSrcweir 					&& getRGBColorA() == rCompare.getRGBColorA()
173*cdf0e10cSrcweir 					&& getRGBColorB() == rCompare.getRGBColorB()
174*cdf0e10cSrcweir                     && getDiscreteDashLength() == rCompare.getDiscreteDashLength());
175*cdf0e10cSrcweir 			}
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir 			return false;
178*cdf0e10cSrcweir 		}
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(OverlayCrosshairPrimitive, PRIMITIVE2D_ID_OVERLAYCROSSHAIRPRIMITIVE)
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir 	} // end of namespace primitive2d
183*cdf0e10cSrcweir } // end of namespace drawinglayer
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir namespace drawinglayer
188*cdf0e10cSrcweir {
189*cdf0e10cSrcweir 	namespace primitive2d
190*cdf0e10cSrcweir 	{
191*cdf0e10cSrcweir         OverlayHatchRectanglePrimitive::OverlayHatchRectanglePrimitive(
192*cdf0e10cSrcweir             const basegfx::B2DRange& rObjectRange,
193*cdf0e10cSrcweir 			double fDiscreteHatchDistance,
194*cdf0e10cSrcweir 			double fHatchRotation,
195*cdf0e10cSrcweir 			const basegfx::BColor& rHatchColor,
196*cdf0e10cSrcweir             double fDiscreteGrow,
197*cdf0e10cSrcweir             double fDiscreteShrink,
198*cdf0e10cSrcweir             double fRotation)
199*cdf0e10cSrcweir         :   DiscreteMetricDependentPrimitive2D(),
200*cdf0e10cSrcweir             maObjectRange(rObjectRange),
201*cdf0e10cSrcweir 			mfDiscreteHatchDistance(fDiscreteHatchDistance),
202*cdf0e10cSrcweir 			mfHatchRotation(fHatchRotation),
203*cdf0e10cSrcweir 			maHatchColor(rHatchColor),
204*cdf0e10cSrcweir             mfDiscreteGrow(fDiscreteGrow),
205*cdf0e10cSrcweir             mfDiscreteShrink(fDiscreteShrink),
206*cdf0e10cSrcweir             mfRotation(fRotation)
207*cdf0e10cSrcweir         {}
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir 		Primitive2DSequence OverlayHatchRectanglePrimitive::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
210*cdf0e10cSrcweir 		{
211*cdf0e10cSrcweir             Primitive2DSequence aRetval;
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir             if(basegfx::fTools::more(getDiscreteUnit(), 0.0))
214*cdf0e10cSrcweir             {
215*cdf0e10cSrcweir 			    basegfx::B2DRange aInnerRange(getObjectRange());
216*cdf0e10cSrcweir 			    basegfx::B2DRange aOuterRange(getObjectRange());
217*cdf0e10cSrcweir 			    basegfx::B2DPolyPolygon aHatchPolyPolygon;
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir 			    aOuterRange.grow(getDiscreteUnit() * getDiscreteGrow());
220*cdf0e10cSrcweir 			    aInnerRange.grow(getDiscreteUnit() * -getDiscreteShrink());
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir 			    aHatchPolyPolygon.append(basegfx::tools::createPolygonFromRect(aOuterRange));
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir 				if(!aInnerRange.isEmpty())
225*cdf0e10cSrcweir 				{
226*cdf0e10cSrcweir 				    aHatchPolyPolygon.append(basegfx::tools::createPolygonFromRect(aInnerRange));
227*cdf0e10cSrcweir 				}
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir 			    if(!basegfx::fTools::equalZero(getRotation()))
230*cdf0e10cSrcweir 			    {
231*cdf0e10cSrcweir                     const basegfx::B2DHomMatrix aTransform(basegfx::tools::createRotateAroundPoint(
232*cdf0e10cSrcweir                         getObjectRange().getMinX(), getObjectRange().getMinY(), getRotation()));
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir                     aHatchPolyPolygon.transform(aTransform);
235*cdf0e10cSrcweir 			    }
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir                 const basegfx::BColor aEmptyColor(0.0, 0.0, 0.0);
238*cdf0e10cSrcweir 				const drawinglayer::attribute::FillHatchAttribute aFillHatchAttribute(
239*cdf0e10cSrcweir 					drawinglayer::attribute::HATCHSTYLE_SINGLE,
240*cdf0e10cSrcweir 					getDiscreteHatchDistance() * getDiscreteUnit(),
241*cdf0e10cSrcweir 					getHatchRotation() - getRotation(),
242*cdf0e10cSrcweir 					getHatchColor(),
243*cdf0e10cSrcweir 					false);
244*cdf0e10cSrcweir                 const Primitive2DReference aPrimitive(
245*cdf0e10cSrcweir                     new PolyPolygonHatchPrimitive2D(
246*cdf0e10cSrcweir                         aHatchPolyPolygon,
247*cdf0e10cSrcweir                         aEmptyColor,
248*cdf0e10cSrcweir                         aFillHatchAttribute));
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir                 aRetval = Primitive2DSequence(&aPrimitive, 1);
251*cdf0e10cSrcweir             }
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir             return aRetval;
254*cdf0e10cSrcweir 		}
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir 		bool OverlayHatchRectanglePrimitive::operator==( const BasePrimitive2D& rPrimitive ) const
257*cdf0e10cSrcweir 		{
258*cdf0e10cSrcweir 			if(DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
259*cdf0e10cSrcweir 			{
260*cdf0e10cSrcweir 				const OverlayHatchRectanglePrimitive& rCompare = static_cast< const OverlayHatchRectanglePrimitive& >(rPrimitive);
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir 				return (getObjectRange() == rCompare.getObjectRange()
263*cdf0e10cSrcweir 					&& getDiscreteHatchDistance() == rCompare.getDiscreteHatchDistance()
264*cdf0e10cSrcweir 					&& getHatchRotation() == rCompare.getHatchRotation()
265*cdf0e10cSrcweir 					&& getHatchColor() == rCompare.getHatchColor()
266*cdf0e10cSrcweir 					&& getDiscreteGrow() == rCompare.getDiscreteGrow()
267*cdf0e10cSrcweir 					&& getDiscreteShrink() == rCompare.getDiscreteShrink()
268*cdf0e10cSrcweir 					&& getRotation() == rCompare.getRotation());
269*cdf0e10cSrcweir 			}
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir 			return false;
272*cdf0e10cSrcweir 		}
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(OverlayHatchRectanglePrimitive, PRIMITIVE2D_ID_OVERLAYHATCHRECTANGLEPRIMITIVE)
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir 	} // end of namespace primitive2d
277*cdf0e10cSrcweir } // end of namespace drawinglayer
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir namespace drawinglayer
282*cdf0e10cSrcweir {
283*cdf0e10cSrcweir 	namespace primitive2d
284*cdf0e10cSrcweir 	{
285*cdf0e10cSrcweir         OverlayHelplineStripedPrimitive::OverlayHelplineStripedPrimitive(
286*cdf0e10cSrcweir             const basegfx::B2DPoint& rBasePosition,
287*cdf0e10cSrcweir             HelplineStyle eStyle,
288*cdf0e10cSrcweir 			const basegfx::BColor& rRGBColorA,
289*cdf0e10cSrcweir 			const basegfx::BColor& rRGBColorB,
290*cdf0e10cSrcweir 			double fDiscreteDashLength)
291*cdf0e10cSrcweir         :   ViewportDependentPrimitive2D(),
292*cdf0e10cSrcweir 			maBasePosition(rBasePosition),
293*cdf0e10cSrcweir             meStyle(eStyle),
294*cdf0e10cSrcweir 			maRGBColorA(rRGBColorA),
295*cdf0e10cSrcweir 			maRGBColorB(rRGBColorB),
296*cdf0e10cSrcweir 			mfDiscreteDashLength(fDiscreteDashLength)
297*cdf0e10cSrcweir         {}
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir 		Primitive2DSequence OverlayHelplineStripedPrimitive::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const
300*cdf0e10cSrcweir 		{
301*cdf0e10cSrcweir             // use the prepared Viewport information accessible using getViewport()
302*cdf0e10cSrcweir             Primitive2DSequence aRetval;
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir             if(!getViewport().isEmpty())
305*cdf0e10cSrcweir             {
306*cdf0e10cSrcweir 			    switch(getStyle())
307*cdf0e10cSrcweir 			    {
308*cdf0e10cSrcweir 				    case HELPLINESTYLE_VERTICAL :
309*cdf0e10cSrcweir 				    {
310*cdf0e10cSrcweir                         aRetval.realloc(1);
311*cdf0e10cSrcweir                         basegfx::B2DPolygon aLine;
312*cdf0e10cSrcweir 
313*cdf0e10cSrcweir                         aLine.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMinY()));
314*cdf0e10cSrcweir 					    aLine.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMaxY()));
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir                         aRetval[0] = Primitive2DReference(
317*cdf0e10cSrcweir                             new PolygonMarkerPrimitive2D(
318*cdf0e10cSrcweir                                 aLine,
319*cdf0e10cSrcweir                                 getRGBColorA(),
320*cdf0e10cSrcweir                                 getRGBColorB(),
321*cdf0e10cSrcweir                                 getDiscreteDashLength()));
322*cdf0e10cSrcweir 					    break;
323*cdf0e10cSrcweir 				    }
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir 				    case HELPLINESTYLE_HORIZONTAL :
326*cdf0e10cSrcweir 				    {
327*cdf0e10cSrcweir                         aRetval.realloc(1);
328*cdf0e10cSrcweir                         basegfx::B2DPolygon aLine;
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir                         aLine.append(basegfx::B2DPoint(getViewport().getMinX(), getBasePosition().getY()));
331*cdf0e10cSrcweir 					    aLine.append(basegfx::B2DPoint(getViewport().getMaxX(), getBasePosition().getY()));
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir                         aRetval[0] = Primitive2DReference(
334*cdf0e10cSrcweir                             new PolygonMarkerPrimitive2D(
335*cdf0e10cSrcweir                                 aLine,
336*cdf0e10cSrcweir                                 getRGBColorA(),
337*cdf0e10cSrcweir                                 getRGBColorB(),
338*cdf0e10cSrcweir                                 getDiscreteDashLength()));
339*cdf0e10cSrcweir 					    break;
340*cdf0e10cSrcweir 				    }
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir                     default: // case HELPLINESTYLE_POINT :
343*cdf0e10cSrcweir 				    {
344*cdf0e10cSrcweir             			const double fDiscreteUnit((rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength());
345*cdf0e10cSrcweir                         aRetval.realloc(2);
346*cdf0e10cSrcweir                         basegfx::B2DPolygon aLineA, aLineB;
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir 					    aLineA.append(basegfx::B2DPoint(getBasePosition().getX(), getBasePosition().getY() - fDiscreteUnit));
349*cdf0e10cSrcweir 					    aLineA.append(basegfx::B2DPoint(getBasePosition().getX(), getBasePosition().getY() + fDiscreteUnit));
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir                         aRetval[0] = Primitive2DReference(
352*cdf0e10cSrcweir                             new PolygonMarkerPrimitive2D(
353*cdf0e10cSrcweir                                 aLineA,
354*cdf0e10cSrcweir                                 getRGBColorA(),
355*cdf0e10cSrcweir                                 getRGBColorB(),
356*cdf0e10cSrcweir                                 getDiscreteDashLength()));
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir 					    aLineB.append(basegfx::B2DPoint(getBasePosition().getX() - fDiscreteUnit, getBasePosition().getY()));
359*cdf0e10cSrcweir 					    aLineB.append(basegfx::B2DPoint(getBasePosition().getX() + fDiscreteUnit, getBasePosition().getY()));
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir                         aRetval[1] = Primitive2DReference(
362*cdf0e10cSrcweir                             new PolygonMarkerPrimitive2D(
363*cdf0e10cSrcweir                                 aLineB,
364*cdf0e10cSrcweir                                 getRGBColorA(),
365*cdf0e10cSrcweir                                 getRGBColorB(),
366*cdf0e10cSrcweir                                 getDiscreteDashLength()));
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir 					    break;
369*cdf0e10cSrcweir 				    }
370*cdf0e10cSrcweir 			    }
371*cdf0e10cSrcweir             }
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir             return aRetval;
374*cdf0e10cSrcweir 		}
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir 		bool OverlayHelplineStripedPrimitive::operator==( const BasePrimitive2D& rPrimitive ) const
377*cdf0e10cSrcweir 		{
378*cdf0e10cSrcweir 			if(ViewportDependentPrimitive2D::operator==(rPrimitive))
379*cdf0e10cSrcweir 			{
380*cdf0e10cSrcweir 				const OverlayHelplineStripedPrimitive& rCompare = static_cast< const OverlayHelplineStripedPrimitive& >(rPrimitive);
381*cdf0e10cSrcweir 
382*cdf0e10cSrcweir 				return (getBasePosition() == rCompare.getBasePosition()
383*cdf0e10cSrcweir                     && getStyle() == rCompare.getStyle()
384*cdf0e10cSrcweir 					&& getRGBColorA() == rCompare.getRGBColorA()
385*cdf0e10cSrcweir 					&& getRGBColorB() == rCompare.getRGBColorB()
386*cdf0e10cSrcweir                     && getDiscreteDashLength() == rCompare.getDiscreteDashLength());
387*cdf0e10cSrcweir 			}
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir 			return false;
390*cdf0e10cSrcweir 		}
391*cdf0e10cSrcweir 
392*cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(OverlayHelplineStripedPrimitive, PRIMITIVE2D_ID_OVERLAYHELPLINESTRIPEDPRIMITIVE)
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir 	} // end of namespace primitive2d
395*cdf0e10cSrcweir } // end of namespace drawinglayer
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
398*cdf0e10cSrcweir 
399*cdf0e10cSrcweir namespace drawinglayer
400*cdf0e10cSrcweir {
401*cdf0e10cSrcweir 	namespace primitive2d
402*cdf0e10cSrcweir 	{
403*cdf0e10cSrcweir         OverlayRollingRectanglePrimitive::OverlayRollingRectanglePrimitive(
404*cdf0e10cSrcweir             const basegfx::B2DRange& aRollingRectangle,
405*cdf0e10cSrcweir 			const basegfx::BColor& rRGBColorA,
406*cdf0e10cSrcweir 			const basegfx::BColor& rRGBColorB,
407*cdf0e10cSrcweir 			double fDiscreteDashLength)
408*cdf0e10cSrcweir         :   ViewportDependentPrimitive2D(),
409*cdf0e10cSrcweir 			maRollingRectangle(aRollingRectangle),
410*cdf0e10cSrcweir 			maRGBColorA(rRGBColorA),
411*cdf0e10cSrcweir 			maRGBColorB(rRGBColorB),
412*cdf0e10cSrcweir 			mfDiscreteDashLength(fDiscreteDashLength)
413*cdf0e10cSrcweir         {}
414*cdf0e10cSrcweir 
415*cdf0e10cSrcweir 		Primitive2DSequence OverlayRollingRectanglePrimitive::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
416*cdf0e10cSrcweir 		{
417*cdf0e10cSrcweir             // use the prepared Viewport information accessible using getViewport()
418*cdf0e10cSrcweir             Primitive2DSequence aRetval;
419*cdf0e10cSrcweir 
420*cdf0e10cSrcweir             if(!getViewport().isEmpty())
421*cdf0e10cSrcweir             {
422*cdf0e10cSrcweir                 basegfx::B2DPolygon aLine;
423*cdf0e10cSrcweir                 aRetval.realloc(8);
424*cdf0e10cSrcweir 
425*cdf0e10cSrcweir 				// Left lines
426*cdf0e10cSrcweir                 aLine.append(basegfx::B2DPoint(getViewport().getMinX(), getRollingRectangle().getMinY()));
427*cdf0e10cSrcweir                 aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMinY()));
428*cdf0e10cSrcweir                 aRetval[0] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
429*cdf0e10cSrcweir 
430*cdf0e10cSrcweir                 aLine.clear();
431*cdf0e10cSrcweir                 aLine.append(basegfx::B2DPoint(getViewport().getMinX(), getRollingRectangle().getMaxY()));
432*cdf0e10cSrcweir                 aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMaxY()));
433*cdf0e10cSrcweir                 aRetval[1] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
434*cdf0e10cSrcweir 
435*cdf0e10cSrcweir 				// Right lines
436*cdf0e10cSrcweir                 aLine.clear();
437*cdf0e10cSrcweir                 aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMinY()));
438*cdf0e10cSrcweir                 aLine.append(basegfx::B2DPoint(getViewport().getMaxX(), getRollingRectangle().getMinY()));
439*cdf0e10cSrcweir                 aRetval[2] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir                 aLine.clear();
442*cdf0e10cSrcweir                 aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMaxY()));
443*cdf0e10cSrcweir                 aLine.append(basegfx::B2DPoint(getViewport().getMaxX(), getRollingRectangle().getMaxY()));
444*cdf0e10cSrcweir                 aRetval[3] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
445*cdf0e10cSrcweir 
446*cdf0e10cSrcweir 				// Top lines
447*cdf0e10cSrcweir                 aLine.clear();
448*cdf0e10cSrcweir                 aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getViewport().getMinY()));
449*cdf0e10cSrcweir                 aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMinY()));
450*cdf0e10cSrcweir                 aRetval[4] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
451*cdf0e10cSrcweir 
452*cdf0e10cSrcweir                 aLine.clear();
453*cdf0e10cSrcweir                 aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getViewport().getMinY()));
454*cdf0e10cSrcweir                 aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMinY()));
455*cdf0e10cSrcweir                 aRetval[5] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir 				// Bottom lines
458*cdf0e10cSrcweir                 aLine.clear();
459*cdf0e10cSrcweir                 aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMaxY()));
460*cdf0e10cSrcweir                 aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getViewport().getMaxY()));
461*cdf0e10cSrcweir                 aRetval[6] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
462*cdf0e10cSrcweir 
463*cdf0e10cSrcweir                 aLine.clear();
464*cdf0e10cSrcweir                 aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMaxY()));
465*cdf0e10cSrcweir                 aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getViewport().getMaxY()));
466*cdf0e10cSrcweir                 aRetval[7] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
467*cdf0e10cSrcweir             }
468*cdf0e10cSrcweir 
469*cdf0e10cSrcweir             return aRetval;
470*cdf0e10cSrcweir 		}
471*cdf0e10cSrcweir 
472*cdf0e10cSrcweir 		bool OverlayRollingRectanglePrimitive::operator==( const BasePrimitive2D& rPrimitive ) const
473*cdf0e10cSrcweir 		{
474*cdf0e10cSrcweir 			if(ViewportDependentPrimitive2D::operator==(rPrimitive))
475*cdf0e10cSrcweir 			{
476*cdf0e10cSrcweir 				const OverlayRollingRectanglePrimitive& rCompare = static_cast< const OverlayRollingRectanglePrimitive& >(rPrimitive);
477*cdf0e10cSrcweir 
478*cdf0e10cSrcweir 				return (getRollingRectangle() == rCompare.getRollingRectangle()
479*cdf0e10cSrcweir 					&& getRGBColorA() == rCompare.getRGBColorA()
480*cdf0e10cSrcweir 					&& getRGBColorB() == rCompare.getRGBColorB()
481*cdf0e10cSrcweir                     && getDiscreteDashLength() == rCompare.getDiscreteDashLength());
482*cdf0e10cSrcweir 			}
483*cdf0e10cSrcweir 
484*cdf0e10cSrcweir 			return false;
485*cdf0e10cSrcweir 		}
486*cdf0e10cSrcweir 
487*cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(OverlayRollingRectanglePrimitive, PRIMITIVE2D_ID_OVERLAYROLLINGRECTANGLEPRIMITIVE)
488*cdf0e10cSrcweir 
489*cdf0e10cSrcweir 	} // end of namespace primitive2d
490*cdf0e10cSrcweir } // end of namespace drawinglayer
491*cdf0e10cSrcweir 
492*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
493*cdf0e10cSrcweir // eof
494