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