xref: /AOO41X/main/svx/source/engine3d/cube3d.cxx (revision a5258243accf51c522d45cf65e4b16cb17a336f7)
1cdf0e10cSrcweir /*************************************************************************
2cdf0e10cSrcweir  *
3cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4cdf0e10cSrcweir  *
5cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6cdf0e10cSrcweir  *
7cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8cdf0e10cSrcweir  *
9cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10cdf0e10cSrcweir  *
11cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14cdf0e10cSrcweir  *
15cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20cdf0e10cSrcweir  *
21cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25cdf0e10cSrcweir  *
26cdf0e10cSrcweir  ************************************************************************/
27cdf0e10cSrcweir 
28cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29cdf0e10cSrcweir #include "precompiled_svx.hxx"
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include "svx/svdstr.hrc"
32cdf0e10cSrcweir #include "svx/svdglob.hxx"
33cdf0e10cSrcweir #include <svx/cube3d.hxx>
34cdf0e10cSrcweir #include "svx/globl3d.hxx"
35cdf0e10cSrcweir #include <basegfx/point/b3dpoint.hxx>
36cdf0e10cSrcweir #include <basegfx/polygon/b3dpolygon.hxx>
37cdf0e10cSrcweir #include <svx/sdr/contact/viewcontactofe3dcube.hxx>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
40cdf0e10cSrcweir // #110094# DrawContact section
41cdf0e10cSrcweir 
42cdf0e10cSrcweir sdr::contact::ViewContact* E3dCubeObj::CreateObjectSpecificViewContact()
43cdf0e10cSrcweir {
44cdf0e10cSrcweir 	return new sdr::contact::ViewContactOfE3dCube(*this);
45cdf0e10cSrcweir }
46cdf0e10cSrcweir 
47cdf0e10cSrcweir TYPEINIT1(E3dCubeObj, E3dCompoundObject);
48cdf0e10cSrcweir 
49cdf0e10cSrcweir /*************************************************************************
50cdf0e10cSrcweir |*
51cdf0e10cSrcweir |* Konstruktor:                                                 |
52cdf0e10cSrcweir |* 3D-Quader erzeugen; aPos: Zentrum oder links, unten, hinten  |__
53cdf0e10cSrcweir |*                           (abhaengig von bPosIsCenter)      /
54cdf0e10cSrcweir |*
55cdf0e10cSrcweir \************************************************************************/
56cdf0e10cSrcweir 
57cdf0e10cSrcweir E3dCubeObj::E3dCubeObj(E3dDefaultAttributes& rDefault, basegfx::B3DPoint aPos, const basegfx::B3DVector& r3DSize)
58cdf0e10cSrcweir :	E3dCompoundObject(rDefault)
59cdf0e10cSrcweir {
60cdf0e10cSrcweir 	// Defaults setzen
61cdf0e10cSrcweir 	SetDefaultAttributes(rDefault);
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 	// uebergebene drueberbuegeln
64cdf0e10cSrcweir 	aCubePos = aPos;
65cdf0e10cSrcweir 	aCubeSize = r3DSize;
66cdf0e10cSrcweir }
67cdf0e10cSrcweir 
68cdf0e10cSrcweir E3dCubeObj::E3dCubeObj()
69cdf0e10cSrcweir :	E3dCompoundObject()
70cdf0e10cSrcweir {
71cdf0e10cSrcweir 	// Defaults setzen
72cdf0e10cSrcweir 	E3dDefaultAttributes aDefault;
73cdf0e10cSrcweir 	SetDefaultAttributes(aDefault);
74cdf0e10cSrcweir }
75cdf0e10cSrcweir 
76cdf0e10cSrcweir void E3dCubeObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
77cdf0e10cSrcweir {
78cdf0e10cSrcweir 	aCubePos = rDefault.GetDefaultCubePos();
79cdf0e10cSrcweir 	aCubeSize = rDefault.GetDefaultCubeSize();
80cdf0e10cSrcweir 	nSideFlags = rDefault.GetDefaultCubeSideFlags();
81cdf0e10cSrcweir 	bPosIsCenter = rDefault.GetDefaultCubePosIsCenter();
82cdf0e10cSrcweir }
83cdf0e10cSrcweir 
84cdf0e10cSrcweir /*************************************************************************
85cdf0e10cSrcweir |*
86cdf0e10cSrcweir |* Identifier zurueckgeben
87cdf0e10cSrcweir |*
88cdf0e10cSrcweir \************************************************************************/
89cdf0e10cSrcweir 
90cdf0e10cSrcweir sal_uInt16 E3dCubeObj::GetObjIdentifier() const
91cdf0e10cSrcweir {
92cdf0e10cSrcweir 	return E3D_CUBEOBJ_ID;
93cdf0e10cSrcweir }
94cdf0e10cSrcweir 
95cdf0e10cSrcweir /*************************************************************************
96cdf0e10cSrcweir |*
97cdf0e10cSrcweir |* Wandle das Objekt in ein Gruppenobjekt bestehend aus 6 Polygonen
98cdf0e10cSrcweir |*
99cdf0e10cSrcweir \************************************************************************/
100cdf0e10cSrcweir 
101*a5258243SPedro Giffuni SdrObject *E3dCubeObj::DoConvertToPolyObj(sal_Bool /*bBezier*/, bool /*bAddText*/) const
102cdf0e10cSrcweir {
103cdf0e10cSrcweir 	return NULL;
104cdf0e10cSrcweir }
105cdf0e10cSrcweir 
106cdf0e10cSrcweir /*************************************************************************
107cdf0e10cSrcweir |*
108cdf0e10cSrcweir |* Zuweisungsoperator
109cdf0e10cSrcweir |*
110cdf0e10cSrcweir \************************************************************************/
111cdf0e10cSrcweir 
112cdf0e10cSrcweir void E3dCubeObj::operator=(const SdrObject& rObj)
113cdf0e10cSrcweir {
114cdf0e10cSrcweir 	// erstmal alle Childs kopieren
115cdf0e10cSrcweir 	E3dCompoundObject::operator=(rObj);
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	// weitere Parameter kopieren
118cdf0e10cSrcweir 	const E3dCubeObj& r3DObj = (const E3dCubeObj&)rObj;
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 	aCubePos = r3DObj.aCubePos;
121cdf0e10cSrcweir 	aCubeSize = r3DObj.aCubeSize;
122cdf0e10cSrcweir 	bPosIsCenter = r3DObj.bPosIsCenter;
123cdf0e10cSrcweir 	nSideFlags = r3DObj.nSideFlags;
124cdf0e10cSrcweir }
125cdf0e10cSrcweir 
126cdf0e10cSrcweir /*************************************************************************
127cdf0e10cSrcweir |*
128cdf0e10cSrcweir |* Lokale Parameter setzen mit Geometrieneuerzeugung
129cdf0e10cSrcweir |*
130cdf0e10cSrcweir \************************************************************************/
131cdf0e10cSrcweir 
132cdf0e10cSrcweir void E3dCubeObj::SetCubePos(const basegfx::B3DPoint& rNew)
133cdf0e10cSrcweir {
134cdf0e10cSrcweir 	if(aCubePos != rNew)
135cdf0e10cSrcweir 	{
136cdf0e10cSrcweir 		aCubePos = rNew;
137cdf0e10cSrcweir 		ActionChanged();
138cdf0e10cSrcweir 	}
139cdf0e10cSrcweir }
140cdf0e10cSrcweir 
141cdf0e10cSrcweir void E3dCubeObj::SetCubeSize(const basegfx::B3DVector& rNew)
142cdf0e10cSrcweir {
143cdf0e10cSrcweir 	if(aCubeSize != rNew)
144cdf0e10cSrcweir 	{
145cdf0e10cSrcweir 		aCubeSize = rNew;
146cdf0e10cSrcweir 		ActionChanged();
147cdf0e10cSrcweir 	}
148cdf0e10cSrcweir }
149cdf0e10cSrcweir 
150cdf0e10cSrcweir void E3dCubeObj::SetPosIsCenter(sal_Bool bNew)
151cdf0e10cSrcweir {
152cdf0e10cSrcweir 	if(bPosIsCenter != bNew)
153cdf0e10cSrcweir 	{
154cdf0e10cSrcweir 		bPosIsCenter = bNew;
155cdf0e10cSrcweir 		ActionChanged();
156cdf0e10cSrcweir 	}
157cdf0e10cSrcweir }
158cdf0e10cSrcweir 
159cdf0e10cSrcweir void E3dCubeObj::SetSideFlags(sal_uInt16 nNew)
160cdf0e10cSrcweir {
161cdf0e10cSrcweir 	if(nSideFlags != nNew)
162cdf0e10cSrcweir 	{
163cdf0e10cSrcweir 		nSideFlags = nNew;
164cdf0e10cSrcweir 		ActionChanged();
165cdf0e10cSrcweir 	}
166cdf0e10cSrcweir }
167cdf0e10cSrcweir 
168cdf0e10cSrcweir /*************************************************************************
169cdf0e10cSrcweir |*
170cdf0e10cSrcweir |* Get the name of the object (singular)
171cdf0e10cSrcweir |*
172cdf0e10cSrcweir \************************************************************************/
173cdf0e10cSrcweir 
174cdf0e10cSrcweir void E3dCubeObj::TakeObjNameSingul(XubString& rName) const
175cdf0e10cSrcweir {
176cdf0e10cSrcweir 	rName=ImpGetResStr(STR_ObjNameSingulCube3d);
177cdf0e10cSrcweir 
178cdf0e10cSrcweir 	String aName( GetName() );
179cdf0e10cSrcweir 	if(aName.Len())
180cdf0e10cSrcweir 	{
181cdf0e10cSrcweir 		rName += sal_Unicode(' ');
182cdf0e10cSrcweir 		rName += sal_Unicode('\'');
183cdf0e10cSrcweir 		rName += aName;
184cdf0e10cSrcweir 		rName += sal_Unicode('\'');
185cdf0e10cSrcweir 	}
186cdf0e10cSrcweir }
187cdf0e10cSrcweir 
188cdf0e10cSrcweir /*************************************************************************
189cdf0e10cSrcweir |*
190cdf0e10cSrcweir |* Get the name of the object (plural)
191cdf0e10cSrcweir |*
192cdf0e10cSrcweir \************************************************************************/
193cdf0e10cSrcweir 
194cdf0e10cSrcweir void E3dCubeObj::TakeObjNamePlural(XubString& rName) const
195cdf0e10cSrcweir {
196cdf0e10cSrcweir 	rName=ImpGetResStr(STR_ObjNamePluralCube3d);
197cdf0e10cSrcweir }
198cdf0e10cSrcweir 
199cdf0e10cSrcweir // eof
200