1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svx.hxx"
26 
27 #include <svx/sdr/overlay/overlayhatchrect.hxx>
28 #include <vcl/hatch.hxx>
29 #include <vcl/outdev.hxx>
30 #include <basegfx/matrix/b2dhommatrix.hxx>
31 #include <basegfx/polygon/b2dpolygontools.hxx>
32 #include <basegfx/polygon/b2dpolygon.hxx>
33 #include <basegfx/numeric/ftools.hxx>
34 #include <svx/sdr/overlay/overlaytools.hxx>
35 
36 //////////////////////////////////////////////////////////////////////////////
37 
38 namespace sdr
39 {
40 	namespace overlay
41 	{
42 		drawinglayer::primitive2d::Primitive2DSequence OverlayHatchRect::createOverlayObjectPrimitive2DSequence()
43 		{
44             const basegfx::B2DRange aHatchRange(getBasePosition(), getSecondPosition());
45             const drawinglayer::primitive2d::Primitive2DReference aReference(
46                 new drawinglayer::primitive2d::OverlayHatchRectanglePrimitive(
47                     aHatchRange,
48 					3.0,
49 					getHatchRotation(),
50 					getBaseColor().getBColor(),
51                     getDiscreteGrow(),
52                     getDiscreteShrink(),
53                     getRotation()));
54 
55             return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
56 		}
57 
58         OverlayHatchRect::OverlayHatchRect(
59             const basegfx::B2DPoint& rBasePosition,
60             const basegfx::B2DPoint& rSecondPosition,
61             const Color& rHatchColor,
62             double fDiscreteGrow,
63             double fDiscreteShrink,
64             double fHatchRotation,
65             double fRotation)
66 		:	OverlayObjectWithBasePosition(rBasePosition, rHatchColor),
67             maSecondPosition(rSecondPosition),
68             mfDiscreteGrow(fDiscreteGrow),
69             mfDiscreteShrink(fDiscreteShrink),
70             mfHatchRotation(fHatchRotation),
71             mfRotation(fRotation)
72 		{
73 		}
74 
75 		void OverlayHatchRect::setSecondPosition(const basegfx::B2DPoint& rNew)
76 		{
77 			if(rNew != maSecondPosition)
78 			{
79 				// remember new value
80 				maSecondPosition = rNew;
81 
82 				// register change (after change)
83 				objectChange();
84 			}
85 		}
86 	} // end of namespace overlay
87 } // end of namespace sdr
88 
89 //////////////////////////////////////////////////////////////////////////////
90 // eof
91