1*464702f4SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*464702f4SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*464702f4SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*464702f4SAndrew Rist  * distributed with this work for additional information
6*464702f4SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*464702f4SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*464702f4SAndrew Rist  * "License"); you may not use this file except in compliance
9*464702f4SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*464702f4SAndrew Rist  *
11*464702f4SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*464702f4SAndrew Rist  *
13*464702f4SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*464702f4SAndrew Rist  * software distributed under the License is distributed on an
15*464702f4SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*464702f4SAndrew Rist  * KIND, either express or implied.  See the License for the
17*464702f4SAndrew Rist  * specific language governing permissions and limitations
18*464702f4SAndrew Rist  * under the License.
19*464702f4SAndrew Rist  *
20*464702f4SAndrew Rist  *************************************************************/
21*464702f4SAndrew Rist 
22*464702f4SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_drawinglayer.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
28cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygontools.hxx>
29cdf0e10cSrcweir #include <basegfx/tools/canvastools.hxx>
30cdf0e10cSrcweir #include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
31cdf0e10cSrcweir #include <drawinglayer/primitive2d/maskprimitive2d.hxx>
32cdf0e10cSrcweir #include <drawinglayer/primitive2d/fillhatchprimitive2d.hxx>
33cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
34cdf0e10cSrcweir #include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx>
35cdf0e10cSrcweir #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
36cdf0e10cSrcweir #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
39cdf0e10cSrcweir 
40cdf0e10cSrcweir using namespace com::sun::star;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
43cdf0e10cSrcweir 
44cdf0e10cSrcweir namespace drawinglayer
45cdf0e10cSrcweir {
46cdf0e10cSrcweir 	namespace primitive2d
47cdf0e10cSrcweir 	{
48cdf0e10cSrcweir 		Primitive2DSequence PolyPolygonHairlinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
49cdf0e10cSrcweir 		{
50cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
51cdf0e10cSrcweir 			const sal_uInt32 nCount(aPolyPolygon.count());
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 			if(nCount)
54cdf0e10cSrcweir 			{
55cdf0e10cSrcweir 				Primitive2DSequence aRetval(nCount);
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 				for(sal_uInt32 a(0L); a < nCount; a++)
58cdf0e10cSrcweir 				{
59cdf0e10cSrcweir 					aRetval[a] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolyPolygon.getB2DPolygon(a), getBColor()));
60cdf0e10cSrcweir 				}
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 				return aRetval;
63cdf0e10cSrcweir 			}
64cdf0e10cSrcweir 			else
65cdf0e10cSrcweir 			{
66cdf0e10cSrcweir 				return Primitive2DSequence();
67cdf0e10cSrcweir 			}
68cdf0e10cSrcweir 		}
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 		PolyPolygonHairlinePrimitive2D::PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor)
71cdf0e10cSrcweir 		:	BufferedDecompositionPrimitive2D(),
72cdf0e10cSrcweir 			maPolyPolygon(rPolyPolygon),
73cdf0e10cSrcweir 			maBColor(rBColor)
74cdf0e10cSrcweir 		{
75cdf0e10cSrcweir 		}
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 		bool PolyPolygonHairlinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
78cdf0e10cSrcweir 		{
79cdf0e10cSrcweir 			if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
80cdf0e10cSrcweir 			{
81cdf0e10cSrcweir 				const PolyPolygonHairlinePrimitive2D& rCompare = (PolyPolygonHairlinePrimitive2D&)rPrimitive;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 				return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
84cdf0e10cSrcweir 					&& getBColor() == rCompare.getBColor());
85cdf0e10cSrcweir 			}
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 			return false;
88cdf0e10cSrcweir 		}
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 		basegfx::B2DRange PolyPolygonHairlinePrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
91cdf0e10cSrcweir 		{
92cdf0e10cSrcweir 			// return range
93cdf0e10cSrcweir 			return basegfx::tools::getRange(getB2DPolyPolygon());
94cdf0e10cSrcweir 		}
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 		// provide unique ID
97cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(PolyPolygonHairlinePrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D)
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	} // end of namespace primitive2d
100cdf0e10cSrcweir } // end of namespace drawinglayer
101cdf0e10cSrcweir 
102cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
103cdf0e10cSrcweir 
104cdf0e10cSrcweir namespace drawinglayer
105cdf0e10cSrcweir {
106cdf0e10cSrcweir 	namespace primitive2d
107cdf0e10cSrcweir 	{
108cdf0e10cSrcweir 		Primitive2DSequence PolyPolygonMarkerPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
109cdf0e10cSrcweir 		{
110cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
111cdf0e10cSrcweir 			const sal_uInt32 nCount(aPolyPolygon.count());
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 			if(nCount)
114cdf0e10cSrcweir 			{
115cdf0e10cSrcweir 				Primitive2DSequence aRetval(nCount);
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 				for(sal_uInt32 a(0L); a < nCount; a++)
118cdf0e10cSrcweir 				{
119cdf0e10cSrcweir 					aRetval[a] = Primitive2DReference(new PolygonMarkerPrimitive2D(aPolyPolygon.getB2DPolygon(a), getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
120cdf0e10cSrcweir 				}
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 				return aRetval;
123cdf0e10cSrcweir 			}
124cdf0e10cSrcweir 			else
125cdf0e10cSrcweir 			{
126cdf0e10cSrcweir 				return Primitive2DSequence();
127cdf0e10cSrcweir 			}
128cdf0e10cSrcweir 		}
129cdf0e10cSrcweir 
130cdf0e10cSrcweir 		PolyPolygonMarkerPrimitive2D::PolyPolygonMarkerPrimitive2D(
131cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon& rPolyPolygon,
132cdf0e10cSrcweir 			const basegfx::BColor& rRGBColorA,
133cdf0e10cSrcweir 			const basegfx::BColor& rRGBColorB,
134cdf0e10cSrcweir 			double fDiscreteDashLength)
135cdf0e10cSrcweir 		:	BufferedDecompositionPrimitive2D(),
136cdf0e10cSrcweir 			maPolyPolygon(rPolyPolygon),
137cdf0e10cSrcweir 			maRGBColorA(rRGBColorA),
138cdf0e10cSrcweir 			maRGBColorB(rRGBColorB),
139cdf0e10cSrcweir 			mfDiscreteDashLength(fDiscreteDashLength)
140cdf0e10cSrcweir 		{
141cdf0e10cSrcweir 		}
142cdf0e10cSrcweir 
143cdf0e10cSrcweir 		bool PolyPolygonMarkerPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
144cdf0e10cSrcweir 		{
145cdf0e10cSrcweir 			if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
146cdf0e10cSrcweir 			{
147cdf0e10cSrcweir 				const PolyPolygonMarkerPrimitive2D& rCompare = (PolyPolygonMarkerPrimitive2D&)rPrimitive;
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 				return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
150cdf0e10cSrcweir 					&& getRGBColorA() == rCompare.getRGBColorA()
151cdf0e10cSrcweir 					&& getRGBColorB() == rCompare.getRGBColorB()
152cdf0e10cSrcweir 					&& getDiscreteDashLength() == rCompare.getDiscreteDashLength());
153cdf0e10cSrcweir 			}
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 			return false;
156cdf0e10cSrcweir 		}
157cdf0e10cSrcweir 
158cdf0e10cSrcweir 		basegfx::B2DRange PolyPolygonMarkerPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
159cdf0e10cSrcweir 		{
160cdf0e10cSrcweir 			// return range
161cdf0e10cSrcweir 			return basegfx::tools::getRange(getB2DPolyPolygon());
162cdf0e10cSrcweir 		}
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 		// provide unique ID
165cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(PolyPolygonMarkerPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D)
166cdf0e10cSrcweir 
167cdf0e10cSrcweir 	} // end of namespace primitive2d
168cdf0e10cSrcweir } // end of namespace drawinglayer
169cdf0e10cSrcweir 
170cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
171cdf0e10cSrcweir 
172cdf0e10cSrcweir namespace drawinglayer
173cdf0e10cSrcweir {
174cdf0e10cSrcweir 	namespace primitive2d
175cdf0e10cSrcweir 	{
176cdf0e10cSrcweir 		Primitive2DSequence PolyPolygonStrokePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
177cdf0e10cSrcweir 		{
178cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
179cdf0e10cSrcweir 			const sal_uInt32 nCount(aPolyPolygon.count());
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 			if(nCount)
182cdf0e10cSrcweir 			{
183cdf0e10cSrcweir 				Primitive2DSequence aRetval(nCount);
184cdf0e10cSrcweir 
185cdf0e10cSrcweir 				for(sal_uInt32 a(0L); a < nCount; a++)
186cdf0e10cSrcweir 				{
187cdf0e10cSrcweir 					aRetval[a] = Primitive2DReference(
188cdf0e10cSrcweir                         new PolygonStrokePrimitive2D(
189cdf0e10cSrcweir                             aPolyPolygon.getB2DPolygon(a), getLineAttribute(), getStrokeAttribute()));
190cdf0e10cSrcweir 				}
191cdf0e10cSrcweir 
192cdf0e10cSrcweir 				return aRetval;
193cdf0e10cSrcweir 			}
194cdf0e10cSrcweir 			else
195cdf0e10cSrcweir 			{
196cdf0e10cSrcweir 				return Primitive2DSequence();
197cdf0e10cSrcweir 			}
198cdf0e10cSrcweir 		}
199cdf0e10cSrcweir 
200cdf0e10cSrcweir 		PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D(
201cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon& rPolyPolygon,
202cdf0e10cSrcweir   			const attribute::LineAttribute& rLineAttribute,
203cdf0e10cSrcweir 			const attribute::StrokeAttribute& rStrokeAttribute)
204cdf0e10cSrcweir 		:	BufferedDecompositionPrimitive2D(),
205cdf0e10cSrcweir 			maPolyPolygon(rPolyPolygon),
206cdf0e10cSrcweir             maLineAttribute(rLineAttribute),
207cdf0e10cSrcweir 			maStrokeAttribute(rStrokeAttribute)
208cdf0e10cSrcweir 		{
209cdf0e10cSrcweir 		}
210cdf0e10cSrcweir 
211cdf0e10cSrcweir 		PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D(
212cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon& rPolyPolygon,
213cdf0e10cSrcweir   			const attribute::LineAttribute& rLineAttribute)
214cdf0e10cSrcweir 		:	BufferedDecompositionPrimitive2D(),
215cdf0e10cSrcweir 			maPolyPolygon(rPolyPolygon),
216cdf0e10cSrcweir             maLineAttribute(rLineAttribute),
217cdf0e10cSrcweir 			maStrokeAttribute()
218cdf0e10cSrcweir 		{
219cdf0e10cSrcweir 		}
220cdf0e10cSrcweir 
221cdf0e10cSrcweir 		bool PolyPolygonStrokePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
222cdf0e10cSrcweir 		{
223cdf0e10cSrcweir 			if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
224cdf0e10cSrcweir 			{
225cdf0e10cSrcweir 				const PolyPolygonStrokePrimitive2D& rCompare = (PolyPolygonStrokePrimitive2D&)rPrimitive;
226cdf0e10cSrcweir 
227cdf0e10cSrcweir 				return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
228cdf0e10cSrcweir 					&& getLineAttribute() == rCompare.getLineAttribute()
229cdf0e10cSrcweir 					&& getStrokeAttribute() == rCompare.getStrokeAttribute());
230cdf0e10cSrcweir 			}
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 			return false;
233cdf0e10cSrcweir 		}
234cdf0e10cSrcweir 
235cdf0e10cSrcweir 		basegfx::B2DRange PolyPolygonStrokePrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
236cdf0e10cSrcweir 		{
237cdf0e10cSrcweir 			// get range of it (subdivided)
238cdf0e10cSrcweir 			basegfx::B2DRange aRetval(basegfx::tools::getRange(getB2DPolyPolygon()));
239cdf0e10cSrcweir 
240cdf0e10cSrcweir 			// if width, grow by line width
241cdf0e10cSrcweir 			if(getLineAttribute().getWidth())
242cdf0e10cSrcweir 			{
243cdf0e10cSrcweir 				aRetval.grow(getLineAttribute().getWidth() / 2.0);
244cdf0e10cSrcweir 			}
245cdf0e10cSrcweir 
246cdf0e10cSrcweir 			return aRetval;
247cdf0e10cSrcweir 		}
248cdf0e10cSrcweir 
249cdf0e10cSrcweir 		// provide unique ID
250cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(PolyPolygonStrokePrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONSTROKEPRIMITIVE2D)
251cdf0e10cSrcweir 
252cdf0e10cSrcweir 	} // end of namespace primitive2d
253cdf0e10cSrcweir } // end of namespace drawinglayer
254cdf0e10cSrcweir 
255cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
256cdf0e10cSrcweir 
257cdf0e10cSrcweir namespace drawinglayer
258cdf0e10cSrcweir {
259cdf0e10cSrcweir 	namespace primitive2d
260cdf0e10cSrcweir 	{
261cdf0e10cSrcweir 		Primitive2DSequence PolyPolygonStrokeArrowPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
262cdf0e10cSrcweir 		{
263cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
264cdf0e10cSrcweir 			const sal_uInt32 nCount(aPolyPolygon.count());
265cdf0e10cSrcweir 
266cdf0e10cSrcweir 			if(nCount)
267cdf0e10cSrcweir 			{
268cdf0e10cSrcweir 				Primitive2DSequence aRetval(nCount);
269cdf0e10cSrcweir 
270cdf0e10cSrcweir 				for(sal_uInt32 a(0L); a < nCount; a++)
271cdf0e10cSrcweir 				{
272cdf0e10cSrcweir 					const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(a));
273cdf0e10cSrcweir 
274cdf0e10cSrcweir 					if(aPolygon.isClosed())
275cdf0e10cSrcweir 					{
276cdf0e10cSrcweir 						// no need for PolygonStrokeArrowPrimitive2D when polygon is closed
277cdf0e10cSrcweir 						aRetval[a] = Primitive2DReference(
278cdf0e10cSrcweir                             new PolygonStrokePrimitive2D(aPolygon, getLineAttribute(), getStrokeAttribute()));
279cdf0e10cSrcweir 					}
280cdf0e10cSrcweir 					else
281cdf0e10cSrcweir 					{
282cdf0e10cSrcweir 						aRetval[a] = Primitive2DReference(
283cdf0e10cSrcweir                             new PolygonStrokeArrowPrimitive2D(aPolygon, getLineAttribute(),
284cdf0e10cSrcweir                                 getStrokeAttribute(), getStart(), getEnd()));
285cdf0e10cSrcweir 					}
286cdf0e10cSrcweir 				}
287cdf0e10cSrcweir 
288cdf0e10cSrcweir 				return aRetval;
289cdf0e10cSrcweir 			}
290cdf0e10cSrcweir 			else
291cdf0e10cSrcweir 			{
292cdf0e10cSrcweir 				return Primitive2DSequence();
293cdf0e10cSrcweir 			}
294cdf0e10cSrcweir 		}
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 		PolyPolygonStrokeArrowPrimitive2D::PolyPolygonStrokeArrowPrimitive2D(
297cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon& rPolyPolygon,
298cdf0e10cSrcweir    			const attribute::LineAttribute& rLineAttribute,
299cdf0e10cSrcweir 			const attribute::StrokeAttribute& rStrokeAttribute,
300cdf0e10cSrcweir 			const attribute::LineStartEndAttribute& rStart,
301cdf0e10cSrcweir 			const attribute::LineStartEndAttribute& rEnd)
302cdf0e10cSrcweir 		:	PolyPolygonStrokePrimitive2D(rPolyPolygon, rLineAttribute, rStrokeAttribute),
303cdf0e10cSrcweir 			maStart(rStart),
304cdf0e10cSrcweir 			maEnd(rEnd)
305cdf0e10cSrcweir 		{
306cdf0e10cSrcweir 		}
307cdf0e10cSrcweir 
308cdf0e10cSrcweir 		PolyPolygonStrokeArrowPrimitive2D::PolyPolygonStrokeArrowPrimitive2D(
309cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon& rPolyPolygon,
310cdf0e10cSrcweir    			const attribute::LineAttribute& rLineAttribute,
311cdf0e10cSrcweir 			const attribute::LineStartEndAttribute& rStart,
312cdf0e10cSrcweir 			const attribute::LineStartEndAttribute& rEnd)
313cdf0e10cSrcweir 		:	PolyPolygonStrokePrimitive2D(rPolyPolygon, rLineAttribute),
314cdf0e10cSrcweir 			maStart(rStart),
315cdf0e10cSrcweir 			maEnd(rEnd)
316cdf0e10cSrcweir 		{
317cdf0e10cSrcweir 		}
318cdf0e10cSrcweir 
319cdf0e10cSrcweir 		bool PolyPolygonStrokeArrowPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
320cdf0e10cSrcweir 		{
321cdf0e10cSrcweir 			if(PolyPolygonStrokePrimitive2D::operator==(rPrimitive))
322cdf0e10cSrcweir 			{
323cdf0e10cSrcweir 				const PolyPolygonStrokeArrowPrimitive2D& rCompare = (PolyPolygonStrokeArrowPrimitive2D&)rPrimitive;
324cdf0e10cSrcweir 
325cdf0e10cSrcweir 				return (getStart() == rCompare.getStart()
326cdf0e10cSrcweir 					&& getEnd() == rCompare.getEnd());
327cdf0e10cSrcweir 			}
328cdf0e10cSrcweir 
329cdf0e10cSrcweir 			return false;
330cdf0e10cSrcweir 		}
331cdf0e10cSrcweir 
332cdf0e10cSrcweir 		basegfx::B2DRange PolyPolygonStrokeArrowPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
333cdf0e10cSrcweir 		{
334cdf0e10cSrcweir 			basegfx::B2DRange aRetval;
335cdf0e10cSrcweir 
336cdf0e10cSrcweir 			if(getStart().isActive() || getEnd().isActive())
337cdf0e10cSrcweir 			{
338cdf0e10cSrcweir 				// use decomposition when line start/end is used
339cdf0e10cSrcweir 				return BufferedDecompositionPrimitive2D::getB2DRange(rViewInformation);
340cdf0e10cSrcweir 			}
341cdf0e10cSrcweir 			else
342cdf0e10cSrcweir 			{
343cdf0e10cSrcweir 				// get range from parent
344cdf0e10cSrcweir 				return PolyPolygonStrokePrimitive2D::getB2DRange(rViewInformation);
345cdf0e10cSrcweir 			}
346cdf0e10cSrcweir 		}
347cdf0e10cSrcweir 
348cdf0e10cSrcweir 		// provide unique ID
349cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(PolyPolygonStrokeArrowPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONSTROKEARROWPRIMITIVE2D)
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 	} // end of namespace primitive2d
352cdf0e10cSrcweir } // end of namespace drawinglayer
353cdf0e10cSrcweir 
354cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
355cdf0e10cSrcweir 
356cdf0e10cSrcweir namespace drawinglayer
357cdf0e10cSrcweir {
358cdf0e10cSrcweir 	namespace primitive2d
359cdf0e10cSrcweir 	{
360cdf0e10cSrcweir 		PolyPolygonColorPrimitive2D::PolyPolygonColorPrimitive2D(
361cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon& rPolyPolygon,
362cdf0e10cSrcweir 			const basegfx::BColor& rBColor)
363cdf0e10cSrcweir 		:	BasePrimitive2D(),
364cdf0e10cSrcweir 			maPolyPolygon(rPolyPolygon),
365cdf0e10cSrcweir 			maBColor(rBColor)
366cdf0e10cSrcweir 		{
367cdf0e10cSrcweir 		}
368cdf0e10cSrcweir 
369cdf0e10cSrcweir 		bool PolyPolygonColorPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
370cdf0e10cSrcweir 		{
371cdf0e10cSrcweir 			if(BasePrimitive2D::operator==(rPrimitive))
372cdf0e10cSrcweir 			{
373cdf0e10cSrcweir 				const PolyPolygonColorPrimitive2D& rCompare = (PolyPolygonColorPrimitive2D&)rPrimitive;
374cdf0e10cSrcweir 
375cdf0e10cSrcweir 				return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
376cdf0e10cSrcweir 					&& getBColor() == rCompare.getBColor());
377cdf0e10cSrcweir 			}
378cdf0e10cSrcweir 
379cdf0e10cSrcweir 			return false;
380cdf0e10cSrcweir 		}
381cdf0e10cSrcweir 
382cdf0e10cSrcweir 		basegfx::B2DRange PolyPolygonColorPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
383cdf0e10cSrcweir 		{
384cdf0e10cSrcweir 			// return range
385cdf0e10cSrcweir 			return basegfx::tools::getRange(getB2DPolyPolygon());
386cdf0e10cSrcweir 		}
387cdf0e10cSrcweir 
388cdf0e10cSrcweir 		// provide unique ID
389cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(PolyPolygonColorPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D)
390cdf0e10cSrcweir 
391cdf0e10cSrcweir 	} // end of namespace primitive2d
392cdf0e10cSrcweir } // end of namespace drawinglayer
393cdf0e10cSrcweir 
394cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
395cdf0e10cSrcweir 
396cdf0e10cSrcweir namespace drawinglayer
397cdf0e10cSrcweir {
398cdf0e10cSrcweir 	namespace primitive2d
399cdf0e10cSrcweir 	{
400cdf0e10cSrcweir 		Primitive2DSequence PolyPolygonGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
401cdf0e10cSrcweir 		{
402cdf0e10cSrcweir             if(!getFillGradient().isDefault())
403cdf0e10cSrcweir             {
404cdf0e10cSrcweir 			    // create SubSequence with FillGradientPrimitive2D
405cdf0e10cSrcweir 			    const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
406cdf0e10cSrcweir 			    FillGradientPrimitive2D* pNewGradient = new FillGradientPrimitive2D(aPolyPolygonRange, getFillGradient());
407cdf0e10cSrcweir 			    const Primitive2DReference xSubRef(pNewGradient);
408cdf0e10cSrcweir 			    const Primitive2DSequence aSubSequence(&xSubRef, 1L);
409cdf0e10cSrcweir 
410cdf0e10cSrcweir 			    // create mask primitive
411cdf0e10cSrcweir 			    MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence);
412cdf0e10cSrcweir 			    const Primitive2DReference xRef(pNewMask);
413cdf0e10cSrcweir 
414cdf0e10cSrcweir                 return Primitive2DSequence(&xRef, 1);
415cdf0e10cSrcweir             }
416cdf0e10cSrcweir             else
417cdf0e10cSrcweir             {
418cdf0e10cSrcweir                 return Primitive2DSequence();
419cdf0e10cSrcweir             }
420cdf0e10cSrcweir 		}
421cdf0e10cSrcweir 
422cdf0e10cSrcweir 		PolyPolygonGradientPrimitive2D::PolyPolygonGradientPrimitive2D(
423cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon& rPolyPolygon,
424cdf0e10cSrcweir 			const attribute::FillGradientAttribute& rFillGradient)
425cdf0e10cSrcweir 		:	BufferedDecompositionPrimitive2D(),
426cdf0e10cSrcweir 			maPolyPolygon(rPolyPolygon),
427cdf0e10cSrcweir 			maFillGradient(rFillGradient)
428cdf0e10cSrcweir 		{
429cdf0e10cSrcweir 		}
430cdf0e10cSrcweir 
431cdf0e10cSrcweir 		bool PolyPolygonGradientPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
432cdf0e10cSrcweir 		{
433cdf0e10cSrcweir 			if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
434cdf0e10cSrcweir 			{
435cdf0e10cSrcweir 				const PolyPolygonGradientPrimitive2D& rCompare = (PolyPolygonGradientPrimitive2D&)rPrimitive;
436cdf0e10cSrcweir 
437cdf0e10cSrcweir 				return (getFillGradient() == rCompare.getFillGradient());
438cdf0e10cSrcweir 			}
439cdf0e10cSrcweir 
440cdf0e10cSrcweir 			return false;
441cdf0e10cSrcweir 		}
442cdf0e10cSrcweir 
443cdf0e10cSrcweir 		// provide unique ID
444cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(PolyPolygonGradientPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D)
445cdf0e10cSrcweir 
446cdf0e10cSrcweir 	} // end of namespace primitive2d
447cdf0e10cSrcweir } // end of namespace drawinglayer
448cdf0e10cSrcweir 
449cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
450cdf0e10cSrcweir 
451cdf0e10cSrcweir namespace drawinglayer
452cdf0e10cSrcweir {
453cdf0e10cSrcweir 	namespace primitive2d
454cdf0e10cSrcweir 	{
455cdf0e10cSrcweir 		Primitive2DSequence PolyPolygonHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
456cdf0e10cSrcweir 		{
457cdf0e10cSrcweir             if(!getFillHatch().isDefault())
458cdf0e10cSrcweir             {
459cdf0e10cSrcweir 			    // create SubSequence with FillHatchPrimitive2D
460cdf0e10cSrcweir 			    const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
461cdf0e10cSrcweir 			    FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(aPolyPolygonRange, getBackgroundColor(), getFillHatch());
462cdf0e10cSrcweir 			    const Primitive2DReference xSubRef(pNewHatch);
463cdf0e10cSrcweir 			    const Primitive2DSequence aSubSequence(&xSubRef, 1L);
464cdf0e10cSrcweir 
465cdf0e10cSrcweir 			    // create mask primitive
466cdf0e10cSrcweir 			    MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence);
467cdf0e10cSrcweir 			    const Primitive2DReference xRef(pNewMask);
468cdf0e10cSrcweir 
469cdf0e10cSrcweir                 return Primitive2DSequence(&xRef, 1);
470cdf0e10cSrcweir             }
471cdf0e10cSrcweir             else
472cdf0e10cSrcweir             {
473cdf0e10cSrcweir                 return Primitive2DSequence();
474cdf0e10cSrcweir             }
475cdf0e10cSrcweir 		}
476cdf0e10cSrcweir 
477cdf0e10cSrcweir 		PolyPolygonHatchPrimitive2D::PolyPolygonHatchPrimitive2D(
478cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon& rPolyPolygon,
479cdf0e10cSrcweir 			const basegfx::BColor& rBackgroundColor,
480cdf0e10cSrcweir 			const attribute::FillHatchAttribute& rFillHatch)
481cdf0e10cSrcweir 		:	BufferedDecompositionPrimitive2D(),
482cdf0e10cSrcweir 			maPolyPolygon(rPolyPolygon),
483cdf0e10cSrcweir 			maBackgroundColor(rBackgroundColor),
484cdf0e10cSrcweir 			maFillHatch(rFillHatch)
485cdf0e10cSrcweir 		{
486cdf0e10cSrcweir 		}
487cdf0e10cSrcweir 
488cdf0e10cSrcweir 		bool PolyPolygonHatchPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
489cdf0e10cSrcweir 		{
490cdf0e10cSrcweir 			if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
491cdf0e10cSrcweir 			{
492cdf0e10cSrcweir 				const PolyPolygonHatchPrimitive2D& rCompare = (PolyPolygonHatchPrimitive2D&)rPrimitive;
493cdf0e10cSrcweir 
494cdf0e10cSrcweir 				return (getBackgroundColor() == rCompare.getBackgroundColor()
495cdf0e10cSrcweir 					&& getFillHatch() == rCompare.getFillHatch());
496cdf0e10cSrcweir 			}
497cdf0e10cSrcweir 
498cdf0e10cSrcweir 			return false;
499cdf0e10cSrcweir 		}
500cdf0e10cSrcweir 
501cdf0e10cSrcweir 		// provide unique ID
502cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(PolyPolygonHatchPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D)
503cdf0e10cSrcweir 
504cdf0e10cSrcweir 	} // end of namespace primitive2d
505cdf0e10cSrcweir } // end of namespace drawinglayer
506cdf0e10cSrcweir 
507cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
508cdf0e10cSrcweir 
509cdf0e10cSrcweir namespace drawinglayer
510cdf0e10cSrcweir {
511cdf0e10cSrcweir 	namespace primitive2d
512cdf0e10cSrcweir 	{
513cdf0e10cSrcweir 		Primitive2DSequence PolyPolygonBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
514cdf0e10cSrcweir 		{
515cdf0e10cSrcweir             if(!getFillBitmap().isDefault())
516cdf0e10cSrcweir             {
517cdf0e10cSrcweir 			    // create SubSequence with FillBitmapPrimitive2D
518cdf0e10cSrcweir 			    const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
519cdf0e10cSrcweir 			    basegfx::B2DHomMatrix aNewObjectTransform;
520cdf0e10cSrcweir 			    aNewObjectTransform.set(0, 0, aPolyPolygonRange.getWidth());
521cdf0e10cSrcweir 			    aNewObjectTransform.set(1, 1, aPolyPolygonRange.getHeight());
522cdf0e10cSrcweir 			    aNewObjectTransform.set(0, 2, aPolyPolygonRange.getMinX());
523cdf0e10cSrcweir 			    aNewObjectTransform.set(1, 2, aPolyPolygonRange.getMinY());
524cdf0e10cSrcweir 			    FillBitmapPrimitive2D* pNewBitmap = new FillBitmapPrimitive2D(aNewObjectTransform, getFillBitmap());
525cdf0e10cSrcweir 			    const Primitive2DReference xSubRef(pNewBitmap);
526cdf0e10cSrcweir 			    const Primitive2DSequence aSubSequence(&xSubRef, 1L);
527cdf0e10cSrcweir 
528cdf0e10cSrcweir 			    // create mask primitive
529cdf0e10cSrcweir 			    MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence);
530cdf0e10cSrcweir 			    const Primitive2DReference xRef(pNewMask);
531cdf0e10cSrcweir 
532cdf0e10cSrcweir                 return Primitive2DSequence(&xRef, 1);
533cdf0e10cSrcweir             }
534cdf0e10cSrcweir             else
535cdf0e10cSrcweir             {
536cdf0e10cSrcweir                 return Primitive2DSequence();
537cdf0e10cSrcweir             }
538cdf0e10cSrcweir 		}
539cdf0e10cSrcweir 
540cdf0e10cSrcweir 		PolyPolygonBitmapPrimitive2D::PolyPolygonBitmapPrimitive2D(
541cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon& rPolyPolygon,
542cdf0e10cSrcweir 			const attribute::FillBitmapAttribute& rFillBitmap)
543cdf0e10cSrcweir 		:	BufferedDecompositionPrimitive2D(),
544cdf0e10cSrcweir 			maPolyPolygon(rPolyPolygon),
545cdf0e10cSrcweir 			maFillBitmap(rFillBitmap)
546cdf0e10cSrcweir 		{
547cdf0e10cSrcweir 		}
548cdf0e10cSrcweir 
549cdf0e10cSrcweir 		bool PolyPolygonBitmapPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
550cdf0e10cSrcweir 		{
551cdf0e10cSrcweir 			if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
552cdf0e10cSrcweir 			{
553cdf0e10cSrcweir 				const PolyPolygonBitmapPrimitive2D& rCompare = (PolyPolygonBitmapPrimitive2D&)rPrimitive;
554cdf0e10cSrcweir 
555cdf0e10cSrcweir 				return (getFillBitmap() == rCompare.getFillBitmap());
556cdf0e10cSrcweir 			}
557cdf0e10cSrcweir 
558cdf0e10cSrcweir 			return false;
559cdf0e10cSrcweir 		}
560cdf0e10cSrcweir 
561cdf0e10cSrcweir 		// provide unique ID
562cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(PolyPolygonBitmapPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONBITMAPPRIMITIVE2D)
563cdf0e10cSrcweir 
564cdf0e10cSrcweir 	} // end of namespace primitive2d
565cdf0e10cSrcweir } // end of namespace drawinglayer
566cdf0e10cSrcweir 
567cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
568cdf0e10cSrcweir // eof
569