LibreOffice Module svx (master)  1
overlaytools.hxx
Go to the documentation of this file.
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 INCLUDED_SVX_INC_SDR_OVERLAY_OVERLAYTOOLS_HXX
21 #define INCLUDED_SVX_INC_SDR_OVERLAY_OVERLAYTOOLS_HXX
22 
24 #include <vcl/bitmapex.hxx>
26 
27 namespace drawinglayer { namespace primitive2d {
28 
30 {
31 private:
34 
35  // the graphic definition
38  double const mfTransparence;
39 
40  // the rotation of the primitive itself
41  double const mfRotation;
42 
43 protected:
44  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
45 
46 public:
48  const basegfx::B2DPoint& rPosition,
49  const basegfx::B2DSize& rSize,
50  const basegfx::BColor& rStrokeColor,
51  const basegfx::BColor& rFillColor,
52  double fTransparence,
53  double fRotation);
54 
55  // compare operator
56  virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
57 
59 };
60 
61 }} // end of namespace drawinglayer::primitive2d
62 
63 // Overlay helper class which holds a BotmapEx which is to be visualized
64 // at the given logic position with the Bitmap's pixel size, unscaled and
65 // unrotated (like a marker). The discrete pixel on the bitmap assocciated
66 // with the target position is given in discrete X,Y coordinates
67 namespace drawinglayer
68 {
69  namespace primitive2d
70  {
72  {
73  private:
74  // The BitmapEx to use, PixelSize is used
76 
77  // The logic position
79 
80  // The pixel inside the BitmapEx which is assocciated with
81  // the target position (offset in the bitmap)
82  sal_uInt16 const mnCenterX;
83  sal_uInt16 const mnCenterY;
84 
85  // evtl. rotation and shear around center
86  double const mfShearX;
87  double const mfRotation;
88 
89  protected:
90  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
91 
92  public:
94  const BitmapEx& rBitmapEx,
95  const basegfx::B2DPoint& rBasePosition,
96  sal_uInt16 nCenterX,
97  sal_uInt16 nCenterY,
98  double fShearX,
99  double fRotation);
100 
101  // data access
102  const BitmapEx& getBitmapEx() const { return maBitmapEx; }
104  sal_uInt16 getCenterX() const { return mnCenterX; }
105  sal_uInt16 getCenterY() const { return mnCenterY; }
106  double getShearX() const { return mfShearX; }
107  double getRotation() const { return mfRotation; }
108 
109  // compare operator
110  virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
111 
113  };
114  } // end of namespace primitive2d
115 } // end of namespace drawinglayer
116 
117 
118 // Overlay helper class for a crosshair
119 namespace drawinglayer
120 {
121  namespace primitive2d
122  {
124  {
125  private:
126  // The logic position
128 
129  // The stripe colors and length
132  double const mfDiscreteDashLength;
133 
134  protected:
135  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
136 
137  public:
139  const basegfx::B2DPoint& rBasePosition,
140  const basegfx::BColor& rRGBColorA,
141  const basegfx::BColor& rRGBColorB,
142  double fDiscreteDashLength);
143 
144  // data access
146  const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
147  const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
148  double getDiscreteDashLength() const { return mfDiscreteDashLength; }
149 
150  // compare operator
151  virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
152 
154  };
155  } // end of namespace primitive2d
156 } // end of namespace drawinglayer
157 
158 
159 // Overlay helper class for a hatch rectangle as used e.g. for text object
160 // selection highlighting
161 namespace drawinglayer
162 {
163  namespace primitive2d
164  {
166  {
167  private:
168  // the logic rectangle definition
170 
171  // the graphic definition
173  double const mfTransparence;
174 
175  // the discrete grow and shrink of the box
176  double const mfDiscreteGrow;
177  double const mfDiscreteShrink;
178 
179  // the rotation of the primitive itself
180  double const mfRotation;
181 
182  protected:
183  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
184 
185  public:
187  const basegfx::B2DRange& rObjectRange,
188  const basegfx::BColor& rColor,
189  double fTransparence,
190  double fDiscreteGrow,
191  double fDiscreteShrink,
192  double fRotation);
193 
194  // data access
195  const basegfx::B2DRange& getObjectRange() const { return maObjectRange; }
196  const basegfx::BColor& getColor() const { return maColor; }
197  double getTransparence() const { return mfTransparence; }
198  double getDiscreteGrow() const { return mfDiscreteGrow; }
199  double getDiscreteShrink() const { return mfDiscreteShrink; }
200  double getRotation() const { return mfRotation; }
201 
202  // compare operator
203  virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
204 
206  };
207  } // end of namespace primitive2d
208 } // end of namespace drawinglayer
209 
210 
211 // Overlay helper class for a striped helpline
212 
213 namespace drawinglayer
214 {
215  namespace primitive2d
216  {
218  {
222  };
223 
225  {
226  private:
227  // The logic position
229 
230  // the style
232 
233  // The stripe colors and length
236  double const mfDiscreteDashLength;
237 
238  protected:
239  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
240 
241  public:
243  const basegfx::B2DPoint& rBasePosition,
244  HelplineStyle eStyle,
245  const basegfx::BColor& rRGBColorA,
246  const basegfx::BColor& rRGBColorB,
247  double fDiscreteDashLength);
248 
249  // data access
251  HelplineStyle getStyle() const { return meStyle; }
252  const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
253  const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
254  double getDiscreteDashLength() const { return mfDiscreteDashLength; }
255 
256  // compare operator
257  virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
258 
260  };
261  } // end of namespace primitive2d
262 } // end of namespace drawinglayer
263 
264 
265 // Overlay helper class for rolling rectangle helplines. This primitive is
266 // only for the extended lines to the ends of the view
267 
268 namespace drawinglayer
269 {
270  namespace primitive2d
271  {
273  {
274  private:
275  // The logic range
277 
278  // The stripe colors and length
281  double const mfDiscreteDashLength;
282 
283  protected:
284  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
285 
286  public:
288  const basegfx::B2DRange& aRollingRectangle,
289  const basegfx::BColor& rRGBColorA,
290  const basegfx::BColor& rRGBColorB,
291  double fDiscreteDashLength);
292 
293  // data access
295  const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
296  const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
297  double getDiscreteDashLength() const { return mfDiscreteDashLength; }
298 
299  // compare operator
300  virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
301 
303  };
304  } // end of namespace primitive2d
305 } // end of namespace drawinglayer
306 
307 
308 #endif // INCLUDED_SVX_INC_SDR_OVERLAY_OVERLAYTOOLS_HXX
309 
310 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
#define DeclPrimitive2DIDBlock()
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &rViewInformation) const override
OverlayRollingRectanglePrimitive(const basegfx::B2DRange &aRollingRectangle, const basegfx::BColor &rRGBColorA, const basegfx::BColor &rRGBColorB, double fDiscreteDashLength)
const basegfx::B2DPoint & getBasePosition() const
OverlayBitmapExPrimitive(const BitmapEx &rBitmapEx, const basegfx::B2DPoint &rBasePosition, sal_uInt16 nCenterX, sal_uInt16 nCenterY, double fShearX, double fRotation)
const basegfx::B2DPoint & getBasePosition() const
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &rViewInformation) const override
OverlayRectanglePrimitive(const basegfx::B2DRange &rObjectRange, const basegfx::BColor &rColor, double fTransparence, double fDiscreteGrow, double fDiscreteShrink, double fRotation)
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &rViewInformation) const override
const basegfx::B2DRange & getObjectRange() const
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &rViewInformation) const override
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &rViewInformation) const override
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
OverlayCrosshairPrimitive(const basegfx::B2DPoint &rBasePosition, const basegfx::BColor &rRGBColorA, const basegfx::BColor &rRGBColorB, double fDiscreteDashLength)
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &rViewInformation) const override
OverlayHelplineStripedPrimitive(const basegfx::B2DPoint &rBasePosition, HelplineStyle eStyle, const basegfx::BColor &rRGBColorA, const basegfx::BColor &rRGBColorB, double fDiscreteDashLength)
OverlayStaticRectanglePrimitive(const basegfx::B2DPoint &rPosition, const basegfx::B2DSize &rSize, const basegfx::BColor &rStrokeColor, const basegfx::BColor &rFillColor, double fTransparence, double fRotation)