xref: /trunk/main/svx/source/sdr/attribute/sdrformtextattribute.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #include "precompiled_svx.hxx"
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include <svx/sdr/attribute/sdrformtextattribute.hxx>
31*cdf0e10cSrcweir #include <basegfx/vector/b2enums.hxx>
32*cdf0e10cSrcweir #include <svl/itemset.hxx>
33*cdf0e10cSrcweir #include <svx/xftdiit.hxx>
34*cdf0e10cSrcweir #include <svx/xftstit.hxx>
35*cdf0e10cSrcweir #include <svx/xftshxy.hxx>
36*cdf0e10cSrcweir #include <svx/xftshtit.hxx>
37*cdf0e10cSrcweir #include <svx/xtextit0.hxx>
38*cdf0e10cSrcweir #include <svx/xftadit.hxx>
39*cdf0e10cSrcweir #include <svx/xftshit.hxx>
40*cdf0e10cSrcweir #include <svx/xftshcit.hxx>
41*cdf0e10cSrcweir #include <svx/xftmrit.hxx>
42*cdf0e10cSrcweir #include <svx/xftouit.hxx>
43*cdf0e10cSrcweir #include <svx/sdshtitm.hxx>
44*cdf0e10cSrcweir #include <svx/xlntrit.hxx>
45*cdf0e10cSrcweir #include <svx/sdshcitm.hxx>
46*cdf0e10cSrcweir #include <svx/xlnclit.hxx>
47*cdf0e10cSrcweir #include <svx/xlnwtit.hxx>
48*cdf0e10cSrcweir #include <svx/xlinjoit.hxx>
49*cdf0e10cSrcweir #include <svx/xlineit0.hxx>
50*cdf0e10cSrcweir #include <svx/xdash.hxx>
51*cdf0e10cSrcweir #include <svx/xlndsit.hxx>
52*cdf0e10cSrcweir #include <drawinglayer/attribute/lineattribute.hxx>
53*cdf0e10cSrcweir #include <drawinglayer/attribute/strokeattribute.hxx>
54*cdf0e10cSrcweir #include <svx/sdr/attribute/sdrformtextoutlineattribute.hxx>
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
57*cdf0e10cSrcweir // helper to get line, stroke and transparence attributes from SfxItemSet
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir namespace
60*cdf0e10cSrcweir {
61*cdf0e10cSrcweir     basegfx::B2DLineJoin impGetB2DLineJoin(XLineJoint eLineJoint)
62*cdf0e10cSrcweir     {
63*cdf0e10cSrcweir         switch(eLineJoint)
64*cdf0e10cSrcweir         {
65*cdf0e10cSrcweir             case XLINEJOINT_MIDDLE  :
66*cdf0e10cSrcweir             {
67*cdf0e10cSrcweir                 return basegfx::B2DLINEJOIN_MIDDLE;
68*cdf0e10cSrcweir             }
69*cdf0e10cSrcweir             case XLINEJOINT_BEVEL   :
70*cdf0e10cSrcweir             {
71*cdf0e10cSrcweir                 return basegfx::B2DLINEJOIN_BEVEL;
72*cdf0e10cSrcweir             }
73*cdf0e10cSrcweir             case XLINEJOINT_MITER   :
74*cdf0e10cSrcweir             {
75*cdf0e10cSrcweir                 return basegfx::B2DLINEJOIN_MITER;
76*cdf0e10cSrcweir             }
77*cdf0e10cSrcweir             case XLINEJOINT_ROUND   :
78*cdf0e10cSrcweir             {
79*cdf0e10cSrcweir                 return basegfx::B2DLINEJOIN_ROUND;
80*cdf0e10cSrcweir             }
81*cdf0e10cSrcweir             default :
82*cdf0e10cSrcweir             {
83*cdf0e10cSrcweir                 return basegfx::B2DLINEJOIN_NONE; // XLINEJOINT_NONE
84*cdf0e10cSrcweir             }
85*cdf0e10cSrcweir         }
86*cdf0e10cSrcweir     }
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir     sal_uInt8 impGetStrokeTransparence(bool bShadow, const SfxItemSet& rSet)
89*cdf0e10cSrcweir     {
90*cdf0e10cSrcweir         sal_uInt8 nRetval;
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir         if(bShadow)
93*cdf0e10cSrcweir         {
94*cdf0e10cSrcweir             nRetval = (sal_uInt8)((((SdrShadowTransparenceItem&)(rSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue() * 255) / 100);
95*cdf0e10cSrcweir         }
96*cdf0e10cSrcweir         else
97*cdf0e10cSrcweir         {
98*cdf0e10cSrcweir             nRetval = (sal_uInt8)((((XLineTransparenceItem&)(rSet.Get(XATTR_LINETRANSPARENCE))).GetValue() * 255) / 100);
99*cdf0e10cSrcweir         }
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir         return nRetval;
102*cdf0e10cSrcweir     }
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir     drawinglayer::attribute::LineAttribute impGetLineAttribute(bool bShadow, const SfxItemSet& rSet)
105*cdf0e10cSrcweir     {
106*cdf0e10cSrcweir         basegfx::BColor aColorAttribute;
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir         if(bShadow)
109*cdf0e10cSrcweir         {
110*cdf0e10cSrcweir             const Color aShadowColor(((SdrShadowColorItem&)(rSet.Get(SDRATTR_SHADOWCOLOR))).GetColorValue());
111*cdf0e10cSrcweir             aColorAttribute = aShadowColor.getBColor();
112*cdf0e10cSrcweir         }
113*cdf0e10cSrcweir         else
114*cdf0e10cSrcweir         {
115*cdf0e10cSrcweir             const Color aLineColor(((XLineColorItem&)(rSet.Get(XATTR_LINECOLOR))).GetColorValue());
116*cdf0e10cSrcweir             aColorAttribute = aLineColor.getBColor();
117*cdf0e10cSrcweir         }
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir         const sal_uInt32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue();
120*cdf0e10cSrcweir         const XLineJoint eLineJoint = ((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue();
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir         return drawinglayer::attribute::LineAttribute(aColorAttribute, (double)nLineWidth, impGetB2DLineJoin(eLineJoint));
123*cdf0e10cSrcweir     }
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir     drawinglayer::attribute::StrokeAttribute impGetStrokeAttribute(const SfxItemSet& rSet)
126*cdf0e10cSrcweir     {
127*cdf0e10cSrcweir         const XLineStyle eLineStyle = ((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue();
128*cdf0e10cSrcweir         double fFullDotDashLen(0.0);
129*cdf0e10cSrcweir         ::std::vector< double > aDotDashArray;
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir         if(XLINE_DASH == eLineStyle)
132*cdf0e10cSrcweir         {
133*cdf0e10cSrcweir             const XDash& rDash = ((const XLineDashItem&)(rSet.Get(XATTR_LINEDASH))).GetDashValue();
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir             if(rDash.GetDots() || rDash.GetDashes())
136*cdf0e10cSrcweir             {
137*cdf0e10cSrcweir                 const sal_uInt32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue();
138*cdf0e10cSrcweir                 fFullDotDashLen = rDash.CreateDotDashArray(aDotDashArray, (double)nLineWidth);
139*cdf0e10cSrcweir             }
140*cdf0e10cSrcweir         }
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir         return drawinglayer::attribute::StrokeAttribute(aDotDashArray, fFullDotDashLen);
143*cdf0e10cSrcweir     }
144*cdf0e10cSrcweir } // end of anonymous namespace
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir namespace drawinglayer
149*cdf0e10cSrcweir {
150*cdf0e10cSrcweir     namespace attribute
151*cdf0e10cSrcweir     {
152*cdf0e10cSrcweir         class ImpSdrFormTextAttribute
153*cdf0e10cSrcweir         {
154*cdf0e10cSrcweir         public:
155*cdf0e10cSrcweir             // refcounter
156*cdf0e10cSrcweir             sal_uInt32                              mnRefCount;
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir             // FormText (FontWork) Attributes
159*cdf0e10cSrcweir             sal_Int32                               mnFormTextDistance;     // distance from line in upright direction
160*cdf0e10cSrcweir             sal_Int32                               mnFormTextStart;        // shift from polygon start
161*cdf0e10cSrcweir             sal_Int32                               mnFormTextShdwXVal;     // shadow distance or 10th degrees
162*cdf0e10cSrcweir             sal_Int32                               mnFormTextShdwYVal;     // shadow distance or scaling
163*cdf0e10cSrcweir             sal_uInt16                              mnFormTextShdwTransp;   // shadow transparence
164*cdf0e10cSrcweir             XFormTextStyle                          meFormTextStyle;        // on/off and char orientation
165*cdf0e10cSrcweir             XFormTextAdjust                         meFormTextAdjust;       // adjustment (left/right/center) and scale
166*cdf0e10cSrcweir             XFormTextShadow                         meFormTextShadow;       // shadow mode
167*cdf0e10cSrcweir             Color                                   maFormTextShdwColor;    // shadow color
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir             // outline attributes; used when getFormTextOutline() is true and (for
170*cdf0e10cSrcweir             // shadow) when getFormTextShadow() != XFTSHADOW_NONE
171*cdf0e10cSrcweir             SdrFormTextOutlineAttribute             maOutline;
172*cdf0e10cSrcweir             SdrFormTextOutlineAttribute             maShadowOutline;
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir             // bitfield
175*cdf0e10cSrcweir             unsigned                                mbFormTextMirror : 1;   // change orientation
176*cdf0e10cSrcweir             unsigned                                mbFormTextOutline : 1;  // show contour of objects
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir             ImpSdrFormTextAttribute(const SfxItemSet& rSet)
179*cdf0e10cSrcweir             :   mnRefCount(0),
180*cdf0e10cSrcweir                 mnFormTextDistance(((const XFormTextDistanceItem&)rSet.Get(XATTR_FORMTXTDISTANCE)).GetValue()),
181*cdf0e10cSrcweir                 mnFormTextStart(((const XFormTextStartItem&)rSet.Get(XATTR_FORMTXTSTART)).GetValue()),
182*cdf0e10cSrcweir                 mnFormTextShdwXVal(((const XFormTextShadowXValItem&)rSet.Get(XATTR_FORMTXTSHDWXVAL)).GetValue()),
183*cdf0e10cSrcweir                 mnFormTextShdwYVal(((const XFormTextShadowYValItem&)rSet.Get(XATTR_FORMTXTSHDWYVAL)).GetValue()),
184*cdf0e10cSrcweir                 mnFormTextShdwTransp(((const XFormTextShadowTranspItem&)rSet.Get(XATTR_FORMTXTSHDWTRANSP)).GetValue()),
185*cdf0e10cSrcweir                 meFormTextStyle(((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue()),
186*cdf0e10cSrcweir                 meFormTextAdjust(((const XFormTextAdjustItem&)rSet.Get(XATTR_FORMTXTADJUST)).GetValue()),
187*cdf0e10cSrcweir                 meFormTextShadow(((const XFormTextShadowItem&)rSet.Get(XATTR_FORMTXTSHADOW)).GetValue()),
188*cdf0e10cSrcweir                 maFormTextShdwColor(((const XFormTextShadowColorItem&)rSet.Get(XATTR_FORMTXTSHDWCOLOR)).GetColorValue()),
189*cdf0e10cSrcweir                 maOutline(),
190*cdf0e10cSrcweir                 maShadowOutline(),
191*cdf0e10cSrcweir                 mbFormTextMirror(((const XFormTextMirrorItem&)rSet.Get(XATTR_FORMTXTMIRROR)).GetValue()),
192*cdf0e10cSrcweir                 mbFormTextOutline(((const XFormTextOutlineItem&)rSet.Get(XATTR_FORMTXTOUTLINE)).GetValue())
193*cdf0e10cSrcweir             {
194*cdf0e10cSrcweir                 if(getFormTextOutline())
195*cdf0e10cSrcweir                 {
196*cdf0e10cSrcweir                     const StrokeAttribute aStrokeAttribute(impGetStrokeAttribute(rSet));
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir                     // also need to prepare attributes for outlines
199*cdf0e10cSrcweir                     {
200*cdf0e10cSrcweir                         const LineAttribute aLineAttribute(impGetLineAttribute(false, rSet));
201*cdf0e10cSrcweir                         const sal_uInt8 nTransparence(impGetStrokeTransparence(false, rSet));
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir                         maOutline = SdrFormTextOutlineAttribute(
204*cdf0e10cSrcweir                             aLineAttribute, aStrokeAttribute, nTransparence);
205*cdf0e10cSrcweir                     }
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir                     if(XFTSHADOW_NONE != getFormTextShadow())
208*cdf0e10cSrcweir                     {
209*cdf0e10cSrcweir                         // also need to prepare attributes for shadow outlines
210*cdf0e10cSrcweir                         const LineAttribute aLineAttribute(impGetLineAttribute(true, rSet));
211*cdf0e10cSrcweir                         const sal_uInt8 nTransparence(impGetStrokeTransparence(true, rSet));
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir                         maShadowOutline = SdrFormTextOutlineAttribute(
214*cdf0e10cSrcweir                             aLineAttribute, aStrokeAttribute, nTransparence);
215*cdf0e10cSrcweir                     }
216*cdf0e10cSrcweir                 }
217*cdf0e10cSrcweir             }
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir             ImpSdrFormTextAttribute()
220*cdf0e10cSrcweir             :   mnRefCount(0),
221*cdf0e10cSrcweir                 mnFormTextDistance(0),
222*cdf0e10cSrcweir                 mnFormTextStart(0),
223*cdf0e10cSrcweir                 mnFormTextShdwXVal(0),
224*cdf0e10cSrcweir                 mnFormTextShdwYVal(0),
225*cdf0e10cSrcweir                 mnFormTextShdwTransp(0),
226*cdf0e10cSrcweir                 meFormTextStyle(XFT_NONE),
227*cdf0e10cSrcweir                 meFormTextAdjust(XFT_CENTER),
228*cdf0e10cSrcweir                 meFormTextShadow(XFTSHADOW_NONE),
229*cdf0e10cSrcweir                 maFormTextShdwColor(),
230*cdf0e10cSrcweir                 maOutline(),
231*cdf0e10cSrcweir                 maShadowOutline(),
232*cdf0e10cSrcweir                 mbFormTextMirror(false),
233*cdf0e10cSrcweir                 mbFormTextOutline(false)
234*cdf0e10cSrcweir             {
235*cdf0e10cSrcweir             }
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir             // data read access
238*cdf0e10cSrcweir             sal_Int32 getFormTextDistance() const { return mnFormTextDistance; }
239*cdf0e10cSrcweir             sal_Int32 getFormTextStart() const { return mnFormTextStart; }
240*cdf0e10cSrcweir             sal_Int32 getFormTextShdwXVal() const { return mnFormTextShdwXVal; }
241*cdf0e10cSrcweir             sal_Int32 getFormTextShdwYVal() const { return mnFormTextShdwYVal; }
242*cdf0e10cSrcweir             sal_uInt16 getFormTextShdwTransp() const { return mnFormTextShdwTransp; }
243*cdf0e10cSrcweir             XFormTextStyle getFormTextStyle() const { return meFormTextStyle; }
244*cdf0e10cSrcweir             XFormTextAdjust getFormTextAdjust() const { return meFormTextAdjust; }
245*cdf0e10cSrcweir             XFormTextShadow getFormTextShadow() const { return meFormTextShadow; }
246*cdf0e10cSrcweir             Color getFormTextShdwColor() const { return maFormTextShdwColor; }
247*cdf0e10cSrcweir             const SdrFormTextOutlineAttribute& getOutline() const { return maOutline; }
248*cdf0e10cSrcweir             const SdrFormTextOutlineAttribute& getShadowOutline() const { return maShadowOutline; }
249*cdf0e10cSrcweir             bool getFormTextMirror() const { return mbFormTextMirror; }
250*cdf0e10cSrcweir             bool getFormTextOutline() const { return mbFormTextOutline; }
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir             // compare operator
253*cdf0e10cSrcweir             bool operator==(const ImpSdrFormTextAttribute& rCandidate) const
254*cdf0e10cSrcweir             {
255*cdf0e10cSrcweir                 return (getFormTextDistance() == rCandidate.getFormTextDistance()
256*cdf0e10cSrcweir                     && getFormTextStart() == rCandidate.getFormTextStart()
257*cdf0e10cSrcweir                     && getFormTextShdwXVal() == rCandidate.getFormTextShdwXVal()
258*cdf0e10cSrcweir                     && getFormTextShdwYVal() == rCandidate.getFormTextShdwYVal()
259*cdf0e10cSrcweir                     && getFormTextShdwTransp() == rCandidate.getFormTextShdwTransp()
260*cdf0e10cSrcweir                     && getFormTextStyle() == rCandidate.getFormTextStyle()
261*cdf0e10cSrcweir                     && getFormTextAdjust() == rCandidate.getFormTextAdjust()
262*cdf0e10cSrcweir                     && getFormTextShadow() == rCandidate.getFormTextShadow()
263*cdf0e10cSrcweir                     && getFormTextShdwColor() == rCandidate.getFormTextShdwColor()
264*cdf0e10cSrcweir                     && getOutline() == rCandidate.getOutline()
265*cdf0e10cSrcweir                     && getShadowOutline() == rCandidate.getShadowOutline()
266*cdf0e10cSrcweir                     && getFormTextMirror() == rCandidate.getFormTextMirror()
267*cdf0e10cSrcweir                     && getFormTextOutline() == rCandidate.getFormTextOutline());
268*cdf0e10cSrcweir             }
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir             static ImpSdrFormTextAttribute* get_global_default()
271*cdf0e10cSrcweir             {
272*cdf0e10cSrcweir                 static ImpSdrFormTextAttribute* pDefault = 0;
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir                 if(!pDefault)
275*cdf0e10cSrcweir                 {
276*cdf0e10cSrcweir                     pDefault = new ImpSdrFormTextAttribute();
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir                     // never delete; start with RefCount 1, not 0
279*cdf0e10cSrcweir                     pDefault->mnRefCount++;
280*cdf0e10cSrcweir                 }
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir                 return pDefault;
283*cdf0e10cSrcweir             }
284*cdf0e10cSrcweir         };
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir         SdrFormTextAttribute::SdrFormTextAttribute(const SfxItemSet& rSet)
287*cdf0e10cSrcweir         :   mpSdrFormTextAttribute(new ImpSdrFormTextAttribute(rSet))
288*cdf0e10cSrcweir         {
289*cdf0e10cSrcweir         }
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir         SdrFormTextAttribute::SdrFormTextAttribute()
292*cdf0e10cSrcweir         :   mpSdrFormTextAttribute(ImpSdrFormTextAttribute::get_global_default())
293*cdf0e10cSrcweir         {
294*cdf0e10cSrcweir             mpSdrFormTextAttribute->mnRefCount++;
295*cdf0e10cSrcweir         }
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir         SdrFormTextAttribute::SdrFormTextAttribute(const SdrFormTextAttribute& rCandidate)
298*cdf0e10cSrcweir         :   mpSdrFormTextAttribute(rCandidate.mpSdrFormTextAttribute)
299*cdf0e10cSrcweir         {
300*cdf0e10cSrcweir             mpSdrFormTextAttribute->mnRefCount++;
301*cdf0e10cSrcweir         }
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir         SdrFormTextAttribute::~SdrFormTextAttribute()
304*cdf0e10cSrcweir         {
305*cdf0e10cSrcweir             if(mpSdrFormTextAttribute->mnRefCount)
306*cdf0e10cSrcweir             {
307*cdf0e10cSrcweir                 mpSdrFormTextAttribute->mnRefCount--;
308*cdf0e10cSrcweir             }
309*cdf0e10cSrcweir             else
310*cdf0e10cSrcweir             {
311*cdf0e10cSrcweir                 delete mpSdrFormTextAttribute;
312*cdf0e10cSrcweir             }
313*cdf0e10cSrcweir         }
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir         bool SdrFormTextAttribute::isDefault() const
316*cdf0e10cSrcweir         {
317*cdf0e10cSrcweir             return mpSdrFormTextAttribute == ImpSdrFormTextAttribute::get_global_default();
318*cdf0e10cSrcweir         }
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir         SdrFormTextAttribute& SdrFormTextAttribute::operator=(const SdrFormTextAttribute& rCandidate)
321*cdf0e10cSrcweir         {
322*cdf0e10cSrcweir             if(rCandidate.mpSdrFormTextAttribute != mpSdrFormTextAttribute)
323*cdf0e10cSrcweir             {
324*cdf0e10cSrcweir                 if(mpSdrFormTextAttribute->mnRefCount)
325*cdf0e10cSrcweir                 {
326*cdf0e10cSrcweir                     mpSdrFormTextAttribute->mnRefCount--;
327*cdf0e10cSrcweir                 }
328*cdf0e10cSrcweir                 else
329*cdf0e10cSrcweir                 {
330*cdf0e10cSrcweir                     delete mpSdrFormTextAttribute;
331*cdf0e10cSrcweir                 }
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir                 mpSdrFormTextAttribute = rCandidate.mpSdrFormTextAttribute;
334*cdf0e10cSrcweir                 mpSdrFormTextAttribute->mnRefCount++;
335*cdf0e10cSrcweir             }
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir             return *this;
338*cdf0e10cSrcweir         }
339*cdf0e10cSrcweir 
340*cdf0e10cSrcweir         bool SdrFormTextAttribute::operator==(const SdrFormTextAttribute& rCandidate) const
341*cdf0e10cSrcweir         {
342*cdf0e10cSrcweir             if(rCandidate.mpSdrFormTextAttribute == mpSdrFormTextAttribute)
343*cdf0e10cSrcweir             {
344*cdf0e10cSrcweir                 return true;
345*cdf0e10cSrcweir             }
346*cdf0e10cSrcweir 
347*cdf0e10cSrcweir             if(rCandidate.isDefault() != isDefault())
348*cdf0e10cSrcweir             {
349*cdf0e10cSrcweir                 return false;
350*cdf0e10cSrcweir             }
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir             return (*rCandidate.mpSdrFormTextAttribute == *mpSdrFormTextAttribute);
353*cdf0e10cSrcweir         }
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir         sal_Int32 SdrFormTextAttribute::getFormTextDistance() const
356*cdf0e10cSrcweir         {
357*cdf0e10cSrcweir             return mpSdrFormTextAttribute->getFormTextDistance();
358*cdf0e10cSrcweir         }
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir         sal_Int32 SdrFormTextAttribute::getFormTextStart() const
361*cdf0e10cSrcweir         {
362*cdf0e10cSrcweir             return mpSdrFormTextAttribute->getFormTextStart();
363*cdf0e10cSrcweir         }
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir         sal_Int32 SdrFormTextAttribute::getFormTextShdwXVal() const
366*cdf0e10cSrcweir         {
367*cdf0e10cSrcweir             return mpSdrFormTextAttribute->getFormTextShdwXVal();
368*cdf0e10cSrcweir         }
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir         sal_Int32 SdrFormTextAttribute::getFormTextShdwYVal() const
371*cdf0e10cSrcweir         {
372*cdf0e10cSrcweir             return mpSdrFormTextAttribute->getFormTextShdwYVal();
373*cdf0e10cSrcweir         }
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir         sal_uInt16 SdrFormTextAttribute::getFormTextShdwTransp() const
376*cdf0e10cSrcweir         {
377*cdf0e10cSrcweir             return mpSdrFormTextAttribute->getFormTextShdwTransp();
378*cdf0e10cSrcweir         }
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir         XFormTextStyle SdrFormTextAttribute::getFormTextStyle() const
381*cdf0e10cSrcweir         {
382*cdf0e10cSrcweir             return mpSdrFormTextAttribute->getFormTextStyle();
383*cdf0e10cSrcweir         }
384*cdf0e10cSrcweir 
385*cdf0e10cSrcweir         XFormTextAdjust SdrFormTextAttribute::getFormTextAdjust() const
386*cdf0e10cSrcweir         {
387*cdf0e10cSrcweir             return mpSdrFormTextAttribute->getFormTextAdjust();
388*cdf0e10cSrcweir         }
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir         XFormTextShadow SdrFormTextAttribute::getFormTextShadow() const
391*cdf0e10cSrcweir         {
392*cdf0e10cSrcweir             return mpSdrFormTextAttribute->getFormTextShadow();
393*cdf0e10cSrcweir         }
394*cdf0e10cSrcweir 
395*cdf0e10cSrcweir         Color SdrFormTextAttribute::getFormTextShdwColor() const
396*cdf0e10cSrcweir         {
397*cdf0e10cSrcweir             return mpSdrFormTextAttribute->getFormTextShdwColor();
398*cdf0e10cSrcweir         }
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir         const SdrFormTextOutlineAttribute& SdrFormTextAttribute::getOutline() const
401*cdf0e10cSrcweir         {
402*cdf0e10cSrcweir             return mpSdrFormTextAttribute->getOutline();
403*cdf0e10cSrcweir         }
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir         const SdrFormTextOutlineAttribute& SdrFormTextAttribute::getShadowOutline() const
406*cdf0e10cSrcweir         {
407*cdf0e10cSrcweir             return mpSdrFormTextAttribute->getShadowOutline();
408*cdf0e10cSrcweir         }
409*cdf0e10cSrcweir 
410*cdf0e10cSrcweir         bool SdrFormTextAttribute::getFormTextMirror() const
411*cdf0e10cSrcweir         {
412*cdf0e10cSrcweir             return mpSdrFormTextAttribute->getFormTextMirror();
413*cdf0e10cSrcweir         }
414*cdf0e10cSrcweir 
415*cdf0e10cSrcweir         bool SdrFormTextAttribute::getFormTextOutline() const
416*cdf0e10cSrcweir         {
417*cdf0e10cSrcweir             return mpSdrFormTextAttribute->getFormTextOutline();
418*cdf0e10cSrcweir         }
419*cdf0e10cSrcweir     } // end of namespace attribute
420*cdf0e10cSrcweir } // end of namespace drawinglayer
421*cdf0e10cSrcweir 
422*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
423*cdf0e10cSrcweir // eof
424