1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _SDR_OVERLAY_OVERLAYTOOLS_HXX 25 #define _SDR_OVERLAY_OVERLAYTOOLS_HXX 26 27 #include <drawinglayer/primitive2d/primitivetools2d.hxx> 28 #include <vcl/bitmapex.hxx> 29 30 ////////////////////////////////////////////////////////////////////////////// 31 // Overlay helper class which holds a BotmapEx which is to be visualized 32 // at the given logic position with the Bitmap's pixel size, unscaled and 33 // unrotated (like a marker). The discrete pixel on the bitmap assocciated 34 // with the target position is given in discrete X,Y coordinates 35 namespace drawinglayer 36 { 37 namespace primitive2d 38 { 39 class OverlayBitmapExPrimitive : public DiscreteMetricDependentPrimitive2D 40 { 41 private: 42 // The BitmapEx to use, PixelSize is used 43 BitmapEx maBitmapEx; 44 45 // The logic position 46 basegfx::B2DPoint maBasePosition; 47 48 // The pixel inside the BitmapEx which is assocciated with 49 // the target position (offset in the bitmap) 50 sal_uInt16 mnCenterX; 51 sal_uInt16 mnCenterY; 52 53 // evtl. rotation and shear around center 54 double mfShearX; 55 double mfRotation; 56 57 protected: 58 virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 59 60 public: 61 OverlayBitmapExPrimitive( 62 const BitmapEx& rBitmapEx, 63 const basegfx::B2DPoint& rBasePosition, 64 sal_uInt16 nCenterX, 65 sal_uInt16 nCenterY, 66 double fShearX = 0.0, 67 double fRotation = 0.0); 68 69 // data access getBitmapEx() const70 const BitmapEx& getBitmapEx() const { return maBitmapEx; } getBasePosition() const71 const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; } getCenterX() const72 sal_uInt16 getCenterX() const { return mnCenterX; } getCenterY() const73 sal_uInt16 getCenterY() const { return mnCenterY; } getShearX() const74 double getShearX() const { return mfShearX; } getRotation() const75 double getRotation() const { return mfRotation; } 76 77 // compare operator 78 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; 79 80 DeclPrimitrive2DIDBlock() 81 }; 82 } // end of namespace primitive2d 83 } // end of namespace drawinglayer 84 85 ////////////////////////////////////////////////////////////////////////////// 86 // Overlay helper class for a crosshair 87 namespace drawinglayer 88 { 89 namespace primitive2d 90 { 91 class OverlayCrosshairPrimitive : public ViewportDependentPrimitive2D 92 { 93 private: 94 // The logic position 95 basegfx::B2DPoint maBasePosition; 96 97 // The stripe colors and legth 98 basegfx::BColor maRGBColorA; 99 basegfx::BColor maRGBColorB; 100 double mfDiscreteDashLength; 101 102 protected: 103 virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 104 105 public: 106 OverlayCrosshairPrimitive( 107 const basegfx::B2DPoint& rBasePosition, 108 const basegfx::BColor& rRGBColorA, 109 const basegfx::BColor& rRGBColorB, 110 double fDiscreteDashLength); 111 112 // data access getBasePosition() const113 const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; } getRGBColorA() const114 const basegfx::BColor& getRGBColorA() const { return maRGBColorA; } getRGBColorB() const115 const basegfx::BColor& getRGBColorB() const { return maRGBColorB; } getDiscreteDashLength() const116 double getDiscreteDashLength() const { return mfDiscreteDashLength; } 117 118 // compare operator 119 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; 120 121 DeclPrimitrive2DIDBlock() 122 }; 123 } // end of namespace primitive2d 124 } // end of namespace drawinglayer 125 126 ////////////////////////////////////////////////////////////////////////////// 127 // Overlay helper class for a hatch rectangle as used e.g. for text object 128 // selection hilighting 129 namespace drawinglayer 130 { 131 namespace primitive2d 132 { 133 class OverlayRectanglePrimitive : public DiscreteMetricDependentPrimitive2D 134 { 135 private: 136 // the logic rectangle definition 137 basegfx::B2DRange maObjectRange; 138 139 // the graphic definition 140 basegfx::BColor maColor; 141 double mfTransparence; 142 143 // the dscrete grow and shrink of the box 144 double mfDiscreteGrow; 145 double mfDiscreteShrink; 146 147 // the rotation of the primitive itself 148 double mfRotation; 149 150 protected: 151 virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 152 153 public: 154 OverlayRectanglePrimitive( 155 const basegfx::B2DRange& rObjectRange, 156 const basegfx::BColor& rColor, 157 double fTransparence, 158 double fDiscreteGrow, 159 double fDiscreteShrink, 160 double fRotation); 161 162 // data access getObjectRange() const163 const basegfx::B2DRange& getObjectRange() const { return maObjectRange; } getColor() const164 const basegfx::BColor& getColor() const { return maColor; } getTransparence() const165 double getTransparence() const { return mfTransparence; } getDiscreteGrow() const166 double getDiscreteGrow() const { return mfDiscreteGrow; } getDiscreteShrink() const167 double getDiscreteShrink() const { return mfDiscreteShrink; } getRotation() const168 double getRotation() const { return mfRotation; } 169 170 // compare operator 171 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; 172 173 DeclPrimitrive2DIDBlock() 174 }; 175 } // end of namespace primitive2d 176 } // end of namespace drawinglayer 177 178 ////////////////////////////////////////////////////////////////////////////// 179 // Overlay helper class for a striped helpline 180 181 namespace drawinglayer 182 { 183 namespace primitive2d 184 { 185 enum HelplineStyle 186 { 187 HELPLINESTYLE_POINT, 188 HELPLINESTYLE_VERTICAL, 189 HELPLINESTYLE_HORIZONTAL 190 }; 191 192 class OverlayHelplineStripedPrimitive : public ViewportDependentPrimitive2D 193 { 194 private: 195 // The logic position 196 basegfx::B2DPoint maBasePosition; 197 198 // the style 199 HelplineStyle meStyle; 200 201 // The stripe colors and legth 202 basegfx::BColor maRGBColorA; 203 basegfx::BColor maRGBColorB; 204 double mfDiscreteDashLength; 205 206 protected: 207 virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 208 209 public: 210 OverlayHelplineStripedPrimitive( 211 const basegfx::B2DPoint& rBasePosition, 212 HelplineStyle eStyle, 213 const basegfx::BColor& rRGBColorA, 214 const basegfx::BColor& rRGBColorB, 215 double fDiscreteDashLength); 216 217 // data access getBasePosition() const218 const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; } getStyle() const219 HelplineStyle getStyle() const { return meStyle; } getRGBColorA() const220 const basegfx::BColor& getRGBColorA() const { return maRGBColorA; } getRGBColorB() const221 const basegfx::BColor& getRGBColorB() const { return maRGBColorB; } getDiscreteDashLength() const222 double getDiscreteDashLength() const { return mfDiscreteDashLength; } 223 224 // compare operator 225 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; 226 227 DeclPrimitrive2DIDBlock() 228 }; 229 } // end of namespace primitive2d 230 } // end of namespace drawinglayer 231 232 ////////////////////////////////////////////////////////////////////////////// 233 // Overlay helper class for rolling rectangle helplines. This primitive is 234 // only for the extended lines to the ends of the view 235 236 namespace drawinglayer 237 { 238 namespace primitive2d 239 { 240 class OverlayRollingRectanglePrimitive : public ViewportDependentPrimitive2D 241 { 242 private: 243 // The logic range 244 basegfx::B2DRange maRollingRectangle; 245 246 // The stripe colors and legth 247 basegfx::BColor maRGBColorA; 248 basegfx::BColor maRGBColorB; 249 double mfDiscreteDashLength; 250 251 protected: 252 virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 253 254 public: 255 OverlayRollingRectanglePrimitive( 256 const basegfx::B2DRange& aRollingRectangle, 257 const basegfx::BColor& rRGBColorA, 258 const basegfx::BColor& rRGBColorB, 259 double fDiscreteDashLength); 260 261 // data access getRollingRectangle() const262 const basegfx::B2DRange& getRollingRectangle() const { return maRollingRectangle; } getRGBColorA() const263 const basegfx::BColor& getRGBColorA() const { return maRGBColorA; } getRGBColorB() const264 const basegfx::BColor& getRGBColorB() const { return maRGBColorB; } getDiscreteDashLength() const265 double getDiscreteDashLength() const { return mfDiscreteDashLength; } 266 267 // compare operator 268 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; 269 270 DeclPrimitrive2DIDBlock() 271 }; 272 } // end of namespace primitive2d 273 } // end of namespace drawinglayer 274 275 ////////////////////////////////////////////////////////////////////////////// 276 277 #endif //_SDR_OVERLAY_OVERLAYTOOLS_HXX 278 279 // eof 280