26#include <XMLRangeHelper.hxx>
38#include <com/sun/star/chart2/data/XDataSequence.hpp>
39#include <com/sun/star/chart/ChartDataRowSource.hpp>
54using ::com::sun::star::uno::Reference;
55using ::com::sun::star::uno::Sequence;
63constexpr OUStringLiteral lcl_aCategoriesRangeName =
u"categories";
64const char lcl_aCategoriesLevelRangeNamePrefix[] =
"categoriesL ";
65const char lcl_aCategoriesPointRangeNamePrefix[] =
"categoriesP ";
66constexpr OUStringLiteral lcl_aCategoriesRoleName =
u"categories";
67const char lcl_aLabelRangePrefix[] =
"label ";
68constexpr OUStringLiteral lcl_aCompleteRange =
u"all";
70typedef std::multimap< OUString, uno::WeakReference< chart2::data::XDataSequence > >
73std::vector< OUString > lcl_AnyToStringSequence(
const std::vector< uno::Any >& aAnySeq )
75 std::vector< OUString > aResult;
76 aResult.resize( aAnySeq.size() );
79 aResult[
i++] = CommonFunctors::AnyToString()(aAny);
83std::vector< uno::Any > lcl_StringToAnyVector(
const css::uno::Sequence< OUString >& aStringSeq )
85 std::vector< uno::Any > aResult;
86 aResult.resize( aStringSeq.getLength() );
88 for (
const OUString& aStr : aStringSeq)
89 aResult[
i++] = CommonFunctors::makeAny<OUString>()(
aStr);
95 void operator() (
const lcl_tSequenceMap::value_type & rMapEntry )
98 Reference< chart2::data::XDataSequence > xSeq( rMapEntry.second );
101 Reference< util::XModifiable > xMod( xSeq, uno::UNO_QUERY );
103 xMod->setModified(
true );
108struct lcl_internalizeSeries
110 lcl_internalizeSeries( InternalData & rInternalData,
111 InternalDataProvider & rProvider,
112 bool bConnectToModel,
bool bDataInColumns ) :
120 const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & aOldSeriesData = xSeries->getDataSequences2();
121 std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aNewSeriesData( aOldSeriesData.size() );
122 for( std::size_t i=0;
i<aOldSeriesData.size(); ++
i )
125 OUString aIdentifier( OUString::number( nNewIndex ));
127 Reference< chart2::data::XNumericalDataSequence > xValues( aOldSeriesData[i]->getValues(), uno::UNO_QUERY );
128 Reference< chart2::data::XTextualDataSequence > xLabel( aOldSeriesData[i]->getLabel(), uno::UNO_QUERY );
129 Reference< chart2::data::XDataSequence > xNewValues;
140 xNewValues.set(
m_rProvider.createDataSequenceByRangeRepresentation( aIdentifier ));
142 Reference< beans::XPropertySet >( xValues, uno::UNO_QUERY ),
143 Reference< beans::XPropertySet >( xNewValues, uno::UNO_QUERY ));
150 m_rInternalData.setComplexColumnLabel( nNewIndex, lcl_StringToAnyVector( xLabel->getTextualData() ) );
152 m_rInternalData.setComplexRowLabel( nNewIndex, lcl_StringToAnyVector( xLabel->getTextualData() ) );
155 Reference< chart2::data::XDataSequence > xNewLabel(
156 m_rProvider.createDataSequenceByRangeRepresentation( lcl_aLabelRangePrefix + aIdentifier ));
158 Reference< beans::XPropertySet >( xLabel, uno::UNO_QUERY ),
159 Reference< beans::XPropertySet >( xNewLabel, uno::UNO_QUERY ));
160 aNewSeriesData[
i].set(
new LabeledDataSequence( xNewValues, xNewLabel ) );
166 aNewSeriesData[
i].set(
new LabeledDataSequence( xNewValues ) );
170 xSeries->setData( aNewSeriesData );
180struct lcl_copyFromLevel
184 explicit lcl_copyFromLevel( sal_Int32 nLevel ) :
m_nLevel( nLevel )
187 uno::Any operator() (
const std::vector< uno::Any >& rVector )
190 if(
m_nLevel <
static_cast< sal_Int32
>(rVector.size()) )
199struct lcl_getStringFromLevelVector
203 explicit lcl_getStringFromLevelVector( sal_Int32 nLevel ) :
m_nLevel( nLevel )
206 OUString operator() (
const std::vector< uno::Any >& rVector )
209 if(
m_nLevel <
static_cast< sal_Int32
>(rVector.size()) )
210 aString = CommonFunctors::AnyToString()(rVector[
m_nLevel]);
218struct lcl_setAnyAtLevel
222 explicit lcl_setAnyAtLevel( sal_Int32 nLevel ) :
m_nLevel( nLevel )
225 std::vector< uno::Any > operator() (
const std::vector< uno::Any >& rVector,
const uno::Any& rNewValue )
227 std::vector< uno::Any > aRet( rVector );
228 if(
m_nLevel >=
static_cast< sal_Int32
>(aRet.size()) )
238struct lcl_setAnyAtLevelFromStringSequence
242 explicit lcl_setAnyAtLevelFromStringSequence( sal_Int32 nLevel ) :
m_nLevel( nLevel )
245 std::vector< uno::Any > operator() (
const std::vector< uno::Any >& rVector,
const OUString& rNewValue )
247 std::vector< uno::Any > aRet( rVector );
248 if(
m_nLevel >=
static_cast< sal_Int32
>(aRet.size()) )
258struct lcl_insertAnyAtLevel
262 explicit lcl_insertAnyAtLevel( sal_Int32 nLevel ) :
m_nLevel( nLevel )
265 void operator() ( std::vector< uno::Any >& rVector )
267 if(
m_nLevel >=
static_cast< sal_Int32
>(rVector.size()) )
281struct lcl_removeAnyAtLevel
285 explicit lcl_removeAnyAtLevel( sal_Int32 nLevel ) :
m_nLevel( nLevel )
288 void operator() ( std::vector< uno::Any >& rVector )
290 if(
m_nLevel <
static_cast<sal_Int32
>(rVector.size()) )
292 rVector.erase(rVector.begin() +
m_nLevel);
308 bool bConnectToModel,
309 bool bDefaultDataInColumns)
321 OUString aRangeString;
322 bool bFirstCellAsLabel =
true;
323 bool bHasCategories =
true;
325 const bool bSomethingDetected(
327 xModel, aRangeString, aSequenceMapping,
m_bDataInColumns, bFirstCellAsLabel, bHasCategories ));
338 std::vector< std::vector< uno::Any > > aNewCategories;
342 const std::vector< Reference< chart2::data::XLabeledDataSequence> >& rSplitCategoriesList( aExplicitCategoriesProvider.getSplitCategoriesList() );
343 sal_Int32 nLevelCount = rSplitCategoriesList.size();
344 for( sal_Int32 nL = 0; nL<nLevelCount; nL++ )
349 Sequence< uno::Any > aDataSeq;
350 Reference< chart2::data::XDataSequence > xSeq( xLDS->getValues() );
352 aDataSeq = xSeq->getData();
353 sal_Int32
nLength = aDataSeq.getLength();
354 sal_Int32 nCatLength =
static_cast< sal_Int32
>(aNewCategories.size());
355 if( nCatLength < nLength )
356 aNewCategories.resize( nLength );
357 else if( nLength < nCatLength )
358 aDataSeq.realloc( nCatLength );
359 transform( aNewCategories.begin(), aNewCategories.end(), aDataSeq.getConstArray(),
360 aNewCategories.begin(), lcl_setAnyAtLevel(nL) );
364 Sequence< OUString > aSimplecategories = aExplicitCategoriesProvider.getSimpleCategories();
365 sal_Int32
nLength = aSimplecategories.getLength();
366 aNewCategories.reserve( nLength );
367 for( sal_Int32 nN=0; nN<
nLength; nN++)
369 aNewCategories.push_back( {
uno::Any(aSimplecategories[nN]) } );
378 if( bConnectToModel )
379 xDiagram->setCategories(
380 new LabeledDataSequence(
388 for(
const auto& rxScreen : aSeriesVector )
392 catch(
const uno::Exception & )
401 m_aSequenceMap( rOther.m_aSequenceMap ),
402 m_aInternalData( rOther.m_aInternalData ),
410 const OUString & rRangeRepresentation,
414 rRangeRepresentation,
422 for( tSequenceMap::iterator aIt( aRange.first ); aIt != aRange.second; ++aIt )
429 xNamed->setName( OUString());
437 const OUString & rOldRangeRepresentation,
438 const OUString & rNewRangeRepresentation )
442 for( tSequenceMap::iterator aIt( aRange.first ); aIt != aRange.second; ++aIt )
449 xNamed->setName( rNewRangeRepresentation );
451 aNewElements.emplace( rNewRangeRepresentation, aIt->second );
456 m_aSequenceMap.insert( aNewElements.begin(), aNewElements.end() );
460 sal_Int32 nBegin, sal_Int32 nEnd )
465 OUString::number(
nIndex + 1 ));
467 lcl_aLabelRangePrefix + OUString::number(
nIndex + 1 ));
472 sal_Int32 nBegin, sal_Int32 nEnd )
477 OUString::number(
nIndex - 1 ));
479 lcl_aLabelRangePrefix + OUString::number(
nIndex - 1 ));
484 const OUString & rRangeRepresentation )
498 if (rArrayStr.indexOf(
'{') != 0 || rArrayStr[rArrayStr.getLength()-1] !=
'}')
504 bool bAllNumeric =
true;
512 std::vector<OUString> aRawElems;
515 bool bInQuote =
false;
516 for (;
p != pEnd; ++
p)
519 if (bInQuote && *
p ==
'"' && *(
p + 1) ==
'"')
527 bInQuote = !bInQuote;
537 aElem = OUString(pElem,
p-pElem);
539 if (!aElem.isEmpty())
542 aRawElems.push_back(aElem.replaceAll(
"\"\"",
"\""));
551 else if (*
p ==
';' && !bInQuote)
555 aElem = OUString(pElem,
p-pElem);
556 aRawElems.push_back(aElem);
566 aElem = OUString(pElem,
p-pElem);
567 aRawElems.push_back(aElem);
570 if (rRole ==
u"values-y" || rRole ==
u"values-first" || rRole ==
u"values-last" ||
571 rRole ==
u"values-min" || rRole ==
u"values-max" || rRole ==
u"values-size" ||
572 rRole ==
u"error-bars-y-positive" || rRole ==
u"error-bars-y-negative")
576 std::vector<double> aValues;
577 aValues.reserve(aRawElems.size());
578 for (
const OUString & aRawElem : aRawElems)
580 if (aRawElem.isEmpty())
581 aValues.push_back(NAN);
583 aValues.push_back(aRawElem.toDouble());
589 OUString aRangeRep = OUString::number(
n);
593 else if (rRole ==
u"values-x")
595 std::vector<double> aValues;
596 aValues.reserve(aRawElems.size());
599 for (
const OUString & aRawElem : aRawElems)
601 if (!aRawElem.isEmpty())
602 aValues.push_back(aRawElem.toDouble());
604 aValues.push_back(NAN);
609 for (
size_t i = 0;
i < aRawElems.size(); ++
i)
610 aValues.push_back(
i+1);
616 OUString aRangeRep = OUString::number(
n);
620 else if (rRole ==
u"categories")
625 bool bStoreNumeric = rRoleQualifier ==
u"date";
627 for (
size_t i = 0;
i < aRawElems.size(); ++
i)
631 bool bGetDouble = bAllNumeric && !aRawElems[
i].isEmpty();
632 fValue = bGetDouble ? aRawElems[
i].toDouble() :
633 std::numeric_limits<double>::quiet_NaN();
635 std::vector<uno::Any> aLabels(1,
643 else if (rRole ==
u"label")
648 if (!aRawElems.empty() && nColSize)
653 std::vector<uno::Any> aLabels(1,
uno::Any(aRawElems[0]));
657 OUString aRangeRep = lcl_aLabelRangePrefix + OUString::number(nColSize-1);
667 const OUString & rRangeRepresentation,
668 const OUString & rRole )
685sal_Int32 lcl_getInnerLevelCount(
const std::vector< std::vector< uno::Any > >& rLabels )
688 for (
auto const& elemLabel : rLabels)
690 nCount = std::max<sal_Int32>( elemLabel.size(), nCount );
700 OUString aRangeRepresentation;
701 bool bUseColumns =
true;
702 bool bFirstCellAsLabel =
true;
703 bool bHasCategories =
true;
707 if( aRangeRepresentation == lcl_aCategoriesRangeName )
710 std::vector< Reference< chart2::data::XLabeledDataSequence > > aComplexCategories;
714 sal_Int32 nLevelCount = lcl_getInnerLevelCount( aCategories );
715 for( sal_Int32 nL=0; nL<nLevelCount; nL++ )
718 , lcl_aCategoriesLevelRangeNamePrefix + OUString::number( nL )
719 , lcl_aCategoriesRoleName ) ) );
724 for( sal_Int32 nP=0; nP<nPointCount; nP++ )
727 , lcl_aCategoriesPointRangeNamePrefix + OUString::number( nP )
728 , lcl_aCategoriesRoleName ) ) );
734 OSL_ASSERT( aRangeRepresentation == lcl_aCompleteRange );
736 std::vector< Reference< chart2::data::XLabeledDataSequence > > aResultLSeqVec;
740 aResultLSeqVec.push_back(
744 std::vector< Reference< chart2::data::XLabeledDataSequence > > aDataVec;
747 for (sal_Int32 nIdx = 0; nIdx <
nCount; ++nIdx)
762 for( sal_Int32 nNewIndex = 0; nNewIndex < aSequenceMapping.getLength(); nNewIndex++ )
764 std::vector< LabeledDataSequence* >::size_type nOldIndex = aSequenceMapping[nNewIndex];
765 if( nOldIndex < aDataVec.size() )
767 if( aDataVec[nOldIndex].is() )
769 aResultLSeqVec.push_back( aDataVec[nOldIndex] );
770 aDataVec[nOldIndex] =
nullptr;
776 for (
auto const& elem : aDataVec)
779 aResultLSeqVec.push_back(elem);
789 beans::PropertyValue(
790 "CellRangeRepresentation", -1,
uno::Any( OUString(lcl_aCompleteRange) ),
791 beans::PropertyState_DIRECT_VALUE ),
792 beans::PropertyValue(
795 ? css::chart::ChartDataRowSource_COLUMNS
796 : css::chart::ChartDataRowSource_ROWS ),
797 beans::PropertyState_DIRECT_VALUE ),
799 beans::PropertyValue(
800 "FirstCellAsLabel", -1,
uno::Any(
true ), beans::PropertyState_DIRECT_VALUE ),
801 beans::PropertyValue(
802 "HasCategories", -1,
uno::Any(
true ), beans::PropertyState_DIRECT_VALUE )
816 const OUString& aRangeRepresentation )
818 if( aRangeRepresentation.match( lcl_aCategoriesRangeName ))
820 OSL_ASSERT( aRangeRepresentation == lcl_aCategoriesRangeName );
825 else if( aRangeRepresentation.match( lcl_aLabelRangePrefix ))
828 sal_Int32
nIndex =
o3tl::toInt32(aRangeRepresentation.subView( strlen(lcl_aLabelRangePrefix)));
831 else if ( aRangeRepresentation ==
"last" )
838 else if( !aRangeRepresentation.isEmpty())
849 const OUString& aRole,
const OUString& aRangeRepresentation,
const OUString& aRoleQualifier )
863 bool bResult =
false;
865 if( aRange.match( lcl_aCategoriesRangeName ))
867 OSL_ASSERT( aRange == lcl_aCategoriesRangeName );
870 else if( aRange.match( lcl_aLabelRangePrefix ))
877 sal_Int32
nIndex = aRange.toInt32();
888 if( aRange.match( lcl_aLabelRangePrefix ) )
894 if( !aComplexLabel.empty() )
897 else if( aRange.match( lcl_aCategoriesPointRangeNamePrefix ) )
899 auto nPointIndex =
o3tl::toUInt32(aRange.subView( strlen(lcl_aCategoriesPointRangeNamePrefix) ));
903 if( !aComplexCategory.empty() )
906 else if( aRange.match( lcl_aCategoriesLevelRangeNamePrefix ) )
908 sal_Int32 nLevel =
o3tl::toInt32(aRange.subView( strlen(lcl_aCategoriesLevelRangeNamePrefix) ));
910 if( nLevel < lcl_getInnerLevelCount( aCategories ) )
912 aResult.realloc( aCategories.size() );
913 transform( aCategories.begin(), aCategories.end(),
914 aResult.getArray(), lcl_copyFromLevel(nLevel) );
917 else if( aRange == lcl_aCategoriesRangeName )
920 sal_Int32 nLevelCount = lcl_getInnerLevelCount( aCategories );
921 if( nLevelCount == 1 )
929 aResult.realloc( aLabels.getLength() );
930 std::transform( aLabels.begin(), aLabels.end(),
936 sal_Int32
nIndex = aRange.toInt32();
942 if(
aData.hasElements() )
944 aResult.realloc(
aData.getLength());
958 if( aRange.match( lcl_aLabelRangePrefix ) )
966 else if( aRange.match( lcl_aCategoriesPointRangeNamePrefix ) )
968 sal_Int32 nPointIndex =
o3tl::toInt32(aRange.subView( strlen(lcl_aCategoriesLevelRangeNamePrefix)));
974 else if( aRange.match( lcl_aCategoriesLevelRangeNamePrefix ) )
976 sal_Int32 nLevel =
o3tl::toInt32(aRange.subView( strlen(lcl_aCategoriesLevelRangeNamePrefix)));
980 if( aNewVector.size() > aComplexCategories.size() )
981 aComplexCategories.resize( aNewVector.size() );
982 else if( aNewVector.size() < aComplexCategories.size() )
983 aNewVector.resize( aComplexCategories.size() );
985 transform( aComplexCategories.begin(), aComplexCategories.end(), aNewVector.begin(),
986 aComplexCategories.begin(), lcl_setAnyAtLevel(nLevel) );
993 else if( aRange == lcl_aCategoriesRangeName )
995 std::vector< std::vector< uno::Any > > aComplexCategories;
996 aComplexCategories.resize( aNewVector.size() );
997 transform( aComplexCategories.begin(), aComplexCategories.end(), aNewVector.begin(),
998 aComplexCategories.begin(), lcl_setAnyAtLevel(0) );
1006 sal_Int32
nIndex = aRange.toInt32();
1009 std::vector< double > aNewDataVec;
1010 transform( aNewData.begin(), aNewData.end(),
1060 OSL_ENSURE( nLevel> 0,
"you can only insert category levels > 0" );
1064 std::for_each( aComplexCategories.begin(), aComplexCategories.end(), lcl_insertAnyAtLevel(nLevel) );
1071 std::for_each( aRange.first, aRange.second, lcl_setModified());
1076 OSL_ENSURE( nLevel>0,
"you can only delete category levels > 0" );
1080 std::for_each( aComplexCategories.begin(), aComplexCategories.end(), lcl_removeAnyAtLevel(nLevel) );
1087 std::for_each( aRange.first, aRange.second, lcl_setModified());
1093 sal_Int32 nMaxRep = 0;
1106 tSequenceMap::const_iterator aBegin(
m_aSequenceMap.lower_bound(
"0"));
1107 tSequenceMap::const_iterator aEnd(
m_aSequenceMap.upper_bound( OUString::number( nMaxRep )));
1108 std::for_each( aBegin, aEnd, lcl_setModified());
1111 std::for_each( aRange.first, aRange.second, lcl_setModified());
1116 sal_Int32 nMaxRep = 0;
1129 tSequenceMap::const_iterator aBegin(
m_aSequenceMap.lower_bound(
"0"));
1130 tSequenceMap::const_iterator aEnd(
m_aSequenceMap.upper_bound( OUString::number( nMaxRep )));
1131 std::for_each( aBegin, aEnd, lcl_setModified());
1134 std::for_each( aRange.first, aRange.second, lcl_setModified());
1148 tSequenceMap::const_iterator aBegin(
m_aSequenceMap.lower_bound(
"0"));
1149 tSequenceMap::const_iterator aEnd(
m_aSequenceMap.upper_bound( OUString::number( nMaxRep )));
1150 std::for_each( aBegin, aEnd, lcl_setModified());
1153 std::for_each( aRange.first, aRange.second, lcl_setModified());
1172 if( aRangeRepresentation.match( lcl_aCategoriesRangeName ))
1174 OSL_ASSERT( aRangeRepresentation == lcl_aCategoriesRangeName );
1191 else if( aRangeRepresentation.match( lcl_aLabelRangePrefix ))
1193 sal_Int32
nIndex =
o3tl::toInt32(aRangeRepresentation.subView( strlen(lcl_aLabelRangePrefix)));
1207 else if( aRangeRepresentation == lcl_aCompleteRange )
1218 sal_Int32
nIndex = aRangeRepresentation.toInt32();
1244 if (aXMLRange ==
"PivotChart") {
1248 static constexpr OUStringLiteral aPivotTableID(
u"PT@");
1249 if (aXMLRange.startsWith(aPivotTableID))
1250 return aXMLRange.copy(aPivotTableID.getLength());
1263 return lcl_aCompleteRange;
1274 return lcl_aCategoriesRangeName;
1276 return lcl_aLabelRangePrefix + OUString::number( aRange.
aUpperLeft.
nColumn - 1 );
1283 return lcl_aCategoriesRangeName;
1285 return lcl_aLabelRangePrefix + OUString::number( aRange.
aUpperLeft.
nRow - 1 );
1293template<
class Type >
1297 sal_Int32 nOuterCount = rIn.size();
1300 aRet.realloc(nOuterCount);
1301 auto pRet = aRet.getArray();
1302 for( sal_Int32 nN=0; nN<nOuterCount; nN++)
1308template<
class Type >
1309std::vector< std::vector< Type > > lcl_convertSequenceSequenceToVectorVector(
const Sequence< Sequence< Type > >& rIn )
1311 std::vector< std::vector< Type > > aRet;
1312 sal_Int32 nOuterCount = rIn.getLength();
1315 aRet.resize(nOuterCount);
1316 for( sal_Int32 nN=0; nN<nOuterCount; nN++)
1322std::vector< Sequence< OUString > > lcl_convertComplexAnyVectorToStringSequence(
const std::vector< std::vector< uno::Any > >& rIn )
1324 std::vector< Sequence< OUString > > aRet;
1325 sal_Int32 nOuterCount = rIn.size();
1328 aRet.resize(nOuterCount);
1329 for( sal_Int32 nN=0; nN<nOuterCount; nN++)
1335std::vector< std::vector< uno::Any > > lcl_convertComplexStringSequenceToAnyVector(
const Sequence< Sequence< OUString > >& rIn )
1337 std::vector< std::vector< uno::Any > > aRet;
1338 sal_Int32 nOuterCount = rIn.getLength();
1339 aRet.reserve(nOuterCount);
1340 for (sal_Int32 nN = 0; nN < nOuterCount; nN++)
1341 aRet.push_back( lcl_StringToAnyVector( rIn[nN] ) );
1345class SplitCategoriesProvider_ForComplexDescriptions :
public SplitCategoriesProvider
1349 explicit SplitCategoriesProvider_ForComplexDescriptions(
const std::vector< std::vector< uno::Any > >& rComplexDescriptions )
1353 virtual sal_Int32 getLevelCount()
const override;
1354 virtual uno::Sequence< OUString > getStringsForLevel( sal_Int32 nIndex )
const override;
1360sal_Int32 SplitCategoriesProvider_ForComplexDescriptions::getLevelCount()
const
1364uno::Sequence< OUString > SplitCategoriesProvider_ForComplexDescriptions::getStringsForLevel( sal_Int32 nLevel )
const
1366 uno::Sequence< OUString > aResult;
1371 aResult.getArray(), lcl_getStringFromLevelVector(nLevel) );
1382 sal_Int32
nCount = aCategories.size();
1384 auto aDoublesRange = asNonConstRange(aDoubles);
1386 for (
auto const& category : aCategories)
1389 if( category.empty() || !(category[0]>>=fValue) )
1390 fValue = std::numeric_limits<double>::quiet_NaN();
1391 aDoublesRange[nN++]=fValue;
1398 sal_Int32
nCount = rDates.getLength();
1399 std::vector< std::vector< uno::Any > > aNewCategories;
1400 aNewCategories.reserve(
nCount);
1401 std::vector< uno::Any > aSingleLabel(1);
1403 for(sal_Int32 nN=0; nN<
nCount; ++nN )
1405 aSingleLabel[0] <<= rDates[nN];
1406 aNewCategories.push_back(aSingleLabel);
1464 std::vector< std::vector< uno::Any > > aComplexDescriptions( aRowDescriptions.getLength() );
1465 transform( aComplexDescriptions.begin(), aComplexDescriptions.end(), aRowDescriptions.getConstArray(),
1466 aComplexDescriptions.begin(), lcl_setAnyAtLevelFromStringSequence(0) );
1472 std::vector< std::vector< uno::Any > > aComplexDescriptions( aColumnDescriptions.getLength() );
1473 transform( aComplexDescriptions.begin(), aComplexDescriptions.end(), aColumnDescriptions.getConstArray(),
1474 aComplexDescriptions.begin(), lcl_setAnyAtLevelFromStringSequence(0) );
1481 SplitCategoriesProvider_ForComplexDescriptions aProvider( aComplexLabels );
1488 SplitCategoriesProvider_ForComplexDescriptions aProvider( aComplexLabels );
1505 return std::numeric_limits<double>::quiet_NaN();
1510 return std::isnan( nNumber )
1511 || std::isinf( nNumber );
1530 return "com.sun.star.comp.chart.InternalDataProvider";
1540 return {
"com.sun.star.chart2.data.DataProvider" };
1545extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
1547 css::uno::Sequence<css::uno::Any>
const &)
1549 return cppu::acquire(new ::chart::InternalDataProvider);
InternalData & m_rInternalData
const std::vector< std::vector< uno::Any > > & m_rComplexDescriptions
InternalDataProvider & m_rProvider
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_chart_InternalDataProvider_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
static std::vector< rtl::Reference< ::chart::DataSeries > > getDataSeries(const rtl::Reference< ::chart::ChartModel > &xModel)
static rtl::Reference< ::chart::BaseCoordinateSystem > getFirstCoordinateSystem(const rtl::Reference<::chart::ChartModel > &xModel)
static bool detectRangeSegmentation(const rtl::Reference<::chart::ChartModel > &xChartModel, OUString &rOutRangeString, css::uno::Sequence< sal_Int32 > &rSequenceMapping, bool &rOutUseColumns, bool &rOutFirstCellAsLabel, bool &rOutHasCategories)
static SAL_DLLPRIVATE void readArguments(const css::uno::Sequence< css::beans::PropertyValue > &rArguments, OUString &rRangeRepresentation, css::uno::Sequence< sal_Int32 > &rSequenceMapping, bool &bUseColumns, bool &bFirstCellAsLabel, bool &bHasCategories)
static css::uno::Sequence< OUString > getExplicitSimpleCategories(const SplitCategoriesProvider &rSplitCategoriesProvider)
Data provider that handles data internally.
std::multimap< OUString, css::uno::WeakReference< css::chart2::data::XDataSequence > > tSequenceMap
virtual void SAL_CALL appendSequence() override
InternalData m_aInternalData
virtual void SAL_CALL setDateCategories(const css::uno::Sequence< double > &rDates) override
virtual void SAL_CALL setAnyRowDescriptions(const css::uno::Sequence< css::uno::Sequence< css::uno::Any > > &aRowDescriptions) override
void increaseMapReferences(sal_Int32 nBegin, sal_Int32 nEnd)
virtual OUString SAL_CALL convertRangeFromXML(const OUString &aXMLRange) override
virtual void SAL_CALL removeChartDataChangeEventListener(const css::uno::Reference< css::chart::XChartDataChangeEventListener > &aListener) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Sequence< css::uno::Sequence< OUString > > SAL_CALL getComplexRowDescriptions() override
virtual void SAL_CALL swapDataPointWithNextOneForAllSequences(::sal_Int32 nAtIndex) override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getAnyColumnDescriptions() override
virtual void SAL_CALL setComplexColumnDescriptions(const css::uno::Sequence< css::uno::Sequence< OUString > > &aColumnDescriptions) override
void adaptMapReferences(const OUString &rOldRangeRepresentation, const OUString &rNewRangeRepresentation)
virtual void SAL_CALL setColumnDescriptions(const css::uno::Sequence< OUString > &aColumnDescriptions) override
virtual ~InternalDataProvider() override
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL createDataSequenceByValueArray(const OUString &aRole, const OUString &aRangeRepresentation, const OUString &aRoleQualifier) override
virtual void SAL_CALL setDataByRangeRepresentation(const OUString &aRange, const css::uno::Sequence< css::uno::Any > &aNewData) override
virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getAnyRowDescriptions() override
virtual OUString SAL_CALL getImplementationName() override
declare XServiceInfo methods
virtual sal_Bool SAL_CALL createDataSourcePossible(const css::uno::Sequence< css::beans::PropertyValue > &aArguments) override
virtual sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible(const OUString &aRangeRepresentation) override
virtual OUString SAL_CALL convertRangeToXML(const OUString &aRangeRepresentation) override
void addDataSequenceToMap(const OUString &rRangeRepresentation, const css::uno::Reference< css::chart2::data::XDataSequence > &xSequence)
virtual void SAL_CALL addChartDataChangeEventListener(const css::uno::Reference< css::chart::XChartDataChangeEventListener > &aListener) override
virtual void SAL_CALL insertDataPointForAllSequences(::sal_Int32 nAfterIndex) override
virtual void SAL_CALL setData(const css::uno::Sequence< css::uno::Sequence< double > > &aData) override
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL detectArguments(const css::uno::Reference< css::chart2::data::XDataSource > &xDataSource) override
virtual css::uno::Reference< css::chart2::data::XDataSource > SAL_CALL createDataSource(const css::uno::Sequence< css::beans::PropertyValue > &aArguments) override
virtual css::uno::Reference< css::sheet::XRangeSelection > SAL_CALL getRangeSelection() override
std::pair< tSequenceMap::iterator, tSequenceMap::iterator > tSequenceMapRange
void decreaseMapReferences(sal_Int32 nBegin, sal_Int32 nEnd)
virtual css::uno::Sequence< double > SAL_CALL getDateCategories() override
virtual sal_Bool SAL_CALL isNotANumber(double nNumber) override
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
virtual css::uno::Sequence< OUString > SAL_CALL getRowDescriptions() override
virtual css::uno::Sequence< css::uno::Sequence< double > > SAL_CALL getData() override
virtual double SAL_CALL getNotANumber() override
void deleteMapReferences(const OUString &rRangeRepresentation)
tSequenceMap m_aSequenceMap
cache for all sequences that have been returned.
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getDataByRangeRepresentation(const OUString &aRange) override
virtual void SAL_CALL deleteDataPointForAllSequences(::sal_Int32 nAtIndex) override
css::uno::Reference< css::chart2::data::XDataSequence > createDataSequenceAndAddToMap(const OUString &rRangeRepresentation, const OUString &rRole)
virtual void SAL_CALL deleteSequence(::sal_Int32 nAtIndex) override
virtual void SAL_CALL registerDataSequenceForChanges(const css::uno::Reference< css::chart2::data::XDataSequence > &xSeq) override
virtual void SAL_CALL setRowDescriptions(const css::uno::Sequence< OUString > &aRowDescriptions) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Sequence< css::uno::Sequence< OUString > > SAL_CALL getComplexColumnDescriptions() override
virtual void SAL_CALL deleteComplexCategoryLevel(::sal_Int32 nLevel) override
virtual sal_Bool SAL_CALL hasDataByRangeRepresentation(const OUString &aRange) override
virtual void SAL_CALL setComplexRowDescriptions(const css::uno::Sequence< css::uno::Sequence< OUString > > &aRowDescriptions) override
virtual void SAL_CALL insertComplexCategoryLevel(::sal_Int32 nLevel) override
virtual void SAL_CALL setAnyColumnDescriptions(const css::uno::Sequence< css::uno::Sequence< css::uno::Any > > &aColumnDescriptions) override
rtl::Reference< UncachedDataSequence > createDataSequenceFromArray(const OUString &rArrayStr, std::u16string_view rRole, std::u16string_view rRoleQualifier)
virtual css::uno::Sequence< OUString > SAL_CALL getColumnDescriptions() override
virtual void SAL_CALL insertSequence(::sal_Int32 nAfterIndex) override
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation(const OUString &aRangeRepresentation) override
sal_Int32 getColumnCount() const
const tVecVecAny & getComplexColumnLabels() const
sal_Int32 getRowCount() const
void deleteColumn(sal_Int32 nAtIndex)
void setComplexRowLabel(sal_Int32 nRowIndex, std::vector< css::uno::Any > &&rComplexLabel)
css::uno::Sequence< double > getRowValues(sal_Int32 nRowIndex) const
void setComplexColumnLabel(sal_Int32 nColumnIndex, std::vector< css::uno::Any > &&rComplexLabel)
void insertColumn(sal_Int32 nAfterIndex)
css::uno::Sequence< css::uno::Sequence< double > > getData() const
const tVecVecAny & getComplexRowLabels() const
void setColumnValues(sal_Int32 nColumnIndex, const std::vector< double > &rNewData)
void insertRow(sal_Int32 nAfterIndex)
void deleteRow(sal_Int32 nAtIndex)
void setComplexColumnLabels(tVecVecAny &&rNewColumnLabels)
void swapColumnWithNext(sal_Int32 nColumnIndex)
void setRowValues(sal_Int32 nRowIndex, const std::vector< double > &rNewData)
void swapRowWithNext(sal_Int32 nRowIndex)
std::vector< css::uno::Any > getComplexColumnLabel(sal_Int32 nColumnIndex) const
css::uno::Sequence< double > getColumnValues(sal_Int32 nColumnIndex) const
std::vector< css::uno::Any > getComplexRowLabel(sal_Int32 nRowIndex) const
void setData(const css::uno::Sequence< css::uno::Sequence< double > > &rDataInRows)
void setComplexRowLabels(tVecVecAny &&rNewRowLabels)
This sequence object does NOT store actual sequence data.
TValueType getUnpackedValueOrDefault(const OUString &sKey, const TValueType &aDefault) const
#define DBG_UNHANDLED_EXCEPTION(...)
Sequence< PropertyValue > aArguments
constexpr OUStringLiteral aData
OUString getXMLStringFromCellRange(const CellRange &rRange)
CellRange getCellRangeFromXMLString(const OUString &rXMLString)
::cppu::WeakImplHelper< css::chart2::XInternalDataProvider, css::chart2::data::XRangeXMLConversion, css::chart2::XAnyDescriptionAccess, css::chart::XDateCategories, css::util::XCloneable, css::lang::XInitialization, css::lang::XServiceInfo > InternalDataProvider_Base
DstType sequenceToContainer(const css::uno::Sequence< SrcType > &i_Sequence)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
void copyProperties(const Reference< XPropertySet > &_rxSource, const Reference< XPropertySet > &_rxDest)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
sal_uInt32 toUInt32(std::u16string_view str, sal_Int16 radix=10)
unary function to convert css::uno::Any into a double number.
unary function to convert any type T into a css::uno::Any.
Reference< XModel > xModel