Update ooo320-m1
[ooovba.git] / svx / source / engine3d / cube3d.cxx
blob0f52f80dff9e4580f120375fbed934fd5d120000
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cube3d.cxx,v $
10 * $Revision: 1.18.18.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #include "svdstr.hrc"
35 #include "svdglob.hxx"
36 #include <svx/cube3d.hxx>
37 #include "globl3d.hxx"
38 #include <basegfx/point/b3dpoint.hxx>
39 #include <basegfx/polygon/b3dpolygon.hxx>
40 #include <svx/sdr/contact/viewcontactofe3dcube.hxx>
42 //////////////////////////////////////////////////////////////////////////////
43 // #110094# DrawContact section
45 sdr::contact::ViewContact* E3dCubeObj::CreateObjectSpecificViewContact()
47 return new sdr::contact::ViewContactOfE3dCube(*this);
50 TYPEINIT1(E3dCubeObj, E3dCompoundObject);
52 /*************************************************************************
54 |* Konstruktor: |
55 |* 3D-Quader erzeugen; aPos: Zentrum oder links, unten, hinten |__
56 |* (abhaengig von bPosIsCenter) /
58 \************************************************************************/
60 E3dCubeObj::E3dCubeObj(E3dDefaultAttributes& rDefault, basegfx::B3DPoint aPos, const basegfx::B3DVector& r3DSize)
61 : E3dCompoundObject(rDefault)
63 // Defaults setzen
64 SetDefaultAttributes(rDefault);
66 // uebergebene drueberbuegeln
67 aCubePos = aPos;
68 aCubeSize = r3DSize;
71 E3dCubeObj::E3dCubeObj()
72 : E3dCompoundObject()
74 // Defaults setzen
75 E3dDefaultAttributes aDefault;
76 SetDefaultAttributes(aDefault);
79 void E3dCubeObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
81 aCubePos = rDefault.GetDefaultCubePos();
82 aCubeSize = rDefault.GetDefaultCubeSize();
83 nSideFlags = rDefault.GetDefaultCubeSideFlags();
84 bPosIsCenter = rDefault.GetDefaultCubePosIsCenter();
87 /*************************************************************************
89 |* Identifier zurueckgeben
91 \************************************************************************/
93 UINT16 E3dCubeObj::GetObjIdentifier() const
95 return E3D_CUBEOBJ_ID;
98 /*************************************************************************
100 |* Wandle das Objekt in ein Gruppenobjekt bestehend aus 6 Polygonen
102 \************************************************************************/
104 SdrObject *E3dCubeObj::DoConvertToPolyObj(BOOL /*bBezier*/) const
106 return NULL;
109 /*************************************************************************
111 |* Zuweisungsoperator
113 \************************************************************************/
115 void E3dCubeObj::operator=(const SdrObject& rObj)
117 // erstmal alle Childs kopieren
118 E3dCompoundObject::operator=(rObj);
120 // weitere Parameter kopieren
121 const E3dCubeObj& r3DObj = (const E3dCubeObj&)rObj;
123 aCubePos = r3DObj.aCubePos;
124 aCubeSize = r3DObj.aCubeSize;
125 bPosIsCenter = r3DObj.bPosIsCenter;
126 nSideFlags = r3DObj.nSideFlags;
129 /*************************************************************************
131 |* Lokale Parameter setzen mit Geometrieneuerzeugung
133 \************************************************************************/
135 void E3dCubeObj::SetCubePos(const basegfx::B3DPoint& rNew)
137 if(aCubePos != rNew)
139 aCubePos = rNew;
140 ActionChanged();
144 void E3dCubeObj::SetCubeSize(const basegfx::B3DVector& rNew)
146 if(aCubeSize != rNew)
148 aCubeSize = rNew;
149 ActionChanged();
153 void E3dCubeObj::SetPosIsCenter(BOOL bNew)
155 if(bPosIsCenter != bNew)
157 bPosIsCenter = bNew;
158 ActionChanged();
162 void E3dCubeObj::SetSideFlags(UINT16 nNew)
164 if(nSideFlags != nNew)
166 nSideFlags = nNew;
167 ActionChanged();
171 /*************************************************************************
173 |* Get the name of the object (singular)
175 \************************************************************************/
177 void E3dCubeObj::TakeObjNameSingul(XubString& rName) const
179 rName=ImpGetResStr(STR_ObjNameSingulCube3d);
181 String aName( GetName() );
182 if(aName.Len())
184 rName += sal_Unicode(' ');
185 rName += sal_Unicode('\'');
186 rName += aName;
187 rName += sal_Unicode('\'');
191 /*************************************************************************
193 |* Get the name of the object (plural)
195 \************************************************************************/
197 void E3dCubeObj::TakeObjNamePlural(XubString& rName) const
199 rName=ImpGetResStr(STR_ObjNamePluralCube3d);
202 // eof