1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
5 * $RCSfile: sdrallattribute3d.cxx,v $
9 * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $
11 * The Contents of this file are made available subject to
12 * the terms of GNU Lesser General Public License Version 2.1.
15 * GNU Lesser General Public License Version 2.1
16 * =============================================
17 * Copyright 2005 by Sun Microsystems, Inc.
18 * 901 San Antonio Road, Palo Alto, CA 94303, USA
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License version 2.1, as published by the Free Software Foundation.
24 * This library is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Lesser General Public License for more details.
29 * You should have received a copy of the GNU Lesser General Public
30 * License along with this library; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
34 ************************************************************************/
36 // MARKER(update_precomp.py): autogen include statement, do not remove
37 #include "precompiled_drawinglayer.hxx"
39 #include <drawinglayer/attribute/sdrallattribute3d.hxx>
40 #include <drawinglayer/attribute/sdrattribute.hxx>
41 #include <drawinglayer/attribute/fillattribute.hxx>
43 //////////////////////////////////////////////////////////////////////////////
44 // pointer compare define
45 #define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q))
47 //////////////////////////////////////////////////////////////////////////////
49 namespace drawinglayer
53 SdrLineFillShadowAttribute::SdrLineFillShadowAttribute(
54 SdrLineAttribute
* pLine
,
55 SdrFillAttribute
* pFill
,
56 SdrLineStartEndAttribute
* pLineStartEnd
,
57 SdrShadowAttribute
* pShadow
,
58 FillGradientAttribute
* pFillFloatTransGradient
)
61 mpLineStartEnd(pLineStartEnd
),
63 mpFillFloatTransGradient(pFillFloatTransGradient
)
67 SdrLineFillShadowAttribute::SdrLineFillShadowAttribute(
68 const SdrLineFillShadowAttribute
& rCandidate
)
73 mpFillFloatTransGradient(0)
78 SdrLineFillShadowAttribute::~SdrLineFillShadowAttribute()
82 delete mpLineStartEnd
;
84 delete mpFillFloatTransGradient
;
87 SdrLineFillShadowAttribute
& SdrLineFillShadowAttribute::operator=(const SdrLineFillShadowAttribute
& rCandidate
)
91 // delete local mpShadow if necessary
98 // copy mpShadow if necessary
99 if(rCandidate
.mpShadow
)
101 mpShadow
= new SdrShadowAttribute(*rCandidate
.mpShadow
);
107 // delete local mpLine if necessary
114 // copy mpLine if necessary
115 if(rCandidate
.mpLine
)
117 mpLine
= new SdrLineAttribute(*rCandidate
.mpLine
);
121 // handle mpLineStartEnd
123 // delete local mpLineStartEnd if necessary
126 delete mpLineStartEnd
;
130 // copy mpLineStartEnd if necessary
131 if(rCandidate
.mpLineStartEnd
)
133 mpLineStartEnd
= new SdrLineStartEndAttribute(*rCandidate
.mpLineStartEnd
);
139 // delete local mpFill if necessary
146 // copy mpFill if necessary
147 if(rCandidate
.mpFill
)
149 mpFill
= new SdrFillAttribute(*rCandidate
.mpFill
);
153 // handle mpFillFloatTransGradient
155 // delete local mpFillFloatTransGradient if necessary
156 if(mpFillFloatTransGradient
)
158 delete mpFillFloatTransGradient
;
159 mpFillFloatTransGradient
= 0;
162 // copy mpFillFloatTransGradient if necessary
163 if(rCandidate
.mpFillFloatTransGradient
)
165 mpFillFloatTransGradient
= new FillGradientAttribute(*rCandidate
.mpFillFloatTransGradient
);
172 bool SdrLineFillShadowAttribute::operator==(const SdrLineFillShadowAttribute
& rCandidate
) const
175 if(!pointerOrContentEqual(mpShadow
, rCandidate
.mpShadow
))
179 if(!pointerOrContentEqual(mpLine
, rCandidate
.mpLine
))
182 // handle mpLineStartEnd
183 if(!pointerOrContentEqual(mpLineStartEnd
, rCandidate
.mpLineStartEnd
))
187 if(!pointerOrContentEqual(mpFill
, rCandidate
.mpFill
))
190 // handle mpFillFloatTransGradient
191 if(!pointerOrContentEqual(mpFillFloatTransGradient
, rCandidate
.mpFillFloatTransGradient
))
196 } // end of namespace attribute
197 } // end of namespace drawinglayer
199 //////////////////////////////////////////////////////////////////////////////