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
67  {
69  {
70  private:
71  // The BitmapEx to use, PixelSize is used
73 
74  // The logic position
76 
77  // The pixel inside the BitmapEx which is assocciated with
78  // the target position (offset in the bitmap)
79  sal_uInt16 mnCenterX;
80  sal_uInt16 mnCenterY;
81 
82  // evtl. rotation and shear around center
83  double mfShearX;
84  double mfRotation;
85 
86  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
87 
88  public:
90  const BitmapEx& rBitmapEx,
91  const basegfx::B2DPoint& rBasePosition,
92  sal_uInt16 nCenterX,
93  sal_uInt16 nCenterY,
94  double fShearX,
95  double fRotation);
96 
97  // data access
98  const BitmapEx& getBitmapEx() const { return maBitmapEx; }
100  sal_uInt16 getCenterX() const { return mnCenterX; }
101  sal_uInt16 getCenterY() const { return mnCenterY; }
102  double getShearX() const { return mfShearX; }
103  double getRotation() const { return mfRotation; }
104 
105  // compare operator
106  virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
107 
108  virtual sal_uInt32 getPrimitive2DID() const override;
109  };
110 } // end of namespace drawinglayer::primitive2d
111 
112 
113 // Overlay helper class for a crosshair
115  {
117  {
118  private:
119  // The logic position
121 
122  // The stripe colors and length
126 
127  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
128 
129  public:
131  const basegfx::B2DPoint& rBasePosition,
132  const basegfx::BColor& rRGBColorA,
133  const basegfx::BColor& rRGBColorB,
134  double fDiscreteDashLength);
135 
136  // data access
138  const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
139  const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
140  double getDiscreteDashLength() const { return mfDiscreteDashLength; }
141 
142  // compare operator
143  virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
144 
145  virtual sal_uInt32 getPrimitive2DID() const override;
146  };
147 } // end of namespace drawinglayer::primitive2d
148 
149 
150 // Overlay helper class for a hatch rectangle as used e.g. for text object
151 // selection highlighting
153  {
155  {
156  private:
157  // the logic rectangle definition
159 
160  // the graphic definition
163 
164  // the discrete grow and shrink of the box
167 
168  // the rotation of the primitive itself
169  double mfRotation;
170 
171  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
172 
173  public:
175  const basegfx::B2DRange& rObjectRange,
176  const basegfx::BColor& rColor,
177  double fTransparence,
178  double fDiscreteGrow,
179  double fDiscreteShrink,
180  double fRotation);
181 
182  // data access
183  const basegfx::B2DRange& getObjectRange() const { return maObjectRange; }
184  const basegfx::BColor& getColor() const { return maColor; }
185  double getTransparence() const { return mfTransparence; }
186  double getDiscreteGrow() const { return mfDiscreteGrow; }
187  double getDiscreteShrink() const { return mfDiscreteShrink; }
188  double getRotation() const { return mfRotation; }
189 
190  // compare operator
191  virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
192 
193  virtual sal_uInt32 getPrimitive2DID() const override;
194  };
195 } // end of namespace drawinglayer::primitive2d
196 
197 
198 // Overlay helper class for a striped helpline
199 
201  {
203  {
207  };
208 
210  {
211  private:
212  // The logic position
214 
215  // the style
217 
218  // The stripe colors and length
222 
223  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
224 
225  public:
227  const basegfx::B2DPoint& rBasePosition,
228  HelplineStyle eStyle,
229  const basegfx::BColor& rRGBColorA,
230  const basegfx::BColor& rRGBColorB,
231  double fDiscreteDashLength);
232 
233  // data access
235  HelplineStyle getStyle() const { return meStyle; }
236  const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
237  const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
238  double getDiscreteDashLength() const { return mfDiscreteDashLength; }
239 
240  // compare operator
241  virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
242 
243  virtual sal_uInt32 getPrimitive2DID() const override;
244  };
245 } // end of namespace drawinglayer::primitive2d
246 
247 
248 // Overlay helper class for rolling rectangle helplines. This primitive is
249 // only for the extended lines to the ends of the view
250 
252  {
254  {
255  private:
256  // The logic range
258 
259  // The stripe colors and length
263 
264  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
265 
266  public:
268  const basegfx::B2DRange& aRollingRectangle,
269  const basegfx::BColor& rRGBColorA,
270  const basegfx::BColor& rRGBColorB,
271  double fDiscreteDashLength);
272 
273  // data access
275  const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
276  const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
277  double getDiscreteDashLength() const { return mfDiscreteDashLength; }
278 
279  // compare operator
280  virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
281 
282  virtual sal_uInt32 getPrimitive2DID() const override;
283  };
284 } // end of namespace drawinglayer::primitive2d
285 
286 
287 #endif // INCLUDED_SVX_INC_SDR_OVERLAY_OVERLAYTOOLS_HXX
288 
289 /* 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)