1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_chart2.hxx"
30 #include "ChartTypeManager.hxx"
32 #include "StackMode.hxx"
33 #include "ContainerHelper.hxx"
35 #include "CartesianCoordinateSystem.hxx"
37 #include "LineChartTypeTemplate.hxx"
38 #include "BarChartTypeTemplate.hxx"
39 #include "ColumnLineChartTypeTemplate.hxx"
40 #include "AreaChartTypeTemplate.hxx"
41 #include "PieChartTypeTemplate.hxx"
42 #include "ScatterChartTypeTemplate.hxx"
43 #include "StockChartTypeTemplate.hxx"
44 #include "NetChartTypeTemplate.hxx"
45 #include "BubbleChartTypeTemplate.hxx"
46 #include <cppuhelper/component_context.hxx>
47 #include <comphelper/InlineContainer.hxx>
48 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
49 #include <com/sun/star/lang/XServiceName.hpp>
50 #include <com/sun/star/chart/ChartSolidType.hpp>
51 #include <com/sun/star/chart2/CurveStyle.hpp>
57 using namespace ::com::sun::star
;
59 using ::rtl::OUString
;
60 using ::com::sun::star::uno::Sequence
;
61 using ::com::sun::star::uno::Reference
;
62 using ::com::sun::star::uno::Any
;
63 using ::osl::MutexGuard
;
65 // ======================================================================
73 TEMPLATE_STACKEDSYMBOL
,
74 TEMPLATE_PERCENTSTACKEDSYMBOL
,
77 TEMPLATE_PERCENTSTACKEDLINE
,
79 TEMPLATE_STACKEDLINESYMBOL
,
80 TEMPLATE_PERCENTSTACKEDLINESYMBOL
,
82 TEMPLATE_STACKEDTHREEDLINE
,
83 TEMPLATE_PERCENTSTACKEDTHREEDLINE
,
84 TEMPLATE_THREEDLINEDEEP
,
86 TEMPLATE_STACKEDCOLUMN
,
87 TEMPLATE_PERCENTSTACKEDCOLUMN
,
90 TEMPLATE_PERCENTSTACKEDBAR
,
91 TEMPLATE_THREEDCOLUMNDEEP
,
92 TEMPLATE_THREEDCOLUMNFLAT
,
93 TEMPLATE_STACKEDTHREEDCOLUMNFLAT
,
94 TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT
,
95 TEMPLATE_THREEDBARDEEP
,
96 TEMPLATE_THREEDBARFLAT
,
97 TEMPLATE_STACKEDTHREEDBARFLAT
,
98 TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT
,
99 TEMPLATE_COLUMNWITHLINE
,
100 TEMPLATE_STACKEDCOLUMNWITHLINE
,
102 TEMPLATE_STACKEDAREA
,
103 TEMPLATE_PERCENTSTACKEDAREA
,
105 TEMPLATE_STACKEDTHREEDAREA
,
106 TEMPLATE_PERCENTSTACKEDTHREEDAREA
,
108 TEMPLATE_PIEALLEXPLODED
,
110 TEMPLATE_DONUTALLEXPLODED
,
112 TEMPLATE_THREEDPIEALLEXPLODED
,
113 TEMPLATE_THREEDDONUT
,
114 TEMPLATE_THREEDDONUTALLEXPLODED
,
115 TEMPLATE_SCATTERLINESYMBOL
,
116 TEMPLATE_SCATTERLINE
,
117 TEMPLATE_SCATTERSYMBOL
,
118 TEMPLATE_THREEDSCATTER
,
123 TEMPLATE_STACKEDNETSYMBOL
,
124 TEMPLATE_STACKEDNETLINE
,
125 TEMPLATE_PERCENTSTACKEDNET
,
126 TEMPLATE_PERCENTSTACKEDNETSYMBOL
,
127 TEMPLATE_PERCENTSTACKEDNETLINE
,
129 TEMPLATE_STACKEDFILLEDNET
,
130 TEMPLATE_PERCENTSTACKEDFILLEDNET
,
131 TEMPLATE_STOCKLOWHIGHCLOSE
,
132 TEMPLATE_STOCKOPENLOWHIGHCLOSE
,
133 TEMPLATE_STOCKVOLUMELOWHIGHCLOSE
,
134 TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE
,
138 TEMPLATE_NOT_FOUND
= 0xffff
141 typedef ::std::map
< OUString
, TemplateId
> tTemplateMapType
;
143 const tTemplateMapType
& lcl_DefaultChartTypeMap()
145 static const tTemplateMapType aMap
= tTemplateMapType(
146 ::comphelper::MakeMap
< tTemplateMapType::key_type
, tTemplateMapType::mapped_type
>
147 ( C2U( "com.sun.star.chart2.template.Symbol" ), TEMPLATE_SYMBOL
)
148 ( C2U( "com.sun.star.chart2.template.StackedSymbol" ), TEMPLATE_STACKEDSYMBOL
)
149 ( C2U( "com.sun.star.chart2.template.PercentStackedSymbol" ), TEMPLATE_PERCENTSTACKEDSYMBOL
)
150 ( C2U( "com.sun.star.chart2.template.Line" ), TEMPLATE_LINE
)
151 ( C2U( "com.sun.star.chart2.template.StackedLine" ), TEMPLATE_STACKEDLINE
)
152 ( C2U( "com.sun.star.chart2.template.PercentStackedLine" ), TEMPLATE_PERCENTSTACKEDLINE
)
153 ( C2U( "com.sun.star.chart2.template.LineSymbol" ), TEMPLATE_LINESYMBOL
)
154 ( C2U( "com.sun.star.chart2.template.StackedLineSymbol" ), TEMPLATE_STACKEDLINESYMBOL
)
155 ( C2U( "com.sun.star.chart2.template.PercentStackedLineSymbol" ), TEMPLATE_PERCENTSTACKEDLINESYMBOL
)
156 ( C2U( "com.sun.star.chart2.template.ThreeDLine" ), TEMPLATE_THREEDLINE
)
157 ( C2U( "com.sun.star.chart2.template.StackedThreeDLine" ), TEMPLATE_STACKEDTHREEDLINE
)
158 ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDLine" ), TEMPLATE_PERCENTSTACKEDTHREEDLINE
)
159 ( C2U( "com.sun.star.chart2.template.ThreeDLineDeep" ), TEMPLATE_THREEDLINEDEEP
)
160 ( C2U( "com.sun.star.chart2.template.Column" ), TEMPLATE_COLUMN
)
161 ( C2U( "com.sun.star.chart2.template.StackedColumn" ), TEMPLATE_STACKEDCOLUMN
)
162 ( C2U( "com.sun.star.chart2.template.PercentStackedColumn" ), TEMPLATE_PERCENTSTACKEDCOLUMN
)
163 ( C2U( "com.sun.star.chart2.template.Bar" ), TEMPLATE_BAR
)
164 ( C2U( "com.sun.star.chart2.template.StackedBar" ), TEMPLATE_STACKEDBAR
)
165 ( C2U( "com.sun.star.chart2.template.PercentStackedBar" ), TEMPLATE_PERCENTSTACKEDBAR
)
166 ( C2U( "com.sun.star.chart2.template.ThreeDColumnDeep" ), TEMPLATE_THREEDCOLUMNDEEP
)
167 ( C2U( "com.sun.star.chart2.template.ThreeDColumnFlat" ), TEMPLATE_THREEDCOLUMNFLAT
)
168 ( C2U( "com.sun.star.chart2.template.StackedThreeDColumnFlat" ), TEMPLATE_STACKEDTHREEDCOLUMNFLAT
)
169 ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDColumnFlat" ), TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT
)
170 ( C2U( "com.sun.star.chart2.template.ThreeDBarDeep" ), TEMPLATE_THREEDBARDEEP
)
171 ( C2U( "com.sun.star.chart2.template.ThreeDBarFlat" ), TEMPLATE_THREEDBARFLAT
)
172 ( C2U( "com.sun.star.chart2.template.StackedThreeDBarFlat" ), TEMPLATE_STACKEDTHREEDBARFLAT
)
173 ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDBarFlat" ), TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT
)
174 ( C2U( "com.sun.star.chart2.template.ColumnWithLine" ), TEMPLATE_COLUMNWITHLINE
)
175 ( C2U( "com.sun.star.chart2.template.StackedColumnWithLine" ), TEMPLATE_STACKEDCOLUMNWITHLINE
)
176 ( C2U( "com.sun.star.chart2.template.Area" ), TEMPLATE_AREA
)
177 ( C2U( "com.sun.star.chart2.template.StackedArea" ), TEMPLATE_STACKEDAREA
)
178 ( C2U( "com.sun.star.chart2.template.PercentStackedArea" ), TEMPLATE_PERCENTSTACKEDAREA
)
179 ( C2U( "com.sun.star.chart2.template.ThreeDArea" ), TEMPLATE_THREEDAREA
)
180 ( C2U( "com.sun.star.chart2.template.StackedThreeDArea" ), TEMPLATE_STACKEDTHREEDAREA
)
181 ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDArea" ), TEMPLATE_PERCENTSTACKEDTHREEDAREA
)
182 ( C2U( "com.sun.star.chart2.template.Pie" ), TEMPLATE_PIE
)
183 ( C2U( "com.sun.star.chart2.template.PieAllExploded" ), TEMPLATE_PIEALLEXPLODED
)
184 ( C2U( "com.sun.star.chart2.template.Donut" ), TEMPLATE_DONUT
)
185 ( C2U( "com.sun.star.chart2.template.DonutAllExploded" ), TEMPLATE_DONUTALLEXPLODED
)
186 ( C2U( "com.sun.star.chart2.template.ThreeDPie" ), TEMPLATE_THREEDPIE
)
187 ( C2U( "com.sun.star.chart2.template.ThreeDPieAllExploded" ), TEMPLATE_THREEDPIEALLEXPLODED
)
188 ( C2U( "com.sun.star.chart2.template.ThreeDDonut" ), TEMPLATE_THREEDDONUT
)
189 ( C2U( "com.sun.star.chart2.template.ThreeDDonutAllExploded" ), TEMPLATE_THREEDDONUTALLEXPLODED
)
190 ( C2U( "com.sun.star.chart2.template.ScatterLineSymbol" ), TEMPLATE_SCATTERLINESYMBOL
)
191 ( C2U( "com.sun.star.chart2.template.ScatterLine" ), TEMPLATE_SCATTERLINE
)
192 ( C2U( "com.sun.star.chart2.template.ScatterSymbol" ), TEMPLATE_SCATTERSYMBOL
)
193 ( C2U( "com.sun.star.chart2.template.ThreeDScatter" ), TEMPLATE_THREEDSCATTER
)
194 ( C2U( "com.sun.star.chart2.template.Net" ), TEMPLATE_NET
)
195 ( C2U( "com.sun.star.chart2.template.NetSymbol" ), TEMPLATE_NETSYMBOL
)
196 ( C2U( "com.sun.star.chart2.template.NetLine" ), TEMPLATE_NETLINE
)
197 ( C2U( "com.sun.star.chart2.template.StackedNet" ), TEMPLATE_STACKEDNET
)
198 ( C2U( "com.sun.star.chart2.template.StackedNetSymbol" ), TEMPLATE_STACKEDNETSYMBOL
)
199 ( C2U( "com.sun.star.chart2.template.StackedNetLine" ), TEMPLATE_STACKEDNETLINE
)
200 ( C2U( "com.sun.star.chart2.template.PercentStackedNet" ), TEMPLATE_PERCENTSTACKEDNET
)
201 ( C2U( "com.sun.star.chart2.template.PercentStackedNetSymbol" ), TEMPLATE_PERCENTSTACKEDNETSYMBOL
)
202 ( C2U( "com.sun.star.chart2.template.PercentStackedNetLine" ), TEMPLATE_PERCENTSTACKEDNETLINE
)
203 ( C2U( "com.sun.star.chart2.template.FilledNet" ), TEMPLATE_FILLEDNET
)
204 ( C2U( "com.sun.star.chart2.template.StackedFilledNet" ), TEMPLATE_STACKEDFILLEDNET
)
205 ( C2U( "com.sun.star.chart2.template.PercentStackedFilledNet" ), TEMPLATE_PERCENTSTACKEDFILLEDNET
)
206 ( C2U( "com.sun.star.chart2.template.StockLowHighClose" ), TEMPLATE_STOCKLOWHIGHCLOSE
)
207 ( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ), TEMPLATE_STOCKOPENLOWHIGHCLOSE
)
208 ( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ), TEMPLATE_STOCKVOLUMELOWHIGHCLOSE
)
209 ( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ), TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE
)
210 ( C2U( "com.sun.star.chart2.template.Bubble" ), TEMPLATE_BUBBLE
)
211 // ( C2U( "com.sun.star.chart2.template.Surface" ), TEMPLATE_SURFACE )
212 // ( C2U( "com.sun.star.chart2.template.Addin" ), TEMPLATE_ADDIN )
218 TemplateId
lcl_GetTemplateIdForService( const OUString
& rServiceName
)
220 TemplateId eResult
= TEMPLATE_NOT_FOUND
;
221 const tTemplateMapType
& rMap
= lcl_DefaultChartTypeMap();
222 tTemplateMapType::const_iterator
aIt( rMap
.find( rServiceName
));
224 if( aIt
!= rMap
.end())
225 eResult
= (*aIt
).second
;
230 } // anonymous namespace
235 ChartTypeManager::ChartTypeManager(
237 uno::XComponentContext
> const & xContext
) :
238 m_xContext( xContext
)
241 ChartTypeManager::~ChartTypeManager()
244 // ____ XMultiServiceFactory ____
245 uno::Reference
< uno::XInterface
> SAL_CALL
ChartTypeManager::createInstance(
246 const OUString
& aServiceSpecifier
)
247 throw (uno::Exception
,
248 uno::RuntimeException
)
250 uno::Reference
< uno::XInterface
> xResult
;
251 TemplateId nId
= lcl_GetTemplateIdForService( aServiceSpecifier
);
253 if( nId
== TEMPLATE_NOT_FOUND
)
257 xResult
= m_xContext
->getServiceManager()->createInstanceWithContext(
258 aServiceSpecifier
, m_xContext
);
260 // catch( registry::InvalidValueException & ex )
261 catch( uno::Exception
& ex
)
263 // couldn't create service via factory
265 // As XMultiServiceFactory does not specify, what to do in case
266 // createInstance is called with an unknown service-name, this
267 // function will just return an empty XInterface.
268 ASSERT_EXCEPTION( ex
);
269 OSL_TRACE( "Couldn't instantiate service \"%s\"", U2C( aServiceSpecifier
));
275 uno::Reference
< chart2::XChartTypeTemplate
> xTemplate
;
278 // Point (category x axis)
279 case TEMPLATE_SYMBOL
:
280 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
281 StackMode_NONE
, true, false ));
283 case TEMPLATE_STACKEDSYMBOL
:
284 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
285 StackMode_Y_STACKED
, true, false ));
287 case TEMPLATE_PERCENTSTACKEDSYMBOL
:
288 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
289 StackMode_Y_STACKED_PERCENT
, true, false ));
291 // Line (category x axis)
293 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
294 StackMode_NONE
, false ));
296 case TEMPLATE_STACKEDLINE
:
297 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
298 StackMode_Y_STACKED
, false ));
300 case TEMPLATE_PERCENTSTACKEDLINE
:
301 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
302 StackMode_Y_STACKED_PERCENT
, false ));
304 case TEMPLATE_LINESYMBOL
:
305 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
306 StackMode_NONE
, true ));
308 case TEMPLATE_STACKEDLINESYMBOL
:
309 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
310 StackMode_Y_STACKED
, true ));
312 case TEMPLATE_PERCENTSTACKEDLINESYMBOL
:
313 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
314 StackMode_Y_STACKED_PERCENT
, true ));
316 case TEMPLATE_THREEDLINE
:
317 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
318 StackMode_NONE
, false, true, 3 ));
320 case TEMPLATE_STACKEDTHREEDLINE
:
321 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
322 StackMode_Y_STACKED
, false, true, 3 ));
324 case TEMPLATE_PERCENTSTACKEDTHREEDLINE
:
325 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
326 StackMode_Y_STACKED_PERCENT
, false, true, 3 ));
328 case TEMPLATE_THREEDLINEDEEP
:
329 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
330 StackMode_Z_STACKED
, false, true, 3 ));
334 case TEMPLATE_COLUMN
:
335 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
336 StackMode_NONE
, BarChartTypeTemplate::VERTICAL
));
338 case TEMPLATE_STACKEDCOLUMN
:
339 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
340 StackMode_Y_STACKED
, BarChartTypeTemplate::VERTICAL
));
342 case TEMPLATE_PERCENTSTACKEDCOLUMN
:
343 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
344 StackMode_Y_STACKED_PERCENT
, BarChartTypeTemplate::VERTICAL
));
347 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
348 StackMode_NONE
, BarChartTypeTemplate::HORIZONTAL
));
350 case TEMPLATE_STACKEDBAR
:
351 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
352 StackMode_Y_STACKED
, BarChartTypeTemplate::HORIZONTAL
));
354 case TEMPLATE_PERCENTSTACKEDBAR
:
355 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
356 StackMode_Y_STACKED_PERCENT
, BarChartTypeTemplate::HORIZONTAL
));
358 case TEMPLATE_THREEDCOLUMNDEEP
:
359 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
360 StackMode_Z_STACKED
, BarChartTypeTemplate::VERTICAL
, 3 ));
362 case TEMPLATE_THREEDCOLUMNFLAT
:
363 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
364 StackMode_NONE
, BarChartTypeTemplate::VERTICAL
, 3 ));
366 case TEMPLATE_STACKEDTHREEDCOLUMNFLAT
:
367 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
368 StackMode_Y_STACKED
, BarChartTypeTemplate::VERTICAL
, 3 ));
370 case TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT
:
371 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
372 StackMode_Y_STACKED_PERCENT
, BarChartTypeTemplate::VERTICAL
, 3 ));
374 case TEMPLATE_THREEDBARDEEP
:
375 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
376 StackMode_Z_STACKED
, BarChartTypeTemplate::HORIZONTAL
, 3 ));
378 case TEMPLATE_THREEDBARFLAT
:
379 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
380 StackMode_NONE
, BarChartTypeTemplate::HORIZONTAL
, 3 ));
382 case TEMPLATE_STACKEDTHREEDBARFLAT
:
383 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
384 StackMode_Y_STACKED
, BarChartTypeTemplate::HORIZONTAL
, 3 ));
386 case TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT
:
387 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
388 StackMode_Y_STACKED_PERCENT
, BarChartTypeTemplate::HORIZONTAL
, 3 ));
391 // Combi-Chart Line/Column
392 case TEMPLATE_COLUMNWITHLINE
:
393 case TEMPLATE_STACKEDCOLUMNWITHLINE
:
395 StackMode eMode
= ( nId
== TEMPLATE_COLUMNWITHLINE
)
397 : StackMode_Y_STACKED
;
399 xTemplate
.set( new ColumnLineChartTypeTemplate( m_xContext
, aServiceSpecifier
, eMode
, 1 ));
405 xTemplate
.set( new AreaChartTypeTemplate( m_xContext
, aServiceSpecifier
, StackMode_NONE
));
407 case TEMPLATE_STACKEDAREA
:
408 xTemplate
.set( new AreaChartTypeTemplate( m_xContext
, aServiceSpecifier
, StackMode_Y_STACKED
));
410 case TEMPLATE_PERCENTSTACKEDAREA
:
411 xTemplate
.set( new AreaChartTypeTemplate( m_xContext
, aServiceSpecifier
, StackMode_Y_STACKED_PERCENT
));
413 case TEMPLATE_THREEDAREA
:
414 xTemplate
.set( new AreaChartTypeTemplate( m_xContext
, aServiceSpecifier
, StackMode_Z_STACKED
, 3 ));
416 case TEMPLATE_STACKEDTHREEDAREA
:
417 xTemplate
.set( new AreaChartTypeTemplate( m_xContext
, aServiceSpecifier
, StackMode_Y_STACKED
, 3 ));
419 case TEMPLATE_PERCENTSTACKEDTHREEDAREA
:
420 xTemplate
.set( new AreaChartTypeTemplate( m_xContext
, aServiceSpecifier
, StackMode_Y_STACKED_PERCENT
, 3 ));
424 xTemplate
.set( new PieChartTypeTemplate( m_xContext
, aServiceSpecifier
,
425 chart2::PieChartOffsetMode_NONE
, false ));
427 case TEMPLATE_PIEALLEXPLODED
:
428 xTemplate
.set( new PieChartTypeTemplate( m_xContext
, aServiceSpecifier
,
429 chart2::PieChartOffsetMode_ALL_EXPLODED
, false ));
432 xTemplate
.set( new PieChartTypeTemplate( m_xContext
, aServiceSpecifier
,
433 chart2::PieChartOffsetMode_NONE
, true ));
435 case TEMPLATE_DONUTALLEXPLODED
:
436 xTemplate
.set( new PieChartTypeTemplate( m_xContext
, aServiceSpecifier
,
437 chart2::PieChartOffsetMode_ALL_EXPLODED
, true ));
439 case TEMPLATE_THREEDPIE
:
440 xTemplate
.set( new PieChartTypeTemplate( m_xContext
, aServiceSpecifier
,
441 chart2::PieChartOffsetMode_NONE
, false, 3 ));
443 case TEMPLATE_THREEDPIEALLEXPLODED
:
444 xTemplate
.set( new PieChartTypeTemplate( m_xContext
, aServiceSpecifier
,
445 chart2::PieChartOffsetMode_ALL_EXPLODED
, false, 3 ));
447 case TEMPLATE_THREEDDONUT
:
448 xTemplate
.set( new PieChartTypeTemplate( m_xContext
, aServiceSpecifier
,
449 chart2::PieChartOffsetMode_NONE
, true, 3 ));
451 case TEMPLATE_THREEDDONUTALLEXPLODED
:
452 xTemplate
.set( new PieChartTypeTemplate( m_xContext
, aServiceSpecifier
,
453 chart2::PieChartOffsetMode_ALL_EXPLODED
, true, 3 ));
456 case TEMPLATE_SCATTERLINESYMBOL
:
457 xTemplate
.set( new ScatterChartTypeTemplate( m_xContext
, aServiceSpecifier
, /* bSymbols */ true ));
459 case TEMPLATE_SCATTERLINE
:
460 xTemplate
.set( new ScatterChartTypeTemplate( m_xContext
, aServiceSpecifier
, /* bSymbols */ false ));
462 case TEMPLATE_SCATTERSYMBOL
:
463 xTemplate
.set( new ScatterChartTypeTemplate( m_xContext
, aServiceSpecifier
, /* bSymbols */ true, /* bHasLines */ false ));
465 case TEMPLATE_THREEDSCATTER
:
466 xTemplate
.set( new ScatterChartTypeTemplate( m_xContext
, aServiceSpecifier
, /* bSymbols */ false, /* bHasLines */ true, 3 ));
471 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
472 StackMode_NONE
, true ));
474 case TEMPLATE_NETSYMBOL
:
475 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
476 StackMode_NONE
, true, false ));
478 case TEMPLATE_NETLINE
:
479 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
480 StackMode_NONE
, false ));
483 case TEMPLATE_STACKEDNET
:
484 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
485 StackMode_Y_STACKED
, true ));
487 case TEMPLATE_STACKEDNETSYMBOL
:
488 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
489 StackMode_Y_STACKED
, true, false ));
491 case TEMPLATE_STACKEDNETLINE
:
492 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
493 StackMode_Y_STACKED
, false, true ));
496 case TEMPLATE_PERCENTSTACKEDNET
:
497 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
498 StackMode_Y_STACKED_PERCENT
, true ));
500 case TEMPLATE_PERCENTSTACKEDNETSYMBOL
:
501 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
502 StackMode_Y_STACKED_PERCENT
, true, false ));
504 case TEMPLATE_PERCENTSTACKEDNETLINE
:
505 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
506 StackMode_Y_STACKED_PERCENT
, false, true ));
509 case TEMPLATE_FILLEDNET
:
510 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
511 StackMode_NONE
, false, false, true ));
513 case TEMPLATE_STACKEDFILLEDNET
:
514 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
515 StackMode_Y_STACKED
, false, false, true ));
517 case TEMPLATE_PERCENTSTACKEDFILLEDNET
:
518 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
519 StackMode_Y_STACKED_PERCENT
, false, false, true ));
522 case TEMPLATE_STOCKLOWHIGHCLOSE
:
523 xTemplate
.set( new StockChartTypeTemplate( m_xContext
, aServiceSpecifier
,
524 StockChartTypeTemplate::LOW_HI_CLOSE
, false ));
526 case TEMPLATE_STOCKOPENLOWHIGHCLOSE
:
527 xTemplate
.set( new StockChartTypeTemplate( m_xContext
, aServiceSpecifier
,
528 StockChartTypeTemplate::OPEN_LOW_HI_CLOSE
, true ));
530 case TEMPLATE_STOCKVOLUMELOWHIGHCLOSE
:
531 xTemplate
.set( new StockChartTypeTemplate( m_xContext
, aServiceSpecifier
,
532 StockChartTypeTemplate::VOL_LOW_HI_CLOSE
, false ));
534 case TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE
:
535 xTemplate
.set( new StockChartTypeTemplate( m_xContext
, aServiceSpecifier
,
536 StockChartTypeTemplate::VOL_OPEN_LOW_HI_CLOSE
, true ));
540 case TEMPLATE_BUBBLE
:
541 xTemplate
.set( new BubbleChartTypeTemplate( m_xContext
, aServiceSpecifier
));
544 // case TEMPLATE_SURFACE:
545 // case TEMPLATE_ADDIN:
548 case TEMPLATE_NOT_FOUND
:
552 xResult
.set( xTemplate
, uno::UNO_QUERY
);
558 uno::Reference
< uno::XInterface
> SAL_CALL
ChartTypeManager::createInstanceWithArguments(
559 const OUString
& ServiceSpecifier
,
560 const uno::Sequence
< uno::Any
>& /* Arguments */ )
561 throw (uno::Exception
,
562 uno::RuntimeException
)
564 OSL_ENSURE( false, "createInstanceWithArguments: No arguments supported" );
565 return createInstance( ServiceSpecifier
);
568 uno::Sequence
< OUString
> SAL_CALL
ChartTypeManager::getAvailableServiceNames()
569 throw (uno::RuntimeException
)
571 ::std::vector
< OUString
> aServices
;
572 const tTemplateMapType
& rMap
= lcl_DefaultChartTypeMap();
573 aServices
.reserve( rMap
.size());
575 // get own default templates
576 ::std::transform( rMap
.begin(), rMap
.end(), ::std::back_inserter( aServices
),
577 ::std::select1st
< tTemplateMapType::value_type
>());
579 // add components that were registered in the context's factory
580 uno::Reference
< container::XContentEnumerationAccess
> xEnumAcc(
581 m_xContext
->getServiceManager(), uno::UNO_QUERY
);
584 uno::Reference
< container::XEnumeration
> xEnum(
585 xEnumAcc
->createContentEnumeration( C2U( "com.sun.star.chart2.ChartTypeTemplate" ) ));
588 uno::Reference
< uno::XInterface
> xFactIntf
;
590 while( xEnum
->hasMoreElements())
592 if( xEnum
->nextElement() >>= xFactIntf
)
594 uno::Reference
< lang::XServiceName
> xServiceName( xFactIntf
, uno::UNO_QUERY
);
595 if( xServiceName
.is())
596 aServices
.push_back( xServiceName
->getServiceName());
602 return ContainerHelper::ContainerToSequence( aServices
);
605 // ____ XServiceInfo ____
606 Sequence
< OUString
> ChartTypeManager::getSupportedServiceNames_Static()
608 Sequence
< OUString
> aServices( 2 );
609 aServices
[ 0 ] = C2U( "com.sun.star.chart2.ChartTypeManager" );
610 aServices
[ 1 ] = C2U( "com.sun.star.lang.MultiServiceFactory" );
614 // ================================================================================
616 // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
617 APPHELPER_XSERVICEINFO_IMPL( ChartTypeManager
,
618 C2U( "com.sun.star.comp.chart.ChartTypeManager" ));