1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ChartTypeManager.cxx,v $
10 * $Revision: 1.18.44.2 $
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"
33 #include "ChartTypeManager.hxx"
35 #include "StackMode.hxx"
36 #include "ContainerHelper.hxx"
38 #include "CartesianCoordinateSystem.hxx"
40 #include "LineChartTypeTemplate.hxx"
41 #include "BarChartTypeTemplate.hxx"
42 #include "ColumnLineChartTypeTemplate.hxx"
43 #include "AreaChartTypeTemplate.hxx"
44 #include "PieChartTypeTemplate.hxx"
45 #include "ScatterChartTypeTemplate.hxx"
46 #include "StockChartTypeTemplate.hxx"
47 #include "NetChartTypeTemplate.hxx"
48 #include "BubbleChartTypeTemplate.hxx"
49 #include <cppuhelper/component_context.hxx>
50 #include <comphelper/InlineContainer.hxx>
51 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
52 #include <com/sun/star/lang/XServiceName.hpp>
53 #include <com/sun/star/chart/ChartSolidType.hpp>
54 #include <com/sun/star/chart2/CurveStyle.hpp>
60 using namespace ::com::sun::star
;
62 using ::rtl::OUString
;
63 using ::com::sun::star::uno::Sequence
;
64 using ::com::sun::star::uno::Reference
;
65 using ::com::sun::star::uno::Any
;
66 using ::osl::MutexGuard
;
68 // ======================================================================
76 TEMPLATE_STACKEDSYMBOL
,
77 TEMPLATE_PERCENTSTACKEDSYMBOL
,
80 TEMPLATE_PERCENTSTACKEDLINE
,
82 TEMPLATE_STACKEDLINESYMBOL
,
83 TEMPLATE_PERCENTSTACKEDLINESYMBOL
,
85 TEMPLATE_STACKEDTHREEDLINE
,
86 TEMPLATE_PERCENTSTACKEDTHREEDLINE
,
87 TEMPLATE_THREEDLINEDEEP
,
89 TEMPLATE_STACKEDCOLUMN
,
90 TEMPLATE_PERCENTSTACKEDCOLUMN
,
93 TEMPLATE_PERCENTSTACKEDBAR
,
94 TEMPLATE_THREEDCOLUMNDEEP
,
95 TEMPLATE_THREEDCOLUMNFLAT
,
96 TEMPLATE_STACKEDTHREEDCOLUMNFLAT
,
97 TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT
,
98 TEMPLATE_THREEDBARDEEP
,
99 TEMPLATE_THREEDBARFLAT
,
100 TEMPLATE_STACKEDTHREEDBARFLAT
,
101 TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT
,
102 TEMPLATE_COLUMNWITHLINE
,
103 TEMPLATE_STACKEDCOLUMNWITHLINE
,
105 TEMPLATE_STACKEDAREA
,
106 TEMPLATE_PERCENTSTACKEDAREA
,
108 TEMPLATE_STACKEDTHREEDAREA
,
109 TEMPLATE_PERCENTSTACKEDTHREEDAREA
,
111 TEMPLATE_PIEALLEXPLODED
,
113 TEMPLATE_DONUTALLEXPLODED
,
115 TEMPLATE_THREEDPIEALLEXPLODED
,
116 TEMPLATE_THREEDDONUT
,
117 TEMPLATE_THREEDDONUTALLEXPLODED
,
118 TEMPLATE_SCATTERLINESYMBOL
,
119 TEMPLATE_SCATTERLINE
,
120 TEMPLATE_SCATTERSYMBOL
,
121 TEMPLATE_THREEDSCATTER
,
126 TEMPLATE_STACKEDNETSYMBOL
,
127 TEMPLATE_STACKEDNETLINE
,
128 TEMPLATE_PERCENTSTACKEDNET
,
129 TEMPLATE_PERCENTSTACKEDNETSYMBOL
,
130 TEMPLATE_PERCENTSTACKEDNETLINE
,
132 TEMPLATE_STACKEDFILLEDNET
,
133 TEMPLATE_PERCENTSTACKEDFILLEDNET
,
134 TEMPLATE_STOCKLOWHIGHCLOSE
,
135 TEMPLATE_STOCKOPENLOWHIGHCLOSE
,
136 TEMPLATE_STOCKVOLUMELOWHIGHCLOSE
,
137 TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE
,
141 TEMPLATE_NOT_FOUND
= 0xffff
144 typedef ::std::map
< OUString
, TemplateId
> tTemplateMapType
;
146 const tTemplateMapType
& lcl_DefaultChartTypeMap()
148 static const tTemplateMapType aMap
= tTemplateMapType(
149 ::comphelper::MakeMap
< tTemplateMapType::key_type
, tTemplateMapType::mapped_type
>
150 ( C2U( "com.sun.star.chart2.template.Symbol" ), TEMPLATE_SYMBOL
)
151 ( C2U( "com.sun.star.chart2.template.StackedSymbol" ), TEMPLATE_STACKEDSYMBOL
)
152 ( C2U( "com.sun.star.chart2.template.PercentStackedSymbol" ), TEMPLATE_PERCENTSTACKEDSYMBOL
)
153 ( C2U( "com.sun.star.chart2.template.Line" ), TEMPLATE_LINE
)
154 ( C2U( "com.sun.star.chart2.template.StackedLine" ), TEMPLATE_STACKEDLINE
)
155 ( C2U( "com.sun.star.chart2.template.PercentStackedLine" ), TEMPLATE_PERCENTSTACKEDLINE
)
156 ( C2U( "com.sun.star.chart2.template.LineSymbol" ), TEMPLATE_LINESYMBOL
)
157 ( C2U( "com.sun.star.chart2.template.StackedLineSymbol" ), TEMPLATE_STACKEDLINESYMBOL
)
158 ( C2U( "com.sun.star.chart2.template.PercentStackedLineSymbol" ), TEMPLATE_PERCENTSTACKEDLINESYMBOL
)
159 ( C2U( "com.sun.star.chart2.template.ThreeDLine" ), TEMPLATE_THREEDLINE
)
160 ( C2U( "com.sun.star.chart2.template.StackedThreeDLine" ), TEMPLATE_STACKEDTHREEDLINE
)
161 ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDLine" ), TEMPLATE_PERCENTSTACKEDTHREEDLINE
)
162 ( C2U( "com.sun.star.chart2.template.ThreeDLineDeep" ), TEMPLATE_THREEDLINEDEEP
)
163 ( C2U( "com.sun.star.chart2.template.Column" ), TEMPLATE_COLUMN
)
164 ( C2U( "com.sun.star.chart2.template.StackedColumn" ), TEMPLATE_STACKEDCOLUMN
)
165 ( C2U( "com.sun.star.chart2.template.PercentStackedColumn" ), TEMPLATE_PERCENTSTACKEDCOLUMN
)
166 ( C2U( "com.sun.star.chart2.template.Bar" ), TEMPLATE_BAR
)
167 ( C2U( "com.sun.star.chart2.template.StackedBar" ), TEMPLATE_STACKEDBAR
)
168 ( C2U( "com.sun.star.chart2.template.PercentStackedBar" ), TEMPLATE_PERCENTSTACKEDBAR
)
169 ( C2U( "com.sun.star.chart2.template.ThreeDColumnDeep" ), TEMPLATE_THREEDCOLUMNDEEP
)
170 ( C2U( "com.sun.star.chart2.template.ThreeDColumnFlat" ), TEMPLATE_THREEDCOLUMNFLAT
)
171 ( C2U( "com.sun.star.chart2.template.StackedThreeDColumnFlat" ), TEMPLATE_STACKEDTHREEDCOLUMNFLAT
)
172 ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDColumnFlat" ), TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT
)
173 ( C2U( "com.sun.star.chart2.template.ThreeDBarDeep" ), TEMPLATE_THREEDBARDEEP
)
174 ( C2U( "com.sun.star.chart2.template.ThreeDBarFlat" ), TEMPLATE_THREEDBARFLAT
)
175 ( C2U( "com.sun.star.chart2.template.StackedThreeDBarFlat" ), TEMPLATE_STACKEDTHREEDBARFLAT
)
176 ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDBarFlat" ), TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT
)
177 ( C2U( "com.sun.star.chart2.template.ColumnWithLine" ), TEMPLATE_COLUMNWITHLINE
)
178 ( C2U( "com.sun.star.chart2.template.StackedColumnWithLine" ), TEMPLATE_STACKEDCOLUMNWITHLINE
)
179 ( C2U( "com.sun.star.chart2.template.Area" ), TEMPLATE_AREA
)
180 ( C2U( "com.sun.star.chart2.template.StackedArea" ), TEMPLATE_STACKEDAREA
)
181 ( C2U( "com.sun.star.chart2.template.PercentStackedArea" ), TEMPLATE_PERCENTSTACKEDAREA
)
182 ( C2U( "com.sun.star.chart2.template.ThreeDArea" ), TEMPLATE_THREEDAREA
)
183 ( C2U( "com.sun.star.chart2.template.StackedThreeDArea" ), TEMPLATE_STACKEDTHREEDAREA
)
184 ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDArea" ), TEMPLATE_PERCENTSTACKEDTHREEDAREA
)
185 ( C2U( "com.sun.star.chart2.template.Pie" ), TEMPLATE_PIE
)
186 ( C2U( "com.sun.star.chart2.template.PieAllExploded" ), TEMPLATE_PIEALLEXPLODED
)
187 ( C2U( "com.sun.star.chart2.template.Donut" ), TEMPLATE_DONUT
)
188 ( C2U( "com.sun.star.chart2.template.DonutAllExploded" ), TEMPLATE_DONUTALLEXPLODED
)
189 ( C2U( "com.sun.star.chart2.template.ThreeDPie" ), TEMPLATE_THREEDPIE
)
190 ( C2U( "com.sun.star.chart2.template.ThreeDPieAllExploded" ), TEMPLATE_THREEDPIEALLEXPLODED
)
191 ( C2U( "com.sun.star.chart2.template.ThreeDDonut" ), TEMPLATE_THREEDDONUT
)
192 ( C2U( "com.sun.star.chart2.template.ThreeDDonutAllExploded" ), TEMPLATE_THREEDDONUTALLEXPLODED
)
193 ( C2U( "com.sun.star.chart2.template.ScatterLineSymbol" ), TEMPLATE_SCATTERLINESYMBOL
)
194 ( C2U( "com.sun.star.chart2.template.ScatterLine" ), TEMPLATE_SCATTERLINE
)
195 ( C2U( "com.sun.star.chart2.template.ScatterSymbol" ), TEMPLATE_SCATTERSYMBOL
)
196 ( C2U( "com.sun.star.chart2.template.ThreeDScatter" ), TEMPLATE_THREEDSCATTER
)
197 ( C2U( "com.sun.star.chart2.template.Net" ), TEMPLATE_NET
)
198 ( C2U( "com.sun.star.chart2.template.NetSymbol" ), TEMPLATE_NETSYMBOL
)
199 ( C2U( "com.sun.star.chart2.template.NetLine" ), TEMPLATE_NETLINE
)
200 ( C2U( "com.sun.star.chart2.template.StackedNet" ), TEMPLATE_STACKEDNET
)
201 ( C2U( "com.sun.star.chart2.template.StackedNetSymbol" ), TEMPLATE_STACKEDNETSYMBOL
)
202 ( C2U( "com.sun.star.chart2.template.StackedNetLine" ), TEMPLATE_STACKEDNETLINE
)
203 ( C2U( "com.sun.star.chart2.template.PercentStackedNet" ), TEMPLATE_PERCENTSTACKEDNET
)
204 ( C2U( "com.sun.star.chart2.template.PercentStackedNetSymbol" ), TEMPLATE_PERCENTSTACKEDNETSYMBOL
)
205 ( C2U( "com.sun.star.chart2.template.PercentStackedNetLine" ), TEMPLATE_PERCENTSTACKEDNETLINE
)
206 ( C2U( "com.sun.star.chart2.template.FilledNet" ), TEMPLATE_FILLEDNET
)
207 ( C2U( "com.sun.star.chart2.template.StackedFilledNet" ), TEMPLATE_STACKEDFILLEDNET
)
208 ( C2U( "com.sun.star.chart2.template.PercentStackedFilledNet" ), TEMPLATE_PERCENTSTACKEDFILLEDNET
)
209 ( C2U( "com.sun.star.chart2.template.StockLowHighClose" ), TEMPLATE_STOCKLOWHIGHCLOSE
)
210 ( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ), TEMPLATE_STOCKOPENLOWHIGHCLOSE
)
211 ( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ), TEMPLATE_STOCKVOLUMELOWHIGHCLOSE
)
212 ( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ), TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE
)
213 ( C2U( "com.sun.star.chart2.template.Bubble" ), TEMPLATE_BUBBLE
)
214 // ( C2U( "com.sun.star.chart2.template.Surface" ), TEMPLATE_SURFACE )
215 // ( C2U( "com.sun.star.chart2.template.Addin" ), TEMPLATE_ADDIN )
221 TemplateId
lcl_GetTemplateIdForService( const OUString
& rServiceName
)
223 TemplateId eResult
= TEMPLATE_NOT_FOUND
;
224 const tTemplateMapType
& rMap
= lcl_DefaultChartTypeMap();
225 tTemplateMapType::const_iterator
aIt( rMap
.find( rServiceName
));
227 if( aIt
!= rMap
.end())
228 eResult
= (*aIt
).second
;
233 } // anonymous namespace
238 ChartTypeManager::ChartTypeManager(
240 uno::XComponentContext
> const & xContext
) :
241 m_xContext( xContext
)
244 ChartTypeManager::~ChartTypeManager()
247 // ____ XMultiServiceFactory ____
248 uno::Reference
< uno::XInterface
> SAL_CALL
ChartTypeManager::createInstance(
249 const OUString
& aServiceSpecifier
)
250 throw (uno::Exception
,
251 uno::RuntimeException
)
253 uno::Reference
< uno::XInterface
> xResult
;
254 TemplateId nId
= lcl_GetTemplateIdForService( aServiceSpecifier
);
256 if( nId
== TEMPLATE_NOT_FOUND
)
260 xResult
= m_xContext
->getServiceManager()->createInstanceWithContext(
261 aServiceSpecifier
, m_xContext
);
263 // catch( registry::InvalidValueException & ex )
264 catch( uno::Exception
& ex
)
266 // couldn't create service via factory
268 // As XMultiServiceFactory does not specify, what to do in case
269 // createInstance is called with an unknown service-name, this
270 // function will just return an empty XInterface.
271 ASSERT_EXCEPTION( ex
);
272 OSL_TRACE( "Couldn't instantiate service \"%s\"", U2C( aServiceSpecifier
));
278 uno::Reference
< chart2::XChartTypeTemplate
> xTemplate
;
281 // Point (category x axis)
282 case TEMPLATE_SYMBOL
:
283 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
284 StackMode_NONE
, true, false ));
286 case TEMPLATE_STACKEDSYMBOL
:
287 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
288 StackMode_Y_STACKED
, true, false ));
290 case TEMPLATE_PERCENTSTACKEDSYMBOL
:
291 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
292 StackMode_Y_STACKED_PERCENT
, true, false ));
294 // Line (category x axis)
296 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
297 StackMode_NONE
, false ));
299 case TEMPLATE_STACKEDLINE
:
300 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
301 StackMode_Y_STACKED
, false ));
303 case TEMPLATE_PERCENTSTACKEDLINE
:
304 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
305 StackMode_Y_STACKED_PERCENT
, false ));
307 case TEMPLATE_LINESYMBOL
:
308 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
309 StackMode_NONE
, true ));
311 case TEMPLATE_STACKEDLINESYMBOL
:
312 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
313 StackMode_Y_STACKED
, true ));
315 case TEMPLATE_PERCENTSTACKEDLINESYMBOL
:
316 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
317 StackMode_Y_STACKED_PERCENT
, true ));
319 case TEMPLATE_THREEDLINE
:
320 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
321 StackMode_NONE
, false, true, 3 ));
323 case TEMPLATE_STACKEDTHREEDLINE
:
324 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
325 StackMode_Y_STACKED
, false, true, 3 ));
327 case TEMPLATE_PERCENTSTACKEDTHREEDLINE
:
328 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
329 StackMode_Y_STACKED_PERCENT
, false, true, 3 ));
331 case TEMPLATE_THREEDLINEDEEP
:
332 xTemplate
.set( new LineChartTypeTemplate( m_xContext
, aServiceSpecifier
,
333 StackMode_Z_STACKED
, false, true, 3 ));
337 case TEMPLATE_COLUMN
:
338 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
339 StackMode_NONE
, BarChartTypeTemplate::VERTICAL
));
341 case TEMPLATE_STACKEDCOLUMN
:
342 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
343 StackMode_Y_STACKED
, BarChartTypeTemplate::VERTICAL
));
345 case TEMPLATE_PERCENTSTACKEDCOLUMN
:
346 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
347 StackMode_Y_STACKED_PERCENT
, BarChartTypeTemplate::VERTICAL
));
350 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
351 StackMode_NONE
, BarChartTypeTemplate::HORIZONTAL
));
353 case TEMPLATE_STACKEDBAR
:
354 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
355 StackMode_Y_STACKED
, BarChartTypeTemplate::HORIZONTAL
));
357 case TEMPLATE_PERCENTSTACKEDBAR
:
358 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
359 StackMode_Y_STACKED_PERCENT
, BarChartTypeTemplate::HORIZONTAL
));
361 case TEMPLATE_THREEDCOLUMNDEEP
:
362 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
363 StackMode_Z_STACKED
, BarChartTypeTemplate::VERTICAL
, 3 ));
365 case TEMPLATE_THREEDCOLUMNFLAT
:
366 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
367 StackMode_NONE
, BarChartTypeTemplate::VERTICAL
, 3 ));
369 case TEMPLATE_STACKEDTHREEDCOLUMNFLAT
:
370 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
371 StackMode_Y_STACKED
, BarChartTypeTemplate::VERTICAL
, 3 ));
373 case TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT
:
374 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
375 StackMode_Y_STACKED_PERCENT
, BarChartTypeTemplate::VERTICAL
, 3 ));
377 case TEMPLATE_THREEDBARDEEP
:
378 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
379 StackMode_Z_STACKED
, BarChartTypeTemplate::HORIZONTAL
, 3 ));
381 case TEMPLATE_THREEDBARFLAT
:
382 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
383 StackMode_NONE
, BarChartTypeTemplate::HORIZONTAL
, 3 ));
385 case TEMPLATE_STACKEDTHREEDBARFLAT
:
386 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
387 StackMode_Y_STACKED
, BarChartTypeTemplate::HORIZONTAL
, 3 ));
389 case TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT
:
390 xTemplate
.set( new BarChartTypeTemplate( m_xContext
, aServiceSpecifier
,
391 StackMode_Y_STACKED_PERCENT
, BarChartTypeTemplate::HORIZONTAL
, 3 ));
394 // Combi-Chart Line/Column
395 case TEMPLATE_COLUMNWITHLINE
:
396 case TEMPLATE_STACKEDCOLUMNWITHLINE
:
398 StackMode eMode
= ( nId
== TEMPLATE_COLUMNWITHLINE
)
400 : StackMode_Y_STACKED
;
402 xTemplate
.set( new ColumnLineChartTypeTemplate( m_xContext
, aServiceSpecifier
, eMode
, 1 ));
408 xTemplate
.set( new AreaChartTypeTemplate( m_xContext
, aServiceSpecifier
, StackMode_NONE
));
410 case TEMPLATE_STACKEDAREA
:
411 xTemplate
.set( new AreaChartTypeTemplate( m_xContext
, aServiceSpecifier
, StackMode_Y_STACKED
));
413 case TEMPLATE_PERCENTSTACKEDAREA
:
414 xTemplate
.set( new AreaChartTypeTemplate( m_xContext
, aServiceSpecifier
, StackMode_Y_STACKED_PERCENT
));
416 case TEMPLATE_THREEDAREA
:
417 xTemplate
.set( new AreaChartTypeTemplate( m_xContext
, aServiceSpecifier
, StackMode_Z_STACKED
, 3 ));
419 case TEMPLATE_STACKEDTHREEDAREA
:
420 xTemplate
.set( new AreaChartTypeTemplate( m_xContext
, aServiceSpecifier
, StackMode_Y_STACKED
, 3 ));
422 case TEMPLATE_PERCENTSTACKEDTHREEDAREA
:
423 xTemplate
.set( new AreaChartTypeTemplate( m_xContext
, aServiceSpecifier
, StackMode_Y_STACKED_PERCENT
, 3 ));
427 xTemplate
.set( new PieChartTypeTemplate( m_xContext
, aServiceSpecifier
,
428 chart2::PieChartOffsetMode_NONE
, false ));
430 case TEMPLATE_PIEALLEXPLODED
:
431 xTemplate
.set( new PieChartTypeTemplate( m_xContext
, aServiceSpecifier
,
432 chart2::PieChartOffsetMode_ALL_EXPLODED
, false ));
435 xTemplate
.set( new PieChartTypeTemplate( m_xContext
, aServiceSpecifier
,
436 chart2::PieChartOffsetMode_NONE
, true ));
438 case TEMPLATE_DONUTALLEXPLODED
:
439 xTemplate
.set( new PieChartTypeTemplate( m_xContext
, aServiceSpecifier
,
440 chart2::PieChartOffsetMode_ALL_EXPLODED
, true ));
442 case TEMPLATE_THREEDPIE
:
443 xTemplate
.set( new PieChartTypeTemplate( m_xContext
, aServiceSpecifier
,
444 chart2::PieChartOffsetMode_NONE
, false, 3 ));
446 case TEMPLATE_THREEDPIEALLEXPLODED
:
447 xTemplate
.set( new PieChartTypeTemplate( m_xContext
, aServiceSpecifier
,
448 chart2::PieChartOffsetMode_ALL_EXPLODED
, false, 3 ));
450 case TEMPLATE_THREEDDONUT
:
451 xTemplate
.set( new PieChartTypeTemplate( m_xContext
, aServiceSpecifier
,
452 chart2::PieChartOffsetMode_NONE
, true, 3 ));
454 case TEMPLATE_THREEDDONUTALLEXPLODED
:
455 xTemplate
.set( new PieChartTypeTemplate( m_xContext
, aServiceSpecifier
,
456 chart2::PieChartOffsetMode_ALL_EXPLODED
, true, 3 ));
459 case TEMPLATE_SCATTERLINESYMBOL
:
460 xTemplate
.set( new ScatterChartTypeTemplate( m_xContext
, aServiceSpecifier
, /* bSymbols */ true ));
462 case TEMPLATE_SCATTERLINE
:
463 xTemplate
.set( new ScatterChartTypeTemplate( m_xContext
, aServiceSpecifier
, /* bSymbols */ false ));
465 case TEMPLATE_SCATTERSYMBOL
:
466 xTemplate
.set( new ScatterChartTypeTemplate( m_xContext
, aServiceSpecifier
, /* bSymbols */ true, /* bHasLines */ false ));
468 case TEMPLATE_THREEDSCATTER
:
469 xTemplate
.set( new ScatterChartTypeTemplate( m_xContext
, aServiceSpecifier
, /* bSymbols */ false, /* bHasLines */ true, 3 ));
474 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
475 StackMode_NONE
, true ));
477 case TEMPLATE_NETSYMBOL
:
478 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
479 StackMode_NONE
, true, false ));
481 case TEMPLATE_NETLINE
:
482 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
483 StackMode_NONE
, false ));
486 case TEMPLATE_STACKEDNET
:
487 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
488 StackMode_Y_STACKED
, true ));
490 case TEMPLATE_STACKEDNETSYMBOL
:
491 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
492 StackMode_Y_STACKED
, true, false ));
494 case TEMPLATE_STACKEDNETLINE
:
495 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
496 StackMode_Y_STACKED
, false, true ));
499 case TEMPLATE_PERCENTSTACKEDNET
:
500 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
501 StackMode_Y_STACKED_PERCENT
, true ));
503 case TEMPLATE_PERCENTSTACKEDNETSYMBOL
:
504 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
505 StackMode_Y_STACKED_PERCENT
, true, false ));
507 case TEMPLATE_PERCENTSTACKEDNETLINE
:
508 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
509 StackMode_Y_STACKED_PERCENT
, false, true ));
512 case TEMPLATE_FILLEDNET
:
513 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
514 StackMode_NONE
, false, false, true ));
516 case TEMPLATE_STACKEDFILLEDNET
:
517 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
518 StackMode_Y_STACKED
, false, false, true ));
520 case TEMPLATE_PERCENTSTACKEDFILLEDNET
:
521 xTemplate
.set( new NetChartTypeTemplate( m_xContext
, aServiceSpecifier
,
522 StackMode_Y_STACKED_PERCENT
, false, false, true ));
525 case TEMPLATE_STOCKLOWHIGHCLOSE
:
526 xTemplate
.set( new StockChartTypeTemplate( m_xContext
, aServiceSpecifier
,
527 StockChartTypeTemplate::LOW_HI_CLOSE
, false ));
529 case TEMPLATE_STOCKOPENLOWHIGHCLOSE
:
530 xTemplate
.set( new StockChartTypeTemplate( m_xContext
, aServiceSpecifier
,
531 StockChartTypeTemplate::OPEN_LOW_HI_CLOSE
, true ));
533 case TEMPLATE_STOCKVOLUMELOWHIGHCLOSE
:
534 xTemplate
.set( new StockChartTypeTemplate( m_xContext
, aServiceSpecifier
,
535 StockChartTypeTemplate::VOL_LOW_HI_CLOSE
, false ));
537 case TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE
:
538 xTemplate
.set( new StockChartTypeTemplate( m_xContext
, aServiceSpecifier
,
539 StockChartTypeTemplate::VOL_OPEN_LOW_HI_CLOSE
, true ));
543 case TEMPLATE_BUBBLE
:
544 xTemplate
.set( new BubbleChartTypeTemplate( m_xContext
, aServiceSpecifier
));
547 // case TEMPLATE_SURFACE:
548 // case TEMPLATE_ADDIN:
551 case TEMPLATE_NOT_FOUND
:
555 xResult
.set( xTemplate
, uno::UNO_QUERY
);
561 uno::Reference
< uno::XInterface
> SAL_CALL
ChartTypeManager::createInstanceWithArguments(
562 const OUString
& ServiceSpecifier
,
563 const uno::Sequence
< uno::Any
>& /* Arguments */ )
564 throw (uno::Exception
,
565 uno::RuntimeException
)
567 OSL_ENSURE( false, "createInstanceWithArguments: No arguments supported" );
568 return createInstance( ServiceSpecifier
);
571 uno::Sequence
< OUString
> SAL_CALL
ChartTypeManager::getAvailableServiceNames()
572 throw (uno::RuntimeException
)
574 ::std::vector
< OUString
> aServices
;
575 const tTemplateMapType
& rMap
= lcl_DefaultChartTypeMap();
576 aServices
.reserve( rMap
.size());
578 // get own default templates
579 ::std::transform( rMap
.begin(), rMap
.end(), ::std::back_inserter( aServices
),
580 ::std::select1st
< tTemplateMapType::value_type
>());
582 // add components that were registered in the context's factory
583 uno::Reference
< container::XContentEnumerationAccess
> xEnumAcc(
584 m_xContext
->getServiceManager(), uno::UNO_QUERY
);
587 uno::Reference
< container::XEnumeration
> xEnum(
588 xEnumAcc
->createContentEnumeration( C2U( "com.sun.star.chart2.ChartTypeTemplate" ) ));
591 uno::Reference
< uno::XInterface
> xFactIntf
;
593 while( xEnum
->hasMoreElements())
595 if( xEnum
->nextElement() >>= xFactIntf
)
597 uno::Reference
< lang::XServiceName
> xServiceName( xFactIntf
, uno::UNO_QUERY
);
598 if( xServiceName
.is())
599 aServices
.push_back( xServiceName
->getServiceName());
605 return ContainerHelper::ContainerToSequence( aServices
);
608 // ____ XServiceInfo ____
609 Sequence
< OUString
> ChartTypeManager::getSupportedServiceNames_Static()
611 Sequence
< OUString
> aServices( 2 );
612 aServices
[ 0 ] = C2U( "com.sun.star.chart2.ChartTypeManager" );
613 aServices
[ 1 ] = C2U( "com.sun.star.lang.MultiServiceFactory" );
617 // ================================================================================
619 // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
620 APPHELPER_XSERVICEINFO_IMPL( ChartTypeManager
,
621 C2U( "com.sun.star.comp.chart.ChartTypeManager" ));