xref: /aoo41x/main/svx/source/engine3d/cube3d.cxx (revision f6e50924)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svx.hxx"
26 
27 #include "svx/svdstr.hrc"
28 #include "svx/svdglob.hxx"
29 #include <svx/cube3d.hxx>
30 #include "svx/globl3d.hxx"
31 #include <basegfx/point/b3dpoint.hxx>
32 #include <basegfx/polygon/b3dpolygon.hxx>
33 #include <svx/sdr/contact/viewcontactofe3dcube.hxx>
34 
35 //////////////////////////////////////////////////////////////////////////////
36 // #110094# DrawContact section
37 
CreateObjectSpecificViewContact()38 sdr::contact::ViewContact* E3dCubeObj::CreateObjectSpecificViewContact()
39 {
40 	return new sdr::contact::ViewContactOfE3dCube(*this);
41 }
42 
43 TYPEINIT1(E3dCubeObj, E3dCompoundObject);
44 
45 /*************************************************************************
46 |*
47 |* Konstruktor:                                                 |
48 |* 3D-Quader erzeugen; aPos: Zentrum oder links, unten, hinten  |__
49 |*                           (abhaengig von bPosIsCenter)      /
50 |*
51 \************************************************************************/
52 
E3dCubeObj(E3dDefaultAttributes & rDefault,basegfx::B3DPoint aPos,const basegfx::B3DVector & r3DSize)53 E3dCubeObj::E3dCubeObj(E3dDefaultAttributes& rDefault, basegfx::B3DPoint aPos, const basegfx::B3DVector& r3DSize)
54 :	E3dCompoundObject(rDefault)
55 {
56 	// Defaults setzen
57 	SetDefaultAttributes(rDefault);
58 
59 	// uebergebene drueberbuegeln
60 	aCubePos = aPos;
61 	aCubeSize = r3DSize;
62 }
63 
E3dCubeObj()64 E3dCubeObj::E3dCubeObj()
65 :	E3dCompoundObject()
66 {
67 	// Defaults setzen
68 	E3dDefaultAttributes aDefault;
69 	SetDefaultAttributes(aDefault);
70 }
71 
SetDefaultAttributes(E3dDefaultAttributes & rDefault)72 void E3dCubeObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
73 {
74 	aCubePos = rDefault.GetDefaultCubePos();
75 	aCubeSize = rDefault.GetDefaultCubeSize();
76 	nSideFlags = rDefault.GetDefaultCubeSideFlags();
77 	bPosIsCenter = rDefault.GetDefaultCubePosIsCenter();
78 }
79 
80 /*************************************************************************
81 |*
82 |* Identifier zurueckgeben
83 |*
84 \************************************************************************/
85 
GetObjIdentifier() const86 sal_uInt16 E3dCubeObj::GetObjIdentifier() const
87 {
88 	return E3D_CUBEOBJ_ID;
89 }
90 
91 /*************************************************************************
92 |*
93 |* Wandle das Objekt in ein Gruppenobjekt bestehend aus 6 Polygonen
94 |*
95 \************************************************************************/
96 
DoConvertToPolyObj(sal_Bool,bool) const97 SdrObject *E3dCubeObj::DoConvertToPolyObj(sal_Bool /*bBezier*/, bool /*bAddText*/) const
98 {
99 	return NULL;
100 }
101 
102 /*************************************************************************
103 |*
104 |* Zuweisungsoperator
105 |*
106 \************************************************************************/
107 
operator =(const SdrObject & rObj)108 void E3dCubeObj::operator=(const SdrObject& rObj)
109 {
110 	// erstmal alle Childs kopieren
111 	E3dCompoundObject::operator=(rObj);
112 
113 	// weitere Parameter kopieren
114 	const E3dCubeObj& r3DObj = (const E3dCubeObj&)rObj;
115 
116 	aCubePos = r3DObj.aCubePos;
117 	aCubeSize = r3DObj.aCubeSize;
118 	bPosIsCenter = r3DObj.bPosIsCenter;
119 	nSideFlags = r3DObj.nSideFlags;
120 }
121 
122 /*************************************************************************
123 |*
124 |* Lokale Parameter setzen mit Geometrieneuerzeugung
125 |*
126 \************************************************************************/
127 
SetCubePos(const basegfx::B3DPoint & rNew)128 void E3dCubeObj::SetCubePos(const basegfx::B3DPoint& rNew)
129 {
130 	if(aCubePos != rNew)
131 	{
132 		aCubePos = rNew;
133 		ActionChanged();
134 	}
135 }
136 
SetCubeSize(const basegfx::B3DVector & rNew)137 void E3dCubeObj::SetCubeSize(const basegfx::B3DVector& rNew)
138 {
139 	if(aCubeSize != rNew)
140 	{
141 		aCubeSize = rNew;
142 		ActionChanged();
143 	}
144 }
145 
SetPosIsCenter(sal_Bool bNew)146 void E3dCubeObj::SetPosIsCenter(sal_Bool bNew)
147 {
148 	if(bPosIsCenter != bNew)
149 	{
150 		bPosIsCenter = bNew;
151 		ActionChanged();
152 	}
153 }
154 
SetSideFlags(sal_uInt16 nNew)155 void E3dCubeObj::SetSideFlags(sal_uInt16 nNew)
156 {
157 	if(nSideFlags != nNew)
158 	{
159 		nSideFlags = nNew;
160 		ActionChanged();
161 	}
162 }
163 
164 /*************************************************************************
165 |*
166 |* Get the name of the object (singular)
167 |*
168 \************************************************************************/
169 
TakeObjNameSingul(XubString & rName) const170 void E3dCubeObj::TakeObjNameSingul(XubString& rName) const
171 {
172 	rName=ImpGetResStr(STR_ObjNameSingulCube3d);
173 
174 	String aName( GetName() );
175 	if(aName.Len())
176 	{
177 		rName += sal_Unicode(' ');
178 		rName += sal_Unicode('\'');
179 		rName += aName;
180 		rName += sal_Unicode('\'');
181 	}
182 }
183 
184 /*************************************************************************
185 |*
186 |* Get the name of the object (plural)
187 |*
188 \************************************************************************/
189 
TakeObjNamePlural(XubString & rName) const190 void E3dCubeObj::TakeObjNamePlural(XubString& rName) const
191 {
192 	rName=ImpGetResStr(STR_ObjNamePluralCube3d);
193 }
194 
195 // eof
196