Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <svx/svdpage.hxx>
21 : #include "svx/globl3d.hxx"
22 : #include <svx/polysc3d.hxx>
23 : #include <svx/cube3d.hxx>
24 : #include <svx/sphere3d.hxx>
25 : #include <svx/extrud3d.hxx>
26 : #include <svx/lathe3d.hxx>
27 : #include <svx/polygn3d.hxx>
28 : #include "svx/objfac3d.hxx"
29 : #include <svx/svdobj.hxx>
30 :
31 : static bool bInit = false;
32 :
33 587 : E3dObjFactory::E3dObjFactory()
34 : {
35 587 : if ( !bInit )
36 : {
37 114 : SdrObjFactory::InsertMakeObjectHdl(LINK(this, E3dObjFactory, MakeObject));
38 114 : bInit = true;
39 : }
40 587 : }
41 :
42 582 : E3dObjFactory::~E3dObjFactory()
43 : {
44 582 : }
45 :
46 : // Generate chart internal objects
47 :
48 12334 : IMPL_STATIC_LINK(
49 : E3dObjFactory, MakeObject, SdrObjFactory*, pObjFactory)
50 : {
51 6167 : if ( pObjFactory->nInventor == E3dInventor )
52 : {
53 6167 : switch ( pObjFactory->nIdentifier )
54 : {
55 : case E3D_POLYSCENE_ID:
56 1273 : pObjFactory->pNewObj = new E3dPolyScene();
57 1273 : break;
58 : case E3D_POLYGONOBJ_ID :
59 474 : pObjFactory->pNewObj = new E3dPolygonObj();
60 474 : break;
61 : case E3D_CUBEOBJ_ID :
62 0 : pObjFactory->pNewObj = new E3dCubeObj();
63 0 : break;
64 : case E3D_SPHEREOBJ_ID:
65 : // Gets the dummy constructor, as this is only called when
66 : // loading documents. The actual number of segments is however
67 : // determined only after loading the members. This will result
68 : // in that the first sphere will be immediately destroyed,
69 : // although it was never used.
70 0 : pObjFactory->pNewObj = new E3dSphereObj(123);
71 0 : break;
72 : case E3D_EXTRUDEOBJ_ID:
73 4168 : pObjFactory->pNewObj = new E3dExtrudeObj();
74 4168 : break;
75 : case E3D_LATHEOBJ_ID:
76 252 : pObjFactory->pNewObj = new E3dLatheObj();
77 252 : break;
78 : case E3D_COMPOUNDOBJ_ID:
79 0 : pObjFactory->pNewObj = new E3dCompoundObject();
80 0 : break;
81 : }
82 : }
83 6167 : return 0;
84 : }
85 :
86 :
87 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|