tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / svx / inc / sdr / overlay / overlaytools.hxx
blob853bb760711467fb4ecfe4a9391de22a9fcdc1ea
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_SVX_INC_SDR_OVERLAY_OVERLAYTOOLS_HXX
21 #define INCLUDED_SVX_INC_SDR_OVERLAY_OVERLAYTOOLS_HXX
23 #include <drawinglayer/primitive2d/primitivetools2d.hxx>
24 #include <vcl/bitmapex.hxx>
25 #include <basegfx/vector/b2dsize.hxx>
27 namespace drawinglayer::primitive2d {
29 class OverlayStaticRectanglePrimitive final : public DiscreteMetricDependentPrimitive2D
31 private:
32 basegfx::B2DPoint maPosition;
33 basegfx::B2DSize maSize;
35 // the graphic definition
36 basegfx::BColor maStrokeColor;
37 basegfx::BColor maFillColor;
38 double mfTransparence;
40 // the rotation of the primitive itself
41 double mfRotation;
43 virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override;
45 public:
46 OverlayStaticRectanglePrimitive(
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);
54 // compare operator
55 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
57 virtual sal_uInt32 getPrimitive2DID() const override;
60 } // end of namespace drawinglayer::primitive2d
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 associated
65 // with the target position is given in discrete X,Y coordinates
66 namespace drawinglayer::primitive2d
68 class OverlayBitmapExPrimitive final : public DiscreteMetricDependentPrimitive2D
70 private:
71 // The BitmapEx to use, PixelSize is used
72 BitmapEx maBitmapEx;
74 // The logic position
75 basegfx::B2DPoint maBasePosition;
77 // The pixel inside the BitmapEx which is associated with
78 // the target position (offset in the bitmap)
79 sal_uInt16 mnCenterX;
80 sal_uInt16 mnCenterY;
82 // evtl. rotation and shear around center
83 double mfShearX;
84 double mfRotation;
86 virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override;
88 public:
89 OverlayBitmapExPrimitive(
90 const BitmapEx& rBitmapEx,
91 const basegfx::B2DPoint& rBasePosition,
92 sal_uInt16 nCenterX,
93 sal_uInt16 nCenterY,
94 double fShearX,
95 double fRotation);
97 // data access
98 const BitmapEx& getBitmapEx() const { return maBitmapEx; }
99 const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
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; }
105 // compare operator
106 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
108 virtual sal_uInt32 getPrimitive2DID() const override;
110 } // end of namespace drawinglayer::primitive2d
113 // Overlay helper class for a crosshair
114 namespace drawinglayer::primitive2d
116 class OverlayCrosshairPrimitive final : public ViewportDependentPrimitive2D
118 private:
119 // The logic position
120 basegfx::B2DPoint maBasePosition;
122 // The stripe colors and length
123 basegfx::BColor maRGBColorA;
124 basegfx::BColor maRGBColorB;
125 double mfDiscreteDashLength;
127 virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override;
129 public:
130 OverlayCrosshairPrimitive(
131 const basegfx::B2DPoint& rBasePosition,
132 const basegfx::BColor& rRGBColorA,
133 const basegfx::BColor& rRGBColorB,
134 double fDiscreteDashLength);
136 // data access
137 const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
138 const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
139 const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
140 double getDiscreteDashLength() const { return mfDiscreteDashLength; }
142 // compare operator
143 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
145 virtual sal_uInt32 getPrimitive2DID() const override;
147 } // end of namespace drawinglayer::primitive2d
150 // Overlay helper class for a hatch rectangle as used e.g. for text object
151 // selection highlighting
152 namespace drawinglayer::primitive2d
154 class OverlayRectanglePrimitive final : public DiscreteMetricDependentPrimitive2D
156 private:
157 // the logic rectangle definition
158 basegfx::B2DRange maObjectRange;
160 // the graphic definition
161 basegfx::BColor maColor;
162 double mfTransparence;
164 // the discrete grow and shrink of the box
165 double mfDiscreteGrow;
166 double mfDiscreteShrink;
168 // the rotation of the primitive itself
169 double mfRotation;
171 virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override;
173 public:
174 OverlayRectanglePrimitive(
175 const basegfx::B2DRange& rObjectRange,
176 const basegfx::BColor& rColor,
177 double fTransparence,
178 double fDiscreteGrow,
179 double fDiscreteShrink,
180 double fRotation);
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; }
190 // compare operator
191 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
193 virtual sal_uInt32 getPrimitive2DID() const override;
195 } // end of namespace drawinglayer::primitive2d
198 // Overlay helper class for a striped helpline
200 namespace drawinglayer::primitive2d
202 enum HelplineStyle
204 HELPLINESTYLE_POINT,
205 HELPLINESTYLE_VERTICAL,
206 HELPLINESTYLE_HORIZONTAL
209 class OverlayHelplineStripedPrimitive final : public ViewportDependentPrimitive2D
211 private:
212 // The logic position
213 basegfx::B2DPoint maBasePosition;
215 // the style
216 HelplineStyle meStyle;
218 // The stripe colors and length
219 basegfx::BColor maRGBColorA;
220 basegfx::BColor maRGBColorB;
221 double mfDiscreteDashLength;
223 virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override;
225 public:
226 OverlayHelplineStripedPrimitive(
227 const basegfx::B2DPoint& rBasePosition,
228 HelplineStyle eStyle,
229 const basegfx::BColor& rRGBColorA,
230 const basegfx::BColor& rRGBColorB,
231 double fDiscreteDashLength);
233 // data access
234 const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
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; }
240 // compare operator
241 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
243 virtual sal_uInt32 getPrimitive2DID() const override;
245 } // end of namespace drawinglayer::primitive2d
248 // Overlay helper class for rolling rectangle helplines. This primitive is
249 // only for the extended lines to the ends of the view
251 namespace drawinglayer::primitive2d
253 class OverlayRollingRectanglePrimitive final : public ViewportDependentPrimitive2D
255 private:
256 // The logic range
257 basegfx::B2DRange maRollingRectangle;
259 // The stripe colors and length
260 basegfx::BColor maRGBColorA;
261 basegfx::BColor maRGBColorB;
262 double mfDiscreteDashLength;
264 virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override;
266 public:
267 OverlayRollingRectanglePrimitive(
268 const basegfx::B2DRange& aRollingRectangle,
269 const basegfx::BColor& rRGBColorA,
270 const basegfx::BColor& rRGBColorB,
271 double fDiscreteDashLength);
273 // data access
274 const basegfx::B2DRange& getRollingRectangle() const { return maRollingRectangle; }
275 const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
276 const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
277 double getDiscreteDashLength() const { return mfDiscreteDashLength; }
279 // compare operator
280 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
282 virtual sal_uInt32 getPrimitive2DID() const override;
284 } // end of namespace drawinglayer::primitive2d
287 #endif // INCLUDED_SVX_INC_SDR_OVERLAY_OVERLAYTOOLS_HXX
289 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */