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_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX 29 #define INCLUDED_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX 30 31 #include <drawinglayer/primitive2d/baseprimitive2d.hxx> 32 #include <svx/sdr/attribute/sdrlineshadowtextattribute.hxx> 33 34 ////////////////////////////////////////////////////////////////////////////// 35 // predefines 36 37 namespace drawinglayer { namespace primitive2d { 38 enum MeasureTextPosition 39 { 40 MEASURETEXTPOSITION_AUTOMATIC, 41 MEASURETEXTPOSITION_NEGATIVE, 42 MEASURETEXTPOSITION_CENTERED, 43 MEASURETEXTPOSITION_POSITIVE 44 }; 45 }} 46 47 namespace drawinglayer { namespace attribute { 48 class SdrLineAttribute; 49 }} 50 51 ////////////////////////////////////////////////////////////////////////////// 52 53 namespace drawinglayer 54 { 55 namespace primitive2d 56 { 57 class SdrMeasurePrimitive2D : public BufferedDecompositionPrimitive2D 58 { 59 private: 60 attribute::SdrLineShadowTextAttribute maSdrLSTAttribute; 61 basegfx::B2DPoint maStart; 62 basegfx::B2DPoint maEnd; 63 MeasureTextPosition meHorizontal; 64 MeasureTextPosition meVertical; 65 double mfDistance; 66 double mfUpper; 67 double mfLower; 68 double mfLeftDelta; 69 double mfRightDelta; 70 71 // bitfield 72 unsigned mbBelow : 1; 73 unsigned mbTextRotation : 1; 74 unsigned mbTextAutoAngle : 1; 75 76 // internal decomposition helper 77 Primitive2DReference impCreatePart( 78 const attribute::SdrLineAttribute& rLineAttribute, 79 const basegfx::B2DHomMatrix& rObjectMatrix, 80 const basegfx::B2DPoint& rStart, 81 const basegfx::B2DPoint& rEnd, 82 bool bLeftActive, 83 bool bRightActive) const; 84 85 protected: 86 // local decomposition. 87 virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; 88 89 public: 90 SdrMeasurePrimitive2D( 91 const attribute::SdrLineShadowTextAttribute& rSdrLSTAttribute, 92 const basegfx::B2DPoint& rStart, 93 const basegfx::B2DPoint& rEnd, 94 MeasureTextPosition eHorizontal, 95 MeasureTextPosition eVertical, 96 double fDistance, 97 double fUpper, 98 double fLower, 99 double fLeftDelta, 100 double fRightDelta, 101 bool bBelow, 102 bool bTextRotation, 103 bool bTextAutoAngle); 104 105 // data access 106 const attribute::SdrLineShadowTextAttribute& getSdrLSTAttribute() const { return maSdrLSTAttribute; } 107 const basegfx::B2DPoint& getStart() const { return maStart; } 108 const basegfx::B2DPoint& getEnd() const { return maEnd; } 109 MeasureTextPosition getHorizontal() const { return meHorizontal; } 110 MeasureTextPosition getVertical() const { return meVertical; } 111 double getDistance() const { return mfDistance; } 112 double getUpper() const { return mfUpper; } 113 double getLower() const { return mfLower; } 114 double getLeftDelta() const { return mfLeftDelta; } 115 double getRightDelta() const { return mfRightDelta; } 116 bool getBelow() const { return mbBelow; } 117 bool getTextRotation() const { return mbTextRotation; } 118 bool getTextAutoAngle() const { return mbTextAutoAngle; } 119 120 // compare operator 121 virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 122 123 // provide unique ID 124 DeclPrimitrive2DIDBlock() 125 }; 126 } // end of namespace primitive2d 127 } // end of namespace drawinglayer 128 129 ////////////////////////////////////////////////////////////////////////////// 130 131 #endif //INCLUDED_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX 132 133 // eof 134