update dev300-m58
[ooovba.git] / chart2 / source / controller / accessibility / ChartElementFactory.cxx
blobdce4ea4f4d3b4c88072e8cb49dfcee43f7542c55
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ChartElementFactory.cxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
34 #include "ChartElementFactory.hxx"
35 #include "ObjectIdentifier.hxx"
37 #include "AccessibleChartElement.hxx"
39 namespace chart
42 AccessibleBase* ChartElementFactory::CreateChartElement( const AccessibleElementInfo& rAccInfo )
44 ObjectType eType(
45 ObjectIdentifier::getObjectType( rAccInfo.m_aCID ));
47 switch( eType )
49 case OBJECTTYPE_DATA_POINT:
50 case OBJECTTYPE_LEGEND_ENTRY:
51 return new AccessibleChartElement( rAccInfo, false, false );
52 case OBJECTTYPE_PAGE:
53 case OBJECTTYPE_TITLE:
54 case OBJECTTYPE_LEGEND:
55 case OBJECTTYPE_DIAGRAM:
56 case OBJECTTYPE_DIAGRAM_WALL:
57 case OBJECTTYPE_DIAGRAM_FLOOR:
58 case OBJECTTYPE_AXIS:
59 case OBJECTTYPE_AXIS_UNITLABEL:
60 case OBJECTTYPE_GRID:
61 case OBJECTTYPE_SUBGRID:
62 case OBJECTTYPE_DATA_SERIES:
63 case OBJECTTYPE_DATA_LABELS:
64 case OBJECTTYPE_DATA_LABEL:
65 case OBJECTTYPE_DATA_ERRORS:
66 case OBJECTTYPE_DATA_ERRORS_X:
67 case OBJECTTYPE_DATA_ERRORS_Y:
68 case OBJECTTYPE_DATA_ERRORS_Z:
69 case OBJECTTYPE_DATA_CURVE: // e.g. a statistical method printed as line
70 case OBJECTTYPE_DATA_AVERAGE_LINE:
71 case OBJECTTYPE_DATA_STOCK_RANGE:
72 case OBJECTTYPE_DATA_STOCK_LOSS:
73 case OBJECTTYPE_DATA_STOCK_GAIN:
74 case OBJECTTYPE_DATA_CURVE_EQUATION:
75 return new AccessibleChartElement( rAccInfo, true, false );
76 case OBJECTTYPE_UNKNOWN:
77 break;
80 return 0;
83 sal_uInt16 nObjId = rId.GetObjectId();
84 switch( nObjId )
86 case CHOBJID_LEGEND:
87 return new AccLegend( pParent );
88 case AccLegendEntry::ObjectId:
89 return new AccLegendEntry( pParent, rId.GetIndex1() );
91 case CHOBJID_TITLE_MAIN:
92 return new AccTitle( pParent, Title::MAIN );
93 case CHOBJID_TITLE_SUB:
94 return new AccTitle( pParent, Title::SUB );
95 case CHOBJID_DIAGRAM_TITLE_X_AXIS:
96 return new AccTitle( pParent, Title::X_AXIS );
97 case CHOBJID_DIAGRAM_TITLE_Y_AXIS:
98 return new AccTitle( pParent, Title::Y_AXIS );
99 case CHOBJID_DIAGRAM_TITLE_Z_AXIS:
100 return new AccTitle( pParent, Title::Z_AXIS );
102 case CHOBJID_DIAGRAM:
103 return new AccDiagram( pParent );
105 // series
106 case CHOBJID_DIAGRAM_ROWGROUP:
107 return new AccDataSeries( pParent, rId.GetIndex1() );
109 // data points
110 case CHOBJID_DIAGRAM_DATA:
111 return new AccDataPoint( pParent, rId.GetIndex1(), rId.GetIndex2() );
113 case Axis::X_AXIS:
114 case Axis::Y_AXIS:
115 case Axis::Z_AXIS:
116 case Axis::SEC_X_AXIS:
117 case Axis::SEC_Y_AXIS:
118 return new AccAxis( pParent, static_cast< Axis::AxisType >( nObjId ) );
120 case Grid::X_MAJOR:
121 case Grid::Y_MAJOR:
122 case Grid::Z_MAJOR:
123 case Grid::X_MINOR:
124 case Grid::Y_MINOR:
125 case Grid::Z_MINOR:
126 return new AccGrid( pParent, static_cast< AccGrid::GridType >( nObjId ) );
128 case AccStatisticsObject::MEAN_VAL_LINE:
129 case AccStatisticsObject::ERROR_BARS:
130 case AccStatisticsObject::REGRESSION:
131 return new AccStatisticsObject( pParent,
132 static_cast< AccStatisticsObject::StatisticsObjectType >( nObjId ),
133 rId.GetIndex1() );
135 case CHOBJID_DIAGRAM_WALL:
136 return new AccWall( pParent );
138 case CHOBJID_DIAGRAM_FLOOR:
139 return new AccFloor( pParent );
141 case CHOBJID_DIAGRAM_AREA:
142 return new AccArea( pParent );
147 } // namespace chart