Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <svx/svdpage.hxx>
30 : : #include "svx/globl3d.hxx"
31 : : #include <svx/polysc3d.hxx>
32 : : #include <svx/cube3d.hxx>
33 : : #include <svx/sphere3d.hxx>
34 : : #include <svx/extrud3d.hxx>
35 : : #include <svx/lathe3d.hxx>
36 : : #include <svx/polygn3d.hxx>
37 : : #include "svx/objfac3d.hxx"
38 : : #include <svx/svdobj.hxx>
39 : :
40 : : static sal_Bool bInit = sal_False;
41 : :
42 : 452 : E3dObjFactory::E3dObjFactory()
43 : : {
44 [ + + ]: 452 : if ( !bInit )
45 : : {
46 [ + - ]: 135 : SdrObjFactory::InsertMakeObjectHdl(LINK(this, E3dObjFactory, MakeObject));
47 : 135 : bInit = sal_True;
48 : : }
49 : 452 : }
50 : :
51 : 442 : E3dObjFactory::~E3dObjFactory()
52 : : {
53 : 442 : }
54 : :
55 : : // Generate chart internal objects
56 : :
57 : 2675 : IMPL_LINK( E3dObjFactory, MakeObject, SdrObjFactory*, pObjFactory)
58 : : {
59 [ + - ]: 2675 : if ( pObjFactory->nInventor == E3dInventor )
60 : : {
61 [ + + - - : 2675 : switch ( pObjFactory->nIdentifier )
+ - - - ]
62 : : {
63 : : case E3D_POLYSCENE_ID:
64 [ + - ]: 736 : pObjFactory->pNewObj = new E3dPolyScene();
65 : 736 : break;
66 : : case E3D_POLYGONOBJ_ID :
67 [ + - ]: 438 : pObjFactory->pNewObj = new E3dPolygonObj();
68 : 438 : break;
69 : : case E3D_CUBEOBJ_ID :
70 [ # # ]: 0 : pObjFactory->pNewObj = new E3dCubeObj();
71 : 0 : break;
72 : : case E3D_SPHEREOBJ_ID:
73 : : // Gets the dummy constructor, as this is only called when
74 : : // loading documents. The actual number of segments is however
75 : : // determined only after loading the members. This will result
76 : : // in that the first sphere will be immediately destroyed,
77 : : // although it was never used.
78 [ # # ]: 0 : pObjFactory->pNewObj = new E3dSphereObj(123);
79 : 0 : break;
80 : : case E3D_EXTRUDEOBJ_ID:
81 [ + - ]: 1501 : pObjFactory->pNewObj = new E3dExtrudeObj();
82 : 1501 : break;
83 : : case E3D_LATHEOBJ_ID:
84 [ # # ]: 0 : pObjFactory->pNewObj = new E3dLatheObj();
85 : 0 : break;
86 : : case E3D_COMPOUNDOBJ_ID:
87 [ # # ]: 0 : pObjFactory->pNewObj = new E3dCompoundObject();
88 : 2675 : break;
89 : : }
90 : : }
91 : 2675 : return 0;
92 : : }
93 : :
94 : :
95 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|