summaryrefslogtreecommitdiff
path: root/xmloff/source/chart/SchXMLChartContext.cxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-10-29 10:28:28 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-11-01 07:11:36 +0100
commit8cb57be792e6991c38cf5d4434569dc118dd0ed4 (patch)
tree46f394a22466fb7281d9c48f6d7fbed8a1a448a6 /xmloff/source/chart/SchXMLChartContext.cxx
parent34d0dd41e1e7bb69d6c4f817b39da26bcd33831f (diff)
Prepare for removal of non-const operator[] from Sequence in xmloff
Change-Id: I7ea7964f76f0a5db678510ac3533003726dc49fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124416 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'xmloff/source/chart/SchXMLChartContext.cxx')
-rw-r--r--xmloff/source/chart/SchXMLChartContext.cxx47
1 files changed, 25 insertions, 22 deletions
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx
index d8a91ff49659..51a7e1f05d93 100644
--- a/xmloff/source/chart/SchXMLChartContext.cxx
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -98,7 +98,7 @@ void lcl_MoveDataToCandleStickSeries(
// @todo: realloc only once outside this function
uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aData( xSource->getDataSequences());
aData.realloc( aData.getLength() + 1);
- aData[ aData.getLength() - 1 ] = aLabeledSeq[0];
+ aData.getArray()[ aData.getLength() - 1 ] = aLabeledSeq[0];
uno::Reference< chart2::data::XDataSink > xSink( xDestination, uno::UNO_QUERY_THROW );
xSink->setData( aData );
}
@@ -206,9 +206,9 @@ uno::Sequence< sal_Int32 > lcl_getNumberSequenceFromString( const OUString& rStr
else if( bAddOneToEachOldIndex )
{
aSeq.realloc( nVecSize+1 );
- aSeq[0]=0;
+ auto pSeqArr = aSeq.getArray();
+ pSeqArr[0]=0;
- sal_Int32* pSeqArr = aSeq.getArray();
for( nPos = 0; nPos < nVecSize; ++nPos )
{
pSeqArr[ nPos+1 ] = aVec[ nPos ]+1;
@@ -641,24 +641,25 @@ static void lcl_ApplyDataFromRectangularRangeToDiagram(
bHasCateories = true;
}
- uno::Sequence< beans::PropertyValue > aArgs( 3 );
- aArgs[0] = beans::PropertyValue(
- "CellRangeRepresentation",
- -1, uno::makeAny( rRectangularRange ),
- beans::PropertyState_DIRECT_VALUE );
- aArgs[1] = beans::PropertyValue(
- "DataRowSource",
- -1, uno::makeAny( eDataRowSource ),
- beans::PropertyState_DIRECT_VALUE );
- aArgs[2] = beans::PropertyValue(
- "FirstCellAsLabel",
- -1, uno::makeAny( bFirstCellAsLabel ),
- beans::PropertyState_DIRECT_VALUE );
+ uno::Sequence< beans::PropertyValue > aArgs{
+ beans::PropertyValue(
+ "CellRangeRepresentation",
+ -1, uno::makeAny( rRectangularRange ),
+ beans::PropertyState_DIRECT_VALUE ),
+ beans::PropertyValue(
+ "DataRowSource",
+ -1, uno::makeAny( eDataRowSource ),
+ beans::PropertyState_DIRECT_VALUE ),
+ beans::PropertyValue(
+ "FirstCellAsLabel",
+ -1, uno::makeAny( bFirstCellAsLabel ),
+ beans::PropertyState_DIRECT_VALUE )
+ };
if( !sColTrans.isEmpty() || !sRowTrans.isEmpty() )
{
aArgs.realloc( aArgs.getLength() + 1 );
- aArgs[ sal::static_int_cast<sal_uInt32>(aArgs.getLength()) - 1 ] = beans::PropertyValue(
+ aArgs.getArray()[ sal::static_int_cast<sal_uInt32>(aArgs.getLength()) - 1 ] = beans::PropertyValue(
"SequenceMapping",
-1, uno::makeAny( !sColTrans.isEmpty()
? lcl_getNumberSequenceFromString( sColTrans, bHasCateories && !xNewDoc->hasInternalDataProvider() )
@@ -683,7 +684,7 @@ static void lcl_ApplyDataFromRectangularRangeToDiagram(
if( !aChartOleObjectName.isEmpty() )
{
aArgs.realloc( aArgs.getLength() + 1 );
- aArgs[ sal::static_int_cast<sal_uInt32>(aArgs.getLength()) - 1 ] = beans::PropertyValue(
+ aArgs.getArray()[ sal::static_int_cast<sal_uInt32>(aArgs.getLength()) - 1 ] = beans::PropertyValue(
"ChartOleObjectName",
-1, uno::makeAny( aChartOleObjectName ),
beans::PropertyState_DIRECT_VALUE );
@@ -694,11 +695,12 @@ static void lcl_ApplyDataFromRectangularRangeToDiagram(
xDataProvider->createDataSource( aArgs ));
aArgs.realloc( aArgs.getLength() + 2 );
- aArgs[ sal::static_int_cast<sal_uInt32>(aArgs.getLength()) - 2 ] = beans::PropertyValue(
+ auto pArgs = aArgs.getArray();
+ pArgs[ sal::static_int_cast<sal_uInt32>(aArgs.getLength()) - 2 ] = beans::PropertyValue(
"HasCategories",
-1, uno::makeAny( bHasCateories ),
beans::PropertyState_DIRECT_VALUE );
- aArgs[ sal::static_int_cast<sal_uInt32>(aArgs.getLength()) - 1 ] = beans::PropertyValue(
+ pArgs[ sal::static_int_cast<sal_uInt32>(aArgs.getLength()) - 1 ] = beans::PropertyValue(
"UseCategoriesAsX",
-1, uno::makeAny( false ),//categories in ODF files are not to be used as x values (independent from what is offered in our ui)
beans::PropertyState_DIRECT_VALUE );
@@ -979,6 +981,7 @@ void SchXMLChartContext::MergeSeriesForStockChart()
sal_Int32 nCandleStickCount = nSeriesCount / nSeriesPerCandleStick;
OSL_ASSERT( nSeriesPerCandleStick * nCandleStickCount == nSeriesCount );
uno::Sequence< uno::Reference< chart2::XDataSeries > > aNewSeries( nCandleStickCount );
+ auto aNewSeriesRange = asNonConstRange(aNewSeries);
for( sal_Int32 i=0; i<nCandleStickCount; ++i )
{
sal_Int32 nSeriesIndex = i*nSeriesPerCandleStick;
@@ -986,7 +989,7 @@ void SchXMLChartContext::MergeSeriesForStockChart()
{
// open values
lcl_setRoleAtFirstSequence( aSeriesSeq[ nSeriesIndex ], "values-first");
- aNewSeries[i] = aSeriesSeq[ nSeriesIndex ];
+ aNewSeriesRange[i] = aSeriesSeq[ nSeriesIndex ];
// low values
lcl_MoveDataToCandleStickSeries(
uno::Reference< chart2::data::XDataSource >( aSeriesSeq[ ++nSeriesIndex ], uno::UNO_QUERY_THROW ),
@@ -996,7 +999,7 @@ void SchXMLChartContext::MergeSeriesForStockChart()
{
// low values
lcl_setRoleAtFirstSequence( aSeriesSeq[ nSeriesIndex ], "values-min");
- aNewSeries[i] = aSeriesSeq[ nSeriesIndex ];
+ aNewSeriesRange[i] = aSeriesSeq[ nSeriesIndex ];
}
// high values
lcl_MoveDataToCandleStickSeries(