33#include <com/sun/star/container/XContentEnumerationAccess.hpp>
34#include <com/sun/star/lang/XServiceName.hpp>
35#include <com/sun/star/uno/XComponentContext.hpp>
46using ::com::sun::star::uno::Sequence;
54 TEMPLATE_STACKEDSYMBOL,
55 TEMPLATE_PERCENTSTACKEDSYMBOL,
58 TEMPLATE_PERCENTSTACKEDLINE,
60 TEMPLATE_STACKEDLINESYMBOL,
61 TEMPLATE_PERCENTSTACKEDLINESYMBOL,
63 TEMPLATE_STACKEDTHREEDLINE,
64 TEMPLATE_PERCENTSTACKEDTHREEDLINE,
65 TEMPLATE_THREEDLINEDEEP,
67 TEMPLATE_STACKEDCOLUMN,
68 TEMPLATE_PERCENTSTACKEDCOLUMN,
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,
84 TEMPLATE_PERCENTSTACKEDAREA,
86 TEMPLATE_STACKEDTHREEDAREA,
87 TEMPLATE_PERCENTSTACKEDTHREEDAREA,
89 TEMPLATE_PIEALLEXPLODED,
91 TEMPLATE_DONUTALLEXPLODED,
93 TEMPLATE_THREEDPIEALLEXPLODED,
95 TEMPLATE_THREEDDONUTALLEXPLODED,
96 TEMPLATE_SCATTERLINESYMBOL,
98 TEMPLATE_SCATTERSYMBOL,
99 TEMPLATE_THREEDSCATTER,
104 TEMPLATE_STACKEDNETSYMBOL,
105 TEMPLATE_STACKEDNETLINE,
106 TEMPLATE_PERCENTSTACKEDNET,
107 TEMPLATE_PERCENTSTACKEDNETSYMBOL,
108 TEMPLATE_PERCENTSTACKEDNETLINE,
110 TEMPLATE_STACKEDFILLEDNET,
111 TEMPLATE_PERCENTSTACKEDFILLEDNET,
112 TEMPLATE_STOCKLOWHIGHCLOSE,
113 TEMPLATE_STOCKOPENLOWHIGHCLOSE,
114 TEMPLATE_STOCKVOLUMELOWHIGHCLOSE,
115 TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE,
119 TEMPLATE_NOT_FOUND = 0xffff
122typedef std::map< OUString, TemplateId > tTemplateMapType;
124const tTemplateMapType & lcl_DefaultChartTypeMap()
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},
197TemplateId lcl_GetTemplateIdForService(
const OUString & rServiceName )
199 TemplateId eResult = TEMPLATE_NOT_FOUND;
200 const tTemplateMapType & rMap = lcl_DefaultChartTypeMap();
201 tTemplateMapType::const_iterator aIt( rMap.find( rServiceName ));
203 if( aIt != rMap.end())
204 eResult = (*aIt).second;
216 uno::XComponentContext > xContext ) :
225 const OUString& aServiceSpecifier )
231 const OUString& aServiceSpecifier )
233 TemplateId
nId = lcl_GetTemplateIdForService( aServiceSpecifier );
239 case TEMPLATE_SYMBOL:
243 case TEMPLATE_STACKEDSYMBOL:
247 case TEMPLATE_PERCENTSTACKEDSYMBOL:
256 case TEMPLATE_STACKEDLINE:
260 case TEMPLATE_PERCENTSTACKEDLINE:
264 case TEMPLATE_LINESYMBOL:
268 case TEMPLATE_STACKEDLINESYMBOL:
272 case TEMPLATE_PERCENTSTACKEDLINESYMBOL:
276 case TEMPLATE_THREEDLINE:
280 case TEMPLATE_STACKEDTHREEDLINE:
284 case TEMPLATE_PERCENTSTACKEDTHREEDLINE:
288 case TEMPLATE_THREEDLINEDEEP:
294 case TEMPLATE_COLUMN:
298 case TEMPLATE_STACKEDCOLUMN:
302 case TEMPLATE_PERCENTSTACKEDCOLUMN:
310 case TEMPLATE_STACKEDBAR:
314 case TEMPLATE_PERCENTSTACKEDBAR:
318 case TEMPLATE_THREEDCOLUMNDEEP:
322 case TEMPLATE_THREEDCOLUMNFLAT:
326 case TEMPLATE_STACKEDTHREEDCOLUMNFLAT:
330 case TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT:
334 case TEMPLATE_THREEDBARDEEP:
338 case TEMPLATE_THREEDBARFLAT:
342 case TEMPLATE_STACKEDTHREEDBARFLAT:
346 case TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT:
352 case TEMPLATE_COLUMNWITHLINE:
353 case TEMPLATE_STACKEDCOLUMNWITHLINE:
367 case TEMPLATE_STACKEDAREA:
370 case TEMPLATE_PERCENTSTACKEDAREA:
373 case TEMPLATE_THREEDAREA:
376 case TEMPLATE_STACKEDTHREEDAREA:
379 case TEMPLATE_PERCENTSTACKEDTHREEDAREA:
385 chart2::PieChartOffsetMode_NONE,
false ));
387 case TEMPLATE_PIEALLEXPLODED:
389 chart2::PieChartOffsetMode_ALL_EXPLODED,
false ));
393 chart2::PieChartOffsetMode_NONE,
true ));
395 case TEMPLATE_DONUTALLEXPLODED:
397 chart2::PieChartOffsetMode_ALL_EXPLODED,
true ));
399 case TEMPLATE_THREEDPIE:
401 chart2::PieChartOffsetMode_NONE,
false, 3 ));
403 case TEMPLATE_THREEDPIEALLEXPLODED:
405 chart2::PieChartOffsetMode_ALL_EXPLODED,
false, 3 ));
407 case TEMPLATE_THREEDDONUT:
409 chart2::PieChartOffsetMode_NONE,
true, 3 ));
411 case TEMPLATE_THREEDDONUTALLEXPLODED:
413 chart2::PieChartOffsetMode_ALL_EXPLODED,
true, 3 ));
416 case TEMPLATE_SCATTERLINESYMBOL:
419 case TEMPLATE_SCATTERLINE:
422 case TEMPLATE_SCATTERSYMBOL:
425 case TEMPLATE_THREEDSCATTER:
434 case TEMPLATE_NETSYMBOL:
438 case TEMPLATE_NETLINE:
443 case TEMPLATE_STACKEDNET:
447 case TEMPLATE_STACKEDNETSYMBOL:
451 case TEMPLATE_STACKEDNETLINE:
456 case TEMPLATE_PERCENTSTACKEDNET:
460 case TEMPLATE_PERCENTSTACKEDNETSYMBOL:
464 case TEMPLATE_PERCENTSTACKEDNETLINE:
469 case TEMPLATE_FILLEDNET:
473 case TEMPLATE_STACKEDFILLEDNET:
477 case TEMPLATE_PERCENTSTACKEDFILLEDNET:
482 case TEMPLATE_STOCKLOWHIGHCLOSE:
486 case TEMPLATE_STOCKOPENLOWHIGHCLOSE:
490 case TEMPLATE_STOCKVOLUMELOWHIGHCLOSE:
494 case TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE:
500 case TEMPLATE_BUBBLE:
504 case TEMPLATE_NOT_FOUND:
505 SAL_WARN(
"chart2",
"Couldn't instantiate service: "<< aServiceSpecifier );
519 const OUString& ServiceSpecifier,
522 OSL_FAIL(
"createInstanceWithArguments: No arguments supported" );
528 std::vector< OUString > aServices;
529 const tTemplateMapType & rMap = lcl_DefaultChartTypeMap();
530 aServices.reserve( rMap.size());
533 std::transform( rMap.begin(), rMap.end(), std::back_inserter( aServices ),
538 m_xContext->getServiceManager(), uno::UNO_QUERY );
542 xEnumAcc->createContentEnumeration(
"com.sun.star.chart2.ChartTypeTemplate" ));
547 while( xEnum->hasMoreElements())
549 if( xEnum->nextElement() >>= xFactIntf )
552 if( xServiceName.is())
553 aServices.push_back( xServiceName->getServiceName());
565 return "com.sun.star.comp.chart.ChartTypeManager";
576 "com.sun.star.chart2.ChartTypeManager",
577 "com.sun.star.lang.MultiServiceFactory" };
582extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
584 css::uno::Sequence<css::uno::Any>
const &)
586 return cppu::acquire(new ::chart::ChartTypeManager(context));
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)
#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