Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #ifndef _SDR_OVERLAY_OVERLAYTOOLS_HXX
21 : : #define _SDR_OVERLAY_OVERLAYTOOLS_HXX
22 : :
23 : : #include <drawinglayer/primitive2d/primitivetools2d.hxx>
24 : : #include <vcl/bitmapex.hxx>
25 : :
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
32 : : {
33 : : namespace primitive2d
34 : : {
35 [ + - ][ - + ]: 12016 : class OverlayBitmapExPrimitive : public DiscreteMetricDependentPrimitive2D
36 : : {
37 : : private:
38 : : // The BitmapEx to use, PixelSize is used
39 : : BitmapEx maBitmapEx;
40 : :
41 : : // The logic position
42 : : basegfx::B2DPoint maBasePosition;
43 : :
44 : : // The pixel inside the BitmapEx which is assocciated with
45 : : // the target position (offset in the bitmap)
46 : : sal_uInt16 mnCenterX;
47 : : sal_uInt16 mnCenterY;
48 : :
49 : : protected:
50 : : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
51 : :
52 : : public:
53 : : OverlayBitmapExPrimitive(
54 : : const BitmapEx& rBitmapEx,
55 : : const basegfx::B2DPoint& rBasePosition,
56 : : sal_uInt16 nCenterX,
57 : : sal_uInt16 nCenterY);
58 : :
59 : : // data access
60 : 12016 : const BitmapEx& getBitmapEx() const { return maBitmapEx; }
61 : 24032 : const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
62 : 12016 : sal_uInt16 getCenterX() const { return mnCenterX; }
63 : 12016 : sal_uInt16 getCenterY() const { return mnCenterY; }
64 : :
65 : : // compare operator
66 : : virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
67 : :
68 : : DeclPrimitrive2DIDBlock()
69 : : };
70 : : } // end of namespace primitive2d
71 : : } // end of namespace drawinglayer
72 : :
73 : : //////////////////////////////////////////////////////////////////////////////
74 : : // Overlay helper class for a crosshair
75 : : namespace drawinglayer
76 : : {
77 : : namespace primitive2d
78 : : {
79 [ # # ]: 0 : class OverlayCrosshairPrimitive : public ViewportDependentPrimitive2D
80 : : {
81 : : private:
82 : : // The logic position
83 : : basegfx::B2DPoint maBasePosition;
84 : :
85 : : // The stripe colors and legth
86 : : basegfx::BColor maRGBColorA;
87 : : basegfx::BColor maRGBColorB;
88 : : double mfDiscreteDashLength;
89 : :
90 : : protected:
91 : : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
92 : :
93 : : public:
94 : : OverlayCrosshairPrimitive(
95 : : const basegfx::B2DPoint& rBasePosition,
96 : : const basegfx::BColor& rRGBColorA,
97 : : const basegfx::BColor& rRGBColorB,
98 : : double fDiscreteDashLength);
99 : :
100 : : // data access
101 : 0 : const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
102 : 0 : const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
103 : 0 : const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
104 : 0 : double getDiscreteDashLength() const { return mfDiscreteDashLength; }
105 : :
106 : : // compare operator
107 : : virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
108 : :
109 : : DeclPrimitrive2DIDBlock()
110 : : };
111 : : } // end of namespace primitive2d
112 : : } // end of namespace drawinglayer
113 : :
114 : : //////////////////////////////////////////////////////////////////////////////
115 : : // Overlay helper class for a hatch rectangle as used e.g. for text object
116 : : // selection hilighting
117 : : namespace drawinglayer
118 : : {
119 : : namespace primitive2d
120 : : {
121 [ # # ]: 0 : class OverlayHatchRectanglePrimitive : public DiscreteMetricDependentPrimitive2D
122 : : {
123 : : private:
124 : : // the logic rectangle definition
125 : : basegfx::B2DRange maObjectRange;
126 : :
127 : : // the hatch definition
128 : : double mfDiscreteHatchDistance;
129 : : double mfHatchRotation;
130 : : basegfx::BColor maHatchColor;
131 : :
132 : : // the dscrete grow and shrink of the box
133 : : double mfDiscreteGrow;
134 : : double mfDiscreteShrink;
135 : :
136 : : // the rotation of the primitive itself
137 : : double mfRotation;
138 : :
139 : : protected:
140 : : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
141 : :
142 : : public:
143 : : OverlayHatchRectanglePrimitive(
144 : : const basegfx::B2DRange& rObjectRange,
145 : : double fDiscreteHatchDistance,
146 : : double fHatchRotation,
147 : : const basegfx::BColor& rHatchColor,
148 : : double fDiscreteGrow,
149 : : double fDiscreteShrink,
150 : : double fRotation);
151 : :
152 : : // data access
153 : 0 : const basegfx::B2DRange& getObjectRange() const { return maObjectRange; }
154 : 0 : double getDiscreteHatchDistance() const { return mfDiscreteHatchDistance; }
155 : 0 : double getHatchRotation() const { return mfHatchRotation; }
156 : 0 : const basegfx::BColor& getHatchColor() const { return maHatchColor; }
157 : 0 : double getDiscreteGrow() const { return mfDiscreteGrow; }
158 : 0 : double getDiscreteShrink() const { return mfDiscreteShrink; }
159 : 0 : double getRotation() const { return mfRotation; }
160 : :
161 : : // compare operator
162 : : virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
163 : :
164 : : DeclPrimitrive2DIDBlock()
165 : : };
166 : : } // end of namespace primitive2d
167 : : } // end of namespace drawinglayer
168 : :
169 : : //////////////////////////////////////////////////////////////////////////////
170 : : // Overlay helper class for a striped helpline
171 : :
172 : : namespace drawinglayer
173 : : {
174 : : namespace primitive2d
175 : : {
176 : : enum HelplineStyle
177 : : {
178 : : HELPLINESTYLE_POINT,
179 : : HELPLINESTYLE_VERTICAL,
180 : : HELPLINESTYLE_HORIZONTAL
181 : : };
182 : :
183 [ # # ]: 0 : class OverlayHelplineStripedPrimitive : public ViewportDependentPrimitive2D
184 : : {
185 : : private:
186 : : // The logic position
187 : : basegfx::B2DPoint maBasePosition;
188 : :
189 : : // the style
190 : : HelplineStyle meStyle;
191 : :
192 : : // The stripe colors and legth
193 : : basegfx::BColor maRGBColorA;
194 : : basegfx::BColor maRGBColorB;
195 : : double mfDiscreteDashLength;
196 : :
197 : : protected:
198 : : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
199 : :
200 : : public:
201 : : OverlayHelplineStripedPrimitive(
202 : : const basegfx::B2DPoint& rBasePosition,
203 : : HelplineStyle eStyle,
204 : : const basegfx::BColor& rRGBColorA,
205 : : const basegfx::BColor& rRGBColorB,
206 : : double fDiscreteDashLength);
207 : :
208 : : // data access
209 : 0 : const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
210 : 0 : HelplineStyle getStyle() const { return meStyle; }
211 : 0 : const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
212 : 0 : const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
213 : 0 : double getDiscreteDashLength() const { return mfDiscreteDashLength; }
214 : :
215 : : // compare operator
216 : : virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
217 : :
218 : : DeclPrimitrive2DIDBlock()
219 : : };
220 : : } // end of namespace primitive2d
221 : : } // end of namespace drawinglayer
222 : :
223 : : //////////////////////////////////////////////////////////////////////////////
224 : : // Overlay helper class for rolling rectangle helplines. This primitive is
225 : : // only for the extended lines to the ends of the view
226 : :
227 : : namespace drawinglayer
228 : : {
229 : : namespace primitive2d
230 : : {
231 [ # # ]: 0 : class OverlayRollingRectanglePrimitive : public ViewportDependentPrimitive2D
232 : : {
233 : : private:
234 : : // The logic range
235 : : basegfx::B2DRange maRollingRectangle;
236 : :
237 : : // The stripe colors and legth
238 : : basegfx::BColor maRGBColorA;
239 : : basegfx::BColor maRGBColorB;
240 : : double mfDiscreteDashLength;
241 : :
242 : : protected:
243 : : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
244 : :
245 : : public:
246 : : OverlayRollingRectanglePrimitive(
247 : : const basegfx::B2DRange& aRollingRectangle,
248 : : const basegfx::BColor& rRGBColorA,
249 : : const basegfx::BColor& rRGBColorB,
250 : : double fDiscreteDashLength);
251 : :
252 : : // data access
253 : 0 : const basegfx::B2DRange& getRollingRectangle() const { return maRollingRectangle; }
254 : 0 : const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
255 : 0 : const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
256 : 0 : double getDiscreteDashLength() const { return mfDiscreteDashLength; }
257 : :
258 : : // compare operator
259 : : virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
260 : :
261 : : DeclPrimitrive2DIDBlock()
262 : : };
263 : : } // end of namespace primitive2d
264 : : } // end of namespace drawinglayer
265 : :
266 : : //////////////////////////////////////////////////////////////////////////////
267 : :
268 : : #endif //_SDR_OVERLAY_OVERLAYTOOLS_HXX
269 : :
270 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|