1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  *  OpenOffice.org - a multi-platform office productivity suite
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  *  $RCSfile: sdrdecompositiontools3d.cxx,v $
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  *  $Revision: 1.7 $
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  *  last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  *  The Contents of this file are made available subject to
12*cdf0e10cSrcweir  *  the terms of GNU Lesser General Public License Version 2.1.
13*cdf0e10cSrcweir  *
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  *    GNU Lesser General Public License Version 2.1
16*cdf0e10cSrcweir  *    =============================================
17*cdf0e10cSrcweir  *    Copyright 2005 by Sun Microsystems, Inc.
18*cdf0e10cSrcweir  *    901 San Antonio Road, Palo Alto, CA 94303, USA
19*cdf0e10cSrcweir  *
20*cdf0e10cSrcweir  *    This library is free software; you can redistribute it and/or
21*cdf0e10cSrcweir  *    modify it under the terms of the GNU Lesser General Public
22*cdf0e10cSrcweir  *    License version 2.1, as published by the Free Software Foundation.
23*cdf0e10cSrcweir  *
24*cdf0e10cSrcweir  *    This library is distributed in the hope that it will be useful,
25*cdf0e10cSrcweir  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
26*cdf0e10cSrcweir  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
27*cdf0e10cSrcweir  *    Lesser General Public License for more details.
28*cdf0e10cSrcweir  *
29*cdf0e10cSrcweir  *    You should have received a copy of the GNU Lesser General Public
30*cdf0e10cSrcweir  *    License along with this library; if not, write to the Free Software
31*cdf0e10cSrcweir  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32*cdf0e10cSrcweir  *    MA  02111-1307  USA
33*cdf0e10cSrcweir  *
34*cdf0e10cSrcweir  ************************************************************************/
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
37*cdf0e10cSrcweir #include "precompiled_drawinglayer.hxx"
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
40*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
41*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx>
42*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
43*cdf0e10cSrcweir #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
44*cdf0e10cSrcweir #include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx>
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir namespace drawinglayer
49*cdf0e10cSrcweir {
50*cdf0e10cSrcweir 	namespace primitive2d
51*cdf0e10cSrcweir 	{
52*cdf0e10cSrcweir         Primitive2DReference createHiddenGeometryPrimitives2D(
53*cdf0e10cSrcweir             bool bFilled,
54*cdf0e10cSrcweir             const basegfx::B2DHomMatrix& rMatrix)
55*cdf0e10cSrcweir         {
56*cdf0e10cSrcweir 			const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon());
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir             return createHiddenGeometryPrimitives2D(
59*cdf0e10cSrcweir                 bFilled,
60*cdf0e10cSrcweir                 basegfx::B2DPolyPolygon(aUnitOutline),
61*cdf0e10cSrcweir                 rMatrix);
62*cdf0e10cSrcweir         }
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir         Primitive2DReference createHiddenGeometryPrimitives2D(
65*cdf0e10cSrcweir             bool bFilled,
66*cdf0e10cSrcweir             const basegfx::B2DPolyPolygon& rPolyPolygon)
67*cdf0e10cSrcweir         {
68*cdf0e10cSrcweir             return createHiddenGeometryPrimitives2D(
69*cdf0e10cSrcweir                 bFilled,
70*cdf0e10cSrcweir                 rPolyPolygon,
71*cdf0e10cSrcweir                 basegfx::B2DHomMatrix());
72*cdf0e10cSrcweir         }
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir         Primitive2DReference createHiddenGeometryPrimitives2D(
75*cdf0e10cSrcweir             bool bFilled,
76*cdf0e10cSrcweir             const basegfx::B2DRange& rRange)
77*cdf0e10cSrcweir 		{
78*cdf0e10cSrcweir 			return createHiddenGeometryPrimitives2D(
79*cdf0e10cSrcweir                 bFilled,
80*cdf0e10cSrcweir                 rRange,
81*cdf0e10cSrcweir                 basegfx::B2DHomMatrix());
82*cdf0e10cSrcweir 		}
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir         Primitive2DReference createHiddenGeometryPrimitives2D(
85*cdf0e10cSrcweir             bool bFilled,
86*cdf0e10cSrcweir             const basegfx::B2DRange& rRange,
87*cdf0e10cSrcweir             const basegfx::B2DHomMatrix& rMatrix)
88*cdf0e10cSrcweir 		{
89*cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon aOutline(basegfx::tools::createPolygonFromRect(rRange));
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir 			return createHiddenGeometryPrimitives2D(
92*cdf0e10cSrcweir                 bFilled,
93*cdf0e10cSrcweir                 aOutline,
94*cdf0e10cSrcweir                 rMatrix);
95*cdf0e10cSrcweir 		}
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir         Primitive2DReference createHiddenGeometryPrimitives2D(
98*cdf0e10cSrcweir             bool bFilled,
99*cdf0e10cSrcweir             const basegfx::B2DPolyPolygon& rPolyPolygon,
100*cdf0e10cSrcweir             const basegfx::B2DHomMatrix& rMatrix)
101*cdf0e10cSrcweir         {
102*cdf0e10cSrcweir             // create fill or line primitive
103*cdf0e10cSrcweir             Primitive2DReference xReference;
104*cdf0e10cSrcweir 			basegfx::B2DPolyPolygon aScaledOutline(rPolyPolygon);
105*cdf0e10cSrcweir             aScaledOutline.transform(rMatrix);
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir             if(bFilled)
108*cdf0e10cSrcweir             {
109*cdf0e10cSrcweir                 xReference = new PolyPolygonColorPrimitive2D(
110*cdf0e10cSrcweir                     basegfx::B2DPolyPolygon(aScaledOutline),
111*cdf0e10cSrcweir                     basegfx::BColor(0.0, 0.0, 0.0));
112*cdf0e10cSrcweir             }
113*cdf0e10cSrcweir             else
114*cdf0e10cSrcweir             {
115*cdf0e10cSrcweir 				const basegfx::BColor aGrayTone(0xc0 / 255.0, 0xc0 / 255.0, 0xc0 / 255.0);
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir                 xReference = new PolyPolygonHairlinePrimitive2D(
118*cdf0e10cSrcweir                     aScaledOutline,
119*cdf0e10cSrcweir                     aGrayTone);
120*cdf0e10cSrcweir             }
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir             // create HiddenGeometryPrimitive2D
123*cdf0e10cSrcweir             return Primitive2DReference(
124*cdf0e10cSrcweir                 new HiddenGeometryPrimitive2D(Primitive2DSequence(&xReference, 1)));
125*cdf0e10cSrcweir         }
126*cdf0e10cSrcweir 	} // end of namespace primitive2d
127*cdf0e10cSrcweir } // end of namespace drawinglayer
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
130*cdf0e10cSrcweir // eof
131