merge the formfield patch from ooo-build
[ooovba.git] / drawinglayer / source / primitive3d / sdrprimitive3d.cxx
blobb57f49e59eac741cc6314e46539e5b8ae1746290
1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
5 * $RCSfile: sdrprimitive3d.cxx,v $
7 * $Revision: 1.10 $
9 * last change: $Author: aw $ $Date: 2008-06-24 15:31:08 $
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/primitive3d/sdrprimitive3d.hxx>
40 #include <drawinglayer/attribute/sdrattribute.hxx>
41 #include <basegfx/polygon/b3dpolypolygontools.hxx>
42 #include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
44 //////////////////////////////////////////////////////////////////////////////
46 using namespace com::sun::star;
48 //////////////////////////////////////////////////////////////////////////////
50 namespace drawinglayer
52 namespace primitive3d
54 basegfx::B3DRange SdrPrimitive3D::getStandard3DRange() const
56 basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
57 aUnitRange.transform(getTransform());
59 if(getSdrLFSAttribute().getLine())
61 const attribute::SdrLineAttribute& rLine = *getSdrLFSAttribute().getLine();
63 if(rLine.isVisible() && !basegfx::fTools::equalZero(rLine.getWidth()))
65 // expand by hald LineWidth as tube radius
66 aUnitRange.grow(rLine.getWidth() / 2.0);
70 return aUnitRange;
73 basegfx::B3DRange SdrPrimitive3D::get3DRangeFromSlices(const Slice3DVector& rSlices) const
75 basegfx::B3DRange aRetval;
77 if(rSlices.size())
79 for(sal_uInt32 a(0L); a < rSlices.size(); a++)
81 aRetval.expand(basegfx::tools::getRange(rSlices[a].getB3DPolyPolygon()));
84 aRetval.transform(getTransform());
86 if(getSdrLFSAttribute().getLine())
88 const attribute::SdrLineAttribute& rLine = *getSdrLFSAttribute().getLine();
90 if(rLine.isVisible() && !basegfx::fTools::equalZero(rLine.getWidth()))
92 // expand by half LineWidth as tube radius
93 aRetval.grow(rLine.getWidth() / 2.0);
98 return aRetval;
101 SdrPrimitive3D::SdrPrimitive3D(
102 const basegfx::B3DHomMatrix& rTransform,
103 const basegfx::B2DVector& rTextureSize,
104 const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute,
105 const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute)
106 : BasePrimitive3D(),
107 maTransform(rTransform),
108 maTextureSize(rTextureSize),
109 maSdrLFSAttribute(rSdrLFSAttribute),
110 maSdr3DObjectAttribute(rSdr3DObjectAttribute)
114 bool SdrPrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
116 if(BasePrimitive3D::operator==(rPrimitive))
118 const SdrPrimitive3D& rCompare = static_cast< const SdrPrimitive3D& >(rPrimitive);
120 return (getTransform() == rCompare.getTransform()
121 && getTextureSize() == rCompare.getTextureSize()
122 && getSdrLFSAttribute() == rCompare.getSdrLFSAttribute()
123 && getSdr3DObjectAttribute() == rCompare.getSdr3DObjectAttribute());
126 return false;
129 } // end of namespace primitive3d
130 } // end of namespace drawinglayer
132 //////////////////////////////////////////////////////////////////////////////
133 // eof