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 #include <svx/svdpage.hxx>
27 #include "svx/globl3d.hxx"
28 #include <svx/polysc3d.hxx>
29 #include <svx/cube3d.hxx>
30 #include <svx/sphere3d.hxx>
31 #include <svx/extrud3d.hxx>
32 #include <svx/lathe3d.hxx>
33 #include <svx/polygn3d.hxx>
34 #include "svx/objfac3d.hxx"
35 #include <svx/svdobj.hxx>
36
37 /*************************************************************************
38 |*
39 |* Konstruktor
40 |*
41 \************************************************************************/
42
43 static sal_Bool bInit = sal_False;
44
E3dObjFactory()45 E3dObjFactory::E3dObjFactory()
46 {
47 if ( !bInit )
48 {
49 SdrObjFactory::InsertMakeObjectHdl(LINK(this, E3dObjFactory, MakeObject));
50 bInit = sal_True;
51 }
52 }
53
54 /*************************************************************************
55 |*
56 |* Destruktor
57 |*
58 \************************************************************************/
59
~E3dObjFactory()60 E3dObjFactory::~E3dObjFactory()
61 {
62 }
63
64 /*************************************************************************
65 |*
66 |* Chart-interne Objekte erzeugen
67 |*
68 \************************************************************************/
69
IMPL_LINK(E3dObjFactory,MakeObject,SdrObjFactory *,pObjFactory)70 IMPL_LINK( E3dObjFactory, MakeObject, SdrObjFactory*, pObjFactory)
71 {
72 if ( pObjFactory->nInventor == E3dInventor )
73 {
74 switch ( pObjFactory->nIdentifier )
75 {
76 case E3D_POLYSCENE_ID:
77 pObjFactory->pNewObj = new E3dPolyScene();
78 break;
79 case E3D_POLYGONOBJ_ID :
80 pObjFactory->pNewObj = new E3dPolygonObj();
81 break;
82 case E3D_CUBEOBJ_ID :
83 pObjFactory->pNewObj = new E3dCubeObj();
84 break;
85 case E3D_SPHEREOBJ_ID:
86 // FG: ruft den dummy constructor, da dieser Aufruf nur beim Laden von Dokumenten erfolgt.
87 // die wirkliche Anzahkl Segmente wird aber erst nach dem Laden der Member festgelegt.
88 // dies hat zur Folge das die erste Kugel gleich wieder zerstoert wird, obwohl sie nie
89 // gebraucht worden ist.
90 pObjFactory->pNewObj = new E3dSphereObj(123);
91 break;
92 case E3D_EXTRUDEOBJ_ID:
93 pObjFactory->pNewObj = new E3dExtrudeObj();
94 break;
95 case E3D_LATHEOBJ_ID:
96 pObjFactory->pNewObj = new E3dLatheObj();
97 break;
98 case E3D_COMPOUNDOBJ_ID:
99 pObjFactory->pNewObj = new E3dCompoundObject();
100 break;
101 }
102 }
103 return 0;
104 }
105
106
107