Line data Source code
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 "StockChartTypeTemplate.hxx"
21 : #include "macros.hxx"
22 : #include "DataSeriesHelper.hxx"
23 : #include "StockDataInterpreter.hxx"
24 : #include "CartesianCoordinateSystem.hxx"
25 : #include "AxisHelper.hxx"
26 : #include "DiagramHelper.hxx"
27 : #include "servicenames_charttypes.hxx"
28 : #include "servicenames_coosystems.hxx"
29 : #include "ContainerHelper.hxx"
30 : #include "AxisIndexDefines.hxx"
31 : #include <com/sun/star/chart2/AxisType.hpp>
32 : #include <com/sun/star/chart2/data/XDataSource.hpp>
33 : #include <com/sun/star/chart2/XChartTypeContainer.hpp>
34 : #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
35 : #include "PropertyHelper.hxx"
36 : #include <com/sun/star/beans/PropertyAttribute.hpp>
37 : #include <com/sun/star/drawing/LineStyle.hpp>
38 :
39 : #include <vector>
40 : #include <algorithm>
41 :
42 : using namespace ::com::sun::star;
43 : using namespace ::com::sun::star::chart2;
44 :
45 : using ::com::sun::star::uno::Reference;
46 : using ::com::sun::star::uno::Sequence;
47 : using ::com::sun::star::beans::Property;
48 : using ::com::sun::star::uno::Any;
49 : using ::osl::MutexGuard;
50 :
51 : namespace
52 : {
53 :
54 : enum
55 : {
56 : PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME,
57 : PROP_STOCKCHARTTYPE_TEMPLATE_OPEN,
58 : PROP_STOCKCHARTTYPE_TEMPLATE_LOW_HIGH,
59 : PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE
60 : };
61 :
62 4 : void lcl_AddPropertiesToVector(
63 : ::std::vector< Property > & rOutProperties )
64 : {
65 : rOutProperties.push_back(
66 : Property( "Volume",
67 : PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME,
68 4 : ::getBooleanCppuType(),
69 : beans::PropertyAttribute::BOUND
70 8 : | beans::PropertyAttribute::MAYBEDEFAULT ));
71 : rOutProperties.push_back(
72 : Property( "Open",
73 : PROP_STOCKCHARTTYPE_TEMPLATE_OPEN,
74 4 : ::getBooleanCppuType(),
75 : beans::PropertyAttribute::BOUND
76 8 : | beans::PropertyAttribute::MAYBEDEFAULT ));
77 : rOutProperties.push_back(
78 : Property( "LowHigh",
79 : PROP_STOCKCHARTTYPE_TEMPLATE_LOW_HIGH,
80 4 : ::getBooleanCppuType(),
81 : beans::PropertyAttribute::BOUND
82 8 : | beans::PropertyAttribute::MAYBEDEFAULT ));
83 : rOutProperties.push_back(
84 : Property( "Japanese",
85 : PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE,
86 4 : ::getBooleanCppuType(),
87 : beans::PropertyAttribute::BOUND
88 8 : | beans::PropertyAttribute::MAYBEDEFAULT ));
89 4 : }
90 :
91 : struct StaticStockChartTypeTemplateDefaults_Initializer
92 : {
93 4 : ::chart::tPropertyValueMap* operator()()
94 : {
95 4 : static ::chart::tPropertyValueMap aStaticDefaults;
96 4 : lcl_AddDefaultsToMap( aStaticDefaults );
97 4 : return &aStaticDefaults;
98 : }
99 : private:
100 4 : void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
101 : {
102 4 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME, false );
103 4 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_STOCKCHARTTYPE_TEMPLATE_OPEN, false );
104 4 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_STOCKCHARTTYPE_TEMPLATE_LOW_HIGH, true );
105 4 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE, false );
106 4 : }
107 : };
108 :
109 : struct StaticStockChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticStockChartTypeTemplateDefaults_Initializer >
110 : {
111 : };
112 :
113 : struct StaticStockChartTypeTemplateInfoHelper_Initializer
114 : {
115 4 : ::cppu::OPropertyArrayHelper* operator()()
116 : {
117 4 : static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
118 4 : return &aPropHelper;
119 : }
120 :
121 : private:
122 4 : Sequence< Property > lcl_GetPropertySequence()
123 : {
124 4 : ::std::vector< ::com::sun::star::beans::Property > aProperties;
125 4 : lcl_AddPropertiesToVector( aProperties );
126 :
127 : ::std::sort( aProperties.begin(), aProperties.end(),
128 4 : ::chart::PropertyNameLess() );
129 :
130 4 : return ::chart::ContainerHelper::ContainerToSequence( aProperties );
131 : }
132 : };
133 :
134 : struct StaticStockChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticStockChartTypeTemplateInfoHelper_Initializer >
135 : {
136 : };
137 :
138 : struct StaticStockChartTypeTemplateInfo_Initializer
139 : {
140 0 : uno::Reference< beans::XPropertySetInfo >* operator()()
141 : {
142 : static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
143 0 : ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticStockChartTypeTemplateInfoHelper::get() ) );
144 0 : return &xPropertySetInfo;
145 : }
146 : };
147 :
148 : struct StaticStockChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticStockChartTypeTemplateInfo_Initializer >
149 : {
150 : };
151 :
152 : } // anonymous namespace
153 :
154 : namespace chart
155 : {
156 :
157 2482 : StockChartTypeTemplate::StockChartTypeTemplate(
158 : uno::Reference<
159 : uno::XComponentContext > const & xContext,
160 : const OUString & rServiceName,
161 : StockVariant eVariant,
162 : bool bJapaneseStyle ) :
163 : ChartTypeTemplate( xContext, rServiceName ),
164 : ::property::OPropertySet( m_aMutex ),
165 2482 : m_eStockVariant( eVariant )
166 : {
167 : setFastPropertyValue_NoBroadcast(
168 : PROP_STOCKCHARTTYPE_TEMPLATE_OPEN,
169 2482 : uno::makeAny( ( eVariant == OPEN_LOW_HI_CLOSE ||
170 2482 : eVariant == VOL_OPEN_LOW_HI_CLOSE )));
171 : setFastPropertyValue_NoBroadcast(
172 : PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME,
173 2482 : uno::makeAny( ( eVariant == VOL_LOW_HI_CLOSE ||
174 2482 : eVariant == VOL_OPEN_LOW_HI_CLOSE )));
175 : setFastPropertyValue_NoBroadcast(
176 : PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE,
177 2482 : uno::makeAny( bJapaneseStyle ));
178 2482 : }
179 :
180 4964 : StockChartTypeTemplate::~StockChartTypeTemplate()
181 4964 : {}
182 : // ____ OPropertySet ____
183 11218 : uno::Any StockChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
184 : throw(beans::UnknownPropertyException)
185 : {
186 11218 : const tPropertyValueMap& rStaticDefaults = *StaticStockChartTypeTemplateDefaults::get();
187 11218 : tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
188 11218 : if( aFound == rStaticDefaults.end() )
189 0 : return uno::Any();
190 11218 : return (*aFound).second;
191 : }
192 :
193 7484 : ::cppu::IPropertyArrayHelper & SAL_CALL StockChartTypeTemplate::getInfoHelper()
194 : {
195 7484 : return *StaticStockChartTypeTemplateInfoHelper::get();
196 : }
197 :
198 : // ____ XPropertySet ____
199 0 : uno::Reference< beans::XPropertySetInfo > SAL_CALL StockChartTypeTemplate::getPropertySetInfo()
200 : throw (uno::RuntimeException, std::exception)
201 : {
202 0 : return *StaticStockChartTypeTemplateInfo::get();
203 : }
204 :
205 12 : sal_Int32 StockChartTypeTemplate::getAxisCountByDimension( sal_Int32 nDimension )
206 : {
207 : // one x-axis
208 12 : if( nDimension <= 0 )
209 6 : return 1;
210 : // no further axes
211 6 : if( nDimension >= 2 )
212 0 : return 0;
213 :
214 : // one or two y-axes depending on volume
215 : OSL_ASSERT( nDimension == 1 );
216 6 : bool bHasVolume = false;
217 6 : getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME ) >>= bHasVolume;
218 6 : return bHasVolume ? 2 : 1;
219 : }
220 :
221 10 : void SAL_CALL StockChartTypeTemplate::applyStyle(
222 : const Reference< chart2::XDataSeries >& xSeries,
223 : ::sal_Int32 nChartTypeIndex,
224 : ::sal_Int32 nSeriesIndex,
225 : ::sal_Int32 nSeriesCount )
226 : throw (uno::RuntimeException, std::exception)
227 : {
228 10 : ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
229 : try
230 : {
231 10 : sal_Int32 nNewAxisIndex = 0;
232 :
233 10 : bool bHasVolume = false;
234 10 : getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME ) >>= bHasVolume;
235 10 : if( bHasVolume )
236 : {
237 0 : if( nChartTypeIndex != 0 )
238 0 : nNewAxisIndex = 1;
239 : }
240 :
241 10 : Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY );
242 10 : if( xProp.is() )
243 10 : xProp->setPropertyValue( "AttachedAxisIndex", uno::makeAny( nNewAxisIndex ) );
244 :
245 10 : if( bHasVolume && nChartTypeIndex==0 )
246 : {
247 : //switch lines off for volume bars
248 0 : DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, "BorderStyle", uno::makeAny( drawing::LineStyle_NONE ) );
249 : }
250 : else
251 : {
252 : //ensure that lines are on
253 10 : if( xProp.is() )
254 : {
255 10 : drawing::LineStyle eStyle = drawing::LineStyle_NONE;
256 10 : xProp->getPropertyValue( "LineStyle" ) >>= eStyle;
257 10 : if( eStyle == drawing::LineStyle_NONE )
258 0 : xProp->setPropertyValue( "LineStyle", uno::makeAny( drawing::LineStyle_SOLID ));
259 : }
260 10 : }
261 :
262 : }
263 0 : catch( const uno::Exception & ex )
264 : {
265 : ASSERT_EXCEPTION( ex );
266 : }
267 10 : }
268 :
269 2 : void SAL_CALL StockChartTypeTemplate::resetStyles(
270 : const Reference< chart2::XDiagram >& xDiagram )
271 : throw (uno::RuntimeException, std::exception)
272 : {
273 2 : ChartTypeTemplate::resetStyles( xDiagram );
274 2 : if( getDimension() == 3 )
275 : {
276 : ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
277 0 : DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
278 0 : for( ::std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeriesVec.begin());
279 0 : aIt != aSeriesVec.end(); ++aIt )
280 : {
281 0 : Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY );
282 0 : if( xProp.is() )
283 0 : xProp->setPropertyValue( "AttachedAxisIndex", uno::makeAny( sal_Int32(0) ) );
284 0 : }
285 : }
286 :
287 2 : DiagramHelper::setVertical( xDiagram, false );
288 2 : }
289 :
290 16 : Reference< XChartType > StockChartTypeTemplate::getChartTypeForIndex( sal_Int32 nChartTypeIndex )
291 : {
292 16 : Reference< XChartType > xCT;
293 : Reference< lang::XMultiServiceFactory > xFact(
294 32 : GetComponentContext()->getServiceManager(), uno::UNO_QUERY );
295 16 : if(xFact.is())
296 : {
297 16 : bool bHasVolume = false;
298 16 : getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME ) >>= bHasVolume;
299 16 : if( bHasVolume )
300 : {
301 0 : if( nChartTypeIndex == 0 )
302 0 : xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ), uno::UNO_QUERY );
303 0 : else if( nChartTypeIndex == 1 )
304 0 : xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ), uno::UNO_QUERY );
305 : else
306 0 : xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY );
307 : }
308 : else
309 : {
310 16 : if( nChartTypeIndex == 0 )
311 16 : xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ), uno::UNO_QUERY );
312 : else
313 0 : xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY );
314 : }
315 : }
316 32 : return xCT;
317 : }
318 :
319 6 : void StockChartTypeTemplate::createChartTypes(
320 : const Sequence< Sequence< Reference< XDataSeries > > > & aSeriesSeq,
321 : const Sequence< Reference< XCoordinateSystem > > & rCoordSys,
322 : const Sequence< Reference< XChartType > >& /* aOldChartTypesSeq */ )
323 : {
324 6 : if( rCoordSys.getLength() < 1 )
325 6 : return;
326 :
327 : try
328 : {
329 : Reference< lang::XMultiServiceFactory > xFact(
330 6 : GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
331 6 : bool bHasVolume = false;
332 6 : bool bShowFirst = false;
333 6 : bool bJapaneseStyle = false;
334 6 : bool bShowHighLow = true;
335 :
336 6 : getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME ) >>= bHasVolume;
337 6 : getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_OPEN ) >>= bShowFirst;
338 6 : getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE ) >>= bJapaneseStyle;
339 6 : getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_LOW_HIGH ) >>= bShowHighLow;
340 :
341 6 : sal_Int32 nSeriesIndex = 0;
342 :
343 12 : std::vector< Reference< chart2::XChartType > > aChartTypeVec;
344 : // Bars (Volume)
345 6 : if( bHasVolume )
346 : {
347 : // chart type
348 : Reference< XChartType > xCT(
349 0 : xFact->createInstance(
350 0 : CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ), uno::UNO_QUERY_THROW );
351 0 : aChartTypeVec.push_back( xCT );
352 :
353 0 : if( aSeriesSeq.getLength() > nSeriesIndex &&
354 0 : aSeriesSeq[nSeriesIndex].getLength() > 0 )
355 : {
356 0 : Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
357 0 : xDSCnt->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
358 : }
359 0 : ++nSeriesIndex;
360 : }
361 :
362 : Reference< XChartType > xCT(
363 6 : xFact->createInstance(
364 12 : CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ), uno::UNO_QUERY_THROW );
365 6 : aChartTypeVec.push_back( xCT );
366 :
367 12 : Reference< beans::XPropertySet > xCTProp( xCT, uno::UNO_QUERY );
368 6 : if( xCTProp.is())
369 : {
370 6 : xCTProp->setPropertyValue( "Japanese", uno::makeAny( bJapaneseStyle ));
371 6 : xCTProp->setPropertyValue( "ShowFirst", uno::makeAny( bShowFirst ));
372 6 : xCTProp->setPropertyValue( "ShowHighLow", uno::makeAny( bShowHighLow ));
373 : }
374 :
375 10 : if( aSeriesSeq.getLength() > nSeriesIndex &&
376 4 : aSeriesSeq[ nSeriesIndex ].getLength() > 0 )
377 : {
378 2 : Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
379 2 : xDSCnt->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
380 : }
381 6 : ++nSeriesIndex;
382 :
383 : // Lines (remaining series)
384 6 : if( aSeriesSeq.getLength() > nSeriesIndex &&
385 0 : aSeriesSeq[ nSeriesIndex ].getLength() > 0 )
386 : {
387 : xCT.set(
388 0 : xFact->createInstance(
389 0 : CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY_THROW );
390 0 : aChartTypeVec.push_back( xCT );
391 :
392 0 : Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
393 0 : xDSCnt->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
394 : }
395 :
396 12 : Reference< XChartTypeContainer > xCTCnt( rCoordSys[ 0 ], uno::UNO_QUERY_THROW );
397 12 : xCTCnt->setChartTypes( ::chart::ContainerHelper::ContainerToSequence(aChartTypeVec) );
398 : }
399 0 : catch( const uno::Exception & ex )
400 : {
401 : ASSERT_EXCEPTION( ex );
402 : }
403 : }
404 :
405 : // ____ XChartTypeTemplate ____
406 2476 : sal_Bool SAL_CALL StockChartTypeTemplate::matchesTemplate(
407 : const uno::Reference< XDiagram >& xDiagram,
408 : sal_Bool /* bAdaptProperties */ )
409 : throw (uno::RuntimeException, std::exception)
410 : {
411 2476 : sal_Bool bResult = sal_False;
412 :
413 2476 : if( ! xDiagram.is())
414 0 : return bResult;
415 :
416 : try
417 : {
418 2476 : sal_Bool bHasVolume = false, bHasOpenValue = false, bHasJapaneseStyle = false;
419 :
420 2476 : getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME ) >>= bHasVolume;
421 2476 : getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_OPEN ) >>= bHasOpenValue;
422 2476 : getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE ) >>= bHasJapaneseStyle;
423 :
424 2476 : Reference< chart2::XChartType > xVolumeChartType;
425 4952 : Reference< chart2::XChartType > xCandleStickChartType;
426 4952 : Reference< chart2::XChartType > xLineChartType;
427 2476 : sal_Int32 nNumberOfChartTypes = 0;
428 :
429 : Reference< XCoordinateSystemContainer > xCooSysCnt(
430 4952 : xDiagram, uno::UNO_QUERY_THROW );
431 : Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
432 4952 : xCooSysCnt->getCoordinateSystems());
433 4952 : for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i )
434 : {
435 2476 : Reference< XChartTypeContainer > xCTCnt( aCooSysSeq[i], uno::UNO_QUERY_THROW );
436 4952 : Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
437 5288 : for( sal_Int32 j=0; j<aChartTypeSeq.getLength(); ++j )
438 : {
439 2812 : if( aChartTypeSeq[j].is())
440 : {
441 2812 : ++nNumberOfChartTypes;
442 2812 : if( nNumberOfChartTypes > 3 )
443 0 : break;
444 2812 : OUString aCTService = aChartTypeSeq[j]->getChartType();
445 2812 : if( aCTService.equals( CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ))
446 1756 : xVolumeChartType.set( aChartTypeSeq[j] );
447 1056 : else if( aCTService.equals( CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ))
448 340 : xCandleStickChartType.set( aChartTypeSeq[j] );
449 716 : else if( aCTService.equals( CHART2_SERVICE_NAME_CHARTTYPE_LINE ))
450 36 : xLineChartType.set( aChartTypeSeq[j] );
451 : }
452 : }
453 2476 : if( nNumberOfChartTypes > 3 )
454 0 : break;
455 2476 : }
456 :
457 2648 : if( xCandleStickChartType.is() &&
458 168 : ( ( bHasVolume &&
459 340 : xVolumeChartType.is() ) ||
460 344 : ( ! bHasVolume &&
461 172 : ! xVolumeChartType.is() )))
462 : {
463 172 : bResult = true;
464 :
465 : // check for japanese style
466 172 : Reference< beans::XPropertySet > xCTProp( xCandleStickChartType, uno::UNO_QUERY );
467 172 : if( xCTProp.is())
468 : {
469 172 : sal_Bool bJapaneseProp = sal_False;
470 172 : xCTProp->getPropertyValue( "Japanese") >>= bJapaneseProp;
471 172 : bResult = bResult && ( bHasJapaneseStyle == bJapaneseProp );
472 :
473 : // in old chart japanese == showFirst
474 172 : sal_Bool bShowFirstProp = sal_False;
475 172 : xCTProp->getPropertyValue( "ShowFirst") >>= bShowFirstProp;
476 172 : bResult = bResult && ( bHasOpenValue == bShowFirstProp );
477 172 : }
478 2476 : }
479 : }
480 0 : catch( const uno::Exception & ex )
481 : {
482 : ASSERT_EXCEPTION( ex );
483 : }
484 :
485 2476 : return bResult;
486 : }
487 :
488 12 : Reference< XChartType > SAL_CALL StockChartTypeTemplate::getChartTypeForNewSeries(
489 : const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
490 : throw (uno::RuntimeException, std::exception)
491 : {
492 12 : Reference< chart2::XChartType > xResult;
493 :
494 : try
495 : {
496 : Reference< lang::XMultiServiceFactory > xFact(
497 12 : GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
498 12 : xResult.set( xFact->createInstance(
499 12 : CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY_THROW );
500 12 : ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
501 : }
502 0 : catch( const uno::Exception & ex )
503 : {
504 : ASSERT_EXCEPTION( ex );
505 : }
506 :
507 12 : return xResult;
508 : }
509 :
510 8 : Reference< XDataInterpreter > SAL_CALL StockChartTypeTemplate::getDataInterpreter()
511 : throw (uno::RuntimeException, std::exception)
512 : {
513 8 : if( ! m_xDataInterpreter.is())
514 8 : m_xDataInterpreter.set( new StockDataInterpreter( m_eStockVariant, GetComponentContext() ) );
515 :
516 8 : return m_xDataInterpreter;
517 : }
518 :
519 20036 : IMPLEMENT_FORWARD_XINTERFACE2( StockChartTypeTemplate, ChartTypeTemplate, OPropertySet )
520 0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( StockChartTypeTemplate, ChartTypeTemplate, OPropertySet )
521 :
522 : } // namespace chart
523 :
524 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|