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