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::primitive2d {
28 
30 {
31 private:
34 
35  // the graphic definition
39 
40  // the rotation of the primitive itself
41  double mfRotation;
42 
43  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
44 
45 public:
47  const basegfx::B2DPoint& rPosition,
48  const basegfx::B2DSize& rSize,
49  const basegfx::BColor& rStrokeColor,
50  const basegfx::BColor& rFillColor,
51  double fTransparence,
52  double fRotation);
53 
54  // compare operator
55  virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
56 
57  virtual sal_uInt32 getPrimitive2DID() const override;
58 };
59 
60 } // end of namespace drawinglayer::primitive2d
61 
62 // Overlay helper class which holds a BotmapEx which is to be visualized
63 // at the given logic position with the Bitmap's pixel size, unscaled and
64 // unrotated (like a marker). The discrete pixel on the bitmap assocciated
65 // with the target position is given in discrete X,Y coordinates
66 namespace drawinglayer
67 {
68  namespace primitive2d
69  {
71  {
72  private:
73  // The BitmapEx to use, PixelSize is used
75 
76  // The logic position
78 
79  // The pixel inside the BitmapEx which is assocciated with
80  // the target position (offset in the bitmap)
81  sal_uInt16 mnCenterX;
82  sal_uInt16 mnCenterY;
83 
84  // evtl. rotation and shear around center
85  double mfShearX;
86  double mfRotation;
87 
88  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
89 
90  public:
92  const BitmapEx& rBitmapEx,
93  const basegfx::B2DPoint& rBasePosition,
94  sal_uInt16 nCenterX,
95  sal_uInt16 nCenterY,
96  double fShearX,
97  double fRotation);
98 
99  // data access
100  const BitmapEx& getBitmapEx() const { return maBitmapEx; }
102  sal_uInt16 getCenterX() const { return mnCenterX; }
103  sal_uInt16 getCenterY() const { return mnCenterY; }
104  double getShearX() const { return mfShearX; }
105  double getRotation() const { return mfRotation; }
106 
107  // compare operator
108  virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
109 
110  virtual sal_uInt32 getPrimitive2DID() const override;
111  };
112  } // end of namespace primitive2d
113 } // end of namespace drawinglayer
114 
115 
116 // Overlay helper class for a crosshair
117 namespace drawinglayer
118 {
119  namespace primitive2d
120  {
122  {
123  private:
124  // The logic position
126 
127  // The stripe colors and length
131 
132  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
133 
134  public:
136  const basegfx::B2DPoint& rBasePosition,
137  const basegfx::BColor& rRGBColorA,
138  const basegfx::BColor& rRGBColorB,
139  double fDiscreteDashLength);
140 
141  // data access
143  const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
144  const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
145  double getDiscreteDashLength() const { return mfDiscreteDashLength; }
146 
147  // compare operator
148  virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
149 
150  virtual sal_uInt32 getPrimitive2DID() const override;
151  };
152  } // end of namespace primitive2d
153 } // end of namespace drawinglayer
154 
155 
156 // Overlay helper class for a hatch rectangle as used e.g. for text object
157 // selection highlighting
158 namespace drawinglayer
159 {
160  namespace primitive2d
161  {
163  {
164  private:
165  // the logic rectangle definition
167 
168  // the graphic definition
171 
172  // the discrete grow and shrink of the box
175 
176  // the rotation of the primitive itself
177  double mfRotation;
178 
179  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
180 
181  public:
183  const basegfx::B2DRange& rObjectRange,
184  const basegfx::BColor& rColor,
185  double fTransparence,
186  double fDiscreteGrow,
187  double fDiscreteShrink,
188  double fRotation);
189 
190  // data access
191  const basegfx::B2DRange& getObjectRange() const { return maObjectRange; }
192  const basegfx::BColor& getColor() const { return maColor; }
193  double getTransparence() const { return mfTransparence; }
194  double getDiscreteGrow() const { return mfDiscreteGrow; }
195  double getDiscreteShrink() const { return mfDiscreteShrink; }
196  double getRotation() const { return mfRotation; }
197 
198  // compare operator
199  virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
200 
201  virtual sal_uInt32 getPrimitive2DID() const override;
202  };
203  } // end of namespace primitive2d
204 } // end of namespace drawinglayer
205 
206 
207 // Overlay helper class for a striped helpline
208 
209 namespace drawinglayer
210 {
211  namespace primitive2d
212  {
214  {
218  };
219 
221  {
222  private:
223  // The logic position
225 
226  // the style
228 
229  // The stripe colors and length
233 
234  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
235 
236  public:
238  const basegfx::B2DPoint& rBasePosition,
239  HelplineStyle eStyle,
240  const basegfx::BColor& rRGBColorA,
241  const basegfx::BColor& rRGBColorB,
242  double fDiscreteDashLength);
243 
244  // data access
246  HelplineStyle getStyle() const { return meStyle; }
247  const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
248  const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
249  double getDiscreteDashLength() const { return mfDiscreteDashLength; }
250 
251  // compare operator
252  virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
253 
254  virtual sal_uInt32 getPrimitive2DID() const override;
255  };
256  } // end of namespace primitive2d
257 } // end of namespace drawinglayer
258 
259 
260 // Overlay helper class for rolling rectangle helplines. This primitive is
261 // only for the extended lines to the ends of the view
262 
263 namespace drawinglayer
264 {
265  namespace primitive2d
266  {
268  {
269  private:
270  // The logic range
272 
273  // The stripe colors and length
277 
278  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
279 
280  public:
282  const basegfx::B2DRange& aRollingRectangle,
283  const basegfx::BColor& rRGBColorA,
284  const basegfx::BColor& rRGBColorB,
285  double fDiscreteDashLength);
286 
287  // data access
289  const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
290  const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
291  double getDiscreteDashLength() const { return mfDiscreteDashLength; }
292 
293  // compare operator
294  virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
295 
296  virtual sal_uInt32 getPrimitive2DID() const override;
297  };
298  } // end of namespace primitive2d
299 } // end of namespace drawinglayer
300 
301 
302 #endif // INCLUDED_SVX_INC_SDR_OVERLAY_OVERLAYTOOLS_HXX
303 
304 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
virtual sal_uInt32 getPrimitive2DID() const override
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 sal_uInt32 getPrimitive2DID() const override
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 sal_uInt32 getPrimitive2DID() const override
virtual sal_uInt32 getPrimitive2DID() const override
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
virtual sal_uInt32 getPrimitive2DID() 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
virtual sal_uInt32 getPrimitive2DID() 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)