update dev300-m58
[ooovba.git] / drawinglayer / source / attribute / sdrallattribute3d.cxx
blob4bc4b642f9b8aa68140b1c5626fbd4e2cfff8c22
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(
68 const SdrLineFillShadowAttribute& rCandidate)
69 : mpShadow(0),
70 mpLine(0),
71 mpLineStartEnd(0),
72 mpFill(0),
73 mpFillFloatTransGradient(0)
75 *this = rCandidate;
78 SdrLineFillShadowAttribute::~SdrLineFillShadowAttribute()
80 delete mpShadow;
81 delete mpLine;
82 delete mpLineStartEnd;
83 delete mpFill;
84 delete mpFillFloatTransGradient;
87 SdrLineFillShadowAttribute& SdrLineFillShadowAttribute::operator=(const SdrLineFillShadowAttribute& rCandidate)
89 // handle mpShadow
91 // delete local mpShadow if necessary
92 if(mpShadow)
94 delete mpShadow;
95 mpShadow = 0;
98 // copy mpShadow if necessary
99 if(rCandidate.mpShadow)
101 mpShadow = new SdrShadowAttribute(*rCandidate.mpShadow);
105 // handle mpLine
107 // delete local mpLine if necessary
108 if(mpLine)
110 delete mpLine;
111 mpLine = 0;
114 // copy mpLine if necessary
115 if(rCandidate.mpLine)
117 mpLine = new SdrLineAttribute(*rCandidate.mpLine);
121 // handle mpLineStartEnd
123 // delete local mpLineStartEnd if necessary
124 if(mpLineStartEnd)
126 delete mpLineStartEnd;
127 mpLineStartEnd = 0;
130 // copy mpLineStartEnd if necessary
131 if(rCandidate.mpLineStartEnd)
133 mpLineStartEnd = new SdrLineStartEndAttribute(*rCandidate.mpLineStartEnd);
137 // handle mpFill
139 // delete local mpFill if necessary
140 if(mpFill)
142 delete mpFill;
143 mpFill = 0;
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);
169 return *this;
172 bool SdrLineFillShadowAttribute::operator==(const SdrLineFillShadowAttribute& rCandidate) const
174 // handle mpShadow
175 if(!pointerOrContentEqual(mpShadow, rCandidate.mpShadow))
176 return false;
178 // handle mpLine
179 if(!pointerOrContentEqual(mpLine, rCandidate.mpLine))
180 return false;
182 // handle mpLineStartEnd
183 if(!pointerOrContentEqual(mpLineStartEnd, rCandidate.mpLineStartEnd))
184 return false;
186 // handle mpFill
187 if(!pointerOrContentEqual(mpFill, rCandidate.mpFill))
188 return false;
190 // handle mpFillFloatTransGradient
191 if(!pointerOrContentEqual(mpFillFloatTransGradient, rCandidate.mpFillFloatTransGradient))
192 return false;
194 return true;
196 } // end of namespace attribute
197 } // end of namespace drawinglayer
199 //////////////////////////////////////////////////////////////////////////////
200 // eof