1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _SDR_OVERLAY_OVERLAYTOOLS_HXX
21 #define _SDR_OVERLAY_OVERLAYTOOLS_HXX
23 #include <drawinglayer/primitive2d/primitivetools2d.hxx>
24 #include <vcl/bitmapex.hxx>
26 //////////////////////////////////////////////////////////////////////////////
27 // Overlay helper class which holds a BotmapEx which is to be visualized
28 // at the given logic position with the Bitmap's pixel size, unscaled and
29 // unrotated (like a marker). The discrete pixel on the bitmap assocciated
30 // with the target position is given in discrete X,Y coordinates
31 namespace drawinglayer
35 class OverlayBitmapExPrimitive
: public DiscreteMetricDependentPrimitive2D
38 // The BitmapEx to use, PixelSize is used
42 basegfx::B2DPoint maBasePosition
;
44 // The pixel inside the BitmapEx which is assocciated with
45 // the target position (offset in the bitmap)
50 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const;
53 OverlayBitmapExPrimitive(
54 const BitmapEx
& rBitmapEx
,
55 const basegfx::B2DPoint
& rBasePosition
,
60 const BitmapEx
& getBitmapEx() const { return maBitmapEx
; }
61 const basegfx::B2DPoint
& getBasePosition() const { return maBasePosition
; }
62 sal_uInt16
getCenterX() const { return mnCenterX
; }
63 sal_uInt16
getCenterY() const { return mnCenterY
; }
66 virtual bool operator==( const BasePrimitive2D
& rPrimitive
) const;
68 DeclPrimitive2DIDBlock()
70 } // end of namespace primitive2d
71 } // end of namespace drawinglayer
73 //////////////////////////////////////////////////////////////////////////////
74 // Overlay helper class for a crosshair
75 namespace drawinglayer
79 class OverlayCrosshairPrimitive
: public ViewportDependentPrimitive2D
83 basegfx::B2DPoint maBasePosition
;
85 // The stripe colors and legth
86 basegfx::BColor maRGBColorA
;
87 basegfx::BColor maRGBColorB
;
88 double mfDiscreteDashLength
;
91 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const;
94 OverlayCrosshairPrimitive(
95 const basegfx::B2DPoint
& rBasePosition
,
96 const basegfx::BColor
& rRGBColorA
,
97 const basegfx::BColor
& rRGBColorB
,
98 double fDiscreteDashLength
);
101 const basegfx::B2DPoint
& getBasePosition() const { return maBasePosition
; }
102 const basegfx::BColor
& getRGBColorA() const { return maRGBColorA
; }
103 const basegfx::BColor
& getRGBColorB() const { return maRGBColorB
; }
104 double getDiscreteDashLength() const { return mfDiscreteDashLength
; }
107 virtual bool operator==( const BasePrimitive2D
& rPrimitive
) const;
109 DeclPrimitive2DIDBlock()
111 } // end of namespace primitive2d
112 } // end of namespace drawinglayer
114 //////////////////////////////////////////////////////////////////////////////
115 // Overlay helper class for a hatch rectangle as used e.g. for text object
116 // selection hilighting
117 namespace drawinglayer
119 namespace primitive2d
121 class OverlayHatchRectanglePrimitive
: public DiscreteMetricDependentPrimitive2D
124 // the logic rectangle definition
125 basegfx::B2DRange maObjectRange
;
127 // the hatch definition
128 double mfDiscreteHatchDistance
;
129 double mfHatchRotation
;
130 basegfx::BColor maHatchColor
;
132 // the dscrete grow and shrink of the box
133 double mfDiscreteGrow
;
134 double mfDiscreteShrink
;
136 // the rotation of the primitive itself
140 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const;
143 OverlayHatchRectanglePrimitive(
144 const basegfx::B2DRange
& rObjectRange
,
145 double fDiscreteHatchDistance
,
146 double fHatchRotation
,
147 const basegfx::BColor
& rHatchColor
,
148 double fDiscreteGrow
,
149 double fDiscreteShrink
,
153 const basegfx::B2DRange
& getObjectRange() const { return maObjectRange
; }
154 double getDiscreteHatchDistance() const { return mfDiscreteHatchDistance
; }
155 double getHatchRotation() const { return mfHatchRotation
; }
156 const basegfx::BColor
& getHatchColor() const { return maHatchColor
; }
157 double getDiscreteGrow() const { return mfDiscreteGrow
; }
158 double getDiscreteShrink() const { return mfDiscreteShrink
; }
159 double getRotation() const { return mfRotation
; }
162 virtual bool operator==( const BasePrimitive2D
& rPrimitive
) const;
164 DeclPrimitive2DIDBlock()
166 } // end of namespace primitive2d
167 } // end of namespace drawinglayer
169 //////////////////////////////////////////////////////////////////////////////
170 // Overlay helper class for a striped helpline
172 namespace drawinglayer
174 namespace primitive2d
179 HELPLINESTYLE_VERTICAL
,
180 HELPLINESTYLE_HORIZONTAL
183 class OverlayHelplineStripedPrimitive
: public ViewportDependentPrimitive2D
186 // The logic position
187 basegfx::B2DPoint maBasePosition
;
190 HelplineStyle meStyle
;
192 // The stripe colors and legth
193 basegfx::BColor maRGBColorA
;
194 basegfx::BColor maRGBColorB
;
195 double mfDiscreteDashLength
;
198 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const;
201 OverlayHelplineStripedPrimitive(
202 const basegfx::B2DPoint
& rBasePosition
,
203 HelplineStyle eStyle
,
204 const basegfx::BColor
& rRGBColorA
,
205 const basegfx::BColor
& rRGBColorB
,
206 double fDiscreteDashLength
);
209 const basegfx::B2DPoint
& getBasePosition() const { return maBasePosition
; }
210 HelplineStyle
getStyle() const { return meStyle
; }
211 const basegfx::BColor
& getRGBColorA() const { return maRGBColorA
; }
212 const basegfx::BColor
& getRGBColorB() const { return maRGBColorB
; }
213 double getDiscreteDashLength() const { return mfDiscreteDashLength
; }
216 virtual bool operator==( const BasePrimitive2D
& rPrimitive
) const;
218 DeclPrimitive2DIDBlock()
220 } // end of namespace primitive2d
221 } // end of namespace drawinglayer
223 //////////////////////////////////////////////////////////////////////////////
224 // Overlay helper class for rolling rectangle helplines. This primitive is
225 // only for the extended lines to the ends of the view
227 namespace drawinglayer
229 namespace primitive2d
231 class OverlayRollingRectanglePrimitive
: public ViewportDependentPrimitive2D
235 basegfx::B2DRange maRollingRectangle
;
237 // The stripe colors and legth
238 basegfx::BColor maRGBColorA
;
239 basegfx::BColor maRGBColorB
;
240 double mfDiscreteDashLength
;
243 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const;
246 OverlayRollingRectanglePrimitive(
247 const basegfx::B2DRange
& aRollingRectangle
,
248 const basegfx::BColor
& rRGBColorA
,
249 const basegfx::BColor
& rRGBColorB
,
250 double fDiscreteDashLength
);
253 const basegfx::B2DRange
& getRollingRectangle() const { return maRollingRectangle
; }
254 const basegfx::BColor
& getRGBColorA() const { return maRGBColorA
; }
255 const basegfx::BColor
& getRGBColorB() const { return maRGBColorB
; }
256 double getDiscreteDashLength() const { return mfDiscreteDashLength
; }
259 virtual bool operator==( const BasePrimitive2D
& rPrimitive
) const;
261 DeclPrimitive2DIDBlock()
263 } // end of namespace primitive2d
264 } // end of namespace drawinglayer
266 //////////////////////////////////////////////////////////////////////////////
268 #endif //_SDR_OVERLAY_OVERLAYTOOLS_HXX
270 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */