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 <rtl/math.hxx>
21 :
22 : #include <valarray>
23 :
24 : #include "InternalDataProvider.hxx"
25 : #include "LabeledDataSequence.hxx"
26 : #include "DataSource.hxx"
27 : #include "PropertyHelper.hxx"
28 : #include "macros.hxx"
29 : #include "XMLRangeHelper.hxx"
30 : #include "ContainerHelper.hxx"
31 : #include "CommonConverters.hxx"
32 : #include "CommonFunctors.hxx"
33 : #include "UncachedDataSequence.hxx"
34 : #include "DataSourceHelper.hxx"
35 : #include "ChartModelHelper.hxx"
36 : #include "DiagramHelper.hxx"
37 : #include "ExplicitCategoriesProvider.hxx"
38 :
39 : #include <com/sun/star/chart2/XChartDocument.hpp>
40 : #include <com/sun/star/chart2/data/XDataSequence.hpp>
41 : #include <com/sun/star/chart/ChartDataRowSource.hpp>
42 : #include <rtl/ustrbuf.hxx>
43 : #include <unotools/charclass.hxx>
44 : #include <comphelper/sequenceashashmap.hxx>
45 :
46 : #include <vector>
47 : #include <algorithm>
48 :
49 : using namespace ::com::sun::star;
50 : using namespace ::std;
51 :
52 : using ::com::sun::star::uno::Reference;
53 : using ::com::sun::star::uno::Sequence;
54 :
55 : namespace chart
56 : {
57 :
58 : namespace
59 : {
60 :
61 : // note: in xmloff this name is used to indicate usage of own data
62 0 : static const OUString lcl_aServiceName( "com.sun.star.comp.chart.InternalDataProvider" );
63 :
64 0 : static const OUString lcl_aCategoriesRangeName( "categories" );
65 0 : static const OUString lcl_aCategoriesLevelRangeNamePrefix( "categoriesL " ); //L <-> level
66 0 : static const OUString lcl_aCategoriesPointRangeNamePrefix( "categoriesP " ); //P <-> point
67 0 : static const OUString lcl_aCategoriesRoleName( "categories" );
68 0 : static const OUString lcl_aLabelRangePrefix( "label " );
69 0 : static const OUString lcl_aCompleteRange( "all" );
70 :
71 : typedef ::std::multimap< OUString, uno::WeakReference< chart2::data::XDataSequence > >
72 : lcl_tSequenceMap;
73 :
74 0 : Sequence< OUString > lcl_AnyToStringSequence( const Sequence< uno::Any >& aAnySeq )
75 : {
76 0 : Sequence< OUString > aResult;
77 0 : aResult.realloc( aAnySeq.getLength() );
78 0 : transform( aAnySeq.getConstArray(), aAnySeq.getConstArray() + aAnySeq.getLength(),
79 0 : aResult.getArray(), CommonFunctors::AnyToString() );
80 0 : return aResult;
81 : }
82 :
83 0 : Sequence< uno::Any > lcl_StringToAnySequence( const Sequence< OUString >& aStringSeq )
84 : {
85 0 : Sequence< uno::Any > aResult;
86 0 : aResult.realloc( aStringSeq.getLength() );
87 0 : transform( aStringSeq.getConstArray(), aStringSeq.getConstArray() + aStringSeq.getLength(),
88 0 : aResult.getArray(), CommonFunctors::makeAny< OUString >() );
89 0 : return aResult;
90 : }
91 :
92 : struct lcl_setModified : public ::std::unary_function< lcl_tSequenceMap, void >
93 : {
94 0 : void operator() ( const lcl_tSequenceMap::value_type & rMapEntry )
95 : {
96 : // convert weak reference to reference
97 0 : Reference< chart2::data::XDataSequence > xSeq( rMapEntry.second );
98 0 : if( xSeq.is())
99 : {
100 0 : Reference< util::XModifiable > xMod( xSeq, uno::UNO_QUERY );
101 0 : if( xMod.is())
102 0 : xMod->setModified( sal_True );
103 0 : }
104 0 : }
105 : };
106 :
107 : struct lcl_internalizeSeries : public ::std::unary_function< Reference< chart2::XDataSeries >, void >
108 : {
109 0 : lcl_internalizeSeries( InternalData & rInternalData,
110 : InternalDataProvider & rProvider,
111 : bool bConnectToModel, bool bDataInColumns ) :
112 : m_rInternalData( rInternalData ),
113 : m_rProvider( rProvider ),
114 : m_bConnectToModel( bConnectToModel ),
115 0 : m_bDataInColumns( bDataInColumns )
116 0 : {}
117 0 : void operator() ( const Reference< chart2::XDataSeries > & xSeries )
118 : {
119 0 : Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
120 0 : Reference< chart2::data::XDataSink > xSink( xSeries, uno::UNO_QUERY );
121 0 : if( xSource.is() && xSink.is() )
122 : {
123 0 : Sequence< Reference< chart2::data::XLabeledDataSequence > > aOldSeriesData = xSource->getDataSequences();
124 0 : Sequence< Reference< chart2::data::XLabeledDataSequence > > aNewSeriesData( aOldSeriesData.getLength() );
125 0 : for( sal_Int32 i=0; i<aOldSeriesData.getLength(); ++i )
126 : {
127 0 : sal_Int32 nNewIndex( m_bDataInColumns ? m_rInternalData.appendColumn() : m_rInternalData.appendRow() );
128 0 : OUString aIdentifier( OUString::number( nNewIndex ));
129 : //@todo: deal also with genericXDataSequence
130 0 : Reference< chart2::data::XNumericalDataSequence > xValues( aOldSeriesData[i]->getValues(), uno::UNO_QUERY );
131 0 : Reference< chart2::data::XTextualDataSequence > xLabel( aOldSeriesData[i]->getLabel(), uno::UNO_QUERY );
132 0 : Reference< chart2::data::XDataSequence > xNewValues;
133 :
134 0 : if( xValues.is() )
135 : {
136 0 : ::std::vector< double > aValues( ContainerHelper::SequenceToVector( xValues->getNumericalData()));
137 0 : if( m_bDataInColumns )
138 0 : m_rInternalData.setColumnValues( nNewIndex, aValues );
139 : else
140 0 : m_rInternalData.setRowValues( nNewIndex, aValues );
141 0 : if( m_bConnectToModel )
142 : {
143 0 : xNewValues.set( m_rProvider.createDataSequenceByRangeRepresentation( aIdentifier ));
144 : comphelper::copyProperties(
145 : Reference< beans::XPropertySet >( xValues, uno::UNO_QUERY ),
146 0 : Reference< beans::XPropertySet >( xNewValues, uno::UNO_QUERY ));
147 0 : }
148 : }
149 :
150 0 : if( xLabel.is() )
151 : {
152 0 : if( m_bDataInColumns )
153 0 : m_rInternalData.setComplexColumnLabel( nNewIndex, ContainerHelper::SequenceToVector( lcl_StringToAnySequence( xLabel->getTextualData() ) ) );
154 : else
155 0 : m_rInternalData.setComplexRowLabel( nNewIndex, ContainerHelper::SequenceToVector( lcl_StringToAnySequence( xLabel->getTextualData() ) ) );
156 0 : if( m_bConnectToModel )
157 : {
158 : Reference< chart2::data::XDataSequence > xNewLabel(
159 0 : m_rProvider.createDataSequenceByRangeRepresentation( lcl_aLabelRangePrefix + aIdentifier ));
160 : comphelper::copyProperties(
161 : Reference< beans::XPropertySet >( xLabel, uno::UNO_QUERY ),
162 0 : Reference< beans::XPropertySet >( xNewLabel, uno::UNO_QUERY ));
163 0 : aNewSeriesData[i] = Reference< chart2::data::XLabeledDataSequence >(
164 0 : new LabeledDataSequence( xNewValues, xNewLabel ));
165 : }
166 : }
167 : else
168 : {
169 0 : if( m_bConnectToModel )
170 0 : aNewSeriesData[i] = Reference< chart2::data::XLabeledDataSequence >(
171 0 : new LabeledDataSequence( xNewValues ));
172 : }
173 0 : }
174 0 : if( m_bConnectToModel )
175 0 : xSink->setData( aNewSeriesData );
176 0 : }
177 0 : }
178 :
179 : private:
180 : InternalData & m_rInternalData;
181 : InternalDataProvider & m_rProvider;
182 : bool m_bConnectToModel;
183 : bool m_bDataInColumns;
184 : };
185 :
186 : struct lcl_copyFromLevel : public ::std::unary_function< vector< uno::Any >, uno::Any >
187 : {
188 : public:
189 :
190 0 : explicit lcl_copyFromLevel( sal_Int32 nLevel ) : m_nLevel( nLevel )
191 0 : {}
192 :
193 0 : uno::Any operator() ( const vector< uno::Any >& rVector )
194 : {
195 0 : uno::Any aRet;
196 0 : if( m_nLevel < static_cast< sal_Int32 >(rVector.size()) )
197 0 : aRet = rVector[m_nLevel];
198 0 : return aRet;
199 : }
200 :
201 : private:
202 : sal_Int32 m_nLevel;
203 : };
204 :
205 : struct lcl_getStringFromLevelVector : public ::std::unary_function< vector< uno::Any >, OUString >
206 : {
207 : public:
208 :
209 0 : explicit lcl_getStringFromLevelVector( sal_Int32 nLevel ) : m_nLevel( nLevel )
210 0 : {}
211 :
212 0 : OUString operator() ( const vector< uno::Any >& rVector )
213 : {
214 0 : OUString aString;
215 0 : if( m_nLevel < static_cast< sal_Int32 >(rVector.size()) )
216 0 : aString = CommonFunctors::AnyToString()(rVector[m_nLevel]);
217 0 : return aString;
218 : }
219 :
220 : private:
221 : sal_Int32 m_nLevel;
222 : };
223 :
224 : struct lcl_setAnyAtLevel : public ::std::binary_function< vector< uno::Any >, uno::Any, vector< uno::Any > >
225 : {
226 : public:
227 :
228 0 : explicit lcl_setAnyAtLevel( sal_Int32 nLevel ) : m_nLevel( nLevel )
229 0 : {}
230 :
231 0 : vector< uno::Any > operator() ( const vector< uno::Any >& rVector, const uno::Any& rNewValue )
232 : {
233 0 : vector< uno::Any > aRet( rVector );
234 0 : if( m_nLevel >= static_cast< sal_Int32 >(aRet.size()) )
235 0 : aRet.resize( m_nLevel+1 );
236 0 : aRet[ m_nLevel ]=rNewValue;
237 0 : return aRet;
238 : }
239 :
240 : private:
241 : sal_Int32 m_nLevel;
242 : };
243 :
244 : struct lcl_setAnyAtLevelFromStringSequence : public ::std::binary_function< vector< uno::Any >, OUString, vector< uno::Any > >
245 : {
246 : public:
247 :
248 0 : explicit lcl_setAnyAtLevelFromStringSequence( sal_Int32 nLevel ) : m_nLevel( nLevel )
249 0 : {}
250 :
251 0 : vector< uno::Any > operator() ( const vector< uno::Any >& rVector, const OUString& rNewValue )
252 : {
253 0 : vector< uno::Any > aRet( rVector );
254 0 : if( m_nLevel >= static_cast< sal_Int32 >(aRet.size()) )
255 0 : aRet.resize( m_nLevel+1 );
256 0 : aRet[ m_nLevel ]=uno::makeAny(rNewValue);
257 0 : return aRet;
258 : }
259 :
260 : private:
261 : sal_Int32 m_nLevel;
262 : };
263 :
264 : struct lcl_insertAnyAtLevel : public ::std::unary_function< vector< uno::Any >, void >
265 : {
266 : public:
267 :
268 0 : explicit lcl_insertAnyAtLevel( sal_Int32 nLevel ) : m_nLevel( nLevel )
269 0 : {}
270 :
271 0 : void operator() ( vector< uno::Any >& rVector )
272 : {
273 0 : if( m_nLevel >= static_cast< sal_Int32 >(rVector.size()) )
274 : {
275 0 : rVector.resize( m_nLevel + 1 );
276 : }
277 : else
278 : {
279 0 : rVector.insert( rVector.begin() + m_nLevel, uno::Any() );
280 : }
281 0 : }
282 :
283 : private:
284 : sal_Int32 m_nLevel;
285 : };
286 :
287 : struct lcl_removeAnyAtLevel : public ::std::unary_function< vector< uno::Any >, void >
288 : {
289 : public:
290 :
291 0 : explicit lcl_removeAnyAtLevel( sal_Int32 nLevel ) : m_nLevel( nLevel )
292 0 : {}
293 :
294 0 : void operator() ( vector< uno::Any >& rVector )
295 : {
296 0 : if( m_nLevel < static_cast<sal_Int32>(rVector.size()) )
297 : {
298 0 : rVector.erase(rVector.begin() + m_nLevel);
299 : }
300 0 : }
301 :
302 : private:
303 : sal_Int32 m_nLevel;
304 : };
305 :
306 : } // anonymous namespace
307 :
308 0 : InternalDataProvider::InternalDataProvider( const Reference< uno::XComponentContext > & /*_xContext*/)
309 0 : : m_bDataInColumns( true )
310 0 : {}
311 :
312 0 : InternalDataProvider::InternalDataProvider(
313 : const Reference< chart2::XChartDocument > & xChartDoc,
314 : bool bConnectToModel,
315 : bool bDefaultDataInColumns)
316 0 : : m_bDataInColumns( bDefaultDataInColumns )
317 : {
318 : try
319 : {
320 0 : Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartDoc ) );
321 0 : if( xDiagram.is())
322 : {
323 0 : Reference< frame::XModel > xChartModel( xChartDoc, uno::UNO_QUERY );
324 :
325 : //data in columns?
326 : {
327 0 : OUString aRangeString;
328 0 : bool bFirstCellAsLabel = true;
329 0 : bool bHasCategories = true;
330 0 : uno::Sequence< sal_Int32 > aSequenceMapping;
331 : const bool bSomethingDetected(
332 : DataSourceHelper::detectRangeSegmentation(
333 0 : xChartModel, aRangeString, aSequenceMapping, m_bDataInColumns, bFirstCellAsLabel, bHasCategories ));
334 :
335 : // #i120559# if no data was available, restore default
336 0 : if(!bSomethingDetected && m_bDataInColumns != bDefaultDataInColumns)
337 : {
338 0 : m_bDataInColumns = bDefaultDataInColumns;
339 0 : }
340 : }
341 :
342 : // categories
343 : {
344 0 : vector< vector< uno::Any > > aNewCategories;//inner count is level
345 : {
346 0 : ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get());
347 : assert(pModel);
348 0 : ExplicitCategoriesProvider aExplicitCategoriesProvider( ChartModelHelper::getFirstCoordinateSystem(xChartModel), *pModel );
349 :
350 0 : const Sequence< Reference< chart2::data::XLabeledDataSequence> >& rSplitCategoriesList( aExplicitCategoriesProvider.getSplitCategoriesList() );
351 0 : sal_Int32 nLevelCount = rSplitCategoriesList.getLength();
352 0 : for( sal_Int32 nL = 0; nL<nLevelCount; nL++ )
353 : {
354 0 : Reference< chart2::data::XLabeledDataSequence > xLDS( rSplitCategoriesList[nL] );
355 0 : if( !xLDS.is() )
356 0 : continue;
357 0 : Sequence< uno::Any > aDataSeq;
358 0 : Reference< chart2::data::XDataSequence > xSeq( xLDS->getValues() );
359 0 : if( xSeq.is() )
360 0 : aDataSeq = xSeq->getData();
361 0 : sal_Int32 nLength = aDataSeq.getLength();
362 0 : sal_Int32 nCatLength = static_cast< sal_Int32 >(aNewCategories.size());
363 0 : if( nCatLength < nLength )
364 0 : aNewCategories.resize( nLength );
365 0 : else if( nLength < nCatLength )
366 0 : aDataSeq.realloc( nCatLength );
367 : transform( aNewCategories.begin(), aNewCategories.end(), aDataSeq.getConstArray(),
368 0 : aNewCategories.begin(), lcl_setAnyAtLevel(nL) );
369 0 : }
370 0 : if( !nLevelCount )
371 : {
372 0 : Sequence< OUString > aSimplecategories = aExplicitCategoriesProvider.getSimpleCategories();
373 0 : sal_Int32 nLength = aSimplecategories.getLength();
374 0 : aNewCategories.reserve( nLength );
375 0 : for( sal_Int32 nN=0; nN<nLength; nN++)
376 : {
377 0 : vector< uno::Any > aVector(1);
378 0 : aVector[0] = uno::makeAny( aSimplecategories[nN] );
379 0 : aNewCategories.push_back( aVector );
380 0 : }
381 0 : }
382 : }
383 :
384 0 : if( m_bDataInColumns )
385 0 : m_aInternalData.setComplexRowLabels( aNewCategories );
386 : else
387 0 : m_aInternalData.setComplexColumnLabels( aNewCategories );
388 0 : if( bConnectToModel )
389 : DiagramHelper::setCategoriesToDiagram( new LabeledDataSequence(
390 0 : createDataSequenceByRangeRepresentation( lcl_aCategoriesRangeName )), xDiagram );
391 : }
392 :
393 : // data series
394 0 : ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector( ChartModelHelper::getDataSeries( xChartDoc ));
395 0 : ::std::for_each( aSeriesVector.begin(), aSeriesVector.end(), lcl_internalizeSeries( m_aInternalData, *this, bConnectToModel, m_bDataInColumns ) );
396 0 : }
397 : }
398 0 : catch( const uno::Exception & ex )
399 : {
400 : ASSERT_EXCEPTION( ex );
401 : }
402 0 : }
403 :
404 : // copy-CTOR
405 0 : InternalDataProvider::InternalDataProvider( const InternalDataProvider & rOther ) :
406 : impl::InternalDataProvider_Base(),
407 : m_aSequenceMap( rOther.m_aSequenceMap ),
408 : m_aInternalData( rOther.m_aInternalData ),
409 0 : m_bDataInColumns( rOther.m_bDataInColumns )
410 0 : {}
411 :
412 0 : InternalDataProvider::~InternalDataProvider()
413 0 : {}
414 :
415 0 : void InternalDataProvider::lcl_addDataSequenceToMap(
416 : const OUString & rRangeRepresentation,
417 : const Reference< chart2::data::XDataSequence > & xSequence )
418 : {
419 : m_aSequenceMap.insert(
420 : tSequenceMap::value_type(
421 : rRangeRepresentation,
422 0 : uno::WeakReference< chart2::data::XDataSequence >( xSequence )));
423 0 : }
424 :
425 0 : void InternalDataProvider::lcl_deleteMapReferences( const OUString & rRangeRepresentation )
426 : {
427 : // set sequence to deleted by setting its range to an empty string
428 0 : tSequenceMapRange aRange( m_aSequenceMap.equal_range( rRangeRepresentation ));
429 0 : for( tSequenceMap::iterator aIt( aRange.first ); aIt != aRange.second; ++aIt )
430 : {
431 0 : Reference< chart2::data::XDataSequence > xSeq( aIt->second );
432 0 : if( xSeq.is())
433 : {
434 0 : Reference< container::XNamed > xNamed( xSeq, uno::UNO_QUERY );
435 0 : if( xNamed.is())
436 0 : xNamed->setName( OUString());
437 : }
438 0 : }
439 : // remove from map
440 0 : m_aSequenceMap.erase( aRange.first, aRange.second );
441 0 : }
442 :
443 0 : void InternalDataProvider::lcl_adaptMapReferences(
444 : const OUString & rOldRangeRepresentation,
445 : const OUString & rNewRangeRepresentation )
446 : {
447 0 : tSequenceMapRange aRange( m_aSequenceMap.equal_range( rOldRangeRepresentation ));
448 0 : tSequenceMap aNewElements;
449 0 : for( tSequenceMap::iterator aIt( aRange.first ); aIt != aRange.second; ++aIt )
450 : {
451 0 : Reference< chart2::data::XDataSequence > xSeq( aIt->second );
452 0 : if( xSeq.is())
453 : {
454 0 : Reference< container::XNamed > xNamed( xSeq, uno::UNO_QUERY );
455 0 : if( xNamed.is())
456 0 : xNamed->setName( rNewRangeRepresentation );
457 : }
458 0 : aNewElements.insert( tSequenceMap::value_type( rNewRangeRepresentation, aIt->second ));
459 0 : }
460 : // erase map values for old index
461 0 : m_aSequenceMap.erase( aRange.first, aRange.second );
462 : // add new entries for values with new index
463 : ::std::copy( aNewElements.begin(), aNewElements.end(),
464 : ::std::inserter( m_aSequenceMap,
465 0 : m_aSequenceMap.upper_bound( rNewRangeRepresentation )));
466 0 : }
467 :
468 0 : void InternalDataProvider::lcl_increaseMapReferences(
469 : sal_Int32 nBegin, sal_Int32 nEnd )
470 : {
471 0 : for( sal_Int32 nIndex = nEnd - 1; nIndex >= nBegin; --nIndex )
472 : {
473 : lcl_adaptMapReferences( OUString::number( nIndex ),
474 0 : OUString::number( nIndex + 1 ));
475 0 : lcl_adaptMapReferences( lcl_aLabelRangePrefix + OUString::number( nIndex ),
476 0 : lcl_aLabelRangePrefix + OUString::number( nIndex + 1 ));
477 : }
478 0 : }
479 :
480 0 : void InternalDataProvider::lcl_decreaseMapReferences(
481 : sal_Int32 nBegin, sal_Int32 nEnd )
482 : {
483 0 : for( sal_Int32 nIndex = nBegin; nIndex < nEnd; ++nIndex )
484 : {
485 : lcl_adaptMapReferences( OUString::number( nIndex ),
486 0 : OUString::number( nIndex - 1 ));
487 0 : lcl_adaptMapReferences( lcl_aLabelRangePrefix + OUString::number( nIndex ),
488 0 : lcl_aLabelRangePrefix + OUString::number( nIndex - 1 ));
489 : }
490 0 : }
491 :
492 0 : Reference< chart2::data::XDataSequence > InternalDataProvider::lcl_createDataSequenceAndAddToMap(
493 : const OUString & rRangeRepresentation )
494 : {
495 0 : OUString aRangeRepresentation = rRangeRepresentation;
496 0 : if( aRangeRepresentation.indexOf('{') >= 0 )
497 : {
498 0 : ::std::vector< double > aNewData;
499 0 : ::std::vector< uno::Any > aNewLabels;
500 0 : OUString aToken;
501 0 : sal_Int32 nCategories = 0;
502 0 : sal_Int32 nIndex = 0;
503 0 : bool bValues = true;
504 0 : bool bLabelSet = false;
505 0 : OUString str = aRangeRepresentation.replace('{',' ').replace('}',' ');
506 :
507 0 : m_aInternalData.clearDefaultData();
508 0 : sal_Int32 n = m_aInternalData.getColumnCount();
509 0 : if( n )
510 0 : n = n - 1;
511 :
512 0 : do
513 : {
514 : // TODO: This will be problematic if ';' is used in label names
515 : // '"' character also needs to be considered in such cases
516 0 : aToken = str.getToken(0,';',nIndex);
517 0 : if( aToken.isEmpty() )
518 0 : break;
519 0 : if( aToken.indexOf('"') < 0 )
520 : {
521 0 : aNewData.push_back( aToken.toDouble() );
522 : }
523 : else
524 : {
525 0 : aNewLabels.push_back( uno::makeAny(aToken.replace('"', ' ').trim()) );
526 0 : if( !nCategories &&
527 0 : ( !m_aInternalData.getComplexColumnLabel(n).size() ||
528 0 : !m_aInternalData.getComplexColumnLabel(n).front().hasValue() ) )
529 : {
530 0 : m_aInternalData.setComplexColumnLabel( n, aNewLabels );
531 0 : bLabelSet = true;
532 : }
533 : else
534 : {
535 0 : m_aInternalData.setComplexRowLabel(nCategories, aNewLabels);
536 0 : if(nCategories==1 && bLabelSet)
537 : {
538 0 : ::std::vector< uno::Any > aLabels;
539 0 : m_aInternalData.setComplexRowLabel( 0, m_aInternalData.getComplexColumnLabel( n ) );
540 0 : m_aInternalData.setComplexColumnLabel( n, aLabels );
541 : }
542 : }
543 0 : aNewLabels.pop_back();
544 0 : nCategories++;
545 0 : bValues = false;
546 : }
547 0 : } while( nIndex >= 0 );
548 :
549 0 : if( bValues )
550 : {
551 0 : m_aInternalData.insertColumn( n );
552 0 : m_aInternalData.setColumnValues( n, aNewData );
553 0 : aRangeRepresentation = OUString::number( n );
554 : }
555 0 : else if( nCategories > 1 )
556 : {
557 0 : aRangeRepresentation = lcl_aCategoriesRangeName;
558 : }
559 : else
560 : {
561 0 : aRangeRepresentation = lcl_aLabelRangePrefix+OUString::number( n );
562 0 : }
563 : }
564 :
565 : Reference< chart2::data::XDataSequence > xSeq(
566 0 : new UncachedDataSequence( this, aRangeRepresentation ));
567 0 : lcl_addDataSequenceToMap( aRangeRepresentation, xSeq );
568 0 : return xSeq;
569 : }
570 :
571 0 : Reference< chart2::data::XDataSequence > InternalDataProvider::lcl_createDataSequenceAndAddToMap(
572 : const OUString & rRangeRepresentation,
573 : const OUString & rRole )
574 : {
575 : Reference< chart2::data::XDataSequence > xSeq(
576 0 : new UncachedDataSequence( this, rRangeRepresentation, rRole ));
577 0 : lcl_addDataSequenceToMap( rRangeRepresentation, xSeq );
578 0 : return xSeq;
579 : }
580 :
581 0 : void InternalDataProvider::createDefaultData()
582 : {
583 0 : m_aInternalData.createDefaultData();
584 0 : }
585 :
586 : // ____ XDataProvider ____
587 0 : sal_Bool SAL_CALL InternalDataProvider::createDataSourcePossible( const Sequence< beans::PropertyValue >& /* aArguments */ )
588 : throw (uno::RuntimeException, std::exception)
589 : {
590 0 : return true;
591 : }
592 :
593 : namespace
594 : {
595 :
596 0 : sal_Int32 lcl_getInnerLevelCount( const vector< vector< uno::Any > >& rLabels )
597 : {
598 0 : sal_Int32 nCount = 1;//minimum is 1!
599 0 : vector< vector< uno::Any > >::const_iterator aLevelIt( rLabels.begin() );
600 0 : vector< vector< uno::Any > >::const_iterator aLevelEnd( rLabels.end() );
601 0 : for( ;aLevelIt!=aLevelEnd; ++aLevelIt )
602 : {
603 0 : const vector< uno::Any >& rCurrentLevelLabels = *aLevelIt;
604 0 : nCount = std::max<sal_Int32>( rCurrentLevelLabels.size(), nCount );
605 : }
606 0 : return nCount;
607 : }
608 :
609 : }//end anonymous namespace
610 :
611 0 : Reference< chart2::data::XDataSource > SAL_CALL InternalDataProvider::createDataSource(
612 : const Sequence< beans::PropertyValue >& aArguments )
613 : throw (lang::IllegalArgumentException,
614 : uno::RuntimeException, std::exception)
615 : {
616 0 : OUString aRangeRepresentation;
617 0 : bool bUseColumns = true;
618 0 : bool bFirstCellAsLabel = true;
619 0 : bool bHasCategories = true;
620 0 : uno::Sequence< sal_Int32 > aSequenceMapping;
621 0 : DataSourceHelper::readArguments( aArguments, aRangeRepresentation, aSequenceMapping, bUseColumns, bFirstCellAsLabel, bHasCategories );
622 :
623 0 : if( aRangeRepresentation.equals( lcl_aCategoriesRangeName ) )
624 : {
625 : //return split complex categories if we have any:
626 0 : ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aComplexCategories;
627 0 : vector< vector< uno::Any > > aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
628 0 : if( bUseColumns==m_bDataInColumns )
629 : {
630 0 : sal_Int32 nLevelCount = lcl_getInnerLevelCount( aCategories );
631 0 : for( sal_Int32 nL=0; nL<nLevelCount; nL++ )
632 : aComplexCategories.push_back( new LabeledDataSequence(
633 : new UncachedDataSequence( this
634 0 : , lcl_aCategoriesLevelRangeNamePrefix + OUString::number( nL )
635 0 : , lcl_aCategoriesRoleName ) ) );
636 : }
637 : else
638 : {
639 0 : sal_Int32 nPointCount = m_bDataInColumns ? m_aInternalData.getRowCount() : m_aInternalData.getColumnCount();
640 0 : for( sal_Int32 nP=0; nP<nPointCount; nP++ )
641 : aComplexCategories.push_back( new LabeledDataSequence(
642 : new UncachedDataSequence( this
643 0 : , lcl_aCategoriesPointRangeNamePrefix + OUString::number( nP )
644 0 : , lcl_aCategoriesRoleName ) ) );
645 : }
646 : //don't add the created sequences to the map as they are used temporarily only ...
647 0 : return new DataSource( ContainerHelper::ContainerToSequence(aComplexCategories) );
648 : }
649 :
650 : OSL_ASSERT( aRangeRepresentation.equals( lcl_aCompleteRange ));
651 :
652 0 : ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aResultLSeqVec;
653 :
654 : // categories
655 0 : if( bHasCategories )
656 : aResultLSeqVec.push_back(
657 0 : new LabeledDataSequence( lcl_createDataSequenceAndAddToMap( lcl_aCategoriesRangeName, lcl_aCategoriesRoleName ) ) );
658 :
659 : // data with labels
660 0 : ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aDataVec;
661 0 : const sal_Int32 nCount = (bUseColumns ? m_aInternalData.getColumnCount() : m_aInternalData.getRowCount());
662 0 : for( sal_Int32 nIdx=0; nIdx<nCount; ++nIdx )
663 : {
664 : aDataVec.push_back(
665 : new LabeledDataSequence(
666 : lcl_createDataSequenceAndAddToMap( OUString::number( nIdx )),
667 0 : lcl_createDataSequenceAndAddToMap( lcl_aLabelRangePrefix + OUString::number( nIdx ))));
668 : }
669 :
670 : // attention: this data provider has the limitation that it stores
671 : // internally if data comes from columns or rows. It is intended for
672 : // creating only one used data source.
673 : // @todo: add this information in the range representation strings
674 0 : m_bDataInColumns = bUseColumns;
675 :
676 : //reorder labeled sequences according to aSequenceMapping; ignore categories
677 0 : for( sal_Int32 nNewIndex = 0; nNewIndex < aSequenceMapping.getLength(); nNewIndex++ )
678 : {
679 0 : std::vector< LabeledDataSequence* >::size_type nOldIndex = aSequenceMapping[nNewIndex];
680 0 : if( nOldIndex < aDataVec.size() )
681 : {
682 0 : if( aDataVec[nOldIndex].is() )
683 : {
684 0 : aResultLSeqVec.push_back( aDataVec[nOldIndex] );
685 0 : aDataVec[nOldIndex] = 0;
686 : }
687 : }
688 : }
689 :
690 : //add left over data sequences to result
691 0 : ::std::vector< Reference< chart2::data::XLabeledDataSequence > >::iterator aIt(aDataVec.begin());
692 0 : const ::std::vector< Reference< chart2::data::XLabeledDataSequence > >::const_iterator aEndIt(aDataVec.end());
693 0 : for( ;aIt!=aEndIt; ++aIt)
694 : {
695 0 : if( aIt->is() )
696 0 : aResultLSeqVec.push_back( *aIt );
697 : }
698 :
699 0 : return new DataSource( ContainerHelper::ContainerToSequence(aResultLSeqVec) );
700 : }
701 :
702 0 : Sequence< beans::PropertyValue > SAL_CALL InternalDataProvider::detectArguments(
703 : const Reference< chart2::data::XDataSource >& /* xDataSource */ )
704 : throw (uno::RuntimeException, std::exception)
705 : {
706 0 : Sequence< beans::PropertyValue > aArguments( 4 );
707 0 : aArguments[0] = beans::PropertyValue(
708 : "CellRangeRepresentation", -1, uno::makeAny( lcl_aCompleteRange ),
709 0 : beans::PropertyState_DIRECT_VALUE );
710 0 : aArguments[1] = beans::PropertyValue(
711 : "DataRowSource", -1, uno::makeAny(
712 : m_bDataInColumns
713 : ? ::com::sun::star::chart::ChartDataRowSource_COLUMNS
714 : : ::com::sun::star::chart::ChartDataRowSource_ROWS ),
715 0 : beans::PropertyState_DIRECT_VALUE );
716 : // internal data always contains labels and categories
717 0 : aArguments[2] = beans::PropertyValue(
718 0 : "FirstCellAsLabel", -1, uno::makeAny( true ), beans::PropertyState_DIRECT_VALUE );
719 0 : aArguments[3] = beans::PropertyValue(
720 0 : "HasCategories", -1, uno::makeAny( true ), beans::PropertyState_DIRECT_VALUE );
721 :
722 : // #i85913# Sequence Mapping is not needed for internal data, as it is
723 : // applied to the data when the data source is created.
724 :
725 0 : return aArguments;
726 : }
727 :
728 0 : sal_Bool SAL_CALL InternalDataProvider::createDataSequenceByRangeRepresentationPossible( const OUString& /* aRangeRepresentation */ )
729 : throw (uno::RuntimeException, std::exception)
730 : {
731 0 : return true;
732 : }
733 :
734 0 : Reference< chart2::data::XDataSequence > SAL_CALL InternalDataProvider::createDataSequenceByRangeRepresentation(
735 : const OUString& aRangeRepresentation )
736 : throw (lang::IllegalArgumentException,
737 : uno::RuntimeException, std::exception)
738 : {
739 0 : if( aRangeRepresentation.match( lcl_aCategoriesRangeName ))
740 : {
741 : OSL_ASSERT( aRangeRepresentation.equals( lcl_aCategoriesRangeName ) );//it is not expected nor implmented that only parts of the categories are really requested
742 :
743 : // categories
744 0 : return lcl_createDataSequenceAndAddToMap( lcl_aCategoriesRangeName, lcl_aCategoriesRoleName );
745 : }
746 0 : else if( aRangeRepresentation.match( lcl_aLabelRangePrefix ))
747 : {
748 : // label
749 0 : sal_Int32 nIndex = aRangeRepresentation.copy( lcl_aLabelRangePrefix.getLength()).toInt32();
750 0 : return lcl_createDataSequenceAndAddToMap( lcl_aLabelRangePrefix + OUString::number( nIndex ));
751 : }
752 0 : else if ( aRangeRepresentation == "last" )
753 : {
754 : sal_Int32 nIndex = (m_bDataInColumns
755 0 : ? m_aInternalData.getColumnCount()
756 0 : : m_aInternalData.getRowCount()) - 1;
757 0 : return lcl_createDataSequenceAndAddToMap( OUString::number( nIndex ));
758 : }
759 0 : else if( !aRangeRepresentation.isEmpty())
760 : {
761 : // data
762 0 : return lcl_createDataSequenceAndAddToMap( aRangeRepresentation );
763 : }
764 :
765 0 : return Reference< chart2::data::XDataSequence >();
766 : }
767 :
768 0 : Reference< sheet::XRangeSelection > SAL_CALL InternalDataProvider::getRangeSelection()
769 : throw (uno::RuntimeException, std::exception)
770 : {
771 : // there is no range selection component
772 0 : return Reference< sheet::XRangeSelection >();
773 : }
774 :
775 : // ____ XInternalDataProvider ____
776 0 : sal_Bool SAL_CALL InternalDataProvider::hasDataByRangeRepresentation( const OUString& aRange )
777 : throw (uno::RuntimeException, std::exception)
778 : {
779 0 : sal_Bool bResult = false;
780 :
781 0 : if( aRange.match( lcl_aCategoriesRangeName ))
782 : {
783 : OSL_ASSERT( aRange.equals( lcl_aCategoriesRangeName ) );//it is not expected nor implmented that only parts of the categories are really requested
784 0 : bResult = true;
785 : }
786 0 : else if( aRange.match( lcl_aLabelRangePrefix ))
787 : {
788 0 : sal_Int32 nIndex = aRange.copy( lcl_aLabelRangePrefix.getLength()).toInt32();
789 0 : bResult = (nIndex < (m_bDataInColumns ? m_aInternalData.getColumnCount(): m_aInternalData.getRowCount()));
790 : }
791 : else
792 : {
793 0 : sal_Int32 nIndex = aRange.toInt32();
794 0 : bResult = (nIndex < (m_bDataInColumns ? m_aInternalData.getColumnCount(): m_aInternalData.getRowCount()));
795 : }
796 :
797 0 : return bResult;
798 : }
799 :
800 0 : Sequence< uno::Any > SAL_CALL InternalDataProvider::getDataByRangeRepresentation( const OUString& aRange )
801 : throw (uno::RuntimeException, std::exception)
802 : {
803 0 : Sequence< uno::Any > aResult;
804 :
805 0 : if( aRange.match( lcl_aLabelRangePrefix ) )
806 : {
807 0 : sal_Int32 nIndex = aRange.copy( lcl_aLabelRangePrefix.getLength()).toInt32();
808 : vector< uno::Any > aComplexLabel = m_bDataInColumns
809 : ? m_aInternalData.getComplexColumnLabel( nIndex )
810 0 : : m_aInternalData.getComplexRowLabel( nIndex );
811 0 : if( !aComplexLabel.empty() )
812 0 : aResult = ContainerHelper::ContainerToSequence(aComplexLabel);
813 : }
814 0 : else if( aRange.match( lcl_aCategoriesPointRangeNamePrefix ) )
815 : {
816 0 : sal_Int32 nPointIndex = aRange.copy( lcl_aCategoriesPointRangeNamePrefix.getLength() ).toInt32();
817 : vector< uno::Any > aComplexCategory = m_bDataInColumns
818 : ? m_aInternalData.getComplexRowLabel( nPointIndex )
819 0 : : m_aInternalData.getComplexColumnLabel( nPointIndex );
820 0 : if( !aComplexCategory.empty() )
821 0 : aResult = ContainerHelper::ContainerToSequence(aComplexCategory);
822 : }
823 0 : else if( aRange.match( lcl_aCategoriesLevelRangeNamePrefix ) )
824 : {
825 0 : sal_Int32 nLevel = aRange.copy( lcl_aCategoriesLevelRangeNamePrefix.getLength() ).toInt32();
826 0 : vector< vector< uno::Any > > aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
827 0 : if( nLevel < lcl_getInnerLevelCount( aCategories ) )
828 : {
829 0 : aResult.realloc( aCategories.size() );
830 : transform( aCategories.begin(), aCategories.end(),
831 0 : aResult.getArray(), lcl_copyFromLevel(nLevel) );
832 0 : }
833 : }
834 0 : else if( aRange.equals( lcl_aCategoriesRangeName ) )
835 : {
836 0 : vector< vector< uno::Any > > aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
837 0 : sal_Int32 nLevelCount = lcl_getInnerLevelCount( aCategories );
838 0 : if( nLevelCount == 1 )
839 : {
840 0 : sal_Int32 nL=0;
841 0 : aResult = this->getDataByRangeRepresentation( lcl_aCategoriesLevelRangeNamePrefix + OUString::number( nL ) );
842 : }
843 : else
844 : {
845 0 : Sequence< OUString > aLabels = m_bDataInColumns ? this->getRowDescriptions() : this->getColumnDescriptions();
846 0 : aResult.realloc( aLabels.getLength() );
847 0 : transform( aLabels.getConstArray(), aLabels.getConstArray() + aLabels.getLength(),
848 0 : aResult.getArray(), CommonFunctors::makeAny< OUString >() );
849 0 : }
850 : }
851 : else
852 : {
853 0 : sal_Int32 nIndex = aRange.toInt32();
854 0 : if( nIndex >= 0 )
855 : {
856 0 : Sequence< double > aData;
857 0 : if( m_bDataInColumns )
858 0 : aData = m_aInternalData.getColumnValues(nIndex);
859 : else
860 0 : aData = m_aInternalData.getRowValues(nIndex);
861 0 : if( aData.getLength() )
862 : {
863 0 : aResult.realloc( aData.getLength());
864 0 : transform( aData.getConstArray(), aData.getConstArray() + aData.getLength(),
865 0 : aResult.getArray(), CommonFunctors::makeAny< double >());
866 0 : }
867 : }
868 : }
869 :
870 0 : return aResult;
871 : }
872 :
873 0 : void SAL_CALL InternalDataProvider::setDataByRangeRepresentation(
874 : const OUString& aRange, const Sequence< uno::Any >& aNewData )
875 : throw (uno::RuntimeException, std::exception)
876 : {
877 0 : vector< uno::Any > aNewVector( ContainerHelper::SequenceToVector(aNewData) );
878 0 : if( aRange.match( lcl_aLabelRangePrefix ) )
879 : {
880 0 : sal_uInt32 nIndex = aRange.copy( lcl_aLabelRangePrefix.getLength()).toInt32();
881 0 : if( m_bDataInColumns )
882 0 : m_aInternalData.setComplexColumnLabel( nIndex, aNewVector );
883 : else
884 0 : m_aInternalData.setComplexRowLabel( nIndex, aNewVector );
885 : }
886 0 : else if( aRange.match( lcl_aCategoriesPointRangeNamePrefix ) )
887 : {
888 0 : sal_Int32 nPointIndex = aRange.copy( lcl_aCategoriesLevelRangeNamePrefix.getLength()).toInt32();
889 0 : if( m_bDataInColumns )
890 0 : m_aInternalData.setComplexRowLabel( nPointIndex, aNewVector );
891 : else
892 0 : m_aInternalData.setComplexColumnLabel( nPointIndex, aNewVector );
893 : }
894 0 : else if( aRange.match( lcl_aCategoriesLevelRangeNamePrefix ) )
895 : {
896 0 : sal_Int32 nLevel = aRange.copy( lcl_aCategoriesLevelRangeNamePrefix.getLength()).toInt32();
897 0 : vector< vector< uno::Any > > aComplexCategories = m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels();
898 :
899 : //ensure equal length
900 0 : if( aNewVector.size() > aComplexCategories.size() )
901 0 : aComplexCategories.resize( aNewVector.size() );
902 0 : else if( aNewVector.size() < aComplexCategories.size() )
903 0 : aNewVector.resize( aComplexCategories.size() );
904 :
905 : transform( aComplexCategories.begin(), aComplexCategories.end(), aNewVector.begin(),
906 0 : aComplexCategories.begin(), lcl_setAnyAtLevel(nLevel) );
907 :
908 0 : if( m_bDataInColumns )
909 0 : m_aInternalData.setComplexRowLabels( aComplexCategories );
910 : else
911 0 : m_aInternalData.setComplexColumnLabels( aComplexCategories );
912 : }
913 0 : else if( aRange.equals( lcl_aCategoriesRangeName ) )
914 : {
915 0 : vector< vector< uno::Any > > aComplexCategories;
916 0 : aComplexCategories.resize( aNewVector.size() );
917 : transform( aComplexCategories.begin(), aComplexCategories.end(), aNewVector.begin(),
918 0 : aComplexCategories.begin(), lcl_setAnyAtLevel(0) );
919 0 : if( m_bDataInColumns )
920 0 : m_aInternalData.setComplexRowLabels( aComplexCategories );
921 : else
922 0 : m_aInternalData.setComplexColumnLabels( aComplexCategories );
923 : }
924 : else
925 : {
926 0 : sal_Int32 nIndex = aRange.toInt32();
927 0 : if( nIndex>=0 )
928 : {
929 0 : vector< double > aNewDataVec;
930 0 : transform( aNewData.getConstArray(), aNewData.getConstArray() + aNewData.getLength(),
931 0 : back_inserter( aNewDataVec ), CommonFunctors::AnyToDouble());
932 0 : if( m_bDataInColumns )
933 0 : m_aInternalData.setColumnValues( nIndex, aNewDataVec );
934 : else
935 0 : m_aInternalData.setRowValues( nIndex, aNewDataVec );
936 : }
937 0 : }
938 0 : }
939 :
940 0 : void SAL_CALL InternalDataProvider::insertSequence( ::sal_Int32 nAfterIndex )
941 : throw (uno::RuntimeException, std::exception)
942 : {
943 0 : if( m_bDataInColumns )
944 : {
945 0 : lcl_increaseMapReferences( nAfterIndex + 1, m_aInternalData.getColumnCount());
946 0 : m_aInternalData.insertColumn( nAfterIndex );
947 : }
948 : else
949 : {
950 0 : lcl_increaseMapReferences( nAfterIndex + 1, m_aInternalData.getRowCount());
951 0 : m_aInternalData.insertRow( nAfterIndex );
952 : }
953 0 : }
954 :
955 0 : void SAL_CALL InternalDataProvider::deleteSequence( ::sal_Int32 nAtIndex )
956 : throw (uno::RuntimeException, std::exception)
957 : {
958 0 : lcl_deleteMapReferences( OUString::number( nAtIndex ));
959 0 : lcl_deleteMapReferences( lcl_aLabelRangePrefix + OUString::number( nAtIndex ));
960 0 : if( m_bDataInColumns )
961 : {
962 0 : lcl_decreaseMapReferences( nAtIndex + 1, m_aInternalData.getColumnCount());
963 0 : m_aInternalData.deleteColumn( nAtIndex );
964 : }
965 : else
966 : {
967 0 : lcl_decreaseMapReferences( nAtIndex + 1, m_aInternalData.getRowCount());
968 0 : m_aInternalData.deleteRow( nAtIndex );
969 : }
970 0 : }
971 :
972 0 : void SAL_CALL InternalDataProvider::appendSequence()
973 : throw (uno::RuntimeException, std::exception)
974 : {
975 0 : if( m_bDataInColumns )
976 0 : m_aInternalData.appendColumn();
977 : else
978 0 : m_aInternalData.appendRow();
979 0 : }
980 :
981 0 : void SAL_CALL InternalDataProvider::insertComplexCategoryLevel( sal_Int32 nLevel )
982 : throw (uno::RuntimeException, std::exception)
983 : {
984 : OSL_ENSURE( nLevel> 0, "you can only insert category levels > 0" );//the first categories level cannot be deleted, check the calling code for error
985 0 : if( nLevel>0 )
986 : {
987 0 : vector< vector< uno::Any > > aComplexCategories = m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels();
988 0 : ::std::for_each( aComplexCategories.begin(), aComplexCategories.end(), lcl_insertAnyAtLevel(nLevel) );
989 0 : if( m_bDataInColumns )
990 0 : m_aInternalData.setComplexRowLabels( aComplexCategories );
991 : else
992 0 : m_aInternalData.setComplexColumnLabels( aComplexCategories );
993 :
994 0 : tSequenceMapRange aRange( m_aSequenceMap.equal_range( lcl_aCategoriesRangeName ));
995 0 : ::std::for_each( aRange.first, aRange.second, lcl_setModified());
996 : }
997 0 : }
998 0 : void SAL_CALL InternalDataProvider::deleteComplexCategoryLevel( sal_Int32 nLevel )
999 : throw (uno::RuntimeException, std::exception)
1000 : {
1001 : OSL_ENSURE( nLevel>0, "you can only delete category levels > 0" );//the first categories level cannot be deleted, check the calling code for error
1002 0 : if( nLevel>0 )
1003 : {
1004 0 : vector< vector< uno::Any > > aComplexCategories = m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels();
1005 0 : ::std::for_each( aComplexCategories.begin(), aComplexCategories.end(), lcl_removeAnyAtLevel(nLevel) );
1006 0 : if( m_bDataInColumns )
1007 0 : m_aInternalData.setComplexRowLabels( aComplexCategories );
1008 : else
1009 0 : m_aInternalData.setComplexColumnLabels( aComplexCategories );
1010 :
1011 0 : tSequenceMapRange aRange( m_aSequenceMap.equal_range( lcl_aCategoriesRangeName ));
1012 0 : ::std::for_each( aRange.first, aRange.second, lcl_setModified());
1013 : }
1014 0 : }
1015 :
1016 0 : void SAL_CALL InternalDataProvider::insertDataPointForAllSequences( ::sal_Int32 nAfterIndex )
1017 : throw (uno::RuntimeException, std::exception)
1018 : {
1019 0 : sal_Int32 nMaxRep = 0;
1020 0 : if( m_bDataInColumns )
1021 : {
1022 0 : m_aInternalData.insertRow( nAfterIndex );
1023 0 : nMaxRep = m_aInternalData.getColumnCount();
1024 : }
1025 : else
1026 : {
1027 0 : m_aInternalData.insertColumn( nAfterIndex );
1028 0 : nMaxRep = m_aInternalData.getRowCount();
1029 : }
1030 :
1031 : // notify change to all affected ranges
1032 0 : tSequenceMap::const_iterator aBegin( m_aSequenceMap.lower_bound( "0"));
1033 0 : tSequenceMap::const_iterator aEnd( m_aSequenceMap.upper_bound( OUString::number( nMaxRep )));
1034 0 : ::std::for_each( aBegin, aEnd, lcl_setModified());
1035 :
1036 0 : tSequenceMapRange aRange( m_aSequenceMap.equal_range( lcl_aCategoriesRangeName ));
1037 0 : ::std::for_each( aRange.first, aRange.second, lcl_setModified());
1038 0 : }
1039 :
1040 0 : void SAL_CALL InternalDataProvider::deleteDataPointForAllSequences( ::sal_Int32 nAtIndex )
1041 : throw (uno::RuntimeException, std::exception)
1042 : {
1043 0 : sal_Int32 nMaxRep = 0;
1044 0 : if( m_bDataInColumns )
1045 : {
1046 0 : m_aInternalData.deleteRow( nAtIndex );
1047 0 : nMaxRep = m_aInternalData.getColumnCount();
1048 : }
1049 : else
1050 : {
1051 0 : m_aInternalData.deleteColumn( nAtIndex );
1052 0 : nMaxRep = m_aInternalData.getRowCount();
1053 : }
1054 :
1055 : // notify change to all affected ranges
1056 0 : tSequenceMap::const_iterator aBegin( m_aSequenceMap.lower_bound( "0"));
1057 0 : tSequenceMap::const_iterator aEnd( m_aSequenceMap.upper_bound( OUString::number( nMaxRep )));
1058 0 : ::std::for_each( aBegin, aEnd, lcl_setModified());
1059 :
1060 0 : tSequenceMapRange aRange( m_aSequenceMap.equal_range( lcl_aCategoriesRangeName ));
1061 0 : ::std::for_each( aRange.first, aRange.second, lcl_setModified());
1062 0 : }
1063 :
1064 0 : void SAL_CALL InternalDataProvider::swapDataPointWithNextOneForAllSequences( ::sal_Int32 nAtIndex )
1065 : throw (uno::RuntimeException, std::exception)
1066 : {
1067 0 : if( m_bDataInColumns )
1068 0 : m_aInternalData.swapRowWithNext( nAtIndex );
1069 : else
1070 0 : m_aInternalData.swapColumnWithNext( nAtIndex );
1071 : sal_Int32 nMaxRep = (m_bDataInColumns
1072 0 : ? m_aInternalData.getColumnCount()
1073 0 : : m_aInternalData.getRowCount());
1074 :
1075 : // notify change to all affected ranges
1076 0 : tSequenceMap::const_iterator aBegin( m_aSequenceMap.lower_bound( "0"));
1077 0 : tSequenceMap::const_iterator aEnd( m_aSequenceMap.upper_bound( OUString::number( nMaxRep )));
1078 0 : ::std::for_each( aBegin, aEnd, lcl_setModified());
1079 :
1080 0 : tSequenceMapRange aRange( m_aSequenceMap.equal_range( lcl_aCategoriesRangeName ));
1081 0 : ::std::for_each( aRange.first, aRange.second, lcl_setModified());
1082 0 : }
1083 :
1084 0 : void SAL_CALL InternalDataProvider::registerDataSequenceForChanges( const Reference< chart2::data::XDataSequence >& xSeq )
1085 : throw (uno::RuntimeException, std::exception)
1086 : {
1087 0 : if( xSeq.is())
1088 0 : lcl_addDataSequenceToMap( xSeq->getSourceRangeRepresentation(), xSeq );
1089 0 : }
1090 :
1091 : // ____ XRangeXMLConversion ____
1092 0 : OUString SAL_CALL InternalDataProvider::convertRangeToXML( const OUString& aRangeRepresentation )
1093 : throw (lang::IllegalArgumentException,
1094 : uno::RuntimeException, std::exception)
1095 : {
1096 0 : XMLRangeHelper::CellRange aRange;
1097 0 : aRange.aTableName = "local-table";
1098 :
1099 : // attention: this data provider has the limitation that it stores
1100 : // internally if data comes from columns or rows. It is intended for
1101 : // creating only one used data source.
1102 : // @todo: add this information in the range representation strings
1103 0 : if( aRangeRepresentation.match( lcl_aCategoriesRangeName ))
1104 : {
1105 : OSL_ASSERT( aRangeRepresentation.equals( lcl_aCategoriesRangeName ) );//it is not expected nor implmented that only parts of the categories are really requested
1106 0 : aRange.aUpperLeft.bIsEmpty = false;
1107 0 : if( m_bDataInColumns )
1108 : {
1109 0 : aRange.aUpperLeft.nColumn = 0;
1110 0 : aRange.aUpperLeft.nRow = 1;
1111 0 : aRange.aLowerRight = aRange.aUpperLeft;
1112 0 : aRange.aLowerRight.nRow = m_aInternalData.getRowCount();
1113 : }
1114 : else
1115 : {
1116 0 : aRange.aUpperLeft.nColumn = 1;
1117 0 : aRange.aUpperLeft.nRow = 0;
1118 0 : aRange.aLowerRight = aRange.aUpperLeft;
1119 0 : aRange.aLowerRight.nColumn = m_aInternalData.getColumnCount();
1120 : }
1121 : }
1122 0 : else if( aRangeRepresentation.match( lcl_aLabelRangePrefix ))
1123 : {
1124 0 : sal_Int32 nIndex = aRangeRepresentation.copy( lcl_aLabelRangePrefix.getLength()).toInt32();
1125 0 : aRange.aUpperLeft.bIsEmpty = false;
1126 0 : aRange.aLowerRight.bIsEmpty = true;
1127 0 : if( m_bDataInColumns )
1128 : {
1129 0 : aRange.aUpperLeft.nColumn = nIndex + 1;
1130 0 : aRange.aUpperLeft.nRow = 0;
1131 : }
1132 : else
1133 : {
1134 0 : aRange.aUpperLeft.nColumn = 0;
1135 0 : aRange.aUpperLeft.nRow = nIndex + 1;
1136 : }
1137 : }
1138 0 : else if( aRangeRepresentation.equals( lcl_aCompleteRange ))
1139 : {
1140 0 : aRange.aUpperLeft.bIsEmpty = false;
1141 0 : aRange.aLowerRight.bIsEmpty = false;
1142 0 : aRange.aUpperLeft.nColumn = 0;
1143 0 : aRange.aUpperLeft.nRow = 0;
1144 0 : aRange.aLowerRight.nColumn = m_aInternalData.getColumnCount();
1145 0 : aRange.aLowerRight.nRow = m_aInternalData.getRowCount();
1146 : }
1147 : else
1148 : {
1149 0 : sal_Int32 nIndex = aRangeRepresentation.toInt32();
1150 0 : aRange.aUpperLeft.bIsEmpty = false;
1151 0 : if( m_bDataInColumns )
1152 : {
1153 0 : aRange.aUpperLeft.nColumn = nIndex + 1;
1154 0 : aRange.aUpperLeft.nRow = 1;
1155 0 : aRange.aLowerRight = aRange.aUpperLeft;
1156 0 : aRange.aLowerRight.nRow = m_aInternalData.getRowCount();
1157 : }
1158 : else
1159 : {
1160 0 : aRange.aUpperLeft.nColumn = 1;
1161 0 : aRange.aUpperLeft.nRow = nIndex + 1;
1162 0 : aRange.aLowerRight = aRange.aUpperLeft;
1163 0 : aRange.aLowerRight.nColumn = m_aInternalData.getColumnCount();
1164 : }
1165 : }
1166 :
1167 0 : return XMLRangeHelper::getXMLStringFromCellRange( aRange );
1168 : }
1169 :
1170 0 : OUString SAL_CALL InternalDataProvider::convertRangeFromXML( const OUString& aXMLRange )
1171 : throw (lang::IllegalArgumentException,
1172 : uno::RuntimeException, std::exception)
1173 : {
1174 0 : XMLRangeHelper::CellRange aRange( XMLRangeHelper::getCellRangeFromXMLString( aXMLRange ));
1175 0 : if( aRange.aUpperLeft.bIsEmpty )
1176 : {
1177 : OSL_ENSURE( aRange.aLowerRight.bIsEmpty, "Weird Range" );
1178 0 : return OUString();
1179 : }
1180 :
1181 : // "all"
1182 0 : if( !aRange.aLowerRight.bIsEmpty &&
1183 0 : ( aRange.aUpperLeft.nColumn != aRange.aLowerRight.nColumn ) &&
1184 0 : ( aRange.aUpperLeft.nRow != aRange.aLowerRight.nRow ) )
1185 0 : return lcl_aCompleteRange;
1186 :
1187 : // attention: this data provider has the limitation that it stores
1188 : // internally if data comes from columns or rows. It is intended for
1189 : // creating only one used data source.
1190 : // @todo: add this information in the range representation strings
1191 :
1192 : // data in columns
1193 0 : if( m_bDataInColumns )
1194 : {
1195 0 : if( aRange.aUpperLeft.nColumn == 0 )
1196 0 : return lcl_aCategoriesRangeName;
1197 0 : if( aRange.aUpperLeft.nRow == 0 )
1198 0 : return lcl_aLabelRangePrefix + OUString::number( aRange.aUpperLeft.nColumn - 1 );
1199 :
1200 0 : return OUString::number( aRange.aUpperLeft.nColumn - 1 );
1201 : }
1202 :
1203 : // data in rows
1204 0 : if( aRange.aUpperLeft.nRow == 0 )
1205 0 : return lcl_aCategoriesRangeName;
1206 0 : if( aRange.aUpperLeft.nColumn == 0 )
1207 0 : return lcl_aLabelRangePrefix + OUString::number( aRange.aUpperLeft.nRow - 1 );
1208 :
1209 0 : return OUString::number( aRange.aUpperLeft.nRow - 1 );
1210 : }
1211 :
1212 : namespace
1213 : {
1214 :
1215 : template< class Type >
1216 0 : Sequence< Sequence< Type > > lcl_convertVectorVectorToSequenceSequence( const vector< vector< Type > >& rIn )
1217 : {
1218 0 : Sequence< Sequence< Type > > aRet;
1219 0 : sal_Int32 nOuterCount = rIn.size();
1220 0 : if( nOuterCount )
1221 : {
1222 0 : aRet.realloc(nOuterCount);
1223 0 : for( sal_Int32 nN=0; nN<nOuterCount; nN++)
1224 0 : aRet[nN]= ContainerHelper::ContainerToSequence( rIn[nN] );
1225 : }
1226 0 : return aRet;
1227 : }
1228 :
1229 : template< class Type >
1230 0 : vector< vector< Type > > lcl_convertSequenceSequenceToVectorVector( const Sequence< Sequence< Type > >& rIn )
1231 : {
1232 0 : vector< vector< Type > > aRet;
1233 0 : sal_Int32 nOuterCount = rIn.getLength();
1234 0 : if( nOuterCount )
1235 : {
1236 0 : aRet.resize(nOuterCount);
1237 0 : for( sal_Int32 nN=0; nN<nOuterCount; nN++)
1238 0 : aRet[nN]= ContainerHelper::SequenceToVector( rIn[nN] );
1239 : }
1240 0 : return aRet;
1241 : }
1242 :
1243 0 : Sequence< Sequence< OUString > > lcl_convertComplexAnyVectorToStringSequence( const vector< vector< uno::Any > >& rIn )
1244 : {
1245 0 : Sequence< Sequence< OUString > > aRet;
1246 0 : sal_Int32 nOuterCount = rIn.size();
1247 0 : if( nOuterCount )
1248 : {
1249 0 : aRet.realloc(nOuterCount);
1250 0 : for( sal_Int32 nN=0; nN<nOuterCount; nN++)
1251 0 : aRet[nN]= lcl_AnyToStringSequence( ContainerHelper::ContainerToSequence( rIn[nN] ) );
1252 : }
1253 0 : return aRet;
1254 : }
1255 :
1256 0 : vector< vector< uno::Any > > lcl_convertComplexStringSequenceToAnyVector( const Sequence< Sequence< OUString > >& rIn )
1257 : {
1258 0 : vector< vector< uno::Any > > aRet;
1259 0 : sal_Int32 nOuterCount = rIn.getLength();
1260 0 : for( sal_Int32 nN=0; nN<nOuterCount; nN++)
1261 0 : aRet.push_back( ContainerHelper::SequenceToVector( lcl_StringToAnySequence( rIn[nN] ) ) );
1262 0 : return aRet;
1263 : }
1264 :
1265 : class SplitCategoriesProvider_ForComplexDescriptions : public SplitCategoriesProvider
1266 : {
1267 : public:
1268 :
1269 0 : explicit SplitCategoriesProvider_ForComplexDescriptions( const ::std::vector< ::std::vector< uno::Any > >& rComplexDescriptions )
1270 0 : : m_rComplexDescriptions( rComplexDescriptions )
1271 0 : {}
1272 0 : virtual ~SplitCategoriesProvider_ForComplexDescriptions()
1273 0 : {}
1274 :
1275 : virtual sal_Int32 getLevelCount() const SAL_OVERRIDE;
1276 : virtual uno::Sequence< OUString > getStringsForLevel( sal_Int32 nIndex ) const SAL_OVERRIDE;
1277 :
1278 : private:
1279 : const ::std::vector< ::std::vector< uno::Any > >& m_rComplexDescriptions;
1280 : };
1281 :
1282 0 : sal_Int32 SplitCategoriesProvider_ForComplexDescriptions::getLevelCount() const
1283 : {
1284 0 : return lcl_getInnerLevelCount( m_rComplexDescriptions );
1285 : }
1286 0 : uno::Sequence< OUString > SplitCategoriesProvider_ForComplexDescriptions::getStringsForLevel( sal_Int32 nLevel ) const
1287 : {
1288 0 : uno::Sequence< OUString > aResult;
1289 0 : if( nLevel < lcl_getInnerLevelCount( m_rComplexDescriptions ) )
1290 : {
1291 0 : aResult.realloc( m_rComplexDescriptions.size() );
1292 : transform( m_rComplexDescriptions.begin(), m_rComplexDescriptions.end(),
1293 0 : aResult.getArray(), lcl_getStringFromLevelVector(nLevel) );
1294 : }
1295 0 : return aResult;
1296 : }
1297 :
1298 : }//anonymous namespace
1299 :
1300 : // ____ XDateCategories ____
1301 0 : Sequence< double > SAL_CALL InternalDataProvider::getDateCategories() throw (uno::RuntimeException, std::exception)
1302 : {
1303 0 : double fNan = InternalDataProvider::getNotANumber();
1304 0 : double fValue = fNan;
1305 0 : vector< vector< uno::Any > > aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
1306 0 : sal_Int32 nCount = aCategories.size();
1307 0 : Sequence< double > aDoubles( nCount );
1308 0 : vector< vector< uno::Any > >::iterator aIt( aCategories.begin() );
1309 0 : vector< vector< uno::Any > >::const_iterator aEnd( aCategories.end() );
1310 0 : for(sal_Int32 nN=0; nN<nCount && aIt!=aEnd; ++nN, ++aIt )
1311 : {
1312 0 : if( !( !aIt->empty() && ((*aIt)[0]>>=fValue) ) )
1313 0 : fValue = fNan;
1314 0 : aDoubles[nN]=fValue;
1315 : }
1316 0 : return aDoubles;
1317 : }
1318 :
1319 0 : void SAL_CALL InternalDataProvider::setDateCategories( const Sequence< double >& rDates ) throw (uno::RuntimeException, std::exception)
1320 : {
1321 0 : sal_Int32 nCount = rDates.getLength();
1322 0 : vector< vector< uno::Any > > aNewCategories;
1323 0 : aNewCategories.reserve(nCount);
1324 0 : vector< uno::Any > aSingleLabel(1);
1325 :
1326 0 : for(sal_Int32 nN=0; nN<nCount; ++nN )
1327 : {
1328 0 : aSingleLabel[0]=uno::makeAny(rDates[nN]);
1329 0 : aNewCategories.push_back(aSingleLabel);
1330 : }
1331 :
1332 0 : if( m_bDataInColumns )
1333 0 : m_aInternalData.setComplexRowLabels( aNewCategories );
1334 : else
1335 0 : m_aInternalData.setComplexColumnLabels( aNewCategories );
1336 0 : }
1337 :
1338 : // ____ XAnyDescriptionAccess ____
1339 0 : Sequence< Sequence< uno::Any > > SAL_CALL InternalDataProvider::getAnyRowDescriptions() throw (uno::RuntimeException, std::exception)
1340 : {
1341 0 : return lcl_convertVectorVectorToSequenceSequence( m_aInternalData.getComplexRowLabels() );
1342 : }
1343 0 : void SAL_CALL InternalDataProvider::setAnyRowDescriptions( const Sequence< Sequence< uno::Any > >& aRowDescriptions ) throw (uno::RuntimeException, std::exception)
1344 : {
1345 0 : m_aInternalData.setComplexRowLabels( lcl_convertSequenceSequenceToVectorVector( aRowDescriptions ) );
1346 0 : }
1347 0 : Sequence< Sequence< uno::Any > > SAL_CALL InternalDataProvider::getAnyColumnDescriptions() throw (uno::RuntimeException, std::exception)
1348 : {
1349 0 : return lcl_convertVectorVectorToSequenceSequence( m_aInternalData.getComplexColumnLabels() );
1350 : }
1351 0 : void SAL_CALL InternalDataProvider::setAnyColumnDescriptions( const Sequence< Sequence< uno::Any > >& aColumnDescriptions ) throw (uno::RuntimeException, std::exception)
1352 : {
1353 0 : m_aInternalData.setComplexColumnLabels( lcl_convertSequenceSequenceToVectorVector( aColumnDescriptions ) );
1354 0 : }
1355 :
1356 : // ____ XComplexDescriptionAccess ____
1357 0 : Sequence< Sequence< OUString > > SAL_CALL InternalDataProvider::getComplexRowDescriptions() throw (uno::RuntimeException, std::exception)
1358 : {
1359 0 : return lcl_convertComplexAnyVectorToStringSequence( m_aInternalData.getComplexRowLabels() );
1360 : }
1361 0 : void SAL_CALL InternalDataProvider::setComplexRowDescriptions( const Sequence< Sequence< OUString > >& aRowDescriptions ) throw (uno::RuntimeException, std::exception)
1362 : {
1363 0 : m_aInternalData.setComplexRowLabels( lcl_convertComplexStringSequenceToAnyVector(aRowDescriptions) );
1364 0 : }
1365 0 : Sequence< Sequence< OUString > > SAL_CALL InternalDataProvider::getComplexColumnDescriptions() throw (uno::RuntimeException, std::exception)
1366 : {
1367 0 : return lcl_convertComplexAnyVectorToStringSequence( m_aInternalData.getComplexColumnLabels() );
1368 : }
1369 0 : void SAL_CALL InternalDataProvider::setComplexColumnDescriptions( const Sequence< Sequence< OUString > >& aColumnDescriptions ) throw (uno::RuntimeException, std::exception)
1370 : {
1371 0 : m_aInternalData.setComplexColumnLabels( lcl_convertComplexStringSequenceToAnyVector(aColumnDescriptions) );
1372 0 : }
1373 :
1374 : // ____ XChartDataArray ____
1375 0 : Sequence< Sequence< double > > SAL_CALL InternalDataProvider::getData()
1376 : throw (uno::RuntimeException, std::exception)
1377 : {
1378 0 : return m_aInternalData.getData();
1379 : }
1380 :
1381 0 : void SAL_CALL InternalDataProvider::setData( const Sequence< Sequence< double > >& rDataInRows )
1382 : throw (uno::RuntimeException, std::exception)
1383 : {
1384 0 : return m_aInternalData.setData( rDataInRows );
1385 : }
1386 :
1387 0 : void SAL_CALL InternalDataProvider::setRowDescriptions( const Sequence< OUString >& aRowDescriptions )
1388 : throw (uno::RuntimeException, std::exception)
1389 : {
1390 0 : vector< vector< uno::Any > > aComplexDescriptions( aRowDescriptions.getLength() );
1391 : transform( aComplexDescriptions.begin(), aComplexDescriptions.end(), aRowDescriptions.getConstArray(),
1392 0 : aComplexDescriptions.begin(), lcl_setAnyAtLevelFromStringSequence(0) );
1393 0 : m_aInternalData.setComplexRowLabels( aComplexDescriptions );
1394 0 : }
1395 :
1396 0 : void SAL_CALL InternalDataProvider::setColumnDescriptions( const Sequence< OUString >& aColumnDescriptions )
1397 : throw (uno::RuntimeException, std::exception)
1398 : {
1399 0 : vector< vector< uno::Any > > aComplexDescriptions( aColumnDescriptions.getLength() );
1400 : transform( aComplexDescriptions.begin(), aComplexDescriptions.end(), aColumnDescriptions.getConstArray(),
1401 0 : aComplexDescriptions.begin(), lcl_setAnyAtLevelFromStringSequence(0) );
1402 0 : m_aInternalData.setComplexColumnLabels( aComplexDescriptions );
1403 0 : }
1404 :
1405 0 : Sequence< OUString > SAL_CALL InternalDataProvider::getRowDescriptions()
1406 : throw (uno::RuntimeException, std::exception)
1407 : {
1408 0 : vector< vector< uno::Any > > aComplexLabels( m_aInternalData.getComplexRowLabels() );
1409 0 : SplitCategoriesProvider_ForComplexDescriptions aProvider( aComplexLabels );
1410 0 : return ExplicitCategoriesProvider::getExplicitSimpleCategories( aProvider );
1411 : }
1412 :
1413 0 : Sequence< OUString > SAL_CALL InternalDataProvider::getColumnDescriptions()
1414 : throw (uno::RuntimeException, std::exception)
1415 : {
1416 0 : vector< vector< uno::Any > > aComplexLabels( m_aInternalData.getComplexColumnLabels() );
1417 0 : SplitCategoriesProvider_ForComplexDescriptions aProvider( aComplexLabels );
1418 0 : return ExplicitCategoriesProvider::getExplicitSimpleCategories( aProvider );
1419 : }
1420 :
1421 : // ____ XChartData (base of XChartDataArray) ____
1422 0 : void SAL_CALL InternalDataProvider::addChartDataChangeEventListener(
1423 : const Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& )
1424 : throw (uno::RuntimeException, std::exception)
1425 : {
1426 0 : }
1427 :
1428 0 : void SAL_CALL InternalDataProvider::removeChartDataChangeEventListener(
1429 : const Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& )
1430 : throw (uno::RuntimeException, std::exception)
1431 : {
1432 0 : }
1433 :
1434 0 : double SAL_CALL InternalDataProvider::getNotANumber()
1435 : throw (uno::RuntimeException, std::exception)
1436 : {
1437 : double fNan;
1438 0 : ::rtl::math::setNan( & fNan );
1439 0 : return fNan;
1440 : }
1441 :
1442 0 : sal_Bool SAL_CALL InternalDataProvider::isNotANumber( double nNumber )
1443 : throw (uno::RuntimeException, std::exception)
1444 : {
1445 0 : return ::rtl::math::isNan( nNumber )
1446 0 : || ::rtl::math::isInf( nNumber );
1447 : }
1448 : // lang::XInitialization:
1449 0 : void SAL_CALL InternalDataProvider::initialize(const uno::Sequence< uno::Any > & _aArguments) throw (uno::RuntimeException, uno::Exception, std::exception)
1450 : {
1451 0 : comphelper::SequenceAsHashMap aArgs(_aArguments);
1452 0 : if ( aArgs.getUnpackedValueOrDefault( "CreateDefaultData" ,sal_False) )
1453 0 : createDefaultData();
1454 0 : }
1455 : // ____ XCloneable ____
1456 0 : Reference< util::XCloneable > SAL_CALL InternalDataProvider::createClone()
1457 : throw (uno::RuntimeException, std::exception)
1458 : {
1459 0 : return Reference< util::XCloneable >( new InternalDataProvider( *this ));
1460 : }
1461 :
1462 0 : Sequence< OUString > InternalDataProvider::getSupportedServiceNames_Static()
1463 : {
1464 0 : Sequence< OUString > aServices( 1 );
1465 0 : aServices[ 0 ] = "com.sun.star.chart2.data.DataProvider";
1466 0 : return aServices;
1467 : }
1468 :
1469 0 : APPHELPER_XSERVICEINFO_IMPL( InternalDataProvider, lcl_aServiceName );
1470 :
1471 0 : } // namespace chart
1472 :
1473 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|