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(const SdrLineFillShadowAttribute
& rCandidate
)
72 mpFillFloatTransGradient(0L)
74 if(!(*this == rCandidate
))
80 SdrLineFillShadowAttribute::~SdrLineFillShadowAttribute()
84 delete mpLineStartEnd
;
86 delete mpFillFloatTransGradient
;
89 SdrLineFillShadowAttribute
& SdrLineFillShadowAttribute::operator=(const SdrLineFillShadowAttribute
& rCandidate
)
93 // delete local mpShadow if necessary
94 if(mpShadow
&& ((!rCandidate
.mpShadow
) || (!(*mpShadow
== *rCandidate
.mpShadow
))))
100 // copy mpShadow if necessary
101 if(!mpShadow
&& rCandidate
.mpShadow
)
103 mpShadow
= new SdrShadowAttribute(*rCandidate
.mpShadow
);
109 // delete local mpLine if necessary
110 if(mpLine
&& ((!rCandidate
.mpLine
) || (!(*mpLine
== *rCandidate
.mpLine
))))
116 // copy mpLine if necessary
117 if(!mpLine
&& rCandidate
.mpLine
)
119 mpLine
= new SdrLineAttribute(*rCandidate
.mpLine
);
123 // handle mpLineStartEnd
125 // delete local mpLineStartEnd if necessary
126 if(mpLineStartEnd
&& ((!rCandidate
.mpLineStartEnd
) || (!(*mpLineStartEnd
== *rCandidate
.mpLineStartEnd
))))
128 delete mpLineStartEnd
;
132 // copy mpLineStartEnd if necessary
133 if(!mpLineStartEnd
&& rCandidate
.mpLineStartEnd
)
135 mpLineStartEnd
= new SdrLineStartEndAttribute(*rCandidate
.mpLineStartEnd
);
141 // delete local mpFill if necessary
142 if(mpFill
&& ((!rCandidate
.mpFill
) || (!(*mpFill
== *rCandidate
.mpFill
))))
148 // copy mpFill if necessary
149 if(!mpFill
&& rCandidate
.mpFill
)
151 mpFill
= new SdrFillAttribute(*rCandidate
.mpFill
);
155 // handle mpFillFloatTransGradient
157 // delete local mpFillFloatTransGradient if necessary
158 if(mpFillFloatTransGradient
&& ((!rCandidate
.mpFillFloatTransGradient
) || (!(*mpFillFloatTransGradient
== *rCandidate
.mpFillFloatTransGradient
))))
160 delete mpFillFloatTransGradient
;
161 mpFillFloatTransGradient
= 0L;
164 // copy mpFillFloatTransGradient if necessary
165 if(!mpFillFloatTransGradient
&& rCandidate
.mpFillFloatTransGradient
)
167 mpFillFloatTransGradient
= new FillGradientAttribute(*rCandidate
.mpFillFloatTransGradient
);
174 bool SdrLineFillShadowAttribute::operator==(const SdrLineFillShadowAttribute
& rCandidate
) const
177 if(!pointerOrContentEqual(mpShadow
, rCandidate
.mpShadow
))
181 if(!pointerOrContentEqual(mpLine
, rCandidate
.mpLine
))
184 // handle mpLineStartEnd
185 if(!pointerOrContentEqual(mpLineStartEnd
, rCandidate
.mpLineStartEnd
))
189 if(!pointerOrContentEqual(mpFill
, rCandidate
.mpFill
))
192 // handle mpFillFloatTransGradient
193 if(!pointerOrContentEqual(mpFillFloatTransGradient
, rCandidate
.mpFillFloatTransGradient
))
198 } // end of namespace attribute
199 } // end of namespace drawinglayer
201 //////////////////////////////////////////////////////////////////////////////