1*3334a7e6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*3334a7e6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*3334a7e6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*3334a7e6SAndrew Rist  * distributed with this work for additional information
6*3334a7e6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*3334a7e6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*3334a7e6SAndrew Rist  * "License"); you may not use this file except in compliance
9*3334a7e6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*3334a7e6SAndrew Rist  *
11*3334a7e6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*3334a7e6SAndrew Rist  *
13*3334a7e6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*3334a7e6SAndrew Rist  * software distributed under the License is distributed on an
15*3334a7e6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*3334a7e6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*3334a7e6SAndrew Rist  * specific language governing permissions and limitations
18*3334a7e6SAndrew Rist  * under the License.
19*3334a7e6SAndrew Rist  *
20*3334a7e6SAndrew Rist  *************************************************************/
21*3334a7e6SAndrew Rist 
22*3334a7e6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef INCLUDED_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX
25cdf0e10cSrcweir #define INCLUDED_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
28cdf0e10cSrcweir #include <svx/sdr/attribute/sdrlineshadowtextattribute.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
31cdf0e10cSrcweir // predefines
32cdf0e10cSrcweir 
33cdf0e10cSrcweir namespace drawinglayer { namespace primitive2d {
34cdf0e10cSrcweir 	enum MeasureTextPosition
35cdf0e10cSrcweir 	{
36cdf0e10cSrcweir 		MEASURETEXTPOSITION_AUTOMATIC,
37cdf0e10cSrcweir 		MEASURETEXTPOSITION_NEGATIVE,
38cdf0e10cSrcweir 		MEASURETEXTPOSITION_CENTERED,
39cdf0e10cSrcweir 		MEASURETEXTPOSITION_POSITIVE
40cdf0e10cSrcweir 	};
41cdf0e10cSrcweir }}
42cdf0e10cSrcweir 
43cdf0e10cSrcweir namespace drawinglayer { namespace attribute {
44cdf0e10cSrcweir 	class SdrLineAttribute;
45cdf0e10cSrcweir }}
46cdf0e10cSrcweir 
47cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
48cdf0e10cSrcweir 
49cdf0e10cSrcweir namespace drawinglayer
50cdf0e10cSrcweir {
51cdf0e10cSrcweir 	namespace primitive2d
52cdf0e10cSrcweir 	{
53cdf0e10cSrcweir 		class SdrMeasurePrimitive2D : public BufferedDecompositionPrimitive2D
54cdf0e10cSrcweir 		{
55cdf0e10cSrcweir 		private:
56cdf0e10cSrcweir 			attribute::SdrLineShadowTextAttribute		maSdrLSTAttribute;
57cdf0e10cSrcweir 			basegfx::B2DPoint							maStart;
58cdf0e10cSrcweir 			basegfx::B2DPoint							maEnd;
59cdf0e10cSrcweir 			MeasureTextPosition							meHorizontal;
60cdf0e10cSrcweir 			MeasureTextPosition							meVertical;
61cdf0e10cSrcweir 			double										mfDistance;
62cdf0e10cSrcweir 			double										mfUpper;
63cdf0e10cSrcweir 			double										mfLower;
64cdf0e10cSrcweir 			double										mfLeftDelta;
65cdf0e10cSrcweir 			double										mfRightDelta;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 			// bitfield
68cdf0e10cSrcweir 			unsigned									mbBelow : 1;
69cdf0e10cSrcweir 			unsigned									mbTextRotation : 1;
70cdf0e10cSrcweir 			unsigned									mbTextAutoAngle : 1;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 			// internal decomposition helper
73cdf0e10cSrcweir 			Primitive2DReference impCreatePart(
74cdf0e10cSrcweir 				const attribute::SdrLineAttribute& rLineAttribute,
75cdf0e10cSrcweir 				const basegfx::B2DHomMatrix& rObjectMatrix,
76cdf0e10cSrcweir 				const basegfx::B2DPoint& rStart,
77cdf0e10cSrcweir 				const basegfx::B2DPoint& rEnd,
78cdf0e10cSrcweir 				bool bLeftActive,
79cdf0e10cSrcweir 				bool bRightActive) const;
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 		protected:
82cdf0e10cSrcweir 			// local decomposition.
83cdf0e10cSrcweir 			virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 		public:
86cdf0e10cSrcweir 			SdrMeasurePrimitive2D(
87cdf0e10cSrcweir 				const attribute::SdrLineShadowTextAttribute& rSdrLSTAttribute,
88cdf0e10cSrcweir 				const basegfx::B2DPoint& rStart,
89cdf0e10cSrcweir                 const basegfx::B2DPoint& rEnd,
90cdf0e10cSrcweir 				MeasureTextPosition eHorizontal,
91cdf0e10cSrcweir 				MeasureTextPosition eVertical,
92cdf0e10cSrcweir 				double fDistance,
93cdf0e10cSrcweir 				double fUpper,
94cdf0e10cSrcweir 				double fLower,
95cdf0e10cSrcweir 				double fLeftDelta,
96cdf0e10cSrcweir 				double fRightDelta,
97cdf0e10cSrcweir 				bool bBelow,
98cdf0e10cSrcweir 				bool bTextRotation,
99cdf0e10cSrcweir 				bool bTextAutoAngle);
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 			// data access
getSdrLSTAttribute() const102cdf0e10cSrcweir 			const attribute::SdrLineShadowTextAttribute& getSdrLSTAttribute() const { return maSdrLSTAttribute; }
getStart() const103cdf0e10cSrcweir 			const basegfx::B2DPoint& getStart() const { return maStart; }
getEnd() const104cdf0e10cSrcweir 			const basegfx::B2DPoint& getEnd() const { return maEnd; }
getHorizontal() const105cdf0e10cSrcweir 			MeasureTextPosition getHorizontal() const { return meHorizontal; }
getVertical() const106cdf0e10cSrcweir 			MeasureTextPosition getVertical() const { return meVertical; }
getDistance() const107cdf0e10cSrcweir 			double getDistance() const { return mfDistance; }
getUpper() const108cdf0e10cSrcweir 			double getUpper() const { return mfUpper; }
getLower() const109cdf0e10cSrcweir 			double getLower() const { return mfLower; }
getLeftDelta() const110cdf0e10cSrcweir 			double getLeftDelta() const { return mfLeftDelta; }
getRightDelta() const111cdf0e10cSrcweir 			double getRightDelta() const { return mfRightDelta; }
getBelow() const112cdf0e10cSrcweir 			bool getBelow() const { return mbBelow; }
getTextRotation() const113cdf0e10cSrcweir 			bool getTextRotation() const { return mbTextRotation; }
getTextAutoAngle() const114cdf0e10cSrcweir 			bool getTextAutoAngle() const { return mbTextAutoAngle; }
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 			// compare operator
117cdf0e10cSrcweir 			virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 			// provide unique ID
120cdf0e10cSrcweir 			DeclPrimitrive2DIDBlock()
121cdf0e10cSrcweir 		};
122cdf0e10cSrcweir 	} // end of namespace primitive2d
123cdf0e10cSrcweir } // end of namespace drawinglayer
124cdf0e10cSrcweir 
125cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
126cdf0e10cSrcweir 
127cdf0e10cSrcweir #endif //INCLUDED_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX
128cdf0e10cSrcweir 
129cdf0e10cSrcweir // eof
130