xref: /aoo42x/main/svx/source/engine3d/objfac3d.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_svx.hxx"
30 #include <svx/svdpage.hxx>
31 #include "svx/globl3d.hxx"
32 #include <svx/polysc3d.hxx>
33 #include <svx/cube3d.hxx>
34 #include <svx/sphere3d.hxx>
35 #include <svx/extrud3d.hxx>
36 #include <svx/lathe3d.hxx>
37 #include <svx/polygn3d.hxx>
38 #include "svx/objfac3d.hxx"
39 #include <svx/svdobj.hxx>
40 
41 /*************************************************************************
42 |*
43 |* Konstruktor
44 |*
45 \************************************************************************/
46 
47 static sal_Bool bInit = sal_False;
48 
49 E3dObjFactory::E3dObjFactory()
50 {
51 	if ( !bInit )
52 	{
53 		SdrObjFactory::InsertMakeObjectHdl(LINK(this, E3dObjFactory, MakeObject));
54 		bInit = sal_True;
55 	}
56 }
57 
58 /*************************************************************************
59 |*
60 |* Destruktor
61 |*
62 \************************************************************************/
63 
64 E3dObjFactory::~E3dObjFactory()
65 {
66 }
67 
68 /*************************************************************************
69 |*
70 |* Chart-interne Objekte erzeugen
71 |*
72 \************************************************************************/
73 
74 IMPL_LINK( E3dObjFactory, MakeObject, SdrObjFactory*, pObjFactory)
75 {
76 	if ( pObjFactory->nInventor == E3dInventor )
77 	{
78 		switch ( pObjFactory->nIdentifier )
79 		{
80 			case E3D_POLYSCENE_ID:
81 				pObjFactory->pNewObj = new E3dPolyScene();
82 				break;
83 			case E3D_POLYGONOBJ_ID	:
84 				pObjFactory->pNewObj = new E3dPolygonObj();
85 				break;
86 			case E3D_CUBEOBJ_ID	:
87 				pObjFactory->pNewObj = new E3dCubeObj();
88 				break;
89 			case E3D_SPHEREOBJ_ID:
90 					// FG: ruft den dummy constructor, da dieser Aufruf nur beim Laden von Dokumenten erfolgt.
91 					//     die wirkliche Anzahkl Segmente wird aber erst nach dem Laden der Member festgelegt.
92 					//     dies hat zur Folge das die erste Kugel gleich wieder zerstoert wird, obwohl sie nie
93 					//     gebraucht worden ist.
94 				pObjFactory->pNewObj = new E3dSphereObj(123);
95 				break;
96 			case E3D_EXTRUDEOBJ_ID:
97 				pObjFactory->pNewObj = new E3dExtrudeObj();
98 				break;
99 			case E3D_LATHEOBJ_ID:
100 				pObjFactory->pNewObj = new E3dLatheObj();
101 				break;
102 			case E3D_COMPOUNDOBJ_ID:
103 				pObjFactory->pNewObj = new E3dCompoundObject();
104 				break;
105 		}
106 	}
107 	return 0;
108 }
109 
110 
111