1f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f6e50924SAndrew Rist  * distributed with this work for additional information
6f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10f6e50924SAndrew Rist  *
11f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12f6e50924SAndrew Rist  *
13f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17f6e50924SAndrew Rist  * specific language governing permissions and limitations
18f6e50924SAndrew Rist  * under the License.
19f6e50924SAndrew Rist  *
20f6e50924SAndrew Rist  *************************************************************/
21f6e50924SAndrew Rist 
22f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "precompiled_svx.hxx"
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <svx/sdr/attribute/sdrformtextattribute.hxx>
27cdf0e10cSrcweir #include <basegfx/vector/b2enums.hxx>
28cdf0e10cSrcweir #include <svl/itemset.hxx>
29cdf0e10cSrcweir #include <svx/xftdiit.hxx>
30cdf0e10cSrcweir #include <svx/xftstit.hxx>
31cdf0e10cSrcweir #include <svx/xftshxy.hxx>
32cdf0e10cSrcweir #include <svx/xftshtit.hxx>
33cdf0e10cSrcweir #include <svx/xtextit0.hxx>
34cdf0e10cSrcweir #include <svx/xftadit.hxx>
35cdf0e10cSrcweir #include <svx/xftshit.hxx>
36cdf0e10cSrcweir #include <svx/xftshcit.hxx>
37cdf0e10cSrcweir #include <svx/xftmrit.hxx>
38cdf0e10cSrcweir #include <svx/xftouit.hxx>
39cdf0e10cSrcweir #include <svx/sdshtitm.hxx>
40cdf0e10cSrcweir #include <svx/xlntrit.hxx>
41cdf0e10cSrcweir #include <svx/sdshcitm.hxx>
42cdf0e10cSrcweir #include <svx/xlnclit.hxx>
43cdf0e10cSrcweir #include <svx/xlnwtit.hxx>
44cdf0e10cSrcweir #include <svx/xlinjoit.hxx>
455aaf853bSArmin Le Grand #include <svx/xlncapit.hxx>
46cdf0e10cSrcweir #include <svx/xlineit0.hxx>
47cdf0e10cSrcweir #include <svx/xdash.hxx>
48cdf0e10cSrcweir #include <svx/xlndsit.hxx>
49cdf0e10cSrcweir #include <drawinglayer/attribute/lineattribute.hxx>
50cdf0e10cSrcweir #include <drawinglayer/attribute/strokeattribute.hxx>
51cdf0e10cSrcweir #include <svx/sdr/attribute/sdrformtextoutlineattribute.hxx>
525aaf853bSArmin Le Grand #include <com/sun/star/drawing/LineCap.hpp>
53cdf0e10cSrcweir 
54cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
55cdf0e10cSrcweir // helper to get line, stroke and transparence attributes from SfxItemSet
56cdf0e10cSrcweir 
57cdf0e10cSrcweir namespace
58cdf0e10cSrcweir {
impGetB2DLineJoin(com::sun::star::drawing::LineJoint eLineJoint)59*d5370dc8SArmin Le Grand 	basegfx::B2DLineJoin impGetB2DLineJoin(com::sun::star::drawing::LineJoint eLineJoint)
60cdf0e10cSrcweir 	{
61cdf0e10cSrcweir 		switch(eLineJoint)
62cdf0e10cSrcweir 		{
63*d5370dc8SArmin Le Grand 			case com::sun::star::drawing::LineJoint_MIDDLE :
64cdf0e10cSrcweir 			{
65cdf0e10cSrcweir 				return basegfx::B2DLINEJOIN_MIDDLE;
66cdf0e10cSrcweir 			}
67*d5370dc8SArmin Le Grand 			case com::sun::star::drawing::LineJoint_BEVEL :
68cdf0e10cSrcweir 			{
69cdf0e10cSrcweir 				return basegfx::B2DLINEJOIN_BEVEL;
70cdf0e10cSrcweir 			}
71*d5370dc8SArmin Le Grand 			case com::sun::star::drawing::LineJoint_MITER :
72cdf0e10cSrcweir 			{
73cdf0e10cSrcweir 				return basegfx::B2DLINEJOIN_MITER;
74cdf0e10cSrcweir 			}
75*d5370dc8SArmin Le Grand 			case com::sun::star::drawing::LineJoint_ROUND :
76cdf0e10cSrcweir 			{
77cdf0e10cSrcweir 				return basegfx::B2DLINEJOIN_ROUND;
78cdf0e10cSrcweir 			}
79*d5370dc8SArmin Le Grand 			default : // com::sun::star::drawing::LineJoint_NONE
80cdf0e10cSrcweir 			{
81cdf0e10cSrcweir 				return basegfx::B2DLINEJOIN_NONE; // XLINEJOINT_NONE
82cdf0e10cSrcweir 			}
83cdf0e10cSrcweir 		}
84cdf0e10cSrcweir 	}
85cdf0e10cSrcweir 
impGetStrokeTransparence(bool bShadow,const SfxItemSet & rSet)86cdf0e10cSrcweir     sal_uInt8 impGetStrokeTransparence(bool bShadow, const SfxItemSet& rSet)
87cdf0e10cSrcweir 	{
88cdf0e10cSrcweir 		sal_uInt8 nRetval;
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 		if(bShadow)
91cdf0e10cSrcweir 		{
92cdf0e10cSrcweir 			nRetval = (sal_uInt8)((((SdrShadowTransparenceItem&)(rSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue() * 255) / 100);
93cdf0e10cSrcweir 		}
94cdf0e10cSrcweir 		else
95cdf0e10cSrcweir 		{
96cdf0e10cSrcweir 			nRetval = (sal_uInt8)((((XLineTransparenceItem&)(rSet.Get(XATTR_LINETRANSPARENCE))).GetValue() * 255) / 100);
97cdf0e10cSrcweir 		}
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 		return nRetval;
100cdf0e10cSrcweir 	}
101cdf0e10cSrcweir 
impGetLineAttribute(bool bShadow,const SfxItemSet & rSet)102cdf0e10cSrcweir 	drawinglayer::attribute::LineAttribute impGetLineAttribute(bool bShadow, const SfxItemSet& rSet)
103cdf0e10cSrcweir 	{
104cdf0e10cSrcweir 		basegfx::BColor aColorAttribute;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 		if(bShadow)
107cdf0e10cSrcweir 		{
108cdf0e10cSrcweir 			const Color aShadowColor(((SdrShadowColorItem&)(rSet.Get(SDRATTR_SHADOWCOLOR))).GetColorValue());
109cdf0e10cSrcweir 			aColorAttribute = aShadowColor.getBColor();
110cdf0e10cSrcweir 		}
111cdf0e10cSrcweir 		else
112cdf0e10cSrcweir 		{
113cdf0e10cSrcweir 			const Color aLineColor(((XLineColorItem&)(rSet.Get(XATTR_LINECOLOR))).GetColorValue());
114cdf0e10cSrcweir 			aColorAttribute = aLineColor.getBColor();
115cdf0e10cSrcweir 		}
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 		const sal_uInt32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue();
118*d5370dc8SArmin Le Grand 		const com::sun::star::drawing::LineJoint eLineJoint = ((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue();
1195aaf853bSArmin Le Grand 		const com::sun::star::drawing::LineCap eLineCap = ((const XLineCapItem&)(rSet.Get(XATTR_LINECAP))).GetValue();
120cdf0e10cSrcweir 
1215aaf853bSArmin Le Grand 		return drawinglayer::attribute::LineAttribute(
1225aaf853bSArmin Le Grand             aColorAttribute,
1235aaf853bSArmin Le Grand             (double)nLineWidth,
1245aaf853bSArmin Le Grand             impGetB2DLineJoin(eLineJoint),
1255aaf853bSArmin Le Grand             eLineCap);
126cdf0e10cSrcweir 	}
127cdf0e10cSrcweir 
impGetStrokeAttribute(const SfxItemSet & rSet)128cdf0e10cSrcweir     drawinglayer::attribute::StrokeAttribute impGetStrokeAttribute(const SfxItemSet& rSet)
129cdf0e10cSrcweir 	{
130cdf0e10cSrcweir 		const XLineStyle eLineStyle = ((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue();
131cdf0e10cSrcweir 		double fFullDotDashLen(0.0);
132cdf0e10cSrcweir 		::std::vector< double > aDotDashArray;
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 		if(XLINE_DASH == eLineStyle)
135cdf0e10cSrcweir 		{
136cdf0e10cSrcweir 			const XDash& rDash = ((const XLineDashItem&)(rSet.Get(XATTR_LINEDASH))).GetDashValue();
137cdf0e10cSrcweir 
138cdf0e10cSrcweir 			if(rDash.GetDots() || rDash.GetDashes())
139cdf0e10cSrcweir 			{
140cdf0e10cSrcweir         		const sal_uInt32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue();
141cdf0e10cSrcweir 				fFullDotDashLen = rDash.CreateDotDashArray(aDotDashArray, (double)nLineWidth);
142cdf0e10cSrcweir 			}
143cdf0e10cSrcweir 		}
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 		return drawinglayer::attribute::StrokeAttribute(aDotDashArray, fFullDotDashLen);
146cdf0e10cSrcweir 	}
147cdf0e10cSrcweir } // end of anonymous namespace
148cdf0e10cSrcweir 
149cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
150cdf0e10cSrcweir 
151cdf0e10cSrcweir namespace drawinglayer
152cdf0e10cSrcweir {
153cdf0e10cSrcweir 	namespace attribute
154cdf0e10cSrcweir 	{
155cdf0e10cSrcweir 	    class ImpSdrFormTextAttribute
156cdf0e10cSrcweir 	    {
157cdf0e10cSrcweir 		public:
158cdf0e10cSrcweir 			// refcounter
159cdf0e10cSrcweir 			sal_uInt32								mnRefCount;
160cdf0e10cSrcweir 
161cdf0e10cSrcweir             // FormText (FontWork) Attributes
162cdf0e10cSrcweir 		    sal_Int32								mnFormTextDistance;		// distance from line in upright direction
163cdf0e10cSrcweir 		    sal_Int32								mnFormTextStart;		// shift from polygon start
164cdf0e10cSrcweir 		    sal_Int32								mnFormTextShdwXVal;		// shadow distance or 10th degrees
165cdf0e10cSrcweir 		    sal_Int32								mnFormTextShdwYVal;		// shadow distance or scaling
166cdf0e10cSrcweir 		    sal_uInt16								mnFormTextShdwTransp;	// shadow transparence
167cdf0e10cSrcweir 		    XFormTextStyle							meFormTextStyle;		// on/off and char orientation
168cdf0e10cSrcweir 		    XFormTextAdjust							meFormTextAdjust;		// adjustment (left/right/center) and scale
169cdf0e10cSrcweir 		    XFormTextShadow							meFormTextShadow;		// shadow mode
170cdf0e10cSrcweir 		    Color									maFormTextShdwColor;	// shadow color
171cdf0e10cSrcweir 
172cdf0e10cSrcweir             // outline attributes; used when getFormTextOutline() is true and (for
173cdf0e10cSrcweir             // shadow) when getFormTextShadow() != XFTSHADOW_NONE
174cdf0e10cSrcweir             SdrFormTextOutlineAttribute				maOutline;
175cdf0e10cSrcweir             SdrFormTextOutlineAttribute				maShadowOutline;
176cdf0e10cSrcweir 
177cdf0e10cSrcweir 		    // bitfield
178cdf0e10cSrcweir 		    unsigned								mbFormTextMirror : 1;	// change orientation
179cdf0e10cSrcweir 		    unsigned								mbFormTextOutline : 1;	// show contour of objects
180cdf0e10cSrcweir 
ImpSdrFormTextAttribute(const SfxItemSet & rSet)181cdf0e10cSrcweir 		    ImpSdrFormTextAttribute(const SfxItemSet& rSet)
182cdf0e10cSrcweir 			:	mnRefCount(0),
183cdf0e10cSrcweir 				mnFormTextDistance(((const XFormTextDistanceItem&)rSet.Get(XATTR_FORMTXTDISTANCE)).GetValue()),
184cdf0e10cSrcweir 				mnFormTextStart(((const XFormTextStartItem&)rSet.Get(XATTR_FORMTXTSTART)).GetValue()),
185cdf0e10cSrcweir 				mnFormTextShdwXVal(((const XFormTextShadowXValItem&)rSet.Get(XATTR_FORMTXTSHDWXVAL)).GetValue()),
186cdf0e10cSrcweir 				mnFormTextShdwYVal(((const XFormTextShadowYValItem&)rSet.Get(XATTR_FORMTXTSHDWYVAL)).GetValue()),
187cdf0e10cSrcweir 				mnFormTextShdwTransp(((const XFormTextShadowTranspItem&)rSet.Get(XATTR_FORMTXTSHDWTRANSP)).GetValue()),
188cdf0e10cSrcweir 				meFormTextStyle(((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue()),
189cdf0e10cSrcweir 				meFormTextAdjust(((const XFormTextAdjustItem&)rSet.Get(XATTR_FORMTXTADJUST)).GetValue()),
190cdf0e10cSrcweir 				meFormTextShadow(((const XFormTextShadowItem&)rSet.Get(XATTR_FORMTXTSHADOW)).GetValue()),
191cdf0e10cSrcweir 				maFormTextShdwColor(((const XFormTextShadowColorItem&)rSet.Get(XATTR_FORMTXTSHDWCOLOR)).GetColorValue()),
192cdf0e10cSrcweir 				maOutline(),
193cdf0e10cSrcweir 				maShadowOutline(),
194cdf0e10cSrcweir 				mbFormTextMirror(((const XFormTextMirrorItem&)rSet.Get(XATTR_FORMTXTMIRROR)).GetValue()),
195cdf0e10cSrcweir 				mbFormTextOutline(((const XFormTextOutlineItem&)rSet.Get(XATTR_FORMTXTOUTLINE)).GetValue())
196cdf0e10cSrcweir 			{
197cdf0e10cSrcweir 				if(getFormTextOutline())
198cdf0e10cSrcweir 				{
199cdf0e10cSrcweir 					const StrokeAttribute aStrokeAttribute(impGetStrokeAttribute(rSet));
200cdf0e10cSrcweir 
201cdf0e10cSrcweir 					// also need to prepare attributes for outlines
202cdf0e10cSrcweir 					{
203cdf0e10cSrcweir 						const LineAttribute aLineAttribute(impGetLineAttribute(false, rSet));
204cdf0e10cSrcweir 						const sal_uInt8 nTransparence(impGetStrokeTransparence(false, rSet));
205cdf0e10cSrcweir 
206cdf0e10cSrcweir 						maOutline = SdrFormTextOutlineAttribute(
207cdf0e10cSrcweir 							aLineAttribute, aStrokeAttribute, nTransparence);
208cdf0e10cSrcweir 					}
209cdf0e10cSrcweir 
210cdf0e10cSrcweir 					if(XFTSHADOW_NONE != getFormTextShadow())
211cdf0e10cSrcweir 					{
212cdf0e10cSrcweir 						// also need to prepare attributes for shadow outlines
213cdf0e10cSrcweir 						const LineAttribute aLineAttribute(impGetLineAttribute(true, rSet));
214cdf0e10cSrcweir 						const sal_uInt8 nTransparence(impGetStrokeTransparence(true, rSet));
215cdf0e10cSrcweir 
216cdf0e10cSrcweir 						maShadowOutline = SdrFormTextOutlineAttribute(
217cdf0e10cSrcweir 							aLineAttribute, aStrokeAttribute, nTransparence);
218cdf0e10cSrcweir 					}
219cdf0e10cSrcweir 				}
220cdf0e10cSrcweir 			}
221cdf0e10cSrcweir 
ImpSdrFormTextAttribute()222cdf0e10cSrcweir 			ImpSdrFormTextAttribute()
223cdf0e10cSrcweir 			:	mnRefCount(0),
224cdf0e10cSrcweir 				mnFormTextDistance(0),
225cdf0e10cSrcweir 				mnFormTextStart(0),
226cdf0e10cSrcweir 				mnFormTextShdwXVal(0),
227cdf0e10cSrcweir 				mnFormTextShdwYVal(0),
228cdf0e10cSrcweir 				mnFormTextShdwTransp(0),
229cdf0e10cSrcweir 				meFormTextStyle(XFT_NONE),
230cdf0e10cSrcweir 				meFormTextAdjust(XFT_CENTER),
231cdf0e10cSrcweir 				meFormTextShadow(XFTSHADOW_NONE),
232cdf0e10cSrcweir 				maFormTextShdwColor(),
233cdf0e10cSrcweir 				maOutline(),
234cdf0e10cSrcweir 				maShadowOutline(),
235cdf0e10cSrcweir 				mbFormTextMirror(false),
236cdf0e10cSrcweir 				mbFormTextOutline(false)
237cdf0e10cSrcweir 			{
238cdf0e10cSrcweir 			}
239cdf0e10cSrcweir 
240cdf0e10cSrcweir 		    // data read access
getFormTextDistance() const241cdf0e10cSrcweir 		    sal_Int32 getFormTextDistance() const { return mnFormTextDistance; }
getFormTextStart() const242cdf0e10cSrcweir 		    sal_Int32 getFormTextStart() const { return mnFormTextStart; }
getFormTextShdwXVal() const243cdf0e10cSrcweir 		    sal_Int32 getFormTextShdwXVal() const { return mnFormTextShdwXVal; }
getFormTextShdwYVal() const244cdf0e10cSrcweir 		    sal_Int32 getFormTextShdwYVal() const { return mnFormTextShdwYVal; }
getFormTextShdwTransp() const245cdf0e10cSrcweir 		    sal_uInt16 getFormTextShdwTransp() const { return mnFormTextShdwTransp; }
getFormTextStyle() const246cdf0e10cSrcweir 		    XFormTextStyle getFormTextStyle() const { return meFormTextStyle; }
getFormTextAdjust() const247cdf0e10cSrcweir 		    XFormTextAdjust getFormTextAdjust() const { return meFormTextAdjust; }
getFormTextShadow() const248cdf0e10cSrcweir 		    XFormTextShadow getFormTextShadow() const { return meFormTextShadow; }
getFormTextShdwColor() const249cdf0e10cSrcweir 		    Color getFormTextShdwColor() const { return maFormTextShdwColor; }
getOutline() const250cdf0e10cSrcweir             const SdrFormTextOutlineAttribute& getOutline() const { return maOutline; }
getShadowOutline() const251cdf0e10cSrcweir             const SdrFormTextOutlineAttribute& getShadowOutline() const { return maShadowOutline; }
getFormTextMirror() const252cdf0e10cSrcweir             bool getFormTextMirror() const { return mbFormTextMirror; }
getFormTextOutline() const253cdf0e10cSrcweir 		    bool getFormTextOutline() const { return mbFormTextOutline; }
254cdf0e10cSrcweir 
255cdf0e10cSrcweir             // compare operator
operator ==(const ImpSdrFormTextAttribute & rCandidate) const256cdf0e10cSrcweir 			bool operator==(const ImpSdrFormTextAttribute& rCandidate) const
257cdf0e10cSrcweir 			{
258cdf0e10cSrcweir 				return (getFormTextDistance() == rCandidate.getFormTextDistance()
259cdf0e10cSrcweir 					&& getFormTextStart() == rCandidate.getFormTextStart()
260cdf0e10cSrcweir 					&& getFormTextShdwXVal() == rCandidate.getFormTextShdwXVal()
261cdf0e10cSrcweir 					&& getFormTextShdwYVal() == rCandidate.getFormTextShdwYVal()
262cdf0e10cSrcweir 					&& getFormTextShdwTransp() == rCandidate.getFormTextShdwTransp()
263cdf0e10cSrcweir 					&& getFormTextStyle() == rCandidate.getFormTextStyle()
264cdf0e10cSrcweir 					&& getFormTextAdjust() == rCandidate.getFormTextAdjust()
265cdf0e10cSrcweir 					&& getFormTextShadow() == rCandidate.getFormTextShadow()
266cdf0e10cSrcweir 					&& getFormTextShdwColor() == rCandidate.getFormTextShdwColor()
267cdf0e10cSrcweir 					&& getOutline() == rCandidate.getOutline()
268cdf0e10cSrcweir 					&& getShadowOutline() == rCandidate.getShadowOutline()
269cdf0e10cSrcweir 					&& getFormTextMirror() == rCandidate.getFormTextMirror()
270cdf0e10cSrcweir 					&& getFormTextOutline() == rCandidate.getFormTextOutline());
271cdf0e10cSrcweir 			}
272cdf0e10cSrcweir 
get_global_default()273cdf0e10cSrcweir             static ImpSdrFormTextAttribute* get_global_default()
274cdf0e10cSrcweir             {
275cdf0e10cSrcweir                 static ImpSdrFormTextAttribute* pDefault = 0;
276cdf0e10cSrcweir 
277cdf0e10cSrcweir                 if(!pDefault)
278cdf0e10cSrcweir                 {
279cdf0e10cSrcweir                     pDefault = new ImpSdrFormTextAttribute();
280cdf0e10cSrcweir 
281cdf0e10cSrcweir                     // never delete; start with RefCount 1, not 0
282cdf0e10cSrcweir     			    pDefault->mnRefCount++;
283cdf0e10cSrcweir                 }
284cdf0e10cSrcweir 
285cdf0e10cSrcweir                 return pDefault;
286cdf0e10cSrcweir             }
287cdf0e10cSrcweir 	    };
288cdf0e10cSrcweir 
SdrFormTextAttribute(const SfxItemSet & rSet)289cdf0e10cSrcweir         SdrFormTextAttribute::SdrFormTextAttribute(const SfxItemSet& rSet)
290cdf0e10cSrcweir 		:	mpSdrFormTextAttribute(new ImpSdrFormTextAttribute(rSet))
291cdf0e10cSrcweir 		{
292cdf0e10cSrcweir 		}
293cdf0e10cSrcweir 
SdrFormTextAttribute()294cdf0e10cSrcweir 		SdrFormTextAttribute::SdrFormTextAttribute()
295cdf0e10cSrcweir         :	mpSdrFormTextAttribute(ImpSdrFormTextAttribute::get_global_default())
296cdf0e10cSrcweir 		{
297cdf0e10cSrcweir 			mpSdrFormTextAttribute->mnRefCount++;
298cdf0e10cSrcweir 		}
299cdf0e10cSrcweir 
SdrFormTextAttribute(const SdrFormTextAttribute & rCandidate)300cdf0e10cSrcweir         SdrFormTextAttribute::SdrFormTextAttribute(const SdrFormTextAttribute& rCandidate)
301cdf0e10cSrcweir 		:	mpSdrFormTextAttribute(rCandidate.mpSdrFormTextAttribute)
302cdf0e10cSrcweir 		{
303cdf0e10cSrcweir 			mpSdrFormTextAttribute->mnRefCount++;
304cdf0e10cSrcweir 		}
305cdf0e10cSrcweir 
~SdrFormTextAttribute()306cdf0e10cSrcweir 		SdrFormTextAttribute::~SdrFormTextAttribute()
307cdf0e10cSrcweir 		{
308cdf0e10cSrcweir 			if(mpSdrFormTextAttribute->mnRefCount)
309cdf0e10cSrcweir 			{
310cdf0e10cSrcweir 				mpSdrFormTextAttribute->mnRefCount--;
311cdf0e10cSrcweir 			}
312cdf0e10cSrcweir 			else
313cdf0e10cSrcweir 			{
314cdf0e10cSrcweir 				delete mpSdrFormTextAttribute;
315cdf0e10cSrcweir 			}
316cdf0e10cSrcweir 		}
317cdf0e10cSrcweir 
isDefault() const318cdf0e10cSrcweir         bool SdrFormTextAttribute::isDefault() const
319cdf0e10cSrcweir         {
320cdf0e10cSrcweir             return mpSdrFormTextAttribute == ImpSdrFormTextAttribute::get_global_default();
321cdf0e10cSrcweir         }
322cdf0e10cSrcweir 
operator =(const SdrFormTextAttribute & rCandidate)323cdf0e10cSrcweir         SdrFormTextAttribute& SdrFormTextAttribute::operator=(const SdrFormTextAttribute& rCandidate)
324cdf0e10cSrcweir 		{
325cdf0e10cSrcweir 			if(rCandidate.mpSdrFormTextAttribute != mpSdrFormTextAttribute)
326cdf0e10cSrcweir 			{
327cdf0e10cSrcweir 				if(mpSdrFormTextAttribute->mnRefCount)
328cdf0e10cSrcweir 				{
329cdf0e10cSrcweir 					mpSdrFormTextAttribute->mnRefCount--;
330cdf0e10cSrcweir 				}
331cdf0e10cSrcweir 				else
332cdf0e10cSrcweir 				{
333cdf0e10cSrcweir 					delete mpSdrFormTextAttribute;
334cdf0e10cSrcweir 				}
335cdf0e10cSrcweir 
336cdf0e10cSrcweir 				mpSdrFormTextAttribute = rCandidate.mpSdrFormTextAttribute;
337cdf0e10cSrcweir 				mpSdrFormTextAttribute->mnRefCount++;
338cdf0e10cSrcweir 			}
339cdf0e10cSrcweir 
340cdf0e10cSrcweir 			return *this;
341cdf0e10cSrcweir 		}
342cdf0e10cSrcweir 
operator ==(const SdrFormTextAttribute & rCandidate) const343cdf0e10cSrcweir 		bool SdrFormTextAttribute::operator==(const SdrFormTextAttribute& rCandidate) const
344cdf0e10cSrcweir 		{
345cdf0e10cSrcweir 			if(rCandidate.mpSdrFormTextAttribute == mpSdrFormTextAttribute)
346cdf0e10cSrcweir 			{
347cdf0e10cSrcweir 				return true;
348cdf0e10cSrcweir 			}
349cdf0e10cSrcweir 
350cdf0e10cSrcweir 			if(rCandidate.isDefault() != isDefault())
351cdf0e10cSrcweir 			{
352cdf0e10cSrcweir 				return false;
353cdf0e10cSrcweir 			}
354cdf0e10cSrcweir 
355cdf0e10cSrcweir 			return (*rCandidate.mpSdrFormTextAttribute == *mpSdrFormTextAttribute);
356cdf0e10cSrcweir 		}
357cdf0e10cSrcweir 
getFormTextDistance() const358cdf0e10cSrcweir 	    sal_Int32 SdrFormTextAttribute::getFormTextDistance() const
359cdf0e10cSrcweir 		{
360cdf0e10cSrcweir 			return mpSdrFormTextAttribute->getFormTextDistance();
361cdf0e10cSrcweir 		}
362cdf0e10cSrcweir 
getFormTextStart() const363cdf0e10cSrcweir 		sal_Int32 SdrFormTextAttribute::getFormTextStart() const
364cdf0e10cSrcweir 		{
365cdf0e10cSrcweir 			return mpSdrFormTextAttribute->getFormTextStart();
366cdf0e10cSrcweir 		}
367cdf0e10cSrcweir 
getFormTextShdwXVal() const368cdf0e10cSrcweir 		sal_Int32 SdrFormTextAttribute::getFormTextShdwXVal() const
369cdf0e10cSrcweir 		{
370cdf0e10cSrcweir 			return mpSdrFormTextAttribute->getFormTextShdwXVal();
371cdf0e10cSrcweir 		}
372cdf0e10cSrcweir 
getFormTextShdwYVal() const373cdf0e10cSrcweir 		sal_Int32 SdrFormTextAttribute::getFormTextShdwYVal() const
374cdf0e10cSrcweir 		{
375cdf0e10cSrcweir 			return mpSdrFormTextAttribute->getFormTextShdwYVal();
376cdf0e10cSrcweir 		}
377cdf0e10cSrcweir 
getFormTextShdwTransp() const378cdf0e10cSrcweir 		sal_uInt16 SdrFormTextAttribute::getFormTextShdwTransp() const
379cdf0e10cSrcweir 		{
380cdf0e10cSrcweir 			return mpSdrFormTextAttribute->getFormTextShdwTransp();
381cdf0e10cSrcweir 		}
382cdf0e10cSrcweir 
getFormTextStyle() const383cdf0e10cSrcweir 		XFormTextStyle SdrFormTextAttribute::getFormTextStyle() const
384cdf0e10cSrcweir 		{
385cdf0e10cSrcweir 			return mpSdrFormTextAttribute->getFormTextStyle();
386cdf0e10cSrcweir 		}
387cdf0e10cSrcweir 
getFormTextAdjust() const388cdf0e10cSrcweir 		XFormTextAdjust SdrFormTextAttribute::getFormTextAdjust() const
389cdf0e10cSrcweir 		{
390cdf0e10cSrcweir 			return mpSdrFormTextAttribute->getFormTextAdjust();
391cdf0e10cSrcweir 		}
392cdf0e10cSrcweir 
getFormTextShadow() const393cdf0e10cSrcweir 		XFormTextShadow SdrFormTextAttribute::getFormTextShadow() const
394cdf0e10cSrcweir 		{
395cdf0e10cSrcweir 			return mpSdrFormTextAttribute->getFormTextShadow();
396cdf0e10cSrcweir 		}
397cdf0e10cSrcweir 
getFormTextShdwColor() const398cdf0e10cSrcweir 		Color SdrFormTextAttribute::getFormTextShdwColor() const
399cdf0e10cSrcweir 		{
400cdf0e10cSrcweir 			return mpSdrFormTextAttribute->getFormTextShdwColor();
401cdf0e10cSrcweir 		}
402cdf0e10cSrcweir 
getOutline() const403cdf0e10cSrcweir 		const SdrFormTextOutlineAttribute& SdrFormTextAttribute::getOutline() const
404cdf0e10cSrcweir 		{
405cdf0e10cSrcweir 			return mpSdrFormTextAttribute->getOutline();
406cdf0e10cSrcweir 		}
407cdf0e10cSrcweir 
getShadowOutline() const408cdf0e10cSrcweir 		const SdrFormTextOutlineAttribute& SdrFormTextAttribute::getShadowOutline() const
409cdf0e10cSrcweir 		{
410cdf0e10cSrcweir 			return mpSdrFormTextAttribute->getShadowOutline();
411cdf0e10cSrcweir 		}
412cdf0e10cSrcweir 
getFormTextMirror() const413cdf0e10cSrcweir 		bool SdrFormTextAttribute::getFormTextMirror() const
414cdf0e10cSrcweir 		{
415cdf0e10cSrcweir 			return mpSdrFormTextAttribute->getFormTextMirror();
416cdf0e10cSrcweir 		}
417cdf0e10cSrcweir 
getFormTextOutline() const418cdf0e10cSrcweir 		bool SdrFormTextAttribute::getFormTextOutline() const
419cdf0e10cSrcweir 		{
420cdf0e10cSrcweir 			return mpSdrFormTextAttribute->getFormTextOutline();
421cdf0e10cSrcweir 		}
422cdf0e10cSrcweir 	} // end of namespace attribute
423cdf0e10cSrcweir } // end of namespace drawinglayer
424cdf0e10cSrcweir 
425cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
426cdf0e10cSrcweir // eof
427