xref: /AOO41X/main/svx/source/sdr/overlay/overlaycrosshair.cxx (revision f6e50924346d0b8c0b07c91832a97665dd718b0c)
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 #include <svx/sdr/overlay/overlaycrosshair.hxx>
27 #include <tools/gen.hxx>
28 #include <vcl/salbtype.hxx>
29 #include <vcl/outdev.hxx>
30 #include <svx/sdr/overlay/overlaytools.hxx>
31 #include <svx/sdr/overlay/overlaymanager.hxx>
32 
33 //////////////////////////////////////////////////////////////////////////////
34 
35 namespace sdr
36 {
37     namespace overlay
38     {
createOverlayObjectPrimitive2DSequence()39         drawinglayer::primitive2d::Primitive2DSequence OverlayCrosshairStriped::createOverlayObjectPrimitive2DSequence()
40         {
41             drawinglayer::primitive2d::Primitive2DSequence aRetval;
42 
43             if(getOverlayManager())
44             {
45                 const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
46                 const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
47                 const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
48 
49                 const drawinglayer::primitive2d::Primitive2DReference aReference(
50                     new drawinglayer::primitive2d::OverlayCrosshairPrimitive(
51                         getBasePosition(),
52                         aRGBColorA,
53                         aRGBColorB,
54                         fStripeLengthPixel));
55 
56                 aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
57             }
58 
59             return aRetval;
60         }
61 
stripeDefinitionHasChanged()62         void OverlayCrosshairStriped::stripeDefinitionHasChanged()
63         {
64             // react on OverlayManager's stripe definition change
65             objectChange();
66         }
67 
OverlayCrosshairStriped(const basegfx::B2DPoint & rBasePos)68         OverlayCrosshairStriped::OverlayCrosshairStriped(const basegfx::B2DPoint& rBasePos)
69         :   OverlayObjectWithBasePosition(rBasePos, Color(COL_BLACK))
70         {
71         }
72 
~OverlayCrosshairStriped()73         OverlayCrosshairStriped::~OverlayCrosshairStriped()
74         {
75         }
76     } // end of namespace overlay
77 } // end of namespace sdr
78 
79 //////////////////////////////////////////////////////////////////////////////
80 // eof
81