LibreOffice Module chart2 (master) 1
ChartTypeManager.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <ChartTypeManager.hxx>
21#include <StackMode.hxx>
22
33#include <com/sun/star/container/XContentEnumerationAccess.hpp>
34#include <com/sun/star/lang/XServiceName.hpp>
35#include <com/sun/star/uno/XComponentContext.hpp>
36#include <sal/log.hxx>
37
38#include <algorithm>
39#include <iterator>
40#include <o3tl/functional.hxx>
41#include <map>
42#include <utility>
43
44using namespace ::com::sun::star;
45
46using ::com::sun::star::uno::Sequence;
47
48namespace
49{
50
51enum TemplateId
52{
53 TEMPLATE_SYMBOL,
54 TEMPLATE_STACKEDSYMBOL,
55 TEMPLATE_PERCENTSTACKEDSYMBOL,
56 TEMPLATE_LINE,
57 TEMPLATE_STACKEDLINE,
58 TEMPLATE_PERCENTSTACKEDLINE,
59 TEMPLATE_LINESYMBOL,
60 TEMPLATE_STACKEDLINESYMBOL,
61 TEMPLATE_PERCENTSTACKEDLINESYMBOL,
62 TEMPLATE_THREEDLINE,
63 TEMPLATE_STACKEDTHREEDLINE,
64 TEMPLATE_PERCENTSTACKEDTHREEDLINE,
65 TEMPLATE_THREEDLINEDEEP,
66 TEMPLATE_COLUMN,
67 TEMPLATE_STACKEDCOLUMN,
68 TEMPLATE_PERCENTSTACKEDCOLUMN,
69 TEMPLATE_BAR,
70 TEMPLATE_STACKEDBAR,
71 TEMPLATE_PERCENTSTACKEDBAR,
72 TEMPLATE_THREEDCOLUMNDEEP,
73 TEMPLATE_THREEDCOLUMNFLAT,
74 TEMPLATE_STACKEDTHREEDCOLUMNFLAT,
75 TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT,
76 TEMPLATE_THREEDBARDEEP,
77 TEMPLATE_THREEDBARFLAT,
78 TEMPLATE_STACKEDTHREEDBARFLAT,
79 TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT,
80 TEMPLATE_COLUMNWITHLINE,
81 TEMPLATE_STACKEDCOLUMNWITHLINE,
82 TEMPLATE_AREA,
83 TEMPLATE_STACKEDAREA,
84 TEMPLATE_PERCENTSTACKEDAREA,
85 TEMPLATE_THREEDAREA,
86 TEMPLATE_STACKEDTHREEDAREA,
87 TEMPLATE_PERCENTSTACKEDTHREEDAREA,
88 TEMPLATE_PIE,
89 TEMPLATE_PIEALLEXPLODED,
90 TEMPLATE_DONUT,
91 TEMPLATE_DONUTALLEXPLODED,
92 TEMPLATE_THREEDPIE,
93 TEMPLATE_THREEDPIEALLEXPLODED,
94 TEMPLATE_THREEDDONUT,
95 TEMPLATE_THREEDDONUTALLEXPLODED,
96 TEMPLATE_SCATTERLINESYMBOL,
97 TEMPLATE_SCATTERLINE,
98 TEMPLATE_SCATTERSYMBOL,
99 TEMPLATE_THREEDSCATTER,
100 TEMPLATE_NET,
101 TEMPLATE_NETSYMBOL,
102 TEMPLATE_NETLINE,
103 TEMPLATE_STACKEDNET,
104 TEMPLATE_STACKEDNETSYMBOL,
105 TEMPLATE_STACKEDNETLINE,
106 TEMPLATE_PERCENTSTACKEDNET,
107 TEMPLATE_PERCENTSTACKEDNETSYMBOL,
108 TEMPLATE_PERCENTSTACKEDNETLINE,
109 TEMPLATE_FILLEDNET,
110 TEMPLATE_STACKEDFILLEDNET,
111 TEMPLATE_PERCENTSTACKEDFILLEDNET,
112 TEMPLATE_STOCKLOWHIGHCLOSE,
113 TEMPLATE_STOCKOPENLOWHIGHCLOSE,
114 TEMPLATE_STOCKVOLUMELOWHIGHCLOSE,
115 TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE,
116 TEMPLATE_BUBBLE,
117// TEMPLATE_SURFACE,
118// TEMPLATE_ADDIN,
119 TEMPLATE_NOT_FOUND = 0xffff
120};
121
122typedef std::map< OUString, TemplateId > tTemplateMapType;
123
124const tTemplateMapType & lcl_DefaultChartTypeMap()
125{
126 static const tTemplateMapType aMap{
127 {"com.sun.star.chart2.template.Symbol", TEMPLATE_SYMBOL},
128 {"com.sun.star.chart2.template.StackedSymbol", TEMPLATE_STACKEDSYMBOL},
129 {"com.sun.star.chart2.template.PercentStackedSymbol", TEMPLATE_PERCENTSTACKEDSYMBOL},
130 {"com.sun.star.chart2.template.Line", TEMPLATE_LINE},
131 {"com.sun.star.chart2.template.StackedLine", TEMPLATE_STACKEDLINE},
132 {"com.sun.star.chart2.template.PercentStackedLine", TEMPLATE_PERCENTSTACKEDLINE},
133 {"com.sun.star.chart2.template.LineSymbol", TEMPLATE_LINESYMBOL},
134 {"com.sun.star.chart2.template.StackedLineSymbol", TEMPLATE_STACKEDLINESYMBOL},
135 {"com.sun.star.chart2.template.PercentStackedLineSymbol", TEMPLATE_PERCENTSTACKEDLINESYMBOL},
136 {"com.sun.star.chart2.template.ThreeDLine", TEMPLATE_THREEDLINE},
137 {"com.sun.star.chart2.template.StackedThreeDLine", TEMPLATE_STACKEDTHREEDLINE},
138 {"com.sun.star.chart2.template.PercentStackedThreeDLine", TEMPLATE_PERCENTSTACKEDTHREEDLINE},
139 {"com.sun.star.chart2.template.ThreeDLineDeep", TEMPLATE_THREEDLINEDEEP},
140 {"com.sun.star.chart2.template.Column", TEMPLATE_COLUMN},
141 {"com.sun.star.chart2.template.StackedColumn", TEMPLATE_STACKEDCOLUMN},
142 {"com.sun.star.chart2.template.PercentStackedColumn", TEMPLATE_PERCENTSTACKEDCOLUMN},
143 {"com.sun.star.chart2.template.Bar", TEMPLATE_BAR},
144 {"com.sun.star.chart2.template.StackedBar", TEMPLATE_STACKEDBAR},
145 {"com.sun.star.chart2.template.PercentStackedBar", TEMPLATE_PERCENTSTACKEDBAR},
146 {"com.sun.star.chart2.template.ThreeDColumnDeep", TEMPLATE_THREEDCOLUMNDEEP},
147 {"com.sun.star.chart2.template.ThreeDColumnFlat", TEMPLATE_THREEDCOLUMNFLAT},
148 {"com.sun.star.chart2.template.StackedThreeDColumnFlat", TEMPLATE_STACKEDTHREEDCOLUMNFLAT},
149 {"com.sun.star.chart2.template.PercentStackedThreeDColumnFlat", TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT},
150 {"com.sun.star.chart2.template.ThreeDBarDeep", TEMPLATE_THREEDBARDEEP},
151 {"com.sun.star.chart2.template.ThreeDBarFlat", TEMPLATE_THREEDBARFLAT},
152 {"com.sun.star.chart2.template.StackedThreeDBarFlat", TEMPLATE_STACKEDTHREEDBARFLAT},
153 {"com.sun.star.chart2.template.PercentStackedThreeDBarFlat", TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT},
154 {"com.sun.star.chart2.template.ColumnWithLine", TEMPLATE_COLUMNWITHLINE},
155 {"com.sun.star.chart2.template.StackedColumnWithLine", TEMPLATE_STACKEDCOLUMNWITHLINE},
156 {"com.sun.star.chart2.template.Area", TEMPLATE_AREA},
157 {"com.sun.star.chart2.template.StackedArea", TEMPLATE_STACKEDAREA},
158 {"com.sun.star.chart2.template.PercentStackedArea", TEMPLATE_PERCENTSTACKEDAREA},
159 {"com.sun.star.chart2.template.ThreeDArea", TEMPLATE_THREEDAREA},
160 {"com.sun.star.chart2.template.StackedThreeDArea", TEMPLATE_STACKEDTHREEDAREA},
161 {"com.sun.star.chart2.template.PercentStackedThreeDArea", TEMPLATE_PERCENTSTACKEDTHREEDAREA},
162 {"com.sun.star.chart2.template.Pie", TEMPLATE_PIE},
163 {"com.sun.star.chart2.template.PieAllExploded", TEMPLATE_PIEALLEXPLODED},
164 {"com.sun.star.chart2.template.Donut", TEMPLATE_DONUT},
165 {"com.sun.star.chart2.template.DonutAllExploded", TEMPLATE_DONUTALLEXPLODED},
166 {"com.sun.star.chart2.template.ThreeDPie", TEMPLATE_THREEDPIE},
167 {"com.sun.star.chart2.template.ThreeDPieAllExploded", TEMPLATE_THREEDPIEALLEXPLODED},
168 {"com.sun.star.chart2.template.ThreeDDonut", TEMPLATE_THREEDDONUT},
169 {"com.sun.star.chart2.template.ThreeDDonutAllExploded", TEMPLATE_THREEDDONUTALLEXPLODED},
170 {"com.sun.star.chart2.template.ScatterLineSymbol", TEMPLATE_SCATTERLINESYMBOL},
171 {"com.sun.star.chart2.template.ScatterLine", TEMPLATE_SCATTERLINE},
172 {"com.sun.star.chart2.template.ScatterSymbol", TEMPLATE_SCATTERSYMBOL},
173 {"com.sun.star.chart2.template.ThreeDScatter", TEMPLATE_THREEDSCATTER},
174 {"com.sun.star.chart2.template.Net", TEMPLATE_NET},
175 {"com.sun.star.chart2.template.NetSymbol", TEMPLATE_NETSYMBOL},
176 {"com.sun.star.chart2.template.NetLine", TEMPLATE_NETLINE},
177 {"com.sun.star.chart2.template.StackedNet", TEMPLATE_STACKEDNET},
178 {"com.sun.star.chart2.template.StackedNetSymbol", TEMPLATE_STACKEDNETSYMBOL},
179 {"com.sun.star.chart2.template.StackedNetLine", TEMPLATE_STACKEDNETLINE},
180 {"com.sun.star.chart2.template.PercentStackedNet", TEMPLATE_PERCENTSTACKEDNET},
181 {"com.sun.star.chart2.template.PercentStackedNetSymbol", TEMPLATE_PERCENTSTACKEDNETSYMBOL},
182 {"com.sun.star.chart2.template.PercentStackedNetLine", TEMPLATE_PERCENTSTACKEDNETLINE},
183 {"com.sun.star.chart2.template.FilledNet", TEMPLATE_FILLEDNET},
184 {"com.sun.star.chart2.template.StackedFilledNet", TEMPLATE_STACKEDFILLEDNET},
185 {"com.sun.star.chart2.template.PercentStackedFilledNet", TEMPLATE_PERCENTSTACKEDFILLEDNET},
186 {"com.sun.star.chart2.template.StockLowHighClose", TEMPLATE_STOCKLOWHIGHCLOSE},
187 {"com.sun.star.chart2.template.StockOpenLowHighClose", TEMPLATE_STOCKOPENLOWHIGHCLOSE},
188 {"com.sun.star.chart2.template.StockVolumeLowHighClose", TEMPLATE_STOCKVOLUMELOWHIGHCLOSE},
189 {"com.sun.star.chart2.template.StockVolumeOpenLowHighClose", TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE},
190 {"com.sun.star.chart2.template.Bubble", TEMPLATE_BUBBLE},
191// {"com.sun.star.chart2.template.Surface", TEMPLATE_SURFACE},
192// {"com.sun.star.chart2.template.Addin", TEMPLATE_ADDIN},
193 };
194 return aMap;
195}
196
197TemplateId lcl_GetTemplateIdForService( const OUString & rServiceName )
198{
199 TemplateId eResult = TEMPLATE_NOT_FOUND;
200 const tTemplateMapType & rMap = lcl_DefaultChartTypeMap();
201 tTemplateMapType::const_iterator aIt( rMap.find( rServiceName ));
202
203 if( aIt != rMap.end())
204 eResult = (*aIt).second;
205
206 return eResult;
207}
208
209} // anonymous namespace
210
211namespace chart
212{
213
216 uno::XComponentContext > xContext ) :
217 m_xContext(std::move( xContext ))
218{}
219
221{}
222
223// ____ XMultiServiceFactory ____
225 const OUString& aServiceSpecifier )
226{
227 return static_cast<cppu::OWeakObject*>(createTemplate(aServiceSpecifier).get());
228}
229
231 const OUString& aServiceSpecifier )
232{
233 TemplateId nId = lcl_GetTemplateIdForService( aServiceSpecifier );
234
236 switch( nId )
237 {
238 // Point (category x axis)
239 case TEMPLATE_SYMBOL:
240 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
241 StackMode::NONE, true, false ));
242 break;
243 case TEMPLATE_STACKEDSYMBOL:
244 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
245 StackMode::YStacked, true, false ));
246 break;
247 case TEMPLATE_PERCENTSTACKEDSYMBOL:
248 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
249 StackMode::YStackedPercent, true, false ));
250 break;
251 // Line (category x axis)
252 case TEMPLATE_LINE:
253 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
254 StackMode::NONE, false ));
255 break;
256 case TEMPLATE_STACKEDLINE:
257 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
258 StackMode::YStacked, false ));
259 break;
260 case TEMPLATE_PERCENTSTACKEDLINE:
261 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
263 break;
264 case TEMPLATE_LINESYMBOL:
265 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
266 StackMode::NONE, true ));
267 break;
268 case TEMPLATE_STACKEDLINESYMBOL:
269 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
270 StackMode::YStacked, true ));
271 break;
272 case TEMPLATE_PERCENTSTACKEDLINESYMBOL:
273 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
275 break;
276 case TEMPLATE_THREEDLINE:
277 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
278 StackMode::NONE, false, true, 3 ));
279 break;
280 case TEMPLATE_STACKEDTHREEDLINE:
281 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
282 StackMode::YStacked, false, true, 3 ));
283 break;
284 case TEMPLATE_PERCENTSTACKEDTHREEDLINE:
285 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
286 StackMode::YStackedPercent, false, true, 3 ));
287 break;
288 case TEMPLATE_THREEDLINEDEEP:
289 xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
290 StackMode::ZStacked, false, true, 3 ));
291 break;
292
293 // Bar/Column
294 case TEMPLATE_COLUMN:
295 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
297 break;
298 case TEMPLATE_STACKEDCOLUMN:
299 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
301 break;
302 case TEMPLATE_PERCENTSTACKEDCOLUMN:
303 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
305 break;
306 case TEMPLATE_BAR:
307 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
309 break;
310 case TEMPLATE_STACKEDBAR:
311 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
313 break;
314 case TEMPLATE_PERCENTSTACKEDBAR:
315 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
317 break;
318 case TEMPLATE_THREEDCOLUMNDEEP:
319 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
321 break;
322 case TEMPLATE_THREEDCOLUMNFLAT:
323 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
325 break;
326 case TEMPLATE_STACKEDTHREEDCOLUMNFLAT:
327 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
329 break;
330 case TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT:
331 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
333 break;
334 case TEMPLATE_THREEDBARDEEP:
335 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
337 break;
338 case TEMPLATE_THREEDBARFLAT:
339 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
341 break;
342 case TEMPLATE_STACKEDTHREEDBARFLAT:
343 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
345 break;
346 case TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT:
347 xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
349 break;
350
351 // Combi-Chart Line/Column
352 case TEMPLATE_COLUMNWITHLINE:
353 case TEMPLATE_STACKEDCOLUMNWITHLINE:
354 {
355 StackMode eMode = ( nId == TEMPLATE_COLUMNWITHLINE )
358
359 xTemplate.set( new ColumnLineChartTypeTemplate( m_xContext, aServiceSpecifier, eMode, 1 ));
360 }
361 break;
362
363 // Area
364 case TEMPLATE_AREA:
365 xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::NONE ));
366 break;
367 case TEMPLATE_STACKEDAREA:
368 xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStacked ));
369 break;
370 case TEMPLATE_PERCENTSTACKEDAREA:
371 xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStackedPercent ));
372 break;
373 case TEMPLATE_THREEDAREA:
374 xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::ZStacked, 3 ));
375 break;
376 case TEMPLATE_STACKEDTHREEDAREA:
377 xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStacked, 3 ));
378 break;
379 case TEMPLATE_PERCENTSTACKEDTHREEDAREA:
380 xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStackedPercent, 3 ));
381 break;
382
383 case TEMPLATE_PIE:
384 xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
385 chart2::PieChartOffsetMode_NONE, false ));
386 break;
387 case TEMPLATE_PIEALLEXPLODED:
388 xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
389 chart2::PieChartOffsetMode_ALL_EXPLODED, false ));
390 break;
391 case TEMPLATE_DONUT:
392 xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
393 chart2::PieChartOffsetMode_NONE, true ));
394 break;
395 case TEMPLATE_DONUTALLEXPLODED:
396 xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
397 chart2::PieChartOffsetMode_ALL_EXPLODED, true ));
398 break;
399 case TEMPLATE_THREEDPIE:
400 xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
401 chart2::PieChartOffsetMode_NONE, false, 3 ));
402 break;
403 case TEMPLATE_THREEDPIEALLEXPLODED:
404 xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
405 chart2::PieChartOffsetMode_ALL_EXPLODED, false, 3 ));
406 break;
407 case TEMPLATE_THREEDDONUT:
408 xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
409 chart2::PieChartOffsetMode_NONE, true, 3 ));
410 break;
411 case TEMPLATE_THREEDDONUTALLEXPLODED:
412 xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
413 chart2::PieChartOffsetMode_ALL_EXPLODED, true, 3 ));
414 break;
415
416 case TEMPLATE_SCATTERLINESYMBOL:
417 xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ true ));
418 break;
419 case TEMPLATE_SCATTERLINE:
420 xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ false ));
421 break;
422 case TEMPLATE_SCATTERSYMBOL:
423 xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ true, /* bHasLines */ false ));
424 break;
425 case TEMPLATE_THREEDSCATTER:
426 xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ false, /* bHasLines */ true, 3 ));
427 break;
428
429 // NetChart
430 case TEMPLATE_NET:
431 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
432 StackMode::NONE, true ));
433 break;
434 case TEMPLATE_NETSYMBOL:
435 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
436 StackMode::NONE, true, false ));
437 break;
438 case TEMPLATE_NETLINE:
439 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
440 StackMode::NONE, false ));
441 break;
442
443 case TEMPLATE_STACKEDNET:
444 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
445 StackMode::YStacked, true ));
446 break;
447 case TEMPLATE_STACKEDNETSYMBOL:
448 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
449 StackMode::YStacked, true, false ));
450 break;
451 case TEMPLATE_STACKEDNETLINE:
452 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
453 StackMode::YStacked, false, true ));
454 break;
455
456 case TEMPLATE_PERCENTSTACKEDNET:
457 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
459 break;
460 case TEMPLATE_PERCENTSTACKEDNETSYMBOL:
461 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
462 StackMode::YStackedPercent, true, false ));
463 break;
464 case TEMPLATE_PERCENTSTACKEDNETLINE:
465 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
466 StackMode::YStackedPercent, false, true ));
467 break;
468
469 case TEMPLATE_FILLEDNET:
470 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
471 StackMode::NONE, false, false, true ));
472 break;
473 case TEMPLATE_STACKEDFILLEDNET:
474 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
475 StackMode::YStacked, false, false, true ));
476 break;
477 case TEMPLATE_PERCENTSTACKEDFILLEDNET:
478 xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
479 StackMode::YStackedPercent, false, false, true ));
480 break;
481
482 case TEMPLATE_STOCKLOWHIGHCLOSE:
483 xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
485 break;
486 case TEMPLATE_STOCKOPENLOWHIGHCLOSE:
487 xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
489 break;
490 case TEMPLATE_STOCKVOLUMELOWHIGHCLOSE:
491 xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
493 break;
494 case TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE:
495 xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
497 break;
498
499 //BubbleChart
500 case TEMPLATE_BUBBLE:
501 xTemplate.set( new BubbleChartTypeTemplate( m_xContext, aServiceSpecifier ));
502 break;
503
504 case TEMPLATE_NOT_FOUND:
505 SAL_WARN("chart2", "Couldn't instantiate service: "<< aServiceSpecifier );
506 assert(false);
507 break;
508
509 default: break;
510// case TEMPLATE_SURFACE:
511// case TEMPLATE_ADDIN:
512// break;
513 }
514
515 return xTemplate;
516}
517
519 const OUString& ServiceSpecifier,
520 const uno::Sequence< uno::Any >& /* Arguments */ )
521{
522 OSL_FAIL( "createInstanceWithArguments: No arguments supported" );
523 return createInstance( ServiceSpecifier );
524}
525
527{
528 std::vector< OUString > aServices;
529 const tTemplateMapType & rMap = lcl_DefaultChartTypeMap();
530 aServices.reserve( rMap.size());
531
532 // get own default templates
533 std::transform( rMap.begin(), rMap.end(), std::back_inserter( aServices ),
535
536 // add components that were registered in the context's factory
538 m_xContext->getServiceManager(), uno::UNO_QUERY );
539 if( xEnumAcc.is())
540 {
542 xEnumAcc->createContentEnumeration( "com.sun.star.chart2.ChartTypeTemplate" ));
543 if( xEnum.is())
544 {
546
547 while( xEnum->hasMoreElements())
548 {
549 if( xEnum->nextElement() >>= xFactIntf )
550 {
551 uno::Reference< lang::XServiceName > xServiceName( xFactIntf, uno::UNO_QUERY );
552 if( xServiceName.is())
553 aServices.push_back( xServiceName->getServiceName());
554 }
555 }
556 }
557 }
558
559 return comphelper::containerToSequence( aServices );
560}
561
562// ____ XServiceInfo ____
564{
565 return "com.sun.star.comp.chart.ChartTypeManager";
566}
567
568sal_Bool SAL_CALL ChartTypeManager::supportsService( const OUString& rServiceName )
569{
570 return cppu::supportsService(this, rServiceName);
571}
572
573css::uno::Sequence< OUString > SAL_CALL ChartTypeManager::getSupportedServiceNames()
574{
575 return {
576 "com.sun.star.chart2.ChartTypeManager",
577 "com.sun.star.lang.MultiServiceFactory" };
578}
579
580} // namespace chart
581
582extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
584 css::uno::Sequence<css::uno::Any> const &)
585{
586 return cppu::acquire(new ::chart::ChartTypeManager(context));
587}
588
589/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_chart_ChartTypeManager_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Reference< uno::XComponentContext > m_xContext
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual ~ChartTypeManager() override
virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override
virtual OUString SAL_CALL getImplementationName() override
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const OUString &ServiceSpecifier, const css::uno::Sequence< css::uno::Any > &Arguments) override
ChartTypeManager(css::uno::Reference< css::uno::XComponentContext > xContext)
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(const OUString &aServiceSpecifier) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
rtl::Reference< ::chart::ChartTypeTemplate > createTemplate(const OUString &aServiceSpecifier)
Mode eMode
#define SAL_WARN(area, stream)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
HashMap_OWString_Interface aMap
sal_Int16 nId
unsigned char sal_Bool