Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / svx / inc / sdr / overlay / overlaytools.hxx
blob05b397845de3ad8302aa6b2831d51197c89b18c1
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 { namespace primitive2d {
29 class OverlayStaticRectanglePrimitive : public DiscreteMetricDependentPrimitive2D
31 private:
32 basegfx::B2DPoint const maPosition;
33 basegfx::B2DSize const maSize;
35 // the graphic definition
36 basegfx::BColor const maStrokeColor;
37 basegfx::BColor const maFillColor;
38 double const mfTransparence;
40 // the rotation of the primitive itself
41 double const mfRotation;
43 protected:
44 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
46 public:
47 OverlayStaticRectanglePrimitive(
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);
55 // compare operator
56 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
58 DeclPrimitive2DIDBlock()
61 }} // end of namespace drawinglayer::primitive2d
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
69 namespace primitive2d
71 class OverlayBitmapExPrimitive : public DiscreteMetricDependentPrimitive2D
73 private:
74 // The BitmapEx to use, PixelSize is used
75 BitmapEx const maBitmapEx;
77 // The logic position
78 basegfx::B2DPoint const maBasePosition;
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;
85 // evtl. rotation and shear around center
86 double const mfShearX;
87 double const mfRotation;
89 protected:
90 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
92 public:
93 OverlayBitmapExPrimitive(
94 const BitmapEx& rBitmapEx,
95 const basegfx::B2DPoint& rBasePosition,
96 sal_uInt16 nCenterX,
97 sal_uInt16 nCenterY,
98 double fShearX,
99 double fRotation);
101 // data access
102 const BitmapEx& getBitmapEx() const { return maBitmapEx; }
103 const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
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; }
109 // compare operator
110 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
112 DeclPrimitive2DIDBlock()
114 } // end of namespace primitive2d
115 } // end of namespace drawinglayer
118 // Overlay helper class for a crosshair
119 namespace drawinglayer
121 namespace primitive2d
123 class OverlayCrosshairPrimitive : public ViewportDependentPrimitive2D
125 private:
126 // The logic position
127 basegfx::B2DPoint const maBasePosition;
129 // The stripe colors and length
130 basegfx::BColor const maRGBColorA;
131 basegfx::BColor const maRGBColorB;
132 double const mfDiscreteDashLength;
134 protected:
135 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
137 public:
138 OverlayCrosshairPrimitive(
139 const basegfx::B2DPoint& rBasePosition,
140 const basegfx::BColor& rRGBColorA,
141 const basegfx::BColor& rRGBColorB,
142 double fDiscreteDashLength);
144 // data access
145 const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
146 const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
147 const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
148 double getDiscreteDashLength() const { return mfDiscreteDashLength; }
150 // compare operator
151 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
153 DeclPrimitive2DIDBlock()
155 } // end of namespace primitive2d
156 } // end of namespace drawinglayer
159 // Overlay helper class for a hatch rectangle as used e.g. for text object
160 // selection highlighting
161 namespace drawinglayer
163 namespace primitive2d
165 class OverlayRectanglePrimitive : public DiscreteMetricDependentPrimitive2D
167 private:
168 // the logic rectangle definition
169 basegfx::B2DRange const maObjectRange;
171 // the graphic definition
172 basegfx::BColor const maColor;
173 double const mfTransparence;
175 // the discrete grow and shrink of the box
176 double const mfDiscreteGrow;
177 double const mfDiscreteShrink;
179 // the rotation of the primitive itself
180 double const mfRotation;
182 protected:
183 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
185 public:
186 OverlayRectanglePrimitive(
187 const basegfx::B2DRange& rObjectRange,
188 const basegfx::BColor& rColor,
189 double fTransparence,
190 double fDiscreteGrow,
191 double fDiscreteShrink,
192 double fRotation);
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; }
202 // compare operator
203 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
205 DeclPrimitive2DIDBlock()
207 } // end of namespace primitive2d
208 } // end of namespace drawinglayer
211 // Overlay helper class for a striped helpline
213 namespace drawinglayer
215 namespace primitive2d
217 enum HelplineStyle
219 HELPLINESTYLE_POINT,
220 HELPLINESTYLE_VERTICAL,
221 HELPLINESTYLE_HORIZONTAL
224 class OverlayHelplineStripedPrimitive : public ViewportDependentPrimitive2D
226 private:
227 // The logic position
228 basegfx::B2DPoint const maBasePosition;
230 // the style
231 HelplineStyle const meStyle;
233 // The stripe colors and length
234 basegfx::BColor const maRGBColorA;
235 basegfx::BColor const maRGBColorB;
236 double const mfDiscreteDashLength;
238 protected:
239 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
241 public:
242 OverlayHelplineStripedPrimitive(
243 const basegfx::B2DPoint& rBasePosition,
244 HelplineStyle eStyle,
245 const basegfx::BColor& rRGBColorA,
246 const basegfx::BColor& rRGBColorB,
247 double fDiscreteDashLength);
249 // data access
250 const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
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; }
256 // compare operator
257 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
259 DeclPrimitive2DIDBlock()
261 } // end of namespace primitive2d
262 } // end of namespace drawinglayer
265 // Overlay helper class for rolling rectangle helplines. This primitive is
266 // only for the extended lines to the ends of the view
268 namespace drawinglayer
270 namespace primitive2d
272 class OverlayRollingRectanglePrimitive : public ViewportDependentPrimitive2D
274 private:
275 // The logic range
276 basegfx::B2DRange const maRollingRectangle;
278 // The stripe colors and length
279 basegfx::BColor const maRGBColorA;
280 basegfx::BColor const maRGBColorB;
281 double const mfDiscreteDashLength;
283 protected:
284 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
286 public:
287 OverlayRollingRectanglePrimitive(
288 const basegfx::B2DRange& aRollingRectangle,
289 const basegfx::BColor& rRGBColorA,
290 const basegfx::BColor& rRGBColorB,
291 double fDiscreteDashLength);
293 // data access
294 const basegfx::B2DRange& getRollingRectangle() const { return maRollingRectangle; }
295 const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
296 const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
297 double getDiscreteDashLength() const { return mfDiscreteDashLength; }
299 // compare operator
300 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
302 DeclPrimitive2DIDBlock()
304 } // end of namespace primitive2d
305 } // end of namespace drawinglayer
308 #endif // INCLUDED_SVX_INC_SDR_OVERLAY_OVERLAYTOOLS_HXX
310 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */