sync master with lastest vba changes
[ooovba.git] / drawinglayer / source / attribute / sdrallattribute3d.cxx
blob705c866062d170b4955c8ef3f0b9b2f913c4576a
1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
5 * $RCSfile: sdrallattribute3d.cxx,v $
7 * $Revision: 1.4 $
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,
32 * MA 02111-1307 USA
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
51 namespace attribute
53 SdrLineFillShadowAttribute::SdrLineFillShadowAttribute(
54 SdrLineAttribute* pLine,
55 SdrFillAttribute* pFill,
56 SdrLineStartEndAttribute* pLineStartEnd,
57 SdrShadowAttribute* pShadow,
58 FillGradientAttribute* pFillFloatTransGradient)
59 : mpShadow(pShadow),
60 mpLine(pLine),
61 mpLineStartEnd(pLineStartEnd),
62 mpFill(pFill),
63 mpFillFloatTransGradient(pFillFloatTransGradient)
67 SdrLineFillShadowAttribute::SdrLineFillShadowAttribute(const SdrLineFillShadowAttribute& rCandidate)
68 : mpShadow(0L),
69 mpLine(0L),
70 mpLineStartEnd(0L),
71 mpFill(0L),
72 mpFillFloatTransGradient(0L)
74 if(!(*this == rCandidate))
76 *this = rCandidate;
80 SdrLineFillShadowAttribute::~SdrLineFillShadowAttribute()
82 delete mpShadow;
83 delete mpLine;
84 delete mpLineStartEnd;
85 delete mpFill;
86 delete mpFillFloatTransGradient;
89 SdrLineFillShadowAttribute& SdrLineFillShadowAttribute::operator=(const SdrLineFillShadowAttribute& rCandidate)
91 // handle mpShadow
93 // delete local mpShadow if necessary
94 if(mpShadow && ((!rCandidate.mpShadow) || (!(*mpShadow == *rCandidate.mpShadow))))
96 delete mpShadow;
97 mpShadow = 0L;
100 // copy mpShadow if necessary
101 if(!mpShadow && rCandidate.mpShadow)
103 mpShadow = new SdrShadowAttribute(*rCandidate.mpShadow);
107 // handle mpLine
109 // delete local mpLine if necessary
110 if(mpLine && ((!rCandidate.mpLine) || (!(*mpLine == *rCandidate.mpLine))))
112 delete mpLine;
113 mpLine = 0L;
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;
129 mpLineStartEnd = 0L;
132 // copy mpLineStartEnd if necessary
133 if(!mpLineStartEnd && rCandidate.mpLineStartEnd)
135 mpLineStartEnd = new SdrLineStartEndAttribute(*rCandidate.mpLineStartEnd);
139 // handle mpFill
141 // delete local mpFill if necessary
142 if(mpFill && ((!rCandidate.mpFill) || (!(*mpFill == *rCandidate.mpFill))))
144 delete mpFill;
145 mpFill = 0L;
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);
171 return *this;
174 bool SdrLineFillShadowAttribute::operator==(const SdrLineFillShadowAttribute& rCandidate) const
176 // handle mpShadow
177 if(!pointerOrContentEqual(mpShadow, rCandidate.mpShadow))
178 return false;
180 // handle mpLine
181 if(!pointerOrContentEqual(mpLine, rCandidate.mpLine))
182 return false;
184 // handle mpLineStartEnd
185 if(!pointerOrContentEqual(mpLineStartEnd, rCandidate.mpLineStartEnd))
186 return false;
188 // handle mpFill
189 if(!pointerOrContentEqual(mpFill, rCandidate.mpFill))
190 return false;
192 // handle mpFillFloatTransGradient
193 if(!pointerOrContentEqual(mpFillFloatTransGradient, rCandidate.mpFillFloatTransGradient))
194 return false;
196 return true;
198 } // end of namespace attribute
199 } // end of namespace drawinglayer
201 //////////////////////////////////////////////////////////////////////////////
202 // eof