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
10f6e50924SAndrew Rist  *
11f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12f6e50924SAndrew Rist  *
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.
19f6e50924SAndrew Rist  *
20f6e50924SAndrew Rist  *************************************************************/
21f6e50924SAndrew Rist 
22f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir #include <svx/sdr/overlay/overlaypolypolygon.hxx>
27cdf0e10cSrcweir #include <vcl/salbtype.hxx>
28cdf0e10cSrcweir #include <vcl/outdev.hxx>
29cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
30cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygontools.hxx>
31cdf0e10cSrcweir #include <svx/sdr/overlay/overlaymanager.hxx>
32cdf0e10cSrcweir #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
35cdf0e10cSrcweir 
36cdf0e10cSrcweir namespace sdr
37cdf0e10cSrcweir {
38cdf0e10cSrcweir 	namespace overlay
39cdf0e10cSrcweir 	{
createOverlayObjectPrimitive2DSequence()40*1cd65da9SArmin Le Grand 		drawinglayer::primitive2d::Primitive2DSequence OverlayPolyPolygonStripedAndFilled::createOverlayObjectPrimitive2DSequence()
41cdf0e10cSrcweir 		{
42cdf0e10cSrcweir 			drawinglayer::primitive2d::Primitive2DSequence aRetval;
43cdf0e10cSrcweir 
44cdf0e10cSrcweir             if(getOverlayManager())
45cdf0e10cSrcweir             {
46cdf0e10cSrcweir                 const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
47cdf0e10cSrcweir                 const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
48cdf0e10cSrcweir                 const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
49*1cd65da9SArmin Le Grand                 const drawinglayer::primitive2d::Primitive2DReference aStriped(
50cdf0e10cSrcweir                     new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D(
51*1cd65da9SArmin Le Grand                         getLinePolyPolygon(),
52cdf0e10cSrcweir                         aRGBColorA,
53cdf0e10cSrcweir                         aRGBColorB,
54cdf0e10cSrcweir                         fStripeLengthPixel));
55cdf0e10cSrcweir 
56*1cd65da9SArmin Le Grand                 aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aStriped, 1);
57*1cd65da9SArmin Le Grand 
58*1cd65da9SArmin Le Grand                 const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
59*1cd65da9SArmin Le Grand                 const basegfx::BColor aHilightColor(aSvtOptionsDrawinglayer.getHilightColor().getBColor());
60*1cd65da9SArmin Le Grand                 const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
61*1cd65da9SArmin Le Grand 
62*1cd65da9SArmin Le Grand                 const drawinglayer::primitive2d::Primitive2DReference aFilled(
63*1cd65da9SArmin Le Grand                     new drawinglayer::primitive2d::PolyPolygonSelectionPrimitive2D(
64*1cd65da9SArmin Le Grand                         getLinePolyPolygon(),
65*1cd65da9SArmin Le Grand                         aHilightColor,
66*1cd65da9SArmin Le Grand                         fTransparence,
67*1cd65da9SArmin Le Grand                         3.0,
68*1cd65da9SArmin Le Grand                         false));
69*1cd65da9SArmin Le Grand 
70*1cd65da9SArmin Le Grand                 drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aFilled);
71cdf0e10cSrcweir             }
72cdf0e10cSrcweir 
73cdf0e10cSrcweir             return aRetval;
74cdf0e10cSrcweir 		}
75cdf0e10cSrcweir 
stripeDefinitionHasChanged()76*1cd65da9SArmin Le Grand 		void OverlayPolyPolygonStripedAndFilled::stripeDefinitionHasChanged()
77cdf0e10cSrcweir 		{
78cdf0e10cSrcweir 			// react on OverlayManager's stripe definition change
79cdf0e10cSrcweir 			objectChange();
80cdf0e10cSrcweir 		}
81cdf0e10cSrcweir 
OverlayPolyPolygonStripedAndFilled(const basegfx::B2DPolyPolygon & rLinePolyPolygon)82*1cd65da9SArmin Le Grand 		OverlayPolyPolygonStripedAndFilled::OverlayPolyPolygonStripedAndFilled(
83*1cd65da9SArmin Le Grand 			const basegfx::B2DPolyPolygon& rLinePolyPolygon)
84cdf0e10cSrcweir 		:	OverlayObject(Color(COL_BLACK)),
85*1cd65da9SArmin Le Grand 			maLinePolyPolygon(rLinePolyPolygon)
86cdf0e10cSrcweir 		{
87cdf0e10cSrcweir 		}
88cdf0e10cSrcweir 
~OverlayPolyPolygonStripedAndFilled()89*1cd65da9SArmin Le Grand 		OverlayPolyPolygonStripedAndFilled::~OverlayPolyPolygonStripedAndFilled()
90cdf0e10cSrcweir 		{
91cdf0e10cSrcweir 		}
92cdf0e10cSrcweir 
setLinePolyPolygon(const basegfx::B2DPolyPolygon & rNew)93*1cd65da9SArmin Le Grand 		void OverlayPolyPolygonStripedAndFilled::setLinePolyPolygon(const basegfx::B2DPolyPolygon& rNew)
94cdf0e10cSrcweir 		{
95*1cd65da9SArmin Le Grand 			if(rNew != maLinePolyPolygon)
96cdf0e10cSrcweir 			{
97cdf0e10cSrcweir 				// remember new value
98*1cd65da9SArmin Le Grand 				maLinePolyPolygon = rNew;
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 				// register change (after change)
101cdf0e10cSrcweir 				objectChange();
102cdf0e10cSrcweir 			}
103cdf0e10cSrcweir 		}
104cdf0e10cSrcweir 	} // end of namespace overlay
105cdf0e10cSrcweir } // end of namespace sdr
106cdf0e10cSrcweir 
107cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
108cdf0e10cSrcweir // eof
109