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_chart2.hxx"
30 
31 #include "ChartElementFactory.hxx"
32 #include "ObjectIdentifier.hxx"
33 #include "AccessibleChartElement.hxx"
34 
35 namespace chart
36 {
37 
38 AccessibleBase* ChartElementFactory::CreateChartElement( const AccessibleElementInfo& rAccInfo )
39 {
40     ObjectIdentifier aOID( rAccInfo.m_aOID );
41     ObjectType eType( aOID.getObjectType() );
42 
43     switch( eType )
44     {
45         case OBJECTTYPE_DATA_POINT:
46         case OBJECTTYPE_LEGEND_ENTRY:
47             return new AccessibleChartElement( rAccInfo, false, false );
48         case OBJECTTYPE_PAGE:
49         case OBJECTTYPE_TITLE:
50         case OBJECTTYPE_LEGEND:
51         case OBJECTTYPE_DIAGRAM:
52         case OBJECTTYPE_DIAGRAM_WALL:
53         case OBJECTTYPE_DIAGRAM_FLOOR:
54         case OBJECTTYPE_AXIS:
55         case OBJECTTYPE_AXIS_UNITLABEL:
56         case OBJECTTYPE_GRID:
57         case OBJECTTYPE_SUBGRID:
58         case OBJECTTYPE_DATA_SERIES:
59         case OBJECTTYPE_DATA_LABELS:
60         case OBJECTTYPE_DATA_LABEL:
61         case OBJECTTYPE_DATA_ERRORS:
62         case OBJECTTYPE_DATA_ERRORS_X:
63         case OBJECTTYPE_DATA_ERRORS_Y:
64         case OBJECTTYPE_DATA_ERRORS_Z:
65         case OBJECTTYPE_DATA_CURVE: // e.g. a statistical method printed as line
66         case OBJECTTYPE_DATA_AVERAGE_LINE:
67         case OBJECTTYPE_DATA_STOCK_RANGE:
68         case OBJECTTYPE_DATA_STOCK_LOSS:
69         case OBJECTTYPE_DATA_STOCK_GAIN:
70         case OBJECTTYPE_DATA_CURVE_EQUATION:
71             return new AccessibleChartElement( rAccInfo, true, false );
72         case OBJECTTYPE_UNKNOWN:
73             break;
74         default:
75             break;
76     }
77 
78     return 0;
79 
80     /*
81     sal_uInt16 nObjId = rId.GetObjectId();
82     switch( nObjId )
83     {
84         case CHOBJID_LEGEND:
85             return new AccLegend( pParent );
86         case AccLegendEntry::ObjectId:
87             return new AccLegendEntry( pParent, rId.GetIndex1() );
88 
89         case CHOBJID_TITLE_MAIN:
90             return new AccTitle( pParent, Title::MAIN );
91         case CHOBJID_TITLE_SUB:
92             return new AccTitle( pParent, Title::SUB );
93         case CHOBJID_DIAGRAM_TITLE_X_AXIS:
94             return new AccTitle( pParent, Title::X_AXIS );
95         case CHOBJID_DIAGRAM_TITLE_Y_AXIS:
96             return new AccTitle( pParent, Title::Y_AXIS );
97         case CHOBJID_DIAGRAM_TITLE_Z_AXIS:
98             return new AccTitle( pParent, Title::Z_AXIS );
99 
100         case CHOBJID_DIAGRAM:
101             return new AccDiagram( pParent );
102 
103         // series
104         case CHOBJID_DIAGRAM_ROWGROUP:
105             return new AccDataSeries( pParent, rId.GetIndex1() );
106 
107         // data points
108         case CHOBJID_DIAGRAM_DATA:
109             return new AccDataPoint( pParent, rId.GetIndex1(), rId.GetIndex2() );
110 
111         case Axis::X_AXIS:
112         case Axis::Y_AXIS:
113         case Axis::Z_AXIS:
114         case Axis::SEC_X_AXIS:
115         case Axis::SEC_Y_AXIS:
116             return new AccAxis( pParent, static_cast< Axis::AxisType >( nObjId ) );
117 
118         case Grid::X_MAJOR:
119         case Grid::Y_MAJOR:
120         case Grid::Z_MAJOR:
121         case Grid::X_MINOR:
122         case Grid::Y_MINOR:
123         case Grid::Z_MINOR:
124             return new AccGrid( pParent, static_cast< AccGrid::GridType >( nObjId ) );
125 
126         case AccStatisticsObject::MEAN_VAL_LINE:
127         case AccStatisticsObject::ERROR_BARS:
128         case AccStatisticsObject::REGRESSION:
129             return new AccStatisticsObject( pParent,
130                                          static_cast< AccStatisticsObject::StatisticsObjectType >( nObjId ),
131                                          rId.GetIndex1() );
132 
133         case CHOBJID_DIAGRAM_WALL:
134             return new AccWall( pParent );
135 
136         case CHOBJID_DIAGRAM_FLOOR:
137             return new AccFloor( pParent );
138 
139         case CHOBJID_DIAGRAM_AREA:
140             return new AccArea( pParent );
141     }
142     */
143 }
144 
145 } // namespace chart
146