diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-28 16:14:54 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-29 11:07:27 +0200 |
commit | 5b0ae3b59cd2cccfb72d991657366eb2a69bff49 (patch) | |
tree | cd7a4b55b70df6a09bc28d8b30d105bb0a54f405 | |
parent | 0787aeac2428bf6a2e372ed5f2eac2f079c28ba6 (diff) |
Prepare for removal of non-const operator[] from Sequence in chart2
Change-Id: I71e0b458c4dd2a85e36a485e3efa72b1077b0e54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124346
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
73 files changed, 555 insertions, 546 deletions
diff --git a/chart2/qa/extras/PivotChartTest.cxx b/chart2/qa/extras/PivotChartTest.cxx index 97dd41634332..ee024531e88b 100644 --- a/chart2/qa/extras/PivotChartTest.cxx +++ b/chart2/qa/extras/PivotChartTest.cxx @@ -844,13 +844,12 @@ void PivotChartTest::testPivotChartRowFieldInOutlineMode() } sheet::DataPilotFieldLayoutInfo aLayoutInfoValue; - uno::Sequence<sheet::GeneralFunction> aGeneralFunctionSequence(1); // Test case where we enable subtotals (auto) and set the outline subtotals at the bottom // We don't expect any change in data as every extra subtotal row should be ignored // Enable subtotals - set to auto - aGeneralFunctionSequence[0] = sheet::GeneralFunction_AUTO; + uno::Sequence<sheet::GeneralFunction> aGeneralFunctionSequence{ sheet::GeneralFunction_AUTO }; lclModifySubtotals(xDataPilotDescriptor, u"Country", aGeneralFunctionSequence); // Set Subtotals layout to bottom + add empty lines aLayoutInfoValue.AddEmptyLines = true; @@ -879,7 +878,7 @@ void PivotChartTest::testPivotChartRowFieldInOutlineMode() // We don't expect any change in data as every extra subtotal row should be ignored // Enable subtotals - set to auto - aGeneralFunctionSequence[0] = sheet::GeneralFunction_AUTO; + aGeneralFunctionSequence.getArray()[0] = sheet::GeneralFunction_AUTO; lclModifySubtotals(xDataPilotDescriptor, u"Country", aGeneralFunctionSequence); // Set Subtotals layout to top + add empty lines aLayoutInfoValue.AddEmptyLines = true; diff --git a/chart2/qa/extras/chart2_trendcalculators.cxx b/chart2/qa/extras/chart2_trendcalculators.cxx index 1eeea5d12e23..c13c1666725e 100644 --- a/chart2/qa/extras/chart2_trendcalculators.cxx +++ b/chart2/qa/extras/chart2_trendcalculators.cxx @@ -112,12 +112,14 @@ void Chart2TrendCalculators::testPotentialRegression1() loadCalculatorFromSheet( SHEET_POTENTIAL1 ); m_xRegressionCurveCalculator->setRegressionProperties( 0, false, 0, 0, 0 ); Sequence< double > xValues( 7 ); + auto pxValues = xValues.getArray(); Sequence< double > yValues( 7 ); + auto pyValues = yValues.getArray(); for (int i=0; i<7; i++) { const double d = static_cast<double>(i); - xValues[i] = d; - yValues[i] = 2.0 * pow ( d, 3 ); + pxValues[i] = d; + pyValues[i] = 2.0 * pow ( d, 3 ); } checkCalculator( xValues, yValues, "f(x) = 2 x^3"); } @@ -128,12 +130,14 @@ void Chart2TrendCalculators::testPotentialRegression2() loadCalculatorFromSheet( SHEET_POTENTIAL2 ); m_xRegressionCurveCalculator->setRegressionProperties( 0, false, 0, 0, 0 ); Sequence< double > xValues( 7 ); + auto pxValues = xValues.getArray(); Sequence< double > yValues( 7 ); + auto pyValues = yValues.getArray(); for (int i=0; i<7; i++) { const double d = static_cast<double>(i); - xValues[i] = d; - yValues[i] = -2.0 * pow ( d, 3 ); + pxValues[i] = d; + pyValues[i] = -2.0 * pow ( d, 3 ); } checkCalculator( xValues, yValues, "f(x) = "+ OUStringChar(aMinusSign) +" 2 x^3"); } @@ -144,12 +148,14 @@ void Chart2TrendCalculators::testLinearRegression1() loadCalculatorFromSheet( SHEET_LINEAR1 ); m_xRegressionCurveCalculator->setRegressionProperties( 1, false, 0, 0, 0 ); Sequence< double > xValues( 7 ); + auto pxValues = xValues.getArray(); Sequence< double > yValues( 7 ); + auto pyValues = yValues.getArray(); for (int i=0; i<7; i++) { const double d = static_cast<double>(i); - xValues[i] = d; - yValues[i] = - 2.0 * d - 5.0 ; + pxValues[i] = d; + pyValues[i] = - 2.0 * d - 5.0 ; } checkCalculator( xValues, yValues, "f(x) = "+ OUStringChar(aMinusSign) +" 2 x "+ OUStringChar(aMinusSign) +" 5"); } @@ -160,12 +166,14 @@ void Chart2TrendCalculators::testPolynomialRegression1() loadCalculatorFromSheet( SHEET_POLYNOMIAL1 ); m_xRegressionCurveCalculator->setRegressionProperties( 2, false, 0, 0, 0 ); Sequence< double > xValues( 7 ); + auto pxValues = xValues.getArray(); Sequence< double > yValues( 7 ); + auto pyValues = yValues.getArray(); for (int i=0; i<7; i++) { const double d = static_cast<double>(i); - xValues[i] = d; - yValues[i] = - 2.0 * d * d + 4 * d - 5; + pxValues[i] = d; + pyValues[i] = - 2.0 * d * d + 4 * d - 5; } OUString sExpectedFormula( "f(x) = "+ OUStringChar(aMinusSign) +" 2 x" + OUStringChar( aSuperscriptFigures[2] ) + " + 4 x "+ OUStringChar(aMinusSign) +" 5" ); checkCalculator( xValues, yValues, sExpectedFormula ); @@ -176,12 +184,14 @@ void Chart2TrendCalculators::testExponentialRegression1() loadCalculatorFromSheet( SHEET_EXPONENTIAL1 ); m_xRegressionCurveCalculator->setRegressionProperties( 0, false, 0, 0, 0 ); Sequence< double > xValues( 7 ); + auto pxValues = xValues.getArray(); Sequence< double > yValues( 7 ); + auto pyValues = yValues.getArray(); for (int i=0; i<7; i++) { const double d = static_cast<double>(i); - xValues[i] = d; - yValues[i] = 2.0 * exp ( 0.3 * d ); + pxValues[i] = d; + pyValues[i] = 2.0 * exp ( 0.3 * d ); } checkCalculator( xValues, yValues, "f(x) = 2 exp( 0.3 x )"); } @@ -191,12 +201,14 @@ void Chart2TrendCalculators::testExponentialRegression2() loadCalculatorFromSheet( SHEET_EXPONENTIAL2 ); m_xRegressionCurveCalculator->setRegressionProperties( 0, false, 0, 0, 0 ); Sequence< double > xValues( 7 ); + auto pxValues = xValues.getArray(); Sequence< double > yValues( 7 ); + auto pyValues = yValues.getArray(); for (int i=0; i<7; i++) { const double d = static_cast<double>(i); - xValues[i] = d; - yValues[i] = -2.0 * exp ( 0.3 * d ); + pxValues[i] = d; + pyValues[i] = -2.0 * exp ( 0.3 * d ); } checkCalculator( xValues, yValues, "f(x) = "+ OUStringChar(aMinusSign) + " 2 exp( 0.3 x )"); } diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx index 2aec79cfccb0..02ad9675d930 100644 --- a/chart2/qa/extras/charttest.hxx +++ b/chart2/qa/extras/charttest.hxx @@ -666,9 +666,10 @@ Sequence< OUString > ChartTest::getFormattedDateCategories( const Reference<char Sequence<double> aDateSeq = getDateCategories(xChartDoc); const sal_Int32 nNumCategories = aDateSeq.getLength(); Sequence<OUString> aFormattedDates(nNumCategories); + auto aFormattedDatesRange = asNonConstRange(aFormattedDates); for (sal_Int32 nIdx = 0; nIdx < nNumCategories; ++nIdx) - aFormattedDates[nIdx] = xNumFormatter->convertNumberToString(nNumFmt, aDateSeq[nIdx]); + aFormattedDatesRange[nIdx] = xNumFormatter->convertNumberToString(nNumFmt, aDateSeq[nIdx]); return aFormattedDates; } diff --git a/chart2/source/controller/accessibility/AccessibleChartElement.cxx b/chart2/source/controller/accessibility/AccessibleChartElement.cxx index cbee2ddbb01a..efbb1f47924e 100644 --- a/chart2/source/controller/accessibility/AccessibleChartElement.cxx +++ b/chart2/source/controller/accessibility/AccessibleChartElement.cxx @@ -101,10 +101,9 @@ void AccessibleChartElement::InitTextEdit() try { Reference< lang::XInitialization > xInit( m_xTextHelper, uno::UNO_QUERY_THROW ); - Sequence< uno::Any > aArgs( 3 ); - aArgs[0] <<= GetInfo().m_aOID.getObjectCID(); - aArgs[1] <<= Reference< XAccessible >( this ); - aArgs[2] <<= Reference< awt::XWindow >( GetInfo().m_xWindow ); + Sequence< uno::Any > aArgs{ uno::Any(GetInfo().m_aOID.getObjectCID()), + uno::Any(Reference< XAccessible >( this )), + uno::Any(Reference< awt::XWindow >( GetInfo().m_xWindow )) }; xInit->initialize( aArgs ); } catch( const uno::Exception & ) diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx index 76df74719682..0880cfba525f 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx @@ -49,14 +49,16 @@ uno::Sequence< uno::Sequence< double > > lcl_getNANInsteadDBL_MIN( const uno::Se uno::Sequence< uno::Sequence< double > > aRet; const sal_Int32 nOuterSize = rData.getLength(); aRet.realloc( nOuterSize ); + auto pRet = aRet.getArray(); for( sal_Int32 nOuter=0; nOuter<nOuterSize; ++nOuter ) { sal_Int32 nInnerSize = rData[nOuter].getLength(); - aRet[nOuter].realloc( nInnerSize ); + pRet[nOuter].realloc( nInnerSize ); + auto pRet_nOuter = pRet[nOuter].getArray(); for( sal_Int32 nInner=0; nInner<nInnerSize; ++nInner ) { - aRet[nOuter][nInner] = rData[nOuter][nInner]; - double& rValue = aRet[nOuter][nInner]; + pRet_nOuter[nInner] = rData[nOuter][nInner]; + double& rValue = pRet_nOuter[nInner]; if( rValue == DBL_MIN ) rValue = std::numeric_limits<double>::quiet_NaN(); } @@ -69,14 +71,16 @@ uno::Sequence< uno::Sequence< double > > lcl_getDBL_MINInsteadNAN( const uno::Se uno::Sequence< uno::Sequence< double > > aRet; const sal_Int32 nOuterSize = rData.getLength(); aRet.realloc( nOuterSize ); + auto pRet = aRet.getArray(); for( sal_Int32 nOuter=0; nOuter<nOuterSize; ++nOuter ) { sal_Int32 nInnerSize = rData[nOuter].getLength(); - aRet[nOuter].realloc( nInnerSize ); + pRet[nOuter].realloc( nInnerSize ); + auto pRet_nOuter = pRet[nOuter].getArray(); for( sal_Int32 nInner=0; nInner<nInnerSize; ++nInner ) { - aRet[nOuter][nInner] = rData[nOuter][nInner]; - double& rValue = aRet[nOuter][nInner]; + pRet_nOuter[nInner] = rData[nOuter][nInner]; + double& rValue = pRet_nOuter[nInner]; if( std::isnan( rValue ) ) rValue = DBL_MIN; } diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index aef26f4a483a..39ec746f3415 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -1252,9 +1252,8 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance( { m_xChartView = xViewInit; - Sequence< Any > aArguments(2); - aArguments[0] <<= Reference<frame::XModel>(this); - aArguments[1] <<= true; // bRefreshAddIn + Sequence< Any > aArguments{ Any(Reference<frame::XModel>(this)), + Any(true) }; // bRefreshAddIn xViewInit->initialize(aArguments); } catch (const uno::Exception&) diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index a55733ffffd8..f46abaae3027 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -1643,7 +1643,7 @@ Any WrappedAttributedDataPointsProperty::getPropertyValue( const Reference< bean ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) ); uno::Sequence< uno::Sequence< sal_Int32 > > aResult( aSeriesVector.size() ); - + auto aResultRange = asNonConstRange(aResult); sal_Int32 i = 0; for (auto const& series : aSeriesVector) { @@ -1654,7 +1654,7 @@ Any WrappedAttributedDataPointsProperty::getPropertyValue( const Reference< bean xProp->getPropertyValue("AttributedDataPoints")); uno::Sequence< sal_Int32 > aSeq; if( aVal >>= aSeq ) - aResult[ i ] = aSeq; + aResultRange[ i ] = aSeq; } ++i; } diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx index a0f39774b5f1..379cc408f52e 100644 --- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx @@ -269,10 +269,11 @@ uno::Sequence< uno::Any > SAL_CALL MinMaxLineWrapper::getPropertyValues( const u if( rNameSeq.hasElements() ) { aRetSeq.realloc( rNameSeq.getLength() ); + auto pRetSeq = aRetSeq.getArray(); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) { OUString aPropertyName( rNameSeq[nN] ); - aRetSeq[nN] = getPropertyValue( aPropertyName ); + pRetSeq[nN] = getPropertyValue( aPropertyName ); } } return aRetSeq; @@ -315,10 +316,11 @@ uno::Sequence< beans::PropertyState > SAL_CALL MinMaxLineWrapper::getPropertySta if( rNameSeq.hasElements() ) { aRetSeq.realloc( rNameSeq.getLength() ); + auto pRetSeq = aRetSeq.getArray(); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) { OUString aPropertyName( rNameSeq[nN] ); - aRetSeq[nN] = getPropertyState( aPropertyName ); + pRetSeq[nN] = getPropertyState( aPropertyName ); } } return aRetSeq; @@ -360,10 +362,11 @@ uno::Sequence< uno::Any > SAL_CALL MinMaxLineWrapper::getPropertyDefaults( const if( rNameSeq.hasElements() ) { aRetSeq.realloc( rNameSeq.getLength() ); + auto pRetSeq = aRetSeq.getArray(); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) { OUString aPropertyName( rNameSeq[nN] ); - aRetSeq[nN] = getPropertyDefault( aPropertyName ); + pRetSeq[nN] = getPropertyDefault( aPropertyName ); } } return aRetSeq; diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx index ab7e5b333a2c..33c53f89a514 100644 --- a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx @@ -244,10 +244,11 @@ uno::Sequence< uno::Any > SAL_CALL UpDownBarWrapper::getPropertyValues( const un if( rNameSeq.hasElements() ) { aRetSeq.realloc( rNameSeq.getLength() ); + auto pRetSeq = aRetSeq.getArray(); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) { OUString aPropertyName( rNameSeq[nN] ); - aRetSeq[nN] = getPropertyValue( aPropertyName ); + pRetSeq[nN] = getPropertyValue( aPropertyName ); } } return aRetSeq; @@ -282,10 +283,11 @@ uno::Sequence< beans::PropertyState > SAL_CALL UpDownBarWrapper::getPropertyStat if( rNameSeq.hasElements() ) { aRetSeq.realloc( rNameSeq.getLength() ); + auto pRetSeq = aRetSeq.getArray(); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) { OUString aPropertyName( rNameSeq[nN] ); - aRetSeq[nN] = getPropertyState( aPropertyName ); + pRetSeq[nN] = getPropertyState( aPropertyName ); } } return aRetSeq; @@ -327,10 +329,11 @@ uno::Sequence< uno::Any > SAL_CALL UpDownBarWrapper::getPropertyDefaults( const if( rNameSeq.hasElements() ) { aRetSeq.realloc( rNameSeq.getLength() ); + auto pRetSeq = aRetSeq.getArray(); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) { OUString aPropertyName( rNameSeq[nN] ); - aRetSeq[nN] = getPropertyDefault( aPropertyName ); + pRetSeq[nN] = getPropertyDefault( aPropertyName ); } } return aRetSeq; diff --git a/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx index b49c5177dc2e..867176e62e32 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx @@ -85,14 +85,13 @@ void WrappedBarPositionProperty_Base::setPropertyValue( const Any& rOuterValue, tools::Long nOldLength = aBarPositionSequence.getLength(); if( nOldLength <= m_nAxisIndex ) - { aBarPositionSequence.realloc( m_nAxisIndex+1 ); - for( sal_Int32 i=nOldLength; i<m_nAxisIndex; i++ ) - { - aBarPositionSequence[i] = m_nDefaultValue; - } + auto pBarPositionSequence = aBarPositionSequence.getArray(); + for( sal_Int32 i=nOldLength; i<m_nAxisIndex; i++ ) + { + pBarPositionSequence[i] = m_nDefaultValue; } - aBarPositionSequence[m_nAxisIndex] = nNewValue; + pBarPositionSequence[m_nAxisIndex] = nNewValue; xProp->setPropertyValue( m_InnerSequencePropertyName, uno::Any( aBarPositionSequence ) ); } diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx index d9ad4a3e6bb4..27e07256e51d 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx @@ -173,6 +173,7 @@ void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, cons Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements ); if( !rSubIncrements.hasElements() ) rSubIncrements.realloc( 1 ); + auto pSubIncrements = rSubIncrements.getArray(); double fStepHelp = 0; if( rOuterValue >>= fStepHelp ) @@ -181,14 +182,14 @@ void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, cons if( AxisHelper::isLogarithmic(aScaleData.Scaling) ) { sal_Int32 nIntervalCount = static_cast< sal_Int32 >(fStepHelp); - rSubIncrements[ 0 ].IntervalCount <<= nIntervalCount; + pSubIncrements[ 0 ].IntervalCount <<= nIntervalCount; } else if( (fStepHelp != 0.0) && (aScaleData.IncrementData.Distance >>= fStepMain) ) { // approximate interval count sal_Int32 nIntervalCount = static_cast< sal_Int32 >(fStepMain / fStepHelp);//cppcheck-suppress zerodiv - rSubIncrements[ 0 ].IntervalCount <<= nIntervalCount; + pSubIncrements[ 0 ].IntervalCount <<= nIntervalCount; } } bSetScaleData = true; @@ -199,11 +200,12 @@ void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, cons Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements ); if( !rSubIncrements.hasElements() ) rSubIncrements.realloc( 1 ); + auto pSubIncrements = rSubIncrements.getArray(); sal_Int32 nIntervalCount=0; if( rOuterValue>>=nIntervalCount ) - rSubIncrements[ 0 ].IntervalCount <<= nIntervalCount; + pSubIncrements[ 0 ].IntervalCount <<= nIntervalCount; else - rSubIncrements[ 0 ].IntervalCount = Any(); + pSubIncrements[ 0 ].IntervalCount = Any(); bSetScaleData = true; break; } @@ -239,11 +241,12 @@ void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, cons Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements ); if( !rSubIncrements.hasElements() ) rSubIncrements.realloc( 1 ); + auto pSubIncrements = rSubIncrements.getArray(); if( (rOuterValue >>= bBool) && bBool ) - rSubIncrements[ 0 ].IntervalCount = Any(); + pSubIncrements[ 0 ].IntervalCount = Any(); else - rSubIncrements[ 0 ].IntervalCount = getPropertyValue( SCALE_PROP_STEPHELP_COUNT, xInnerPropertySet ); + pSubIncrements[ 0 ].IntervalCount = getPropertyValue( SCALE_PROP_STEPHELP_COUNT, xInnerPropertySet ); bSetScaleData = true; break; } diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx index 774e395e8951..ce6da753d6c4 100644 --- a/chart2/source/controller/dialogs/DialogModel.cxx +++ b/chart2/source/controller/dialogs/DialogModel.cxx @@ -265,16 +265,18 @@ Sequence< OUString > lcl_CopyExcludingValuesFirst( Sequence< OUString > const & i_aInput ) { Sequence< OUString > aOutput( i_aInput.getLength()); + auto pOutput = aOutput.getArray(); int nSourceIndex, nDestIndex; for( nSourceIndex = nDestIndex = 0; nSourceIndex < i_aInput.getLength(); nSourceIndex++ ) { if( i_aInput[nSourceIndex] == "values-first" ) { aOutput.realloc( aOutput.getLength() - 1 ); + pOutput = aOutput.getArray(); } else { - aOutput[nDestIndex] = i_aInput[nSourceIndex]; + pOutput[nDestIndex] = i_aInput[nSourceIndex]; nDestIndex++; } } diff --git a/chart2/source/controller/dialogs/RangeSelectionHelper.cxx b/chart2/source/controller/dialogs/RangeSelectionHelper.cxx index 8cd8f64c8383..3a468845dc3f 100644 --- a/chart2/source/controller/dialogs/RangeSelectionHelper.cxx +++ b/chart2/source/controller/dialogs/RangeSelectionHelper.cxx @@ -109,21 +109,21 @@ bool RangeSelectionHelper::chooseRange( Reference< sheet::XRangeSelection > xRangeSel( getRangeSelection()); if( xRangeSel.is()) { - Sequence< beans::PropertyValue > aArgs( 4 ); - aArgs[0] = beans::PropertyValue( - "InitialValue", -1, uno::Any( aCurrentRange ), - beans::PropertyState_DIRECT_VALUE ); - aArgs[1] = beans::PropertyValue( - "Title", -1, - uno::Any( aUIString ), - beans::PropertyState_DIRECT_VALUE ); - aArgs[2] = beans::PropertyValue( - "CloseOnMouseRelease", -1, uno::Any( true ), - beans::PropertyState_DIRECT_VALUE ); - aArgs[3] = beans::PropertyValue( - "MultiSelectionMode", -1, uno::Any( true ), - beans::PropertyState_DIRECT_VALUE ); - + Sequence< beans::PropertyValue > aArgs{ + beans::PropertyValue( + "InitialValue", -1, uno::Any( aCurrentRange ), + beans::PropertyState_DIRECT_VALUE ), + beans::PropertyValue( + "Title", -1, + uno::Any( aUIString ), + beans::PropertyState_DIRECT_VALUE ), + beans::PropertyValue( + "CloseOnMouseRelease", -1, uno::Any( true ), + beans::PropertyState_DIRECT_VALUE ), + beans::PropertyValue( + "MultiSelectionMode", -1, uno::Any( true ), + beans::PropertyState_DIRECT_VALUE ) + }; if( m_xRangeSelectionListener.is() ) stopRangeListening(); m_xRangeSelectionListener.set( Reference< sheet::XRangeSelectionListener >( diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index 2897313ceff1..94d0e9034619 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -251,8 +251,9 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel // initialize with 1, 2, ... //first category (index 0) matches with real number 1.0 aXValues.realloc( aYValues.getLength() ); + auto pXValues = aXValues.getArray(); for( i=0; i<aXValues.getLength(); ++i ) - aXValues[i] = i+1; + pXValues[i] = i+1; bXValuesFound = true; } diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx index 2694d9ca28a6..bcd48c2590df 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.cxx +++ b/chart2/source/controller/dialogs/tp_DataSource.cxx @@ -132,7 +132,7 @@ void lcl_addLSequenceToDataSource( { Sequence< Reference< chart2::data::XLabeledDataSequence > > aData( xSource->getDataSequences()); aData.realloc( aData.getLength() + 1 ); - aData[ aData.getLength() - 1 ] = xLSequence; + aData.getArray()[ aData.getLength() - 1 ] = xLSequence; xSink->setData( aData ); } } diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.cxx b/chart2/source/controller/dialogs/tp_RangeChooser.cxx index 6ef5d45ddd40..bfb214c71593 100644 --- a/chart2/source/controller/dialogs/tp_RangeChooser.cxx +++ b/chart2/source/controller/dialogs/tp_RangeChooser.cxx @@ -215,7 +215,7 @@ void RangeChooserTabPage::changeDialogModelAccordingToControls() if(bTimeBased) { aArguments.realloc( aArguments.getLength() + 1 ); - aArguments[aArguments.getLength() - 1] = + aArguments.getArray()[aArguments.getLength() - 1] = beans::PropertyValue( "TimeBased", -1, uno::Any(bTimeBased), beans::PropertyState_DIRECT_VALUE ); } @@ -226,7 +226,7 @@ void RangeChooserTabPage::changeDialogModelAccordingToControls() m_rDialogModel.setTemplate( m_xCurrentChartTypeTemplate ); aArguments.realloc( aArguments.getLength() + 1 ); - aArguments[aArguments.getLength() - 1] = + aArguments.getArray()[aArguments.getLength() - 1] = beans::PropertyValue( "CellRangeRepresentation" , -1, uno::Any( m_aLastValidRangeString ), beans::PropertyState_DIRECT_VALUE ); diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx index 28d5cf4cabc7..6a1bb0867803 100644 --- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx @@ -616,7 +616,7 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet if( aScale.IncrementData.SubIncrements.hasElements() && aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue() ) { - aScale.IncrementData.SubIncrements[0].IntervalCount.clear(); + aScale.IncrementData.SubIncrements.getArray()[0].IntervalCount.clear(); bSetScale = true; } if( aScale.TimeIncrement.MinorTimeInterval.hasValue() ) @@ -661,7 +661,7 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet aScale.IncrementData.SubIncrements[0].IntervalCount != aValue ) { OSL_ASSERT( aValue.getValueTypeClass() == uno::TypeClass_LONG ); - aScale.IncrementData.SubIncrements[0].IntervalCount = aValue; + aScale.IncrementData.SubIncrements.getArray()[0].IntervalCount = aValue; bSetScale = true; } } diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx index e48ba0b3f443..c531e7e2c76e 100644 --- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx @@ -223,7 +223,7 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf pos = rBarPosition; } else if( nAxisIndex >= 0 && nAxisIndex < aBarPositionSequence.getLength() ) - aBarPositionSequence[nAxisIndex] = rBarPosition; + aBarPositionSequence.getArray()[nAxisIndex] = rBarPosition; xChartTypeProps->setPropertyValue( aPropName, uno::Any(aBarPositionSequence) ); bChanged = true; diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 3bd6a5946ddf..19c314da2635 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -1577,10 +1577,6 @@ void ChartController::impl_initializeAccessible( const uno::Reference< lang::XIn if(!xInit.is()) return; - uno::Sequence< uno::Any > aArguments(5); - aArguments[0] <<= uno::Reference<view::XSelectionSupplier>(this); - aArguments[1] <<= getModel(); - aArguments[2] <<= m_xChartView; uno::Reference< XAccessible > xParent; { SolarMutexGuard aGuard; @@ -1592,8 +1588,11 @@ void ChartController::impl_initializeAccessible( const uno::Reference< lang::XIn xParent.set( pParentWin->GetAccessible()); } } - aArguments[3] <<= xParent; - aArguments[4] <<= m_xViewWindow; + uno::Sequence< uno::Any > aArguments{ uno::Any(uno::Reference<view::XSelectionSupplier>(this)), + uno::Any(getModel()), + uno::Any(m_xChartView), + uno::Any(xParent), + uno::Any(m_xViewWindow) }; xInit->initialize(aArguments); } diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 1d58ddc70b40..92a7f9f16851 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -1271,10 +1271,11 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) } } - css::uno::Sequence< css::uno::Any > aArgs( 3 ); - aArgs[0] <<= comphelper::makePropertyValue( "IsContextMenu", true ); - aArgs[1] <<= comphelper::makePropertyValue( "Frame", m_xFrame ); - aArgs[2] <<= comphelper::makePropertyValue( "Value", aMenuName ); + css::uno::Sequence< css::uno::Any > aArgs{ + css::uno::Any(comphelper::makePropertyValue( "IsContextMenu", true )), + css::uno::Any(comphelper::makePropertyValue( "Frame", m_xFrame )), + css::uno::Any(comphelper::makePropertyValue( "Value", aMenuName )) + }; css::uno::Reference< css::frame::XPopupMenuController > xPopupController( m_xCC->getServiceManager()->createInstanceWithArgumentsAndContext( diff --git a/chart2/source/controller/main/CommandDispatchContainer.cxx b/chart2/source/controller/main/CommandDispatchContainer.cxx index daea97d4c7bf..69528aa67fa1 100644 --- a/chart2/source/controller/main/CommandDispatchContainer.cxx +++ b/chart2/source/controller/main/CommandDispatchContainer.cxx @@ -144,11 +144,12 @@ Sequence< Reference< frame::XDispatch > > CommandDispatchContainer::getDispatche { sal_Int32 nCount = aDescriptors.getLength(); uno::Sequence< uno::Reference< frame::XDispatch > > aRet( nCount ); + auto aRetRange = asNonConstRange(aRet); for( sal_Int32 nPos = 0; nPos < nCount; ++nPos ) { if ( aDescriptors[ nPos ].FrameName == "_self" ) - aRet[ nPos ] = getDispatchForURL( aDescriptors[ nPos ].FeatureURL ); + aRetRange[ nPos ] = getDispatchForURL( aDescriptors[ nPos ].FeatureURL ); } return aRet; } diff --git a/chart2/source/controller/main/ConfigurationAccess.cxx b/chart2/source/controller/main/ConfigurationAccess.cxx index 4040c8db1b8d..54a94adfa083 100644 --- a/chart2/source/controller/main/ConfigurationAccess.cxx +++ b/chart2/source/controller/main/ConfigurationAccess.cxx @@ -64,11 +64,11 @@ FieldUnit CalcConfigItem::getFieldUnit() { FieldUnit eResult( FieldUnit::CM ); - uno::Sequence< OUString > aNames( 1 ); + uno::Sequence< OUString > aNames; if( lcl_IsMetric() ) - aNames[ 0 ] = "Other/MeasureUnit/Metric"; + aNames = { "Other/MeasureUnit/Metric" }; else - aNames[ 0 ] = "Other/MeasureUnit/NonMetric"; + aNames = { "Other/MeasureUnit/NonMetric" }; uno::Sequence< uno::Any > aResult( GetProperties( aNames )); sal_Int32 nValue = 0; diff --git a/chart2/source/inc/CommonConverters.hxx b/chart2/source/inc/CommonConverters.hxx index 7341f5c2b834..e8daa87d5c95 100644 --- a/chart2/source/inc/CommonConverters.hxx +++ b/chart2/source/inc/CommonConverters.hxx @@ -184,12 +184,13 @@ css::uno::Sequence< T > for( nOuter=0; nOuter<nOuterSize; ++nOuter ) nResultSize += aSeqSeq[nOuter].getLength(); css::uno::Sequence< T > aResult( nResultSize ); + auto aResultRange = asNonConstRange(aResult); for( nOuter=0; nOuter<nOuterSize; ++nOuter ) { const sal_Int32 nInnerSize = aSeqSeq[nOuter].getLength(); for( nInner=0; nInner<nInnerSize; ++nInner, ++nCount ) - aResult[nCount] = aSeqSeq[nOuter][nInner]; + aResultRange[nCount] = aSeqSeq[nOuter][nInner]; } return aResult; } diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx index 5838647bc510..6cc27d10f127 100644 --- a/chart2/source/model/filter/XMLFilter.cxx +++ b/chart2/source/model/filter/XMLFilter.cxx @@ -96,13 +96,12 @@ uno::Reference< embed::XStorage > lcl_getWriteStorage( xStorage.set( aMDHelper.Storage ); else { - Sequence< uno::Any > aStorageArgs( 3 ); - if( aMDHelper.ISSET_OutputStream ) - aStorageArgs[0] <<= aMDHelper.OutputStream; - else - aStorageArgs[0] <<= aMDHelper.URL; - aStorageArgs[1] <<= (embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE); - aStorageArgs[2] <<= comphelper::containerToSequence( aPropertiesForStorage ); + Sequence< uno::Any > aStorageArgs{ + aMDHelper.ISSET_OutputStream ? uno::Any(aMDHelper.OutputStream) + : uno::Any(aMDHelper.URL), + uno::Any(embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE), + uno::Any(comphelper::containerToSequence( aPropertiesForStorage )) + }; xStorage.set( xStorageFact->createInstanceWithArguments( aStorageArgs ), @@ -163,10 +162,11 @@ uno::Reference< embed::XStorage > lcl_getReadStorage( // convert XInputStream to XStorage via the storage factory Reference< lang::XSingleServiceFactory > xStorageFact( embed::StorageFactory::create( xContext ) ); - Sequence< uno::Any > aStorageArgs( 3 ); - aStorageArgs[0] <<= xStream; - aStorageArgs[1] <<= (embed::ElementModes::READ | embed::ElementModes::NOCREATE); - aStorageArgs[2] <<= comphelper::containerToSequence( aPropertiesForStorage ); + Sequence< uno::Any > aStorageArgs{ + uno::Any(xStream), + uno::Any(embed::ElementModes::READ | embed::ElementModes::NOCREATE), + uno::Any(comphelper::containerToSequence( aPropertiesForStorage )) + }; xStorage.set( xStorageFact->createInstanceWithArguments( aStorageArgs ), uno::UNO_QUERY_THROW ); } @@ -301,8 +301,7 @@ ErrCode XMLFilter::impl_Import( uno::Reference<lang::XMultiServiceFactory> xServiceFactory(xFactory, uno::UNO_QUERY); if (xServiceFactory.is()) { - uno::Sequence<uno::Any> aArgs(1); - aArgs[0] <<= xStorage; + uno::Sequence<uno::Any> aArgs{ uno::Any(xStorage) }; xGraphicStorageHandler.set( xServiceFactory->createInstanceWithArguments( "com.sun.star.comp.Svx.GraphicImportHelper", aArgs), uno::UNO_QUERY); @@ -430,12 +429,13 @@ ErrCode XMLFilter::impl_ImportStream( nArgs++; uno::Sequence< uno::Any > aFilterCompArgs( nArgs ); + auto aFilterCompArgsRange = asNonConstRange(aFilterCompArgs); nArgs = 0; if( xGraphicStorageHandler.is()) - aFilterCompArgs[nArgs++] <<= xGraphicStorageHandler; + aFilterCompArgsRange[nArgs++] <<= xGraphicStorageHandler; if( xImportInfo.is()) - aFilterCompArgs[ nArgs++ ] <<= xImportInfo; + aFilterCompArgsRange[ nArgs++ ] <<= xImportInfo; // the underlying SvXMLImport implements XFastParser, XImporter, XFastDocumentHandler Reference< XInterface > xFilter = @@ -449,14 +449,10 @@ ErrCode XMLFilter::impl_ImportStream( { try { - uno::Sequence< uno::Any > aArgs(2); - beans::NamedValue aValue; - aValue.Name = "DocumentHandler"; - aValue.Value <<= xFilter; - aArgs[0] <<= aValue; - aValue.Name = "Model"; - aValue.Value <<= m_xTargetDoc; - aArgs[1] <<= aValue; + uno::Sequence< uno::Any > aArgs{ + uno::Any(beans::NamedValue("DocumentHandler", uno::Any(xFilter))), + uno::Any(beans::NamedValue("Model", uno::Any(m_xTargetDoc))) + }; xFilter = xFactory->createInstanceWithArgumentsAndContext(m_sDocumentHandler,aArgs,m_xContext); } @@ -556,14 +552,10 @@ ErrCode XMLFilter::impl_Export( { try { - uno::Sequence< uno::Any > aArgs(2); - beans::NamedValue aValue; - aValue.Name = "DocumentHandler"; - aValue.Value <<= xDocHandler; - aArgs[0] <<= aValue; - aValue.Name = "Model"; - aValue.Value <<= xDocumentComp; - aArgs[1] <<= aValue; + uno::Sequence< uno::Any > aArgs{ + uno::Any(beans::NamedValue("DocumentHandler", uno::Any(xDocHandler))), + uno::Any(beans::NamedValue("Model", uno::Any(xDocumentComp))) + }; xDocHandler.set(xServiceFactory->createInstanceWithArguments(m_sDocumentHandler,aArgs), uno::UNO_QUERY ); xSaxWriter.set(xDocHandler,uno::UNO_QUERY); @@ -602,11 +594,12 @@ ErrCode XMLFilter::impl_Export( uno::Sequence< uno::Any > aFilterProperties( nArgs ); { + auto pFilterProperties = aFilterProperties.getArray(); nArgs = 0; - aFilterProperties[ nArgs++ ] <<= xInfoSet; - aFilterProperties[ nArgs++ ] <<= xDocHandler; + pFilterProperties[ nArgs++ ] <<= xInfoSet; + pFilterProperties[ nArgs++ ] <<= xDocHandler; if( xGraphicStorageHandler.is()) - aFilterProperties[ nArgs++ ] <<= xGraphicStorageHandler; + pFilterProperties[ nArgs++ ] <<= xGraphicStorageHandler; } // export meta information diff --git a/chart2/source/model/main/Axis.cxx b/chart2/source/model/main/Axis.cxx index 332ed7a5e5f7..bfdccbd54e2f 100644 --- a/chart2/source/model/main/Axis.cxx +++ b/chart2/source/model/main/Axis.cxx @@ -416,11 +416,12 @@ void Axis::AllocateSubGrids() else if( nOldSubIncCount < nNewSubIncCount ) { m_aSubGridProperties.realloc( nNewSubIncCount ); + auto pSubGridProperties = m_aSubGridProperties.getArray(); // allocate new entries for( sal_Int32 i = nOldSubIncCount; i < nNewSubIncCount; ++i ) { - m_aSubGridProperties[ i ] = new GridProperties(); + pSubGridProperties[ i ] = new GridProperties(); LinePropertiesHelper::SetLineInvisible( m_aSubGridProperties[ i ] ); LinePropertiesHelper::SetLineColor( m_aSubGridProperties[ i ], static_cast<sal_Int32>(0xdddddd) ); //gray2 aNewBroadcasters.push_back( m_aSubGridProperties[ i ] ); diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index c5bf2167184d..e5e518b63818 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -695,9 +695,8 @@ Reference< chart2::data::XDataSource > ChartModel::impl_createDefaultData() { //init internal dataprovider { - uno::Sequence< uno::Any > aArgs(1); beans::NamedValue aParam( "CreateDefaultData" ,uno::Any(true) ); - aArgs[0] <<= aParam; + uno::Sequence< uno::Any > aArgs{ uno::Any(aParam) }; xIni->initialize(aArgs); } //create data diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx index efb4d0b44c31..b246aa18f2b1 100644 --- a/chart2/source/model/main/ChartModel_Persistence.cxx +++ b/chart2/source/model/main/ChartModel_Persistence.cxx @@ -104,7 +104,7 @@ void lcl_addStorageToMediaDescriptor( const Reference< embed::XStorage > & xStorage ) { rOutMD.realloc( rOutMD.getLength() + 1 ); - rOutMD[rOutMD.getLength() - 1] = beans::PropertyValue( + rOutMD.getArray()[rOutMD.getLength() - 1] = beans::PropertyValue( "Storage", -1, uno::Any( xStorage ), beans::PropertyState_DIRECT_VALUE ); } @@ -125,10 +125,9 @@ Reference< embed::XStorage > lcl_createStorage( uno::UNO_QUERY ); Reference< lang::XSingleServiceFactory > xStorageFact( embed::StorageFactory::create( xContext ) ); - Sequence< uno::Any > aStorageArgs( 3 ); - aStorageArgs[0] <<= xStream; - aStorageArgs[1] <<= embed::ElementModes::READWRITE; - aStorageArgs[2] <<= rMediaDescriptor; + Sequence< uno::Any > aStorageArgs{ uno::Any(xStream), + uno::Any(embed::ElementModes::READWRITE), + uno::Any(rMediaDescriptor) }; xStorage.set( xStorageFact->createInstanceWithArguments( aStorageArgs ), uno::UNO_QUERY_THROW ); } @@ -396,9 +395,8 @@ void ChartModel::insertDefaultChart() bool bSupportsCategories = xTemplate->supportsCategories(); if( bSupportsCategories ) { - aParam.realloc( 1 ); - aParam[0] = beans::PropertyValue( "HasCategories", -1, uno::Any( true ), - beans::PropertyState_DIRECT_VALUE ); + aParam = { beans::PropertyValue( "HasCategories", -1, uno::Any( true ), + beans::PropertyState_DIRECT_VALUE ) }; } Reference< chart2::XDiagram > xDiagram( xTemplate->createDiagramByDataSource( xDataSource, aParam ) ); @@ -510,10 +508,9 @@ void SAL_CALL ChartModel::load( if( aMDHelper.ISSET_Stream ) { // convert XStream to XStorage via the storage factory - Sequence< uno::Any > aStorageArgs( 2 ); - aStorageArgs[0] <<= aMDHelper.Stream; - // todo: check if stream is read-only - aStorageArgs[1] <<= embed::ElementModes::READ; //WRITE | embed::ElementModes::NOCREATE); + Sequence< uno::Any > aStorageArgs{ uno::Any(aMDHelper.Stream), + // todo: check if stream is read-only + uno::Any(embed::ElementModes::READ) }; //WRITE | embed::ElementModes::NOCREATE); xStorage.set( xStorageFact->createInstanceWithArguments( aStorageArgs ), uno::UNO_QUERY_THROW ); @@ -522,9 +519,8 @@ void SAL_CALL ChartModel::load( { OSL_ASSERT( aMDHelper.ISSET_InputStream ); // convert XInputStream to XStorage via the storage factory - Sequence< uno::Any > aStorageArgs( 2 ); - aStorageArgs[0] <<= aMDHelper.InputStream; - aStorageArgs[1] <<= embed::ElementModes::READ; + Sequence< uno::Any > aStorageArgs{ uno::Any(aMDHelper.InputStream), + uno::Any(embed::ElementModes::READ) }; xStorage.set( xStorageFact->createInstanceWithArguments( aStorageArgs ), uno::UNO_QUERY_THROW ); diff --git a/chart2/source/model/template/BubbleDataInterpreter.cxx b/chart2/source/model/template/BubbleDataInterpreter.cxx index 83868db778e5..09fd1c25d7da 100644 --- a/chart2/source/model/template/BubbleDataInterpreter.cxx +++ b/chart2/source/model/template/BubbleDataInterpreter.cxx @@ -148,9 +148,7 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::interpretDataSource( aSeriesVec.push_back( xSeries ); } - Sequence< Sequence< Reference< XDataSeries > > > aSeries(1); - aSeries[0] = comphelper::containerToSequence( aSeriesVec ); - return InterpretedData( aSeries, xCategories ); + return InterpretedData( { comphelper::containerToSequence(aSeriesVec) }, xCategories ); } chart2::InterpretedData SAL_CALL BubbleDataInterpreter::reinterpretDataSeries( @@ -221,22 +219,16 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::reinterpretDataSeries( { if( xValuesX.is() ) { - aNewSequences.realloc(3); - aNewSequences[0] = xValuesX; - aNewSequences[1] = xValuesY; - aNewSequences[2] = xValuesSize; + aNewSequences = { xValuesX, xValuesY, xValuesSize }; } else { - aNewSequences.realloc(2); - aNewSequences[0] = xValuesY; - aNewSequences[1] = xValuesSize; + aNewSequences = { xValuesY, xValuesSize }; } } else { - aNewSequences.realloc(1); - aNewSequences[0] = xValuesSize; + aNewSequences = { xValuesSize }; } } diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index 8aafc1fd1d8b..1f1b09cff89f 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -209,9 +209,8 @@ void SAL_CALL ChartTypeTemplate::changeDiagram( const uno::Reference< XDiagram > Sequence< beans::PropertyValue > aParam; if( aData.Categories.is()) { - aParam.realloc( 1 ); - aParam[0] = beans::PropertyValue( "HasCategories", -1, uno::Any( true ), - beans::PropertyState_DIRECT_VALUE ); + aParam = { beans::PropertyValue( "HasCategories", -1, uno::Any( true ), + beans::PropertyState_DIRECT_VALUE ) }; } aData = xInterpreter->interpretDataSource( xSource, aParam, aFlatSeriesSeq ); } @@ -581,8 +580,7 @@ void ChartTypeTemplate::createCoordinateSystems( } // set new coordinate systems - aCoordinateSystems.realloc( 1 ); - aCoordinateSystems[0] = xCooSys; + aCoordinateSystems = { xCooSys }; xOutCooSysCnt->setCoordinateSystems( aCoordinateSystems ); } @@ -796,10 +794,7 @@ void ChartTypeTemplate::createChartTypes( // we need a new chart type xCT.set( getChartTypeForNewSeries( aOldChartTypesSeq )); Reference< XChartTypeContainer > xCTCnt( rCoordSys[nCooSysIdx], uno::UNO_QUERY_THROW ); - Sequence< Reference< XChartType > > aCTSeq( xCTCnt->getChartTypes()); - aCTSeq.realloc( 1 ); - aCTSeq[0] = xCT; - xCTCnt->setChartTypes( aCTSeq ); + xCTCnt->setChartTypes({ xCT }); } else { @@ -813,7 +808,7 @@ void ChartTypeTemplate::createChartTypes( Sequence< Reference< XChartType > > aCTSeq( xCTCnt->getChartTypes()); if( aCTSeq.hasElements()) { - aCTSeq[0] = xCT; + aCTSeq.getArray()[0] = xCT; xCTCnt->setChartTypes( aCTSeq ); } else diff --git a/chart2/source/model/template/ColumnChartType.cxx b/chart2/source/model/template/ColumnChartType.cxx index 487cf8977099..36eb72b33623 100644 --- a/chart2/source/model/template/ColumnChartType.cxx +++ b/chart2/source/model/template/ColumnChartType.cxx @@ -65,12 +65,10 @@ struct StaticColumnChartTypeDefaults_Initializer private: static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) { - Sequence< sal_Int32 > aSeq(2); - - aSeq[0] = aSeq[1] = 0; + Sequence< sal_Int32 > aSeq{ 0, 0 }; ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_BARCHARTTYPE_OVERLAP_SEQUENCE, aSeq ); - aSeq[0] = aSeq[1] = 100; + aSeq = { 100, 100 }; ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_BARCHARTTYPE_GAPWIDTH_SEQUENCE, aSeq ); } }; diff --git a/chart2/source/model/template/ColumnLineDataInterpreter.cxx b/chart2/source/model/template/ColumnLineDataInterpreter.cxx index 6069255d3f1d..658bf2fd62d9 100644 --- a/chart2/source/model/template/ColumnLineDataInterpreter.cxx +++ b/chart2/source/model/template/ColumnLineDataInterpreter.cxx @@ -60,9 +60,10 @@ InterpretedData SAL_CALL ColumnLineDataInterpreter::interpretDataSource( { sal_Int32 nNumOfLines = std::min( m_nNumberOfLines, nNumberOfSeries - 1 ); aResult.Series.realloc(2); + auto pSeries = aResult.Series.getArray(); - Sequence< Reference< XDataSeries > > & rColumnDataSeries = aResult.Series[0]; - Sequence< Reference< XDataSeries > > & rLineDataSeries = aResult.Series[1]; + Sequence< Reference< XDataSeries > > & rColumnDataSeries = pSeries[0]; + Sequence< Reference< XDataSeries > > & rLineDataSeries = pSeries[1]; rLineDataSeries.realloc( nNumOfLines ); std::copy( std::cbegin(rColumnDataSeries) + nNumberOfSeries - nNumOfLines, std::cbegin(rColumnDataSeries) + nNumberOfSeries, diff --git a/chart2/source/model/template/DataInterpreter.cxx b/chart2/source/model/template/DataInterpreter.cxx index 67e5a0b856e4..524ce73d0d2d 100644 --- a/chart2/source/model/template/DataInterpreter.cxx +++ b/chart2/source/model/template/DataInterpreter.cxx @@ -123,9 +123,7 @@ InterpretedData SAL_CALL DataInterpreter::interpretDataSource( ++nSeriesIndex; } - Sequence< Sequence< Reference< XDataSeries > > > aSeries(1); - aSeries[0] = comphelper::containerToSequence( aSeriesVec ); - return InterpretedData( aSeries, xCategories ); + return InterpretedData( { comphelper::containerToSequence( aSeriesVec ) }, xCategories ); } InterpretedData SAL_CALL DataInterpreter::reinterpretDataSeries( @@ -156,8 +154,7 @@ InterpretedData SAL_CALL DataInterpreter::reinterpretDataSeries( } if( xValuesY.is()) { - aNewSequences.realloc(1); - aNewSequences[0] = xValuesY; + aNewSequences = { xValuesY }; } Sequence< Reference< data::XLabeledDataSequence > > aSeqs( xSeriesSource->getDataSequences()); diff --git a/chart2/source/model/template/StockDataInterpreter.cxx b/chart2/source/model/template/StockDataInterpreter.cxx index 95018fad52ac..7647f475f1f8 100644 --- a/chart2/source/model/template/StockDataInterpreter.cxx +++ b/chart2/source/model/template/StockDataInterpreter.cxx @@ -88,13 +88,15 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource( sal_Int32 nNumberOfGroups( bHasVolume ? 2 : 1 ); // sequences of data::XLabeledDataSequence per series per group Sequence< Sequence< Sequence< Reference< data::XLabeledDataSequence > > > > aSequences( nNumberOfGroups ); - sal_Int32 nBarGroupIndex( 0 ); - sal_Int32 nCandleStickGroupIndex( nNumberOfGroups - 1 ); + auto pSequences = aSequences.getArray(); + const sal_Int32 nBarGroupIndex( 0 ); + const sal_Int32 nCandleStickGroupIndex( nNumberOfGroups - 1 ); // allocate space for labeled sequences if( nRemaining > 0 ) ++nCandleStickSeries; - aSequences[nCandleStickGroupIndex].realloc( nCandleStickSeries ); + pSequences[nCandleStickGroupIndex].realloc( nCandleStickSeries ); + auto pCandleStickGroup = pSequences[nCandleStickGroupIndex].getArray(); if( bHasVolume ) { // if there are remaining sequences, the first one is taken for @@ -102,8 +104,9 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource( // is used if( nRemaining > 1 ) ++nVolumeSeries; - aSequences[nBarGroupIndex].realloc( nVolumeSeries ); + pSequences[nBarGroupIndex].realloc( nVolumeSeries ); } + auto pBarGroup = pSequences[nBarGroupIndex].getArray(); // create data sal_Int32 nSourceIndex = 0; // index into aData sequence @@ -121,8 +124,8 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource( // bar if( bHasVolume ) { - aSequences[nBarGroupIndex][nLabeledSeqIdx].realloc( 1 ); - aSequences[nBarGroupIndex][nLabeledSeqIdx][0].set( aData[nSourceIndex] ); + pBarGroup[nLabeledSeqIdx].realloc( 1 ); + pBarGroup[nLabeledSeqIdx].getArray()[0].set( aData[nSourceIndex] ); if( aData[nSourceIndex].is()) SetRole( aData[nSourceIndex]->getValues(), "values-y"); ++nSourceIndex; @@ -131,29 +134,30 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource( sal_Int32 nSeqIdx = 0; if( bHasOpenValues ) { - aSequences[nCandleStickGroupIndex][nLabeledSeqIdx].realloc( 4 ); - aSequences[nCandleStickGroupIndex][nLabeledSeqIdx][nSeqIdx].set( aData[nSourceIndex] ); + pCandleStickGroup[nLabeledSeqIdx].realloc( 4 ); + pCandleStickGroup[nLabeledSeqIdx].getArray()[nSeqIdx].set( aData[nSourceIndex] ); if( aData[nSourceIndex].is()) SetRole( aData[nSourceIndex]->getValues(), "values-first"); ++nSourceIndex; ++nSeqIdx; } else - aSequences[nCandleStickGroupIndex][nLabeledSeqIdx].realloc( 3 ); + pCandleStickGroup[nLabeledSeqIdx].realloc( 3 ); + auto pLabeledSeq = pCandleStickGroup[nLabeledSeqIdx].getArray(); - aSequences[nCandleStickGroupIndex][nLabeledSeqIdx][nSeqIdx].set( aData[nSourceIndex] ); + pLabeledSeq[nSeqIdx].set( aData[nSourceIndex] ); if( aData[nSourceIndex].is()) SetRole( aData[nSourceIndex]->getValues(), "values-min"); ++nSourceIndex; ++nSeqIdx; - aSequences[nCandleStickGroupIndex][nLabeledSeqIdx][nSeqIdx].set( aData[nSourceIndex] ); + pLabeledSeq[nSeqIdx].set( aData[nSourceIndex] ); if( aData[nSourceIndex].is()) SetRole( aData[nSourceIndex]->getValues(), "values-max"); ++nSourceIndex; ++nSeqIdx; - aSequences[nCandleStickGroupIndex][nLabeledSeqIdx][nSeqIdx].set( aData[nSourceIndex] ); + pLabeledSeq[nSeqIdx].set( aData[nSourceIndex] ); if( aData[nSourceIndex].is()) SetRole( aData[nSourceIndex]->getValues(), "values-last"); ++nSourceIndex; @@ -164,11 +168,11 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource( if( bHasVolume && nRemaining > 1 ) { OSL_ASSERT( nVolumeSeries > nNumOfFullSeries ); - aSequences[nBarGroupIndex][nVolumeSeries - 1].realloc( 1 ); + pBarGroup[nVolumeSeries - 1].realloc( 1 ); OSL_ASSERT( nDataCount > nSourceIndex ); if( aData[nSourceIndex].is()) SetRole( aData[nSourceIndex]->getValues(), "values-y"); - aSequences[nBarGroupIndex][nVolumeSeries - 1][0].set( aData[nSourceIndex] ); + pBarGroup[nVolumeSeries - 1].getArray()[0].set( aData[nSourceIndex] ); ++nSourceIndex; --nRemaining; OSL_ENSURE( nRemaining, "additional bar should only be used if there is at least one more sequence for a candle stick" ); @@ -179,12 +183,13 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource( { OSL_ASSERT( nCandleStickSeries > nNumOfFullSeries ); const sal_Int32 nSeriesIndex = nCandleStickSeries - 1; - aSequences[nCandleStickGroupIndex][nSeriesIndex].realloc( nRemaining ); + pCandleStickGroup[nSeriesIndex].realloc( nRemaining ); + auto pLabeledSeq = pCandleStickGroup[nSeriesIndex].getArray(); OSL_ASSERT( nDataCount > nSourceIndex ); // 1. low sal_Int32 nSeqIdx( 0 ); - aSequences[nCandleStickGroupIndex][nSeriesIndex][nSeqIdx].set( aData[nSourceIndex] ); + pLabeledSeq[nSeqIdx].set( aData[nSourceIndex] ); if( aData[nSourceIndex].is()) SetRole( aData[nSourceIndex]->getValues(), "values-min"); ++nSourceIndex; @@ -193,7 +198,7 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource( // 2. high if( nSeqIdx < nRemaining ) { - aSequences[nCandleStickGroupIndex][nSeriesIndex][nSeqIdx].set( aData[nSourceIndex] ); + pLabeledSeq[nSeqIdx].set( aData[nSourceIndex] ); if( aData[nSourceIndex].is()) SetRole( aData[nSourceIndex]->getValues(), "values-max"); ++nSourceIndex; @@ -204,7 +209,7 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource( OSL_ENSURE( bHasOpenValues || nSeqIdx >= nRemaining, "could have created full series" ); if( nSeqIdx < nRemaining ) { - aSequences[nCandleStickGroupIndex][nSeriesIndex][nSeqIdx].set( aData[nSourceIndex] ); + pLabeledSeq[nSeqIdx].set( aData[nSourceIndex] ); if( aData[nSourceIndex].is()) SetRole( aData[nSourceIndex]->getValues(), "values-last"); ++nSourceIndex; @@ -217,11 +222,13 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource( // create DataSeries Sequence< Sequence< Reference< XDataSeries > > > aResultSeries( nNumberOfGroups ); + auto pResultSeries = aResultSeries.getArray(); sal_Int32 nGroupIndex, nReUsedSeriesIdx = 0; for( nGroupIndex=0; nGroupIndex<nNumberOfGroups; ++nGroupIndex ) { const sal_Int32 nNumSeriesData = aSequences[nGroupIndex].getLength(); - aResultSeries[nGroupIndex].realloc( nNumSeriesData ); + pResultSeries[nGroupIndex].realloc( nNumSeriesData ); + auto pResultSerie = pResultSeries[nGroupIndex].getArray(); for( sal_Int32 nSeriesIdx = 0; nSeriesIdx < nNumSeriesData; ++nSeriesIdx, ++nReUsedSeriesIdx ) { try @@ -234,7 +241,7 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource( OSL_ASSERT( xSeries.is() ); Reference< data::XDataSink > xSink( xSeries, uno::UNO_QUERY_THROW ); xSink->setData( aSequences[nGroupIndex][nSeriesIdx] ); - aResultSeries[nGroupIndex][nSeriesIdx].set( xSeries ); + pResultSerie[nSeriesIdx].set( xSeries ); } catch( const uno::Exception & ) { diff --git a/chart2/source/model/template/XYDataInterpreter.cxx b/chart2/source/model/template/XYDataInterpreter.cxx index 17e9f57cfc92..1f0480a28c39 100644 --- a/chart2/source/model/template/XYDataInterpreter.cxx +++ b/chart2/source/model/template/XYDataInterpreter.cxx @@ -132,9 +132,7 @@ chart2::InterpretedData SAL_CALL XYDataInterpreter::interpretDataSource( ++nSeriesIndex; } - Sequence< Sequence< Reference< XDataSeries > > > aSeries(1); - aSeries[0] = comphelper::containerToSequence( aSeriesVec ); - return InterpretedData( aSeries, xCategories ); + return InterpretedData( { comphelper::containerToSequence( aSeriesVec ) }, xCategories ); } chart2::InterpretedData SAL_CALL XYDataInterpreter::reinterpretDataSeries( @@ -190,14 +188,11 @@ chart2::InterpretedData SAL_CALL XYDataInterpreter::reinterpretDataSeries( { if( xValuesX.is()) { - aNewSequences.realloc(2); - aNewSequences[0] = xValuesX; - aNewSequences[1] = xValuesY; + aNewSequences = { xValuesX, xValuesY }; } else { - aNewSequences.realloc(1); - aNewSequences[0] = xValuesY; + aNewSequences = { xValuesY }; } } diff --git a/chart2/source/tools/CommonConverters.cxx b/chart2/source/tools/CommonConverters.cxx index 4993c749f2ca..b4b4cbf62e72 100644 --- a/chart2/source/tools/CommonConverters.cxx +++ b/chart2/source/tools/CommonConverters.cxx @@ -209,8 +209,11 @@ void addPolygon( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonSh sal_Int32 nAddOuterCount = rAdd.SequenceX.getLength(); sal_Int32 nOuterCount = rRet.SequenceX.getLength() + nAddOuterCount; rRet.SequenceX.realloc( nOuterCount ); + auto pSequenceX = rRet.SequenceX.getArray(); rRet.SequenceY.realloc( nOuterCount ); + auto pSequenceY = rRet.SequenceY.getArray(); rRet.SequenceZ.realloc( nOuterCount ); + auto pSequenceZ = rRet.SequenceZ.getArray(); sal_Int32 nIndex = 0; sal_Int32 nOuter = nOuterCount - nAddOuterCount; @@ -219,9 +222,9 @@ void addPolygon( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonSh if( nIndex >= nAddOuterCount ) break; - rRet.SequenceX[nOuter] = rAdd.SequenceX[nIndex]; - rRet.SequenceY[nOuter] = rAdd.SequenceY[nIndex]; - rRet.SequenceZ[nOuter] = rAdd.SequenceZ[nIndex]; + pSequenceX[nOuter] = rAdd.SequenceX[nIndex]; + pSequenceY[nOuter] = rAdd.SequenceY[nIndex]; + pSequenceZ[nOuter] = rAdd.SequenceZ[nIndex]; nIndex++; } @@ -231,8 +234,11 @@ void appendPoly( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonSh { sal_Int32 nOuterCount = std::max( rRet.SequenceX.getLength(), rAdd.SequenceX.getLength() ); rRet.SequenceX.realloc(nOuterCount); + auto pSequenceX = rRet.SequenceX.getArray(); rRet.SequenceY.realloc(nOuterCount); + auto pSequenceY = rRet.SequenceY.getArray(); rRet.SequenceZ.realloc(nOuterCount); + auto pSequenceZ =rRet.SequenceZ.getArray(); for( sal_Int32 nOuter=0;nOuter<nOuterCount;nOuter++ ) { @@ -245,17 +251,20 @@ void appendPoly( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonSh sal_Int32 nNewPointCount = nOldPointCount + nAddPointCount; - rRet.SequenceX[nOuter].realloc(nNewPointCount); - rRet.SequenceY[nOuter].realloc(nNewPointCount); - rRet.SequenceZ[nOuter].realloc(nNewPointCount); + pSequenceX[nOuter].realloc(nNewPointCount); + auto pSequenceX_nOuter = pSequenceX[nOuter].getArray(); + pSequenceY[nOuter].realloc(nNewPointCount); + auto pSequenceY_nOuter = pSequenceY[nOuter].getArray(); + pSequenceZ[nOuter].realloc(nNewPointCount); + auto pSequenceZ_nOuter = pSequenceZ[nOuter].getArray(); sal_Int32 nPointTarget=nOldPointCount; sal_Int32 nPointSource=nAddPointCount; for( ; nPointSource-- ; nPointTarget++ ) { - rRet.SequenceX[nOuter][nPointTarget] = rAdd.SequenceX[nOuter][nPointSource]; - rRet.SequenceY[nOuter][nPointTarget] = rAdd.SequenceY[nOuter][nPointSource]; - rRet.SequenceZ[nOuter][nPointTarget] = rAdd.SequenceZ[nOuter][nPointSource]; + pSequenceX_nOuter[nPointTarget] = rAdd.SequenceX[nOuter][nPointSource]; + pSequenceY_nOuter[nPointTarget] = rAdd.SequenceY[nOuter][nPointSource]; + pSequenceZ_nOuter[nPointTarget] = rAdd.SequenceZ[nOuter][nPointSource]; } } } @@ -267,16 +276,22 @@ drawing::PolyPolygonShape3D BezierToPoly( drawing::PolyPolygonShape3D aRet; aRet.SequenceX.realloc( rPointSequence.getLength() ); + auto pSequenceX = aRet.SequenceX.getArray(); aRet.SequenceY.realloc( rPointSequence.getLength() ); + auto pSequenceY = aRet.SequenceY.getArray(); aRet.SequenceZ.realloc( rPointSequence.getLength() ); + auto pSequenceZ = aRet.SequenceZ.getArray(); sal_Int32 nRealOuter = 0; for(sal_Int32 nN = 0; nN < rPointSequence.getLength(); nN++) { sal_Int32 nInnerLength = rPointSequence[nN].getLength(); - aRet.SequenceX[nN].realloc( nInnerLength ); - aRet.SequenceY[nN].realloc( nInnerLength ); - aRet.SequenceZ[nN].realloc( nInnerLength ); + pSequenceX[nRealOuter].realloc( nInnerLength ); + auto pSequenceX_nRealOuter = pSequenceX[nRealOuter].getArray(); + pSequenceY[nRealOuter].realloc( nInnerLength ); + auto pSequenceY_nRealOuter = pSequenceY[nRealOuter].getArray(); + pSequenceZ[nRealOuter].realloc( nInnerLength ); + auto pSequenceZ_nRealOuter = pSequenceZ[nRealOuter].getArray(); bool bHasOuterFlags = nN < rBezier.Flags.getLength(); @@ -287,16 +302,16 @@ drawing::PolyPolygonShape3D BezierToPoly( if( !bHasInnerFlags || (rBezier.Flags[nN][nM] == drawing::PolygonFlags_NORMAL) ) { - aRet.SequenceX[nRealOuter][nRealInner] = rPointSequence[nN][nM].X; - aRet.SequenceY[nRealOuter][nRealInner] = rPointSequence[nN][nM].Y; - aRet.SequenceZ[nRealOuter][nRealInner] = 0.0; + pSequenceX_nRealOuter[nRealInner] = rPointSequence[nN][nM].X; + pSequenceY_nRealOuter[nRealInner] = rPointSequence[nN][nM].Y; + pSequenceZ_nRealOuter[nRealInner] = 0.0; nRealInner++; } } - aRet.SequenceX[nRealOuter].realloc( nRealInner ); - aRet.SequenceY[nRealOuter].realloc( nRealInner ); - aRet.SequenceZ[nRealOuter].realloc( nRealInner ); + pSequenceX[nRealOuter].realloc( nRealInner ); + pSequenceY[nRealOuter].realloc( nRealInner ); + pSequenceZ[nRealOuter].realloc( nRealInner ); if( nRealInner>0 ) nRealOuter++; @@ -314,15 +329,17 @@ drawing::PointSequenceSequence PolyToPointSequence( { drawing::PointSequenceSequence aRet; aRet.realloc( rPolyPolygon.SequenceX.getLength() ); + auto pRet = aRet.getArray(); for(sal_Int32 nN = 0; nN < rPolyPolygon.SequenceX.getLength(); nN++) { sal_Int32 nInnerLength = rPolyPolygon.SequenceX[nN].getLength(); - aRet[nN].realloc( nInnerLength ); + pRet[nN].realloc( nInnerLength ); + auto pRet_nN = pRet[nN].getArray(); for( sal_Int32 nM = 0; nM < nInnerLength; nM++) { - aRet[nN][nM].X = static_cast<sal_Int32>(rPolyPolygon.SequenceX[nN][nM]); - aRet[nN][nM].Y = static_cast<sal_Int32>(rPolyPolygon.SequenceY[nN][nM]); + pRet_nN[nM].X = static_cast<sal_Int32>(rPolyPolygon.SequenceX[nN][nM]); + pRet_nN[nM].Y = static_cast<sal_Int32>(rPolyPolygon.SequenceY[nN][nM]); } } return aRet; @@ -337,8 +354,9 @@ void appendPointSequence( drawing::PointSequenceSequence& rTarget sal_Int32 nOldCount = rTarget.getLength(); rTarget.realloc(nOldCount+nAddCount); + auto pTarget = rTarget.getArray(); for(sal_Int32 nS=0; nS<nAddCount; nS++ ) - rTarget[nOldCount+nS]=rAdd[nS]; + pTarget[nOldCount+nS]=rAdd[nS]; } drawing::Position3D operator+( const drawing::Position3D& rPos @@ -427,10 +445,11 @@ uno::Sequence< double > DataSequenceToDoubleSequence( { uno::Sequence< uno::Any > aValues = xDataSequence->getData(); aResult.realloc(aValues.getLength()); + auto pResult = aResult.getArray(); for(sal_Int32 nN=aValues.getLength();nN--;) { - if( !(aValues[nN] >>= aResult[nN]) ) - aResult[nN] = std::numeric_limits<double>::quiet_NaN(); + if( !(aValues[nN] >>= pResult[nN]) ) + pResult[nN] = std::numeric_limits<double>::quiet_NaN(); } } @@ -453,9 +472,10 @@ uno::Sequence< OUString > DataSequenceToStringSequence( { uno::Sequence< uno::Any > aValues = xDataSequence->getData(); aResult.realloc(aValues.getLength()); + auto pResult = aResult.getArray(); for(sal_Int32 nN=aValues.getLength();nN--;) - aValues[nN] >>= aResult[nN]; + aValues[nN] >>= pResult[nN]; } return aResult; diff --git a/chart2/source/tools/DataSourceHelper.cxx b/chart2/source/tools/DataSourceHelper.cxx index 679b625948e0..cbb3976e5e90 100644 --- a/chart2/source/tools/DataSourceHelper.cxx +++ b/chart2/source/tools/DataSourceHelper.cxx @@ -170,14 +170,14 @@ uno::Sequence< beans::PropertyValue > DataSourceHelper::createArguments( { uno::Sequence< beans::PropertyValue > aArguments( createArguments( bUseColumns, bFirstCellAsLabel, bHasCategories )); aArguments.realloc( aArguments.getLength() + 1 ); - aArguments[aArguments.getLength() - 1] = + aArguments.getArray()[aArguments.getLength() - 1] = beans::PropertyValue( "CellRangeRepresentation" , -1, uno::Any( rRangeRepresentation ) , beans::PropertyState_DIRECT_VALUE ); if( rSequenceMapping.hasElements() ) { aArguments.realloc( aArguments.getLength() + 1 ); - aArguments[aArguments.getLength() - 1] = + aArguments.getArray()[aArguments.getLength() - 1] = beans::PropertyValue( "SequenceMapping" , -1, uno::Any( rSequenceMapping ) , beans::PropertyState_DIRECT_VALUE ); @@ -465,20 +465,17 @@ Sequence< OUString > DataSourceHelper::getRangesFromLabeledDataSequence( { if( xValues.is()) { - aResult.realloc( 2 ); - aResult[0] = xLabel->getSourceRangeRepresentation(); - aResult[1] = xValues->getSourceRangeRepresentation(); + aResult = { xLabel->getSourceRangeRepresentation(), + xValues->getSourceRangeRepresentation() }; } else { - aResult.realloc( 1 ); - aResult[0] = xLabel->getSourceRangeRepresentation(); + aResult = { xLabel->getSourceRangeRepresentation() }; } } else if( xValues.is()) { - aResult.realloc( 1 ); - aResult[0] = xValues->getSourceRangeRepresentation(); + aResult = { xValues->getSourceRangeRepresentation() }; } } return aResult; diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index 3a1d06bdcf24..0e7760d2711c 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -977,16 +977,17 @@ void lcl_switchToDateCategories( const Reference< XChartDocument >& xChartDoc, c if( xDataAccess.is() ) { Sequence< Sequence< Any > > aAnyCategories( xDataAccess->getAnyRowDescriptions() ); + auto aAnyCategoriesRange = asNonConstRange(aAnyCategories); double fTest = 0.0; sal_Int32 nN = aAnyCategories.getLength(); for( ; nN--; ) { - Sequence< Any >& rCat = aAnyCategories[nN]; + Sequence< Any >& rCat = aAnyCategoriesRange[nN]; if( rCat.getLength() > 1 ) rCat.realloc(1); if( rCat.getLength() == 1 ) { - Any& rAny = rCat[0]; + Any& rAny = rCat.getArray()[0]; if( !(rAny>>=fTest) ) { rAny <<= std::numeric_limits<double>::quiet_NaN(); @@ -1300,6 +1301,7 @@ bool lcl_moveSeriesOrCheckIfMoveIsAllowed( continue; uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() ); + auto aSeriesListRange = asNonConstRange(aSeriesList); for( sal_Int32 nS = 0; !bFound && nS < aSeriesList.getLength(); ++nS ) { @@ -1326,8 +1328,8 @@ bool lcl_moveSeriesOrCheckIfMoveIsAllowed( bMovedOrMoveAllowed = true; if( bDoMove ) { - aSeriesList[ nOldSeriesIndex ] = aSeriesList[ nNewSeriesIndex ]; - aSeriesList[ nNewSeriesIndex ] = xGivenDataSeries; + aSeriesListRange[ nOldSeriesIndex ] = aSeriesList[ nNewSeriesIndex ]; + aSeriesListRange[ nNewSeriesIndex ] = xGivenDataSeries; xDataSeriesContainer->setDataSeries( aSeriesList ); } } @@ -1347,10 +1349,10 @@ bool lcl_moveSeriesOrCheckIfMoveIsAllowed( if( nOtherSeriesIndex >= 0 && nOtherSeriesIndex < aOtherSeriesList.getLength() ) { uno::Reference< XDataSeries > xExchangeSeries( aOtherSeriesList[nOtherSeriesIndex] ); - aOtherSeriesList[nOtherSeriesIndex] = xGivenDataSeries; + aOtherSeriesList.getArray()[nOtherSeriesIndex] = xGivenDataSeries; xOtherDataSeriesContainer->setDataSeries(aOtherSeriesList); - aSeriesList[nOldSeriesIndex]=xExchangeSeries; + aSeriesListRange[nOldSeriesIndex]=xExchangeSeries; xDataSeriesContainer->setDataSeries(aSeriesList); } } @@ -1373,10 +1375,10 @@ bool lcl_moveSeriesOrCheckIfMoveIsAllowed( if( aOtherSeriesList.hasElements() ) { uno::Reference< XDataSeries > xExchangeSeries( aOtherSeriesList[0] ); - aOtherSeriesList[0] = xGivenDataSeries; + aOtherSeriesList.getArray()[0] = xGivenDataSeries; xOtherDataSeriesContainer->setDataSeries(aOtherSeriesList); - aSeriesList[nOldSeriesIndex]=xExchangeSeries; + aSeriesListRange[nOldSeriesIndex]=xExchangeSeries; xDataSeriesContainer->setDataSeries(aSeriesList); } } diff --git a/chart2/source/tools/ErrorBar.cxx b/chart2/source/tools/ErrorBar.cxx index d894b16a3ff4..2c9b41044396 100644 --- a/chart2/source/tools/ErrorBar.cxx +++ b/chart2/source/tools/ErrorBar.cxx @@ -363,9 +363,10 @@ beans::PropertyState ErrorBar::getPropertyState( const OUString& rPropName ) uno::Sequence< beans::PropertyState > ErrorBar::getPropertyStates( const uno::Sequence< OUString >& rPropNames ) { uno::Sequence< beans::PropertyState > aRet( rPropNames.getLength() ); + auto aRetRange = asNonConstRange(aRet); for(sal_Int32 i = 0; i < rPropNames.getLength(); ++i) { - aRet[i] = getPropertyState(rPropNames[i]); + aRetRange[i] = getPropertyState(rPropNames[i]); } return aRet; } diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index 59ac20dd4640..2f31b9d38dde 100644 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -118,8 +118,7 @@ ExplicitCategoriesProvider::ExplicitCategoriesProvider( const Reference< chart2: } if( !m_aSplitCategoriesList.hasElements() ) { - m_aSplitCategoriesList.realloc(1); - m_aSplitCategoriesList[0]=m_xOriginalCategories; + m_aSplitCategoriesList = { m_xOriginalCategories }; } } } @@ -171,6 +170,7 @@ void ExplicitCategoriesProvider::convertCategoryAnysToText( uno::Sequence< OUStr if(!nCount) return; rOutTexts.realloc(nCount); + auto pOutTexts = rOutTexts.getArray(); sal_Int32 nAxisNumberFormat = 0; Reference< XCoordinateSystem > xCooSysModel( ChartModelHelper::getFirstCoordinateSystem( rModel ) ); @@ -204,7 +204,7 @@ void ExplicitCategoriesProvider::convertCategoryAnysToText( uno::Sequence< OUStr aAny>>=aText; } } - rOutTexts[nN] = aText; + pOutTexts[nN] = aText; } } @@ -359,6 +359,7 @@ static Sequence< OUString > lcl_getExplicitSimpleCategories( if(nMaxCategoryCount) { aRet.realloc(nMaxCategoryCount); + auto pRet = aRet.getArray(); for(sal_Int32 nN=0; nN<nMaxCategoryCount; nN++) { OUStringBuffer aText; @@ -375,7 +376,7 @@ static Sequence< OUString > lcl_getExplicitSimpleCategories( } } } - aRet[nN]=aText.makeStringAndClear(); + pRet[nN]=aText.makeStringAndClear(); } } return aRet; diff --git a/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx b/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx index a5063ee1039b..9c41822d3618 100644 --- a/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx +++ b/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx @@ -135,11 +135,8 @@ uno::Sequence< geometry::RealPoint2D > SAL_CALL ExponentialRegressionCurveCalcul isLogarithmicScaling( xScalingY )) { // optimize result - uno::Sequence< geometry::RealPoint2D > aResult( 2 ); - aResult[0].X = min; - aResult[0].Y = getCurveValue( min ); - aResult[1].X = max; - aResult[1].Y = getCurveValue( max ); + uno::Sequence< geometry::RealPoint2D > aResult{ { min, getCurveValue( min ) }, + { max, getCurveValue( max ) } }; return aResult; } diff --git a/chart2/source/tools/InternalData.cxx b/chart2/source/tools/InternalData.cxx index b93dbe33ae88..3249231a6fec 100644 --- a/chart2/source/tools/InternalData.cxx +++ b/chart2/source/tools/InternalData.cxx @@ -21,6 +21,7 @@ #include <ResId.hxx> #include <strings.hrc> +#include <comphelper/sequence.hxx> #include <osl/diagnose.h> #ifdef DEBUG_CHART2_TOOLS @@ -68,11 +69,7 @@ private: template< typename T > Sequence< T > lcl_ValarrayToSequence( const std::valarray< T > & rValarray ) { - // is there a more elegant way of conversion? - Sequence< T > aResult( rValarray.size()); - for( size_t i = 0; i < rValarray.size(); ++i ) - aResult[i] = rValarray[i]; - return aResult; + return comphelper::containerToSequence(rValarray); } } // anonymous namespace @@ -147,9 +144,10 @@ void InternalData::setData( const Sequence< Sequence< double > >& rDataInRows ) Sequence< Sequence< double > > InternalData::getData() const { Sequence< Sequence< double > > aResult( m_nRowCount ); + auto aResultRange = asNonConstRange(aResult); for( sal_Int32 i=0; i<m_nRowCount; ++i ) - aResult[i] = lcl_ValarrayToSequence< tDataType::value_type >( + aResultRange[i] = lcl_ValarrayToSequence< tDataType::value_type >( m_aData[ std::slice( i*m_nColumnCount, m_nColumnCount, 1 ) ] ); return aResult; diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx index 0323043dbff2..794a780d5a86 100644 --- a/chart2/source/tools/InternalDataProvider.cxx +++ b/chart2/source/tools/InternalDataProvider.cxx @@ -120,6 +120,7 @@ struct lcl_internalizeSeries Sequence< Reference< chart2::data::XLabeledDataSequence > > aOldSeriesData = xSource->getDataSequences(); Sequence< Reference< chart2::data::XLabeledDataSequence > > aNewSeriesData( aOldSeriesData.getLength() ); + auto aNewSeriesDataRange = asNonConstRange(aNewSeriesData); for( sal_Int32 i=0; i<aOldSeriesData.getLength(); ++i ) { sal_Int32 nNewIndex( m_bDataInColumns ? m_rInternalData.appendColumn() : m_rInternalData.appendRow() ); @@ -158,13 +159,13 @@ struct lcl_internalizeSeries comphelper::copyProperties( Reference< beans::XPropertySet >( xLabel, uno::UNO_QUERY ), Reference< beans::XPropertySet >( xNewLabel, uno::UNO_QUERY )); - aNewSeriesData[i].set( new LabeledDataSequence( xNewValues, xNewLabel ) ); + aNewSeriesDataRange[i].set( new LabeledDataSequence( xNewValues, xNewLabel ) ); } } else { if( m_bConnectToModel ) - aNewSeriesData[i].set( new LabeledDataSequence( xNewValues ) ); + aNewSeriesDataRange[i].set( new LabeledDataSequence( xNewValues ) ); } } if( m_bConnectToModel ) @@ -780,22 +781,22 @@ Reference< chart2::data::XDataSource > SAL_CALL InternalDataProvider::createData Sequence< beans::PropertyValue > SAL_CALL InternalDataProvider::detectArguments( const Reference< chart2::data::XDataSource >& /* xDataSource */ ) { - Sequence< beans::PropertyValue > aArguments( 4 ); - aArguments[0] = beans::PropertyValue( - "CellRangeRepresentation", -1, uno::Any( OUString(lcl_aCompleteRange) ), - beans::PropertyState_DIRECT_VALUE ); - aArguments[1] = beans::PropertyValue( - "DataRowSource", -1, uno::Any( - m_bDataInColumns - ? css::chart::ChartDataRowSource_COLUMNS - : css::chart::ChartDataRowSource_ROWS ), - beans::PropertyState_DIRECT_VALUE ); - // internal data always contains labels and categories - aArguments[2] = beans::PropertyValue( - "FirstCellAsLabel", -1, uno::Any( true ), beans::PropertyState_DIRECT_VALUE ); - aArguments[3] = beans::PropertyValue( - "HasCategories", -1, uno::Any( true ), beans::PropertyState_DIRECT_VALUE ); - + Sequence< beans::PropertyValue > aArguments{ + beans::PropertyValue( + "CellRangeRepresentation", -1, uno::Any( OUString(lcl_aCompleteRange) ), + beans::PropertyState_DIRECT_VALUE ), + beans::PropertyValue( + "DataRowSource", -1, uno::Any( + m_bDataInColumns + ? css::chart::ChartDataRowSource_COLUMNS + : css::chart::ChartDataRowSource_ROWS ), + beans::PropertyState_DIRECT_VALUE ), + // internal data always contains labels and categories + beans::PropertyValue( + "FirstCellAsLabel", -1, uno::Any( true ), beans::PropertyState_DIRECT_VALUE ), + beans::PropertyValue( + "HasCategories", -1, uno::Any( true ), beans::PropertyState_DIRECT_VALUE ) + }; // #i85913# Sequence Mapping is not needed for internal data, as it is // applied to the data when the data source is created. @@ -1293,8 +1294,9 @@ Sequence< Sequence< Type > > lcl_convertVectorVectorToSequenceSequence( const ve if( nOuterCount ) { aRet.realloc(nOuterCount); + auto pRet = aRet.getArray(); for( sal_Int32 nN=0; nN<nOuterCount; nN++) - aRet[nN]= comphelper::containerToSequence( rIn[nN] ); + pRet[nN]= comphelper::containerToSequence( rIn[nN] ); } return aRet; } @@ -1375,13 +1377,14 @@ Sequence< double > SAL_CALL InternalDataProvider::getDateCategories() vector< vector< uno::Any > > aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels()); sal_Int32 nCount = aCategories.size(); Sequence< double > aDoubles( nCount ); + auto aDoublesRange = asNonConstRange(aDoubles); sal_Int32 nN=0; for (auto const& category : aCategories) { double fValue; if( category.empty() || !(category[0]>>=fValue) ) fValue = std::numeric_limits<double>::quiet_NaN(); - aDoubles[nN++]=fValue; + aDoublesRange[nN++]=fValue; } return aDoubles; } diff --git a/chart2/source/tools/LinearRegressionCurveCalculator.cxx b/chart2/source/tools/LinearRegressionCurveCalculator.cxx index b4ec56028ec3..ee836555b1e4 100644 --- a/chart2/source/tools/LinearRegressionCurveCalculator.cxx +++ b/chart2/source/tools/LinearRegressionCurveCalculator.cxx @@ -56,11 +56,8 @@ uno::Sequence< geometry::RealPoint2D > SAL_CALL LinearRegressionCurveCalculator: isLinearScaling( xScalingY )) { // optimize result - uno::Sequence< geometry::RealPoint2D > aResult( 2 ); - aResult[0].X = min; - aResult[0].Y = getCurveValue( min ); - aResult[1].X = max; - aResult[1].Y = getCurveValue( max ); + uno::Sequence< geometry::RealPoint2D > aResult{ { min, getCurveValue( min ) }, + { max, getCurveValue( max ) } }; return aResult; } diff --git a/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx b/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx index 1e84ed81d42d..58b0a66da1d1 100644 --- a/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx +++ b/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx @@ -107,11 +107,8 @@ uno::Sequence< geometry::RealPoint2D > SAL_CALL LogarithmicRegressionCurveCalcul isLinearScaling( xScalingY )) { // optimize result - uno::Sequence< geometry::RealPoint2D > aResult( 2 ); - aResult[0].X = min; - aResult[0].Y = getCurveValue( min ); - aResult[1].X = max; - aResult[1].Y = getCurveValue( max ); + uno::Sequence< geometry::RealPoint2D > aResult{ { min, getCurveValue( min ) }, + { max, getCurveValue( max ) } }; return aResult; } diff --git a/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx b/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx index 70c3f1822de4..aefd3f8f05aa 100644 --- a/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx +++ b/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx @@ -99,11 +99,8 @@ uno::Sequence< geometry::RealPoint2D > SAL_CALL MeanValueRegressionCurveCalculat if( bMaySkipPointsInCalculation ) { // optimize result - uno::Sequence< geometry::RealPoint2D > aResult( 2 ); - aResult[0].X = min; - aResult[0].Y = m_fMeanValue; - aResult[1].X = max; - aResult[1].Y = m_fMeanValue; + uno::Sequence< geometry::RealPoint2D > aResult{ { min, m_fMeanValue }, + { max, m_fMeanValue } }; return aResult; } diff --git a/chart2/source/tools/MediaDescriptorHelper.cxx b/chart2/source/tools/MediaDescriptorHelper.cxx index 73c326fdcb38..bd217b0fbf8c 100644 --- a/chart2/source/tools/MediaDescriptorHelper.cxx +++ b/chart2/source/tools/MediaDescriptorHelper.cxx @@ -33,21 +33,23 @@ MediaDescriptorHelper::MediaDescriptorHelper( const uno::Sequence< beans::PropertyValue > & rMediaDescriptor ) : m_aModelProperties(rMediaDescriptor.getLength()) { + auto aModelPropertiesRange = asNonConstRange(m_aModelProperties); css::uno::Sequence< css::beans::PropertyValue > aRegularProperties(rMediaDescriptor.getLength()); //these are the properties which are described in service com.sun.star.document.MediaDescriptor and not marked as deprecated + auto aRegularPropertiesRange = asNonConstRange(aRegularProperties); impl_init(); sal_Int32 nRegularCount = 0; sal_Int32 nModelCount = 0; - auto addRegularProp = [&aRegularProperties, &nRegularCount](const beans::PropertyValue& rRegularProp) + auto addRegularProp = [&aRegularPropertiesRange, &nRegularCount](const beans::PropertyValue& rRegularProp) { - aRegularProperties[nRegularCount] = rRegularProp; + aRegularPropertiesRange[nRegularCount] = rRegularProp; ++nRegularCount; }; - auto addModelProp = [this, &nModelCount, &addRegularProp](const beans::PropertyValue& rModelProp) + auto addModelProp = [&aModelPropertiesRange, &nModelCount, &addRegularProp](const beans::PropertyValue& rModelProp) { addRegularProp(rModelProp); - m_aModelProperties[nModelCount] = rModelProp; + aModelPropertiesRange[nModelCount] = rModelProp; ++nModelCount; }; diff --git a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx index d21ec8d27714..227a509ad3f0 100644 --- a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx +++ b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx @@ -22,6 +22,7 @@ #include <ResId.hxx> #include <strings.hrc> +#include <algorithm> #include <limits> #include <com/sun/star/chart2/MovingAverageType.hpp> @@ -145,12 +146,8 @@ uno::Sequence< geometry::RealPoint2D > SAL_CALL MovingAverageRegressionCurveCalc { size_t nSize = std::min(aXList.size(), aYList.size()); uno::Sequence< geometry::RealPoint2D > aResult( nSize ); - - for( size_t i = 0; i < nSize; ++i ) - { - aResult[i].X = aXList[i]; - aResult[i].Y = aYList[i]; - } + std::transform(aXList.begin(), aXList.begin() + nSize, aYList.begin(), aResult.getArray(), + [](const auto& x, const auto& y) { return geometry::RealPoint2D(x, y); }); return aResult; } diff --git a/chart2/source/tools/NameContainer.cxx b/chart2/source/tools/NameContainer.cxx index 8879ededadee..3e485c624948 100644 --- a/chart2/source/tools/NameContainer.cxx +++ b/chart2/source/tools/NameContainer.cxx @@ -20,7 +20,9 @@ #include <NameContainer.hxx> #include <com/sun/star/uno/Any.hxx> - #include <cppuhelper/supportsservice.hxx> + +#include <comphelper/sequence.hxx> +#include <cppuhelper/supportsservice.hxx> using namespace ::com::sun::star; using ::com::sun::star::uno::Sequence; @@ -108,14 +110,7 @@ Any SAL_CALL NameContainer::getByName( const OUString& rName ) Sequence< OUString > SAL_CALL NameContainer::getElementNames() { - sal_Int32 nCount = m_aMap.size(); - Sequence< OUString > aSeq(nCount); - sal_Int32 nN = 0; - for (auto const& elem : m_aMap) - { - aSeq[nN++]=elem.first; - } - return aSeq; + return comphelper::mapKeysToSequence(m_aMap); } sal_Bool SAL_CALL NameContainer::hasByName( const OUString& rName ) diff --git a/chart2/source/tools/PotentialRegressionCurveCalculator.cxx b/chart2/source/tools/PotentialRegressionCurveCalculator.cxx index 1fa82434e0b4..01aa5b2548fb 100644 --- a/chart2/source/tools/PotentialRegressionCurveCalculator.cxx +++ b/chart2/source/tools/PotentialRegressionCurveCalculator.cxx @@ -120,11 +120,8 @@ uno::Sequence< geometry::RealPoint2D > SAL_CALL PotentialRegressionCurveCalculat isLogarithmicScaling( xScalingY )) { // optimize result - uno::Sequence< geometry::RealPoint2D > aResult( 2 ); - aResult[0].X = min; - aResult[0].Y = getCurveValue( min ); - aResult[1].X = max; - aResult[1].Y = getCurveValue( max ); + uno::Sequence< geometry::RealPoint2D > aResult{ { min, getCurveValue( min ) }, + { max, getCurveValue( max ) } }; return aResult; } diff --git a/chart2/source/tools/RangeHighlighter.cxx b/chart2/source/tools/RangeHighlighter.cxx index fb0e75f4b738..3dc667bfd043 100644 --- a/chart2/source/tools/RangeHighlighter.cxx +++ b/chart2/source/tools/RangeHighlighter.cxx @@ -52,12 +52,13 @@ void lcl_fillRanges( sal_Int32 nIndex = -1 ) { rOutRanges.realloc( aRangeStrings.getLength()); + auto pOutRanges = rOutRanges.getArray(); for( sal_Int32 i=0; i<aRangeStrings.getLength(); ++i ) { - rOutRanges[i].RangeRepresentation = aRangeStrings[i]; - rOutRanges[i].PreferredColor = sal_Int32(nPreferredColor); - rOutRanges[i].AllowMerginigWithOtherRanges = false; - rOutRanges[i].Index = nIndex; + pOutRanges[i].RangeRepresentation = aRangeStrings[i]; + pOutRanges[i].PreferredColor = sal_Int32(nPreferredColor); + pOutRanges[i].AllowMerginigWithOtherRanges = false; + pOutRanges[i].Index = nIndex; } } @@ -197,13 +198,14 @@ void RangeHighlighter::fillRangesForDiagram( const Reference< chart2::XDiagram > { Sequence< OUString > aSelectedRanges( DataSourceHelper::getUsedDataRanges( xDiagram )); m_aSelectedRanges.realloc( aSelectedRanges.getLength()); + auto pSelectedRanges = m_aSelectedRanges.getArray(); // @todo: merge ranges for( sal_Int32 i=0; i<aSelectedRanges.getLength(); ++i ) { - m_aSelectedRanges[i].RangeRepresentation = aSelectedRanges[i]; - m_aSelectedRanges[i].Index = -1; - m_aSelectedRanges[i].PreferredColor = sal_Int32(defaultPreferredColor); - m_aSelectedRanges[i].AllowMerginigWithOtherRanges = true; + pSelectedRanges[i].RangeRepresentation = aSelectedRanges[i]; + pSelectedRanges[i].Index = -1; + pSelectedRanges[i].PreferredColor = sal_Int32(defaultPreferredColor); + pSelectedRanges[i].AllowMerginigWithOtherRanges = true; } } diff --git a/chart2/source/tools/RegressionCurveCalculator.cxx b/chart2/source/tools/RegressionCurveCalculator.cxx index ff2f4d13a896..fbf5d243bdb9 100644 --- a/chart2/source/tools/RegressionCurveCalculator.cxx +++ b/chart2/source/tools/RegressionCurveCalculator.cxx @@ -145,6 +145,7 @@ Sequence< geometry::RealPoint2D > SAL_CALL RegressionCurveCalculator::getCurveVa bDoXScaling = bDoXScaling && xInverseScaling.is(); Sequence< geometry::RealPoint2D > aResult( nPointCount ); + auto pResult = aResult.getArray(); double fMin( min ); double fFact = (max - min) / double(nPointCount-1); @@ -160,8 +161,8 @@ Sequence< geometry::RealPoint2D > SAL_CALL RegressionCurveCalculator::getCurveVa double x = fMin + nP * fFact; if( bDoXScaling ) x = xInverseScaling->doScaling( x ); - aResult[nP].X = x; - aResult[nP].Y = getCurveValue( x ); + pResult[nP].X = x; + pResult[nP].Y = getCurveValue( x ); } return aResult; diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx index 61f155011664..1df7ac904da8 100644 --- a/chart2/source/tools/RegressionCurveHelper.cxx +++ b/chart2/source/tools/RegressionCurveHelper.cxx @@ -211,8 +211,9 @@ void RegressionCurveHelper::initializeCurveCalculator( // initialize with 1, 2, ... //first category (index 0) matches with real number 1.0 aXValues.realloc( aYValues.getLength()); + auto pXValues = aXValues.getArray(); for( i=0; i<aXValues.getLength(); ++i ) - aXValues[i] = i+1; + pXValues[i] = i+1; bXValuesFound = true; } diff --git a/chart2/source/tools/StatisticsHelper.cxx b/chart2/source/tools/StatisticsHelper.cxx index 332843aaa307..c8fad963deab 100644 --- a/chart2/source/tools/StatisticsHelper.cxx +++ b/chart2/source/tools/StatisticsHelper.cxx @@ -133,7 +133,8 @@ void lcl_addSequenceToDataSource( Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences( xDataSource->getDataSequences()); aSequences.realloc( aSequences.getLength() + 1 ); - aSequences[ aSequences.getLength() - 1 ] = xLSeq; + auto pSequences = aSequences.getArray(); + pSequences[ aSequences.getLength() - 1 ] = xLSeq; xSink->setData( aSequences ); } diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx index bc11c4f99c32..83a409984c66 100644 --- a/chart2/source/tools/TitleHelper.cxx +++ b/chart2/source/tools/TitleHelper.cxx @@ -351,12 +351,12 @@ void TitleHelper::setCompleteString( const OUString& rNewText aNewText = aUnstackedStr.makeStringAndClear(); } - uno::Sequence< uno::Reference< XFormattedString > > aNewStringList(1); + uno::Sequence< uno::Reference< XFormattedString > > aNewStringList; uno::Sequence< uno::Reference< XFormattedString > > aOldStringList = xTitle->getText(); if( aOldStringList.hasElements() ) { - aNewStringList[0].set( aOldStringList[0] ); + aNewStringList = { aOldStringList[0] }; aNewStringList[0]->setString( aNewText ); } else @@ -365,7 +365,7 @@ void TitleHelper::setCompleteString( const OUString& rNewText chart2::FormattedString::create( xContext ); xFormattedString->setString( aNewText ); - aNewStringList[0].set( xFormattedString ); + aNewStringList = { xFormattedString }; if( pDefaultCharHeight != nullptr ) { try diff --git a/chart2/source/tools/UncachedDataSequence.cxx b/chart2/source/tools/UncachedDataSequence.cxx index 1c7394d22400..4a7a869dfe7c 100644 --- a/chart2/source/tools/UncachedDataSequence.cxx +++ b/chart2/source/tools/UncachedDataSequence.cxx @@ -233,7 +233,7 @@ void SAL_CALL UncachedDataSequence::replaceByIndex( ::sal_Int32 Index, const uno if( Index < aData.getLength() && m_xDataProvider.is() ) { - aData[Index] = Element; + aData.getArray()[Index] = Element; m_xDataProvider->setDataByRangeRepresentation( m_aSourceRepresentation, aData ); fireModifyEvent(); } diff --git a/chart2/source/tools/WrappedPropertySet.cxx b/chart2/source/tools/WrappedPropertySet.cxx index 483c907a81b1..ead7f6d05bee 100644 --- a/chart2/source/tools/WrappedPropertySet.cxx +++ b/chart2/source/tools/WrappedPropertySet.cxx @@ -237,12 +237,13 @@ Sequence< Any > SAL_CALL WrappedPropertySet::getPropertyValues( const Sequence< if( rNameSeq.hasElements() ) { aRetSeq.realloc( rNameSeq.getLength() ); + auto pRetSeq = aRetSeq.getArray(); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) { try { OUString aPropertyName( rNameSeq[nN] ); - aRetSeq[nN] = getPropertyValue( aPropertyName ); + pRetSeq[nN] = getPropertyValue( aPropertyName ); } catch( const beans::UnknownPropertyException& ) { @@ -309,10 +310,11 @@ Sequence< beans::PropertyState > SAL_CALL WrappedPropertySet::getPropertyStates( if( rNameSeq.hasElements() ) { aRetSeq.realloc( rNameSeq.getLength() ); + auto pRetSeq = aRetSeq.getArray(); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) { OUString aPropertyName( rNameSeq[nN] ); - aRetSeq[nN] = getPropertyState( aPropertyName ); + pRetSeq[nN] = getPropertyState( aPropertyName ); } } return aRetSeq; @@ -367,10 +369,11 @@ Sequence< Any > SAL_CALL WrappedPropertySet::getPropertyDefaults( const Sequence if( rNameSeq.hasElements() ) { aRetSeq.realloc( rNameSeq.getLength() ); + auto pRetSeq = aRetSeq.getArray(); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) { OUString aPropertyName( rNameSeq[nN] ); - aRetSeq[nN] = getPropertyDefault( aPropertyName ); + pRetSeq[nN] = getPropertyDefault( aPropertyName ); } } return aRetSeq; diff --git a/chart2/source/view/axes/Tickmarks.cxx b/chart2/source/view/axes/Tickmarks.cxx index 80476934e7f2..ba4ad8073eb0 100644 --- a/chart2/source/view/axes/Tickmarks.cxx +++ b/chart2/source/view/axes/Tickmarks.cxx @@ -238,11 +238,9 @@ void TickFactory2D::addPointSequenceForTickLine( drawing::PointSequenceSequence& B2DVector aStart = aTickScreenPosition + aOrthoDirection*rTickmarkProperties.RelativePos; B2DVector aEnd = aStart - aOrthoDirection*rTickmarkProperties.Length; - rPoints[nSequenceIndex].realloc(2); - rPoints[nSequenceIndex][0].X = static_cast<sal_Int32>(aStart.getX()); - rPoints[nSequenceIndex][0].Y = static_cast<sal_Int32>(aStart.getY()); - rPoints[nSequenceIndex][1].X = static_cast<sal_Int32>(aEnd.getX()); - rPoints[nSequenceIndex][1].Y = static_cast<sal_Int32>(aEnd.getY()); + rPoints.getArray()[nSequenceIndex] + = { { static_cast<sal_Int32>(aStart.getX()), static_cast<sal_Int32>(aStart.getY()) }, + { static_cast<sal_Int32>(aEnd.getX()), static_cast<sal_Int32>(aEnd.getY()) } }; } B2DVector TickFactory2D::getDistanceAxisTickToText( const AxisProperties& rAxisProperties, bool bIncludeFarAwayDistanceIfSo, bool bIncludeSpaceBetweenTickAndText ) const @@ -300,11 +298,10 @@ B2DVector TickFactory2D::getDistanceAxisTickToText( const AxisProperties& rAxisP void TickFactory2D::createPointSequenceForAxisMainLine( drawing::PointSequenceSequence& rPoints ) const { - rPoints[0].realloc(2); - rPoints[0][0].X = static_cast<sal_Int32>(m_aAxisStartScreenPosition2D.getX()); - rPoints[0][0].Y = static_cast<sal_Int32>(m_aAxisStartScreenPosition2D.getY()); - rPoints[0][1].X = static_cast<sal_Int32>(m_aAxisEndScreenPosition2D.getX()); - rPoints[0][1].Y = static_cast<sal_Int32>(m_aAxisEndScreenPosition2D.getY()); + rPoints.getArray()[0] = { { static_cast<sal_Int32>(m_aAxisStartScreenPosition2D.getX()), + static_cast<sal_Int32>(m_aAxisStartScreenPosition2D.getY()) }, + { static_cast<sal_Int32>(m_aAxisEndScreenPosition2D.getX()), + static_cast<sal_Int32>(m_aAxisEndScreenPosition2D.getY()) } }; } void TickFactory2D::updateScreenValues( TickInfoArraysType& rAllTickInfos ) const diff --git a/chart2/source/view/axes/Tickmarks_Equidistant.cxx b/chart2/source/view/axes/Tickmarks_Equidistant.cxx index 48660a41d986..11778d694416 100644 --- a/chart2/source/view/axes/Tickmarks_Equidistant.cxx +++ b/chart2/source/view/axes/Tickmarks_Equidistant.cxx @@ -150,6 +150,7 @@ void EquidistantTickFactory::addSubTicks( sal_Int32 nDepth, uno::Sequence< uno:: return; uno::Sequence< double > aSubTicks(nMaxSubTickCount); + auto pSubTicks = aSubTicks.getArray(); sal_Int32 nRealSubTickCount = 0; sal_Int32 nIntervalCount = m_rIncrement.SubIncrements[nDepth-1].IntervalCount; @@ -163,13 +164,13 @@ void EquidistantTickFactory::addSubTicks( sal_Int32 nDepth, uno::Sequence< uno:: if(!pValue) continue; - aSubTicks[nRealSubTickCount] = *pValue; + pSubTicks[nRealSubTickCount] = *pValue; nRealSubTickCount++; } } aSubTicks.realloc(nRealSubTickCount); - rParentTicks[nDepth] = aSubTicks; + rParentTicks.getArray()[nDepth] = aSubTicks; if(static_cast<sal_Int32>(m_rIncrement.SubIncrements.size())>nDepth) addSubTicks( nDepth+1, rParentTicks ); } @@ -317,7 +318,9 @@ void EquidistantTickFactory::getAllTicks( TickInfoArraysType& rAllTickInfos ) co return; uno::Sequence< uno::Sequence< double > > aAllTicks(nDepthCount); - aAllTicks[0].realloc(nMaxMajorTickCount); + auto pAllTicks = aAllTicks.getArray(); + pAllTicks[0].realloc(nMaxMajorTickCount); + auto pAllTicks0 = pAllTicks[0].getArray(); sal_Int32 nRealMajorTickCount = 0; for( sal_Int32 nMajorTick=0; nMajorTick<nMaxMajorTickCount; nMajorTick++ ) @@ -325,12 +328,12 @@ void EquidistantTickFactory::getAllTicks( TickInfoArraysType& rAllTickInfos ) co double* pValue = getMajorTick( nMajorTick ); if(!pValue) continue; - aAllTicks[0][nRealMajorTickCount] = *pValue; + pAllTicks0[nRealMajorTickCount] = *pValue; nRealMajorTickCount++; } if(!nRealMajorTickCount) return; - aAllTicks[0].realloc(nRealMajorTickCount); + pAllTicks[0].realloc(nRealMajorTickCount); addSubTicks(1, aAllTicks); @@ -350,7 +353,7 @@ void EquidistantTickFactory::getAllTicks( TickInfoArraysType& rAllTickInfos ) co if( m_rIncrement.SubIncrements[nN].IntervalCount>1 ) nCheckCount *= m_rIncrement.SubIncrements[nN].IntervalCount; } - uno::Sequence< double >& rTicks = aAllTicks[nDepth]; + uno::Sequence< double >& rTicks = pAllTicks[nDepth]; sal_Int32 nCount = rTicks.getLength(); //check lower border for( nTick=0; nTick<nCheckCount && nTick<nCount; nTick++) @@ -377,8 +380,9 @@ void EquidistantTickFactory::getAllTicks( TickInfoArraysType& rAllTickInfos ) co uno::Sequence< double > aOldTicks(rTicks); rTicks.realloc(nNewCount); + auto pTicks = rTicks.getArray(); for(nTick = 0; nTick<nNewCount; nTick++) - rTicks[nTick] = aOldTicks[nInvisibleAtLowerBorder+nTick]; + pTicks[nTick] = aOldTicks[nInvisibleAtLowerBorder+nTick]; } } diff --git a/chart2/source/view/axes/VCartesianGrid.cxx b/chart2/source/view/axes/VCartesianGrid.cxx index eda61d9b8e6c..a520f34cff75 100644 --- a/chart2/source/view/axes/VCartesianGrid.cxx +++ b/chart2/source/view/axes/VCartesianGrid.cxx @@ -62,10 +62,7 @@ GridLinePoints::GridLinePoints( const PlottingPositionHelper* pPosHelper, sal_In , CuboidPlanePosition eLeftWallPos , CuboidPlanePosition eBackWallPos , CuboidPlanePosition eBottomPos ) - : P0(3) - , P1(3) - , P2(3) - , m_nDimensionIndex(nDimensionIndex) + : m_nDimensionIndex(nDimensionIndex) { double MinX = pPosHelper->getLogicMinX(); double MinY = pPosHelper->getLogicMinY(); @@ -101,28 +98,29 @@ GridLinePoints::GridLinePoints( const PlottingPositionHelper* pPosHelper, sal_In //P1: point on both walls //P2: point on 'left' wall not on 'back' wall - P0[0]=P1[0]=P2[0]= (eLeftWallPos == CuboidPlanePosition_Left || bSwapXY) ? MinX : MaxX; - P0[1]=P1[1]=P2[1]= (eLeftWallPos == CuboidPlanePosition_Left || !bSwapXY) ? MinY : MaxY; - P0[2]=P1[2]=P2[2]= (eBackWallPos == CuboidPlanePosition_Back) ? MinZ : MaxZ; + const double v0 = (eLeftWallPos == CuboidPlanePosition_Left || bSwapXY) ? MinX : MaxX; + const double v1 = (eLeftWallPos == CuboidPlanePosition_Left || !bSwapXY) ? MinY : MaxY; + const double v2 = (eBackWallPos == CuboidPlanePosition_Back) ? MinZ : MaxZ; + P0 = P1 = P2 = { v0, v1, v2 }; if(m_nDimensionIndex==0) { - P0[1]= (eLeftWallPos == CuboidPlanePosition_Left || !bSwapXY) ? MaxY : MinY; - P2[2]= (eBackWallPos == CuboidPlanePosition_Back) ? MaxZ : MinZ; + P0.getArray()[1] = (eLeftWallPos == CuboidPlanePosition_Left || !bSwapXY) ? MaxY : MinY; + P2.getArray()[2]= (eBackWallPos == CuboidPlanePosition_Back) ? MaxZ : MinZ; if( eBottomPos != CuboidPlanePosition_Bottom && !bSwapXY ) P2=P1; } else if(m_nDimensionIndex==1) { - P0[0]= (eLeftWallPos == CuboidPlanePosition_Left || bSwapXY) ? MaxX : MinX; - P2[2]= (eBackWallPos == CuboidPlanePosition_Back) ? MaxZ : MinZ; + P0.getArray()[0]= (eLeftWallPos == CuboidPlanePosition_Left || bSwapXY) ? MaxX : MinX; + P2.getArray()[2]= (eBackWallPos == CuboidPlanePosition_Back) ? MaxZ : MinZ; if( eBottomPos != CuboidPlanePosition_Bottom && bSwapXY ) P2=P1; } else if(m_nDimensionIndex==2) { - P0[0]= (eLeftWallPos == CuboidPlanePosition_Left || bSwapXY) ? MaxX : MinX; - P2[1]= (eLeftWallPos == CuboidPlanePosition_Left || !bSwapXY) ? MaxY : MinY; + P0.getArray()[0]= (eLeftWallPos == CuboidPlanePosition_Left || bSwapXY) ? MaxX : MinX; + P2.getArray()[1]= (eLeftWallPos == CuboidPlanePosition_Left || !bSwapXY) ? MaxY : MinY; if( eBottomPos != CuboidPlanePosition_Bottom ) { if( !bSwapXY ) @@ -135,7 +133,7 @@ GridLinePoints::GridLinePoints( const PlottingPositionHelper* pPosHelper, sal_In void GridLinePoints::update( double fScaledTickValue ) { - P0[m_nDimensionIndex] = P1[m_nDimensionIndex] = P2[m_nDimensionIndex] = fScaledTickValue; + P0.getArray()[m_nDimensionIndex] = P1.getArray()[m_nDimensionIndex] = P2.getArray()[m_nDimensionIndex] = fScaledTickValue; } static void addLine2D( drawing::PointSequenceSequence& rPoints, sal_Int32 nIndex @@ -146,11 +144,9 @@ static void addLine2D( drawing::PointSequenceSequence& rPoints, sal_Int32 nIndex drawing::Position3D aPA = SequenceToPosition3D( xTransformation->transform( rScaledLogicPoints.P0 ) ); drawing::Position3D aPB = SequenceToPosition3D( xTransformation->transform( rScaledLogicPoints.P1 ) ); - rPoints[nIndex].realloc(2); - rPoints[nIndex][0].X = static_cast<sal_Int32>(aPA.PositionX); - rPoints[nIndex][0].Y = static_cast<sal_Int32>(aPA.PositionY); - rPoints[nIndex][1].X = static_cast<sal_Int32>(aPB.PositionX); - rPoints[nIndex][1].Y = static_cast<sal_Int32>(aPB.PositionY); + rPoints.getArray()[nIndex] + = { { static_cast<sal_Int32>(aPA.PositionX), static_cast<sal_Int32>(aPA.PositionY) }, + { static_cast<sal_Int32>(aPB.PositionX), static_cast<sal_Int32>(aPB.PositionY) } }; } static void addLine3D( drawing::PolyPolygonShape3D& rPoints, sal_Int32 nIndex @@ -267,10 +263,11 @@ void VCartesianGrid::createShapes() //prepare polygon for handle shape: drawing::PointSequenceSequence aHandlesPoints(1); - sal_Int32 nOldHandleCount = aHandlesPoints[0].getLength(); - aHandlesPoints[0].realloc(nOldHandleCount+nRealPointCount); + auto pHandlesPoints = aHandlesPoints.getArray(); + pHandlesPoints[0].realloc(nRealPointCount); + auto pHandlesPoints0 = pHandlesPoints[0].getArray(); for( sal_Int32 nN = 0; nN<nRealPointCount; nN++) - aHandlesPoints[0][nOldHandleCount+nN] = aPoints[nN][1]; + pHandlesPoints0[nN] = aPoints[nN][1]; //create handle shape: VLineProperties aHandleLineProperties; diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx index a320c85cb497..f546af789ddd 100644 --- a/chart2/source/view/axes/VCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCoordinateSystem.cxx @@ -140,8 +140,8 @@ uno::Sequence< sal_Int32 > VCoordinateSystem::getCoordinateSystemResolution( { uno::Sequence<sal_Int32> aResolution( std::max<sal_Int32>(m_xCooSysModel->getDimension(), 2)); - - for( auto& i : asNonConstRange(aResolution) ) + auto aResolutionRange = asNonConstRange(aResolution); + for( auto& i : aResolutionRange ) i = 1000; ::basegfx::B3DTuple aScale( BaseGFXHelper::GetScaleFromMatrix( @@ -169,8 +169,8 @@ uno::Sequence< sal_Int32 > VCoordinateSystem::getCoordinateSystemResolution( //2D if( aResolution.getLength() == 2 ) { - aResolution[0]=nXResolution; - aResolution[1]=nYResolution; + aResolutionRange[0]=nXResolution; + aResolutionRange[1]=nYResolution; } else { diff --git a/chart2/source/view/axes/VPolarCoordinateSystem.cxx b/chart2/source/view/axes/VPolarCoordinateSystem.cxx index 1fee84175444..16c2d152f96a 100644 --- a/chart2/source/view/axes/VPolarCoordinateSystem.cxx +++ b/chart2/source/view/axes/VPolarCoordinateSystem.cxx @@ -48,15 +48,16 @@ uno::Sequence< sal_Int32 > VPolarCoordinateSystem::getCoordinateSystemResolution if( aResolution.getLength() >= 2 ) { + auto pResolution = aResolution.getArray(); if( getPropertySwapXAndYAxis() ) { - aResolution[0]/=2;//radius - aResolution[1]*=4;//outer circle resolution + pResolution[0]/=2;//radius + pResolution[1]*=4;//outer circle resolution } else { - aResolution[0]*=4;//outer circle resolution - aResolution[1]/=2;//radius + pResolution[0]*=4;//outer circle resolution + pResolution[1]/=2;//radius } } diff --git a/chart2/source/view/axes/VPolarGrid.cxx b/chart2/source/view/axes/VPolarGrid.cxx index b6a0fef73b8f..25fcb6f55d6e 100644 --- a/chart2/source/view/axes/VPolarGrid.cxx +++ b/chart2/source/view/axes/VPolarGrid.cxx @@ -76,28 +76,31 @@ void VPolarGrid::createLinePointSequence_ForAngleAxis( sal_Int32 nTick = 0; EquidistantTickIter aIter( rAllTickInfos, rIncrement, 0 ); + auto pPoints = rPoints.getArray(); for( TickInfo* pTickInfo = aIter.firstInfo() ; pTickInfo ; pTickInfo = aIter.nextInfo(), nTick++ ) { if(nTick>=rPoints[0].getLength()) - rPoints[0].realloc(rPoints[0].getLength()+30); + pPoints[0].realloc(rPoints[0].getLength()+30); + auto pPoints0 = pPoints[0].getArray(); //xxxxx pTickInfo->updateUnscaledValue( xInverseScaling ); double fLogicAngle = pTickInfo->getUnscaledTickValue(); drawing::Position3D aScenePosition3D( pPosHelper->transformAngleRadiusToScene( fLogicAngle, fLogicRadius, fLogicZ ) ); - rPoints[0][nTick].X = static_cast<sal_Int32>(aScenePosition3D.PositionX); - rPoints[0][nTick].Y = static_cast<sal_Int32>(aScenePosition3D.PositionY); + pPoints0[nTick].X = static_cast<sal_Int32>(aScenePosition3D.PositionX); + pPoints0[nTick].Y = static_cast<sal_Int32>(aScenePosition3D.PositionY); } if(rPoints[0].getLength()>1) { - rPoints[0].realloc(nTick+1); - rPoints[0][nTick].X = rPoints[0][0].X; - rPoints[0][nTick].Y = rPoints[0][0].Y; + pPoints[0].realloc(nTick+1); + auto pPoints0 = pPoints[0].getArray(); + pPoints0[nTick].X = rPoints[0][0].X; + pPoints0[nTick].Y = rPoints[0][0].Y; } else - rPoints[0].realloc(0); + pPoints[0].realloc(0); } #ifdef NOTYET void VPolarGrid::create2DAngleGrid( const Reference< drawing::XShapes >& xLogicTarget diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index e0a70af5339f..0d0105246b0a 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -243,6 +243,10 @@ bool AreaChart::create_stepped_line( drawing::PolyPolygonShape3D aStartPoly, cha aSteppedPoly.SequenceY.realloc(nOuterCount); aSteppedPoly.SequenceZ.realloc(nOuterCount); + auto pSequenceX = aSteppedPoly.SequenceX.getArray(); + auto pSequenceY = aSteppedPoly.SequenceY.getArray(); + auto pSequenceZ = aSteppedPoly.SequenceZ.getArray(); + for( sal_uInt32 nOuter = 0; nOuter < nOuterCount; ++nOuter ) { if( aStartPoly.SequenceX[nOuter].getLength() <= 1 ) @@ -259,13 +263,13 @@ bool AreaChart::create_stepped_line( drawing::PolyPolygonShape3D aStartPoly, cha const double* pOldY = aStartPoly.SequenceY[nOuter].getConstArray(); const double* pOldZ = aStartPoly.SequenceZ[nOuter].getConstArray(); - aSteppedPoly.SequenceX[nOuter].realloc( nNewIndexPoints ); - aSteppedPoly.SequenceY[nOuter].realloc( nNewIndexPoints ); - aSteppedPoly.SequenceZ[nOuter].realloc( nNewIndexPoints ); + pSequenceX[nOuter].realloc( nNewIndexPoints ); + pSequenceY[nOuter].realloc( nNewIndexPoints ); + pSequenceZ[nOuter].realloc( nNewIndexPoints ); - double* pNewX = aSteppedPoly.SequenceX[nOuter].getArray(); - double* pNewY = aSteppedPoly.SequenceY[nOuter].getArray(); - double* pNewZ = aSteppedPoly.SequenceZ[nOuter].getArray(); + double* pNewX = pSequenceX[nOuter].getArray(); + double* pNewY = pSequenceY[nOuter].getArray(); + double* pNewZ = pSequenceZ[nOuter].getArray(); pNewX[0] = pOldX[0]; pNewY[0] = pOldY[0]; diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx index 02532136b075..359080667746 100644 --- a/chart2/source/view/charttypes/BarChart.cxx +++ b/chart2/source/view/charttypes/BarChart.cxx @@ -423,19 +423,21 @@ void BarChart::adaptOverlapAndGapwidthForGroupBarsPerAxis() sal_Int32 nUseThisIndex = nAxisIndex; if( nUseThisIndex < 0 || nUseThisIndex >= m_aOverlapSequence.getLength() ) nUseThisIndex = 0; + auto aOverlapSequenceRange = asNonConstRange(m_aOverlapSequence); for( nN = 0; nN < m_aOverlapSequence.getLength(); nN++ ) { if(nN!=nUseThisIndex) - m_aOverlapSequence[nN] = m_aOverlapSequence[nUseThisIndex]; + aOverlapSequenceRange[nN] = m_aOverlapSequence[nUseThisIndex]; } nUseThisIndex = nAxisIndex; if( nUseThisIndex < 0 || nUseThisIndex >= m_aGapwidthSequence.getLength() ) nUseThisIndex = 0; + auto aGapwidthSequenceRange = asNonConstRange(m_aGapwidthSequence); for( nN = 0; nN < m_aGapwidthSequence.getLength(); nN++ ) { if(nN!=nUseThisIndex) - m_aGapwidthSequence[nN] = m_aGapwidthSequence[nUseThisIndex]; + aGapwidthSequenceRange[nN] = m_aGapwidthSequence[nUseThisIndex]; } } diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index 4c9dc95634bb..57dbab089e00 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -518,12 +518,7 @@ void PieChart::createTextLabelShape( + double(nPageHeight) * double(nPageHeight)); if ((aLength.getLength() / fPageDiagonaleLength) >= 0.01) { - drawing::PointSequenceSequence aPoints(1); - aPoints[0].realloc(2); - aPoints[0][0].X = nX1; - aPoints[0][0].Y = nY1; - aPoints[0][1].X = nX2; - aPoints[0][1].Y = nY2; + drawing::PointSequenceSequence aPoints{ { {nX1, nY1}, {nX2, nY2} } }; uno::Reference<beans::XPropertySet> xProp(aPieLabelInfo.xTextShape, uno::UNO_QUERY); @@ -1298,12 +1293,7 @@ void PieChart::rearrangeLabelToAvoidOverlapIfRequested( const awt::Size& rPageSi if( (aLength.getLength()/fPageDiagonaleLength) < 0.01 ) continue; - drawing::PointSequenceSequence aPoints(1); - aPoints[0].realloc(2); - aPoints[0][0].X = nX1; - aPoints[0][0].Y = nY1; - aPoints[0][1].X = nX2; - aPoints[0][1].Y = nY2; + drawing::PointSequenceSequence aPoints{ { {nX1, nY1}, {nX2, nY2} } }; uno::Reference< beans::XPropertySet > xProp( labelInfo.xTextShape, uno::UNO_QUERY); if( xProp.is() ) diff --git a/chart2/source/view/charttypes/Splines.cxx b/chart2/source/view/charttypes/Splines.cxx index f431abdf21b7..89203d3da182 100644 --- a/chart2/source/view/charttypes/Splines.cxx +++ b/chart2/source/view/charttypes/Splines.cxx @@ -543,6 +543,10 @@ void SplineCalculater::CalculateCubicSplines( rResult.SequenceY.realloc(nOuterCount); rResult.SequenceZ.realloc(nOuterCount); + auto pSequenceX = rResult.SequenceX.getArray(); + auto pSequenceY = rResult.SequenceY.getArray(); + auto pSequenceZ = rResult.SequenceZ.getArray(); + if( !nOuterCount ) return; @@ -606,13 +610,13 @@ void SplineCalculater::CalculateCubicSplines( } // fill result polygon with calculated values - rResult.SequenceX[nOuter].realloc( nMaxIndexPoints*nGranularity + 1); - rResult.SequenceY[nOuter].realloc( nMaxIndexPoints*nGranularity + 1); - rResult.SequenceZ[nOuter].realloc( nMaxIndexPoints*nGranularity + 1); + pSequenceX[nOuter].realloc( nMaxIndexPoints*nGranularity + 1); + pSequenceY[nOuter].realloc( nMaxIndexPoints*nGranularity + 1); + pSequenceZ[nOuter].realloc( nMaxIndexPoints*nGranularity + 1); - double* pNewX = rResult.SequenceX[nOuter].getArray(); - double* pNewY = rResult.SequenceY[nOuter].getArray(); - double* pNewZ = rResult.SequenceZ[nOuter].getArray(); + double* pNewX = pSequenceX[nOuter].getArray(); + double* pNewY = pSequenceY[nOuter].getArray(); + double* pNewZ = pSequenceZ[nOuter].getArray(); sal_uInt32 nNewPointIndex = 0; // Index in result points @@ -674,6 +678,10 @@ void SplineCalculater::CalculateBSplines( rResult.SequenceY.realloc(nOuterCount); rResult.SequenceZ.realloc(nOuterCount); + auto pSequenceX = rResult.SequenceX.getArray(); + auto pSequenceY = rResult.SequenceY.getArray(); + auto pSequenceZ = rResult.SequenceZ.getArray(); + if( !nOuterCount ) return; // no input @@ -852,12 +860,12 @@ void SplineCalculater::CalculateBSplines( // calculate the intermediate points according given resolution // using deBoor-Cox algorithm lcl_tSizeType nNewSize = nResolution * n + 1; - rResult.SequenceX[nOuter].realloc(nNewSize); - rResult.SequenceY[nOuter].realloc(nNewSize); - rResult.SequenceZ[nOuter].realloc(nNewSize); - double* pNewX = rResult.SequenceX[nOuter].getArray(); - double* pNewY = rResult.SequenceY[nOuter].getArray(); - double* pNewZ = rResult.SequenceZ[nOuter].getArray(); + pSequenceX[nOuter].realloc(nNewSize); + pSequenceY[nOuter].realloc(nNewSize); + pSequenceZ[nOuter].realloc(nNewSize); + double* pNewX = pSequenceX[nOuter].getArray(); + double* pNewY = pSequenceY[nOuter].getArray(); + double* pNewZ = pSequenceZ[nOuter].getArray(); pNewX[0] = aPointsIn[0].first; pNewY[0] = aPointsIn[0].second; pNewZ[0] = fZCoordinate; // Precondition: z-coordinates of all points of a series are equal diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index fe460c170df2..7084fce1c4a3 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -506,18 +506,19 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re nTextListLength = ( nCustomLabelsCount > 3 ) ? nCustomLabelsCount : 3; aSeparator = ""; aTextList = Sequence< OUString >( nTextListLength ); + auto pTextList = aTextList.getArray(); for( sal_uInt32 i = 0; i < nCustomLabelsCount; ++i ) { switch( aCustomLabels[i]->getFieldType() ) { case DataPointCustomLabelFieldType_VALUE: { - aTextList[i] = getLabelTextForValue( rDataSeries, nPointIndex, fValue, false ); + pTextList[i] = getLabelTextForValue( rDataSeries, nPointIndex, fValue, false ); break; } case DataPointCustomLabelFieldType_CATEGORYNAME: { - aTextList[i] = getCategoryName( nPointIndex ); + pTextList[i] = getCategoryName( nPointIndex ); break; } case DataPointCustomLabelFieldType_SERIESNAME: @@ -526,7 +527,7 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re if ( m_xChartTypeModel ) aRole = m_xChartTypeModel->getRoleOfSequenceForSeriesLabel(); const uno::Reference< XDataSeries >& xSeries( rDataSeries.getModel() ); - aTextList[i] = DataSeriesHelper::getDataSeriesLabel( xSeries, aRole ); + pTextList[i] = DataSeriesHelper::getDataSeriesLabel( xSeries, aRole ); break; } case DataPointCustomLabelFieldType_PERCENTAGE: @@ -537,31 +538,31 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re if(fValue < 0) fValue *= -1.0; - aTextList[i] = getLabelTextForValue(rDataSeries, nPointIndex, fValue, true); + pTextList[i] = getLabelTextForValue(rDataSeries, nPointIndex, fValue, true); break; } case DataPointCustomLabelFieldType_CELLRANGE: { if (aCustomLabels[i]->getDataLabelsRange()) - aTextList[i] = aCustomLabels[i]->getString(); + pTextList[i] = aCustomLabels[i]->getString(); else - aTextList[i] = OUString(); + pTextList[i] = OUString(); break; } case DataPointCustomLabelFieldType_CELLREF: { // TODO: for now doesn't show placeholder - aTextList[i] = OUString(); + pTextList[i] = OUString(); break; } case DataPointCustomLabelFieldType_TEXT: { - aTextList[i] = aCustomLabels[i]->getString(); + pTextList[i] = aCustomLabels[i]->getString(); break; } case DataPointCustomLabelFieldType_NEWLINE: { - aTextList[i] = "\n"; + pTextList[i] = "\n"; break; } default: @@ -572,9 +573,10 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re } else { + auto pTextList = aTextList.getArray(); if( pLabel->ShowCategoryName ) { - aTextList[0] = getCategoryName( nPointIndex ); + pTextList[0] = getCategoryName( nPointIndex ); } if( pLabel->ShowSeriesName ) @@ -583,12 +585,12 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re if ( m_xChartTypeModel ) aRole = m_xChartTypeModel->getRoleOfSequenceForSeriesLabel(); const uno::Reference< XDataSeries >& xSeries( rDataSeries.getModel() ); - aTextList[1] = DataSeriesHelper::getDataSeriesLabel( xSeries, aRole ); + pTextList[1] = DataSeriesHelper::getDataSeriesLabel( xSeries, aRole ); } if( pLabel->ShowNumber ) { - aTextList[2] = getLabelTextForValue(rDataSeries, nPointIndex, fValue, false); + pTextList[2] = getLabelTextForValue(rDataSeries, nPointIndex, fValue, false); } if( pLabel->ShowNumberInPercent ) @@ -599,7 +601,7 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re if( fValue < 0 ) fValue*=-1.0; - aTextList[3] = getLabelTextForValue(rDataSeries, nPointIndex, fValue, true); + pTextList[3] = getLabelTextForValue(rDataSeries, nPointIndex, fValue, true); } } @@ -628,11 +630,8 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re if( bUseCustomLabel ) { - Sequence< uno::Reference< XFormattedString > > aFormattedLabels( aCustomLabels.getLength() ); - for( int i = 0; i < aFormattedLabels.getLength(); i++ ) - { - aFormattedLabels[i] = aCustomLabels[i]; - } + Sequence< uno::Reference< XFormattedString > > aFormattedLabels( + comphelper::containerToSequence<uno::Reference<XFormattedString>>(aCustomLabels)); // create text shape xTextShape = ShapeFactory::getOrCreateShapeFactory( m_xShapeFactory )-> @@ -740,12 +739,7 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re double fPageDiagonaleLength = sqrt(double(m_aPageReferenceSize.Width)*double(m_aPageReferenceSize.Width) + double(m_aPageReferenceSize.Height)*double(m_aPageReferenceSize.Height)); if ((aLength.getLength() / fPageDiagonaleLength) >= 0.01) { - drawing::PointSequenceSequence aPoints(1); - aPoints[0].realloc(2); - aPoints[0][0].X = nX1; - aPoints[0][0].Y = nY1; - aPoints[0][1].X = nX2; - aPoints[0][1].Y = nY2; + drawing::PointSequenceSequence aPoints{ { {nX1, nY1}, {nX2, nY2} } }; VLineProperties aVLineProperties; m_pShapeFactory->createLine2D(xTarget, aPoints, &aVLineProperties); @@ -1404,9 +1398,13 @@ void VSeriesPlotter::createRegressionCurvesShapes( VDataSeries const & rVDataSer aRegressionPoly.SequenceX.realloc(1); aRegressionPoly.SequenceY.realloc(1); aRegressionPoly.SequenceZ.realloc(1); - aRegressionPoly.SequenceX[0].realloc(nPointCount); - aRegressionPoly.SequenceY[0].realloc(nPointCount); - aRegressionPoly.SequenceZ[0].realloc(nPointCount); + auto pSequenceX = aRegressionPoly.SequenceX.getArray(); + auto pSequenceY = aRegressionPoly.SequenceY.getArray(); + auto pSequenceZ = aRegressionPoly.SequenceZ.getArray(); + pSequenceX[0].realloc(nPointCount); + pSequenceY[0].realloc(nPointCount); + auto pSequenceX0 = pSequenceX[0].getArray(); + auto pSequenceY0 = pSequenceY[0].getArray(); sal_Int32 nRealPointCount = 0; @@ -1424,14 +1422,14 @@ void VSeriesPlotter::createRegressionCurvesShapes( VDataSeries const & rVDataSer !std::isnan(fLogicY) && !std::isinf(fLogicY) && !std::isnan(fLogicZ) && !std::isinf(fLogicZ) ) { - aRegressionPoly.SequenceX[0][nRealPointCount] = fLogicX; - aRegressionPoly.SequenceY[0][nRealPointCount] = fLogicY; + pSequenceX0[nRealPointCount] = fLogicX; + pSequenceY0[nRealPointCount] = fLogicY; nRealPointCount++; } } - aRegressionPoly.SequenceX[0].realloc(nRealPointCount); - aRegressionPoly.SequenceY[0].realloc(nRealPointCount); - aRegressionPoly.SequenceZ[0].realloc(nRealPointCount); + pSequenceX[0].realloc(nRealPointCount); + pSequenceY[0].realloc(nRealPointCount); + pSequenceZ[0].realloc(nRealPointCount); drawing::PolyPolygonShape3D aClippedPoly; Clipping::clipPolygonAtRectangle( aRegressionPoly, m_pPosHelper->getScaledLogicClipDoubleRect(), aClippedPoly ); diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 72a58f80cc97..698583e477aa 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -51,6 +51,7 @@ #include <editeng/frmdiritem.hxx> #include <tools/globname.hxx> #include <comphelper/fileformat.h> +#include <comphelper/propertyvalue.hxx> #include <comphelper/scopeguard.hxx> #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> @@ -1119,39 +1120,23 @@ void ChartView::getMetaFile( const uno::Reference< io::XOutputStream >& xOutStre // creating the graphic exporter uno::Reference< drawing::XGraphicExportFilter > xExporter = drawing::GraphicExportFilter::create( m_xCC ); - uno::Sequence< beans::PropertyValue > aProps(3); - aProps[0].Name = "FilterName"; - aProps[0].Value <<= OUString("SVM"); - - aProps[1].Name = "OutputStream"; - aProps[1].Value <<= xOutStream; - - uno::Sequence< beans::PropertyValue > aFilterData(8); - aFilterData[0].Name = "ExportOnlyBackground"; - aFilterData[0].Value <<= false; - aFilterData[1].Name = "HighContrast"; - aFilterData[1].Value <<= bUseHighContrast; - - aFilterData[2].Name = "Version"; - const sal_Int32 nVersion = SOFFICE_FILEFORMAT_50; - aFilterData[2].Value <<= nVersion; - - aFilterData[3].Name = "CurrentPage"; - aFilterData[3].Value <<= uno::Reference< uno::XInterface >( m_xDrawPage, uno::UNO_QUERY ); - - //#i75867# poor quality of ole's alternative view with 3D scenes and zoomfactors besides 100% - aFilterData[4].Name = "ScaleXNumerator"; - aFilterData[4].Value <<= m_nScaleXNumerator; - aFilterData[5].Name = "ScaleXDenominator"; - aFilterData[5].Value <<= m_nScaleXDenominator; - aFilterData[6].Name = "ScaleYNumerator"; - aFilterData[6].Value <<= m_nScaleYNumerator; - aFilterData[7].Name = "ScaleYDenominator"; - aFilterData[7].Value <<= m_nScaleYDenominator; - + uno::Sequence< beans::PropertyValue > aFilterData{ + comphelper::makePropertyValue("ExportOnlyBackground", false), + comphelper::makePropertyValue("HighContrast", bUseHighContrast), + comphelper::makePropertyValue("Version", sal_Int32(SOFFICE_FILEFORMAT_50)), + comphelper::makePropertyValue("CurrentPage", uno::Reference< uno::XInterface >( m_xDrawPage, uno::UNO_QUERY )), + //#i75867# poor quality of ole's alternative view with 3D scenes and zoomfactors besides 100% + comphelper::makePropertyValue("ScaleXNumerator", m_nScaleXNumerator), + comphelper::makePropertyValue("ScaleXDenominator", m_nScaleXDenominator), + comphelper::makePropertyValue("ScaleYNumerator", m_nScaleYNumerator), + comphelper::makePropertyValue("ScaleYDenominator", m_nScaleYDenominator) + }; - aProps[2].Name = "FilterData"; - aProps[2].Value <<= aFilterData; + uno::Sequence< beans::PropertyValue > aProps{ + comphelper::makePropertyValue("FilterName", OUString("SVM")), + comphelper::makePropertyValue("OutputStream", xOutStream), + comphelper::makePropertyValue("FilterData", aFilterData) + }; xExporter->setSourceDocument( uno::Reference< lang::XComponent >( m_xDrawPage, uno::UNO_QUERY) ); if( xExporter->filter( aProps ) ) @@ -2827,14 +2812,12 @@ Reference< uno::XInterface > ChartView::createInstanceWithArguments( const OUStr uno::Sequence< OUString > ChartView::getAvailableServiceNames() { - uno::Sequence< OUString > aServiceNames( 6 ); - - aServiceNames[0] = "com.sun.star.drawing.DashTable"; - aServiceNames[1] = "com.sun.star.drawing.GradientTable"; - aServiceNames[2] = "com.sun.star.drawing.HatchTable"; - aServiceNames[3] = "com.sun.star.drawing.BitmapTable"; - aServiceNames[4] = "com.sun.star.drawing.TransparencyGradientTable"; - aServiceNames[5] = "com.sun.star.drawing.MarkerTable"; + uno::Sequence< OUString > aServiceNames{ "com.sun.star.drawing.DashTable", + "com.sun.star.drawing.GradientTable", + "com.sun.star.drawing.HatchTable", + "com.sun.star.drawing.BitmapTable", + "com.sun.star.drawing.TransparencyGradientTable", + "com.sun.star.drawing.MarkerTable" }; return aServiceNames; } diff --git a/chart2/source/view/main/Linear3DTransformation.cxx b/chart2/source/view/main/Linear3DTransformation.cxx index c27ffa3168a5..f6f403ba26f3 100644 --- a/chart2/source/view/main/Linear3DTransformation.cxx +++ b/chart2/source/view/main/Linear3DTransformation.cxx @@ -44,25 +44,26 @@ Sequence< double > SAL_CALL Linear3DTransformation::transform( if(m_bSwapXAndY) std::swap(fX,fY); Sequence< double > aNewVec(3); + auto pNewVec = aNewVec.getArray(); double fZwi; fZwi = m_Matrix.Line1.Column1 * fX + m_Matrix.Line1.Column2 * fY + m_Matrix.Line1.Column3 * fZ + m_Matrix.Line1.Column4; - aNewVec[0] = fZwi; + pNewVec[0] = fZwi; fZwi = m_Matrix.Line2.Column1 * fX + m_Matrix.Line2.Column2 * fY + m_Matrix.Line2.Column3 * fZ + m_Matrix.Line2.Column4; - aNewVec[1] = fZwi; + pNewVec[1] = fZwi; fZwi = m_Matrix.Line3.Column1 * fX + m_Matrix.Line3.Column2 * fY + m_Matrix.Line3.Column3 * fZ + m_Matrix.Line3.Column4; - aNewVec[2] = fZwi; + pNewVec[2] = fZwi; fZwi = m_Matrix.Line4.Column1 * fX + m_Matrix.Line4.Column2 * fY @@ -70,9 +71,9 @@ Sequence< double > SAL_CALL Linear3DTransformation::transform( + m_Matrix.Line4.Column4; if(fZwi != 1.0 && fZwi != 0.0) { - aNewVec[0] /= fZwi; - aNewVec[1] /= fZwi; - aNewVec[2] /= fZwi; + pNewVec[0] /= fZwi; + pNewVec[1] /= fZwi; + pNewVec[2] /= fZwi; } return aNewVec; } diff --git a/chart2/source/view/main/PlottingPositionHelper.cxx b/chart2/source/view/main/PlottingPositionHelper.cxx index 300ecaddb68b..00421fed86e7 100644 --- a/chart2/source/view/main/PlottingPositionHelper.cxx +++ b/chart2/source/view/main/PlottingPositionHelper.cxx @@ -218,16 +218,19 @@ awt::Point PlottingPositionHelper::transformSceneToScreenPosition( const drawing void PlottingPositionHelper::transformScaledLogicToScene( drawing::PolyPolygonShape3D& rPolygon ) const { drawing::Position3D aScenePosition; + auto SequenceXRange = asNonConstRange(rPolygon.SequenceX); + auto SequenceYRange = asNonConstRange(rPolygon.SequenceY); + auto SequenceZRange = asNonConstRange(rPolygon.SequenceZ); for( sal_Int32 nS = rPolygon.SequenceX.getLength(); nS--;) { - drawing::DoubleSequence& xValues = rPolygon.SequenceX[nS]; - drawing::DoubleSequence& yValues = rPolygon.SequenceY[nS]; - drawing::DoubleSequence& zValues = rPolygon.SequenceZ[nS]; - for( sal_Int32 nP = xValues.getLength(); nP--; ) + auto xValuesRange = asNonConstRange(SequenceXRange[nS]); + auto yValuesRange = asNonConstRange(SequenceYRange[nS]); + auto zValuesRange = asNonConstRange(SequenceZRange[nS]); + for( sal_Int32 nP = SequenceXRange[nS].getLength(); nP--; ) { - double& fX = xValues[nP]; - double& fY = yValues[nP]; - double& fZ = zValues[nP]; + double& fX = xValuesRange[nP]; + double& fY = yValuesRange[nP]; + double& fZ = zValuesRange[nP]; aScenePosition = transformScaledLogicToScene( fX,fY,fZ,true ); fX = aScenePosition.PositionX; fY = aScenePosition.PositionY; diff --git a/chart2/source/view/main/PropertyMapper.cxx b/chart2/source/view/main/PropertyMapper.cxx index d9ae1fc7a925..dfae6a757a71 100644 --- a/chart2/source/view/main/PropertyMapper.cxx +++ b/chart2/source/view/main/PropertyMapper.cxx @@ -80,12 +80,14 @@ void PropertyMapper::getValueMap( if((false) && xMultiPropSet.is()) { uno::Sequence< OUString > aPropSourceNames(rNameMap.size()); + auto aPropSourceNamesRange = asNonConstRange(aPropSourceNames); uno::Sequence< OUString > aPropTargetNames(rNameMap.size()); + auto aPropTargetNamesRange = asNonConstRange(aPropTargetNames); sal_Int32 i = 0; for (auto const& elem : rNameMap) { - aPropTargetNames[i] = elem.first; - aPropSourceNames[i] = elem.second; + aPropTargetNamesRange[i] = elem.first; + aPropSourceNamesRange[i] = elem.second; ++i; } @@ -137,7 +139,9 @@ void PropertyMapper::getMultiPropertyListsFromValueMap( { sal_Int32 nPropertyCount = rValueMap.size(); rNames.realloc(nPropertyCount); + auto pNames = rNames.getArray(); rValues.realloc(nPropertyCount); + auto pValues = rValues.getArray(); //fill sequences sal_Int32 nN=0; @@ -147,8 +151,8 @@ void PropertyMapper::getMultiPropertyListsFromValueMap( if( rAny.hasValue() ) { //do not set empty anys because of performance (otherwise SdrAttrObj::ItemChange will take much longer) - rNames[nN] = elem.first; - rValues[nN] = rAny; + pNames[nN] = elem.first; + pValues[nN] = rAny; ++nN; } } @@ -165,7 +169,7 @@ uno::Any* PropertyMapper::getValuePointer( tAnySequence& rPropValues for( sal_Int32 nN = 0; nN < nCount; nN++ ) { if(rPropNames[nN] == rPropName) - return &rPropValues[nN]; + return &rPropValues.getArray()[nN]; } return nullptr; } diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx index 5f2cfb442820..94ada8d02727 100644 --- a/chart2/source/view/main/ShapeFactory.cxx +++ b/chart2/source/view/main/ShapeFactory.cxx @@ -74,10 +74,10 @@ void lcl_addProperty(uno::Sequence<OUString> & rPropertyNames, uno::Sequence<uno OUString const & rName, uno::Any const & rAny) { rPropertyNames.realloc(rPropertyNames.getLength() + 1); - rPropertyNames[rPropertyNames.getLength() - 1] = rName; + rPropertyNames.getArray()[rPropertyNames.getLength() - 1] = rName; rPropertyValues.realloc(rPropertyValues.getLength() + 1); - rPropertyValues[rPropertyValues.getLength() - 1] = rAny; + rPropertyValues.getArray()[rPropertyValues.getLength() - 1] = rAny; } } // end anonymous namespace @@ -712,19 +712,23 @@ static void appendAndCloseBezierCoords( drawing::PolyPolygonBezierCoords& rRetur sal_Int32 nOldCount = rReturn.Coordinates[0].getLength(); - rReturn.Coordinates[0].realloc(nOldCount+nAddCount+1); - rReturn.Flags[0].realloc(nOldCount+nAddCount+1); + auto pCoordinates = rReturn.Coordinates.getArray(); + pCoordinates[0].realloc(nOldCount + nAddCount + 1); + auto pCoordinates0 = pCoordinates[0].getArray(); + auto pFlags = rReturn.Flags.getArray(); + pFlags[0].realloc(nOldCount+nAddCount+1); + auto pFlags0 = pFlags[0].getArray(); for(sal_Int32 nN=0;nN<nAddCount; nN++ ) { sal_Int32 nAdd = bAppendInverse ? (nAddCount-1-nN) : nN; - rReturn.Coordinates[0][nOldCount+nN] = rAdd.Coordinates[0][nAdd]; - rReturn.Flags[0][nOldCount+nN] = rAdd.Flags[0][nAdd]; + pCoordinates0[nOldCount+nN] = rAdd.Coordinates[0][nAdd]; + pFlags0[nOldCount+nN] = rAdd.Flags[0][nAdd]; } //close - rReturn.Coordinates[0][nOldCount+nAddCount] = rReturn.Coordinates[0][0]; - rReturn.Flags[0][nOldCount+nAddCount] = rReturn.Flags[0][0]; + pCoordinates0[nOldCount+nAddCount] = rReturn.Coordinates[0][0]; + pFlags0[nOldCount+nAddCount] = rReturn.Flags[0][0]; } static drawing::PolyPolygonBezierCoords getCircularArcBezierCoords( @@ -768,11 +772,10 @@ static drawing::PolyPolygonBezierCoords getCircularArcBezierCoords( sal_Int32 nPointCount = 1 + 3*nSegmentCount; //first point of next segment equals last point of former segment - aReturn.Coordinates = drawing::PointSequenceSequence(1); - aReturn.Flags = drawing::FlagSequenceSequence(1); - drawing::PointSequence aPoints(nPointCount); + auto pPoints = aPoints.getArray(); drawing::FlagSequence aFlags(nPointCount); + auto pFlags = aFlags.getArray(); //!! applying matrix to vector does ignore translation, so it is important to use a B2DPoint here instead of B2DVector ::basegfx::B2DPoint P0,P1,P2,P3; @@ -812,28 +815,28 @@ static drawing::PolyPolygonBezierCoords getCircularArcBezierCoords( P2 = rTransformationFromUnitCircle*(aStart*P2); P3 = rTransformationFromUnitCircle*(aStart*P3); - aPoints[nPoint].X = static_cast< sal_Int32 >( P0.getX()); - aPoints[nPoint].Y = static_cast< sal_Int32 >( P0.getY()); - aFlags [nPoint++] = drawing::PolygonFlags_NORMAL; + pPoints[nPoint].X = static_cast< sal_Int32 >( P0.getX()); + pPoints[nPoint].Y = static_cast< sal_Int32 >( P0.getY()); + pFlags [nPoint++] = drawing::PolygonFlags_NORMAL; - aPoints[nPoint].X = static_cast< sal_Int32 >( P1.getX()); - aPoints[nPoint].Y = static_cast< sal_Int32 >( P1.getY()); - aFlags[nPoint++] = drawing::PolygonFlags_CONTROL; + pPoints[nPoint].X = static_cast< sal_Int32 >( P1.getX()); + pPoints[nPoint].Y = static_cast< sal_Int32 >( P1.getY()); + pFlags[nPoint++] = drawing::PolygonFlags_CONTROL; - aPoints[nPoint].X = static_cast< sal_Int32 >( P2.getX()); - aPoints[nPoint].Y = static_cast< sal_Int32 >( P2.getY()); - aFlags [nPoint++] = drawing::PolygonFlags_CONTROL; + pPoints[nPoint].X = static_cast< sal_Int32 >( P2.getX()); + pPoints[nPoint].Y = static_cast< sal_Int32 >( P2.getY()); + pFlags [nPoint++] = drawing::PolygonFlags_CONTROL; if(nSegment==(nSegmentCount-1)) { - aPoints[nPoint].X = static_cast< sal_Int32 >( P3.getX()); - aPoints[nPoint].Y = static_cast< sal_Int32 >( P3.getY()); - aFlags [nPoint++] = drawing::PolygonFlags_NORMAL; + pPoints[nPoint].X = static_cast< sal_Int32 >( P3.getX()); + pPoints[nPoint].Y = static_cast< sal_Int32 >( P3.getY()); + pFlags [nPoint++] = drawing::PolygonFlags_NORMAL; } } - aReturn.Coordinates[0] = aPoints; - aReturn.Flags[0] = aFlags; + aReturn.Coordinates = { aPoints }; + aReturn.Flags = { aFlags }; return aReturn; } @@ -847,13 +850,10 @@ static drawing::PolyPolygonBezierCoords getRingBezierCoords( { drawing::PolyPolygonBezierCoords aReturn; - aReturn.Coordinates = drawing::PointSequenceSequence(1); - aReturn.Flags = drawing::FlagSequenceSequence(1); - drawing::PolyPolygonBezierCoords aOuterArc = getCircularArcBezierCoords( fStartAngleRadian, fWidthAngleRadian, fUnitCircleOuterRadius, aTransformationFromUnitCircle, fAngleSubdivisionRadian ); - aReturn.Coordinates[0] = aOuterArc.Coordinates[0]; - aReturn.Flags[0] = aOuterArc.Flags[0]; + aReturn.Coordinates = { aOuterArc.Coordinates[0] }; + aReturn.Flags = { aOuterArc.Flags[0] }; drawing::PolyPolygonBezierCoords aInnerArc = getCircularArcBezierCoords( fStartAngleRadian, fWidthAngleRadian, fUnitCircleInnerRadius, aTransformationFromUnitCircle, fAngleSubdivisionRadian ); diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index 0d3123a8cb13..14d204a8cf9e 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -274,12 +274,14 @@ void VDataSeries::doSortByXValues() //fill the sorted points back to the members m_aValues_X.Doubles.realloc( m_nPointCount ); + auto pDoublesX = m_aValues_X.Doubles.getArray(); m_aValues_Y.Doubles.realloc( m_nPointCount ); + auto pDoublesY = m_aValues_Y.Doubles.getArray(); for( nPointIndex=0; nPointIndex < m_nPointCount; nPointIndex++ ) { - m_aValues_X.Doubles[nPointIndex]=aTmp[nPointIndex][0]; - m_aValues_Y.Doubles[nPointIndex]=aTmp[nPointIndex][1]; + pDoublesX[nPointIndex]=aTmp[nPointIndex][0]; + pDoublesY[nPointIndex]=aTmp[nPointIndex][1]; } } @@ -724,8 +726,9 @@ uno::Sequence< double > const & VDataSeries::getAllX() const //init x values from category indexes //first category (index 0) matches with real number 1.0 m_aValues_X.Doubles.realloc( m_nPointCount ); + auto pDoubles = m_aValues_X.Doubles.getArray(); for(sal_Int32 nN=m_aValues_X.getLength();nN--;) - m_aValues_X.Doubles[nN] = nN+1; + pDoubles[nN] = nN+1; } return m_aValues_X.Doubles; } @@ -737,8 +740,9 @@ uno::Sequence< double > const & VDataSeries::getAllY() const //init y values from indexes //first y-value (index 0) matches with real number 1.0 m_aValues_Y.Doubles.realloc( m_nPointCount ); + auto pDoubles = m_aValues_Y.Doubles.getArray(); for(sal_Int32 nN=m_aValues_Y.getLength();nN--;) - m_aValues_Y.Doubles[nN] = nN+1; + pDoubles[nN] = nN+1; } return m_aValues_Y.Doubles; } |