1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HELPLINEPRIMITIVE2D_HXX 29 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HELPLINEPRIMITIVE2D_HXX 30 31 #include <drawinglayer/drawinglayerdllapi.h> 32 #include <drawinglayer/primitive2d/baseprimitive2d.hxx> 33 #include <basegfx/color/bcolor.hxx> 34 #include <basegfx/matrix/b2dhommatrix.hxx> 35 36 ////////////////////////////////////////////////////////////////////////////// 37 // HelplinePrimitive2D class 38 39 namespace drawinglayer 40 { 41 namespace primitive2d 42 { 43 /** HelplineStyle2D definition 44 45 The available styles of Helplines 46 */ 47 enum HelplineStyle2D 48 { 49 HELPLINESTYLE2D_POINT, 50 HELPLINESTYLE2D_LINE 51 }; 52 53 /** HelplinePrimitive2D class 54 55 This primitive provides a view-dependent helpline definition. The Helpline 56 is defined by a line equation (Point and vector) and a style. When the style 57 is a line, dependent from Viewport the visible part of that Helpline is 58 constructed. For Point, a cross is constructed. This primitive is highly 59 view-dependent. 60 61 The visualisation uses the two given colors to create a dashed line with 62 the given dash length. 63 */ 64 class DRAWINGLAYER_DLLPUBLIC HelplinePrimitive2D : public BufferedDecompositionPrimitive2D 65 { 66 private: 67 /// Helpline geometry definition 68 basegfx::B2DPoint maPosition; 69 basegfx::B2DVector maDirection; 70 HelplineStyle2D meStyle; 71 72 /// Helpline style definition 73 basegfx::BColor maRGBColA; 74 basegfx::BColor maRGBColB; 75 double mfDiscreteDashLength; 76 77 /** the last used object to view transformtion and the last Viewport, 78 used from getDecomposition for decide buffering 79 */ 80 basegfx::B2DHomMatrix maLastObjectToViewTransformation; 81 basegfx::B2DRange maLastViewport; 82 83 protected: 84 /// create local decomposition 85 virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 86 87 public: 88 /// constructor 89 HelplinePrimitive2D( 90 const basegfx::B2DPoint& rPosition, 91 const basegfx::B2DVector& rDirection, 92 HelplineStyle2D eStyle, 93 const basegfx::BColor& rRGBColA, 94 const basegfx::BColor& aRGBColB, 95 double fDiscreteDashLength); 96 97 /// data read access 98 const basegfx::B2DPoint& getPosition() const { return maPosition; } 99 const basegfx::B2DVector& getDirection() const { return maDirection; } 100 HelplineStyle2D getStyle() const { return meStyle; } 101 const basegfx::BColor& getRGBColA() const { return maRGBColA; } 102 const basegfx::BColor& getRGBColB() const { return maRGBColB; } 103 double getDiscreteDashLength() const { return mfDiscreteDashLength; } 104 105 /// compare operator 106 virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 107 108 /// provide unique ID 109 DeclPrimitrive2DIDBlock() 110 111 /// Overload standard getDecomposition call to be view-dependent here 112 virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 113 }; 114 } // end of namespace primitive2d 115 } // end of namespace drawinglayer 116 117 ////////////////////////////////////////////////////////////////////////////// 118 119 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HELPLINEPRIMITIVE2D_HXX 120 121 ////////////////////////////////////////////////////////////////////////////// 122 // eof 123