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