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 0 : E3dObjFactory::E3dObjFactory()
34 : {
35 0 : if ( !bInit )
36 : {
37 0 : SdrObjFactory::InsertMakeObjectHdl(LINK(this, E3dObjFactory, MakeObject));
38 0 : bInit = true;
39 : }
40 0 : }
41 :
42 0 : E3dObjFactory::~E3dObjFactory()
43 : {
44 0 : }
45 :
46 : // Generate chart internal objects
47 :
48 0 : IMPL_LINK( E3dObjFactory, MakeObject, SdrObjFactory*, pObjFactory)
49 : {
50 0 : if ( pObjFactory->nInventor == E3dInventor )
51 : {
52 0 : switch ( pObjFactory->nIdentifier )
53 : {
54 : case E3D_POLYSCENE_ID:
55 0 : pObjFactory->pNewObj = new E3dPolyScene();
56 0 : break;
57 : case E3D_POLYGONOBJ_ID :
58 0 : pObjFactory->pNewObj = new E3dPolygonObj();
59 0 : break;
60 : case E3D_CUBEOBJ_ID :
61 0 : pObjFactory->pNewObj = new E3dCubeObj();
62 0 : break;
63 : case E3D_SPHEREOBJ_ID:
64 : // Gets the dummy constructor, as this is only called when
65 : // loading documents. The actual number of segments is however
66 : // determined only after loading the members. This will result
67 : // in that the first sphere will be immediately destroyed,
68 : // although it was never used.
69 0 : pObjFactory->pNewObj = new E3dSphereObj(123);
70 0 : break;
71 : case E3D_EXTRUDEOBJ_ID:
72 0 : pObjFactory->pNewObj = new E3dExtrudeObj();
73 0 : break;
74 : case E3D_LATHEOBJ_ID:
75 0 : pObjFactory->pNewObj = new E3dLatheObj();
76 0 : break;
77 : case E3D_COMPOUNDOBJ_ID:
78 0 : pObjFactory->pNewObj = new E3dCompoundObject();
79 0 : break;
80 : }
81 : }
82 0 : return 0;
83 : }
84 :
85 :
86 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|