diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-29 10:28:28 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-11-01 07:11:36 +0100 |
commit | 8cb57be792e6991c38cf5d4434569dc118dd0ed4 (patch) | |
tree | 46f394a22466fb7281d9c48f6d7fbed8a1a448a6 /xmloff | |
parent | 34d0dd41e1e7bb69d6c4f817b39da26bcd33831f (diff) |
Prepare for removal of non-const operator[] from Sequence in xmloff
Change-Id: I7ea7964f76f0a5db678510ac3533003726dc49fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124416
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'xmloff')
32 files changed, 171 insertions, 157 deletions
diff --git a/xmloff/source/chart/MultiPropertySetHandler.hxx b/xmloff/source/chart/MultiPropertySetHandler.hxx index 178fb3e1adf6..d742faf50463 100644 --- a/xmloff/source/chart/MultiPropertySetHandler.hxx +++ b/xmloff/source/chart/MultiPropertySetHandler.hxx @@ -185,9 +185,10 @@ MultiPropertySetHandler::MultiPropertySetHandler (css::uno::Reference< bool MultiPropertySetHandler::GetProperties() { css::uno::Sequence< OUString> aNameList (aPropertyList.size()); + auto aNameListRange = asNonConstRange(aNameList); int i = 0; for (const auto& rProperty : aPropertyList) - aNameList[i++] = rProperty.second->msName; + aNameListRange[i++] = rProperty.second->msName; if ( ! MultiGet(aNameList)) if ( ! SingleGet(aNameList)) return false; diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx index d8a91ff49659..51a7e1f05d93 100644 --- a/xmloff/source/chart/SchXMLChartContext.cxx +++ b/xmloff/source/chart/SchXMLChartContext.cxx @@ -98,7 +98,7 @@ void lcl_MoveDataToCandleStickSeries( // @todo: realloc only once outside this function uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aData( xSource->getDataSequences()); aData.realloc( aData.getLength() + 1); - aData[ aData.getLength() - 1 ] = aLabeledSeq[0]; + aData.getArray()[ aData.getLength() - 1 ] = aLabeledSeq[0]; uno::Reference< chart2::data::XDataSink > xSink( xDestination, uno::UNO_QUERY_THROW ); xSink->setData( aData ); } @@ -206,9 +206,9 @@ uno::Sequence< sal_Int32 > lcl_getNumberSequenceFromString( const OUString& rStr else if( bAddOneToEachOldIndex ) { aSeq.realloc( nVecSize+1 ); - aSeq[0]=0; + auto pSeqArr = aSeq.getArray(); + pSeqArr[0]=0; - sal_Int32* pSeqArr = aSeq.getArray(); for( nPos = 0; nPos < nVecSize; ++nPos ) { pSeqArr[ nPos+1 ] = aVec[ nPos ]+1; @@ -641,24 +641,25 @@ static void lcl_ApplyDataFromRectangularRangeToDiagram( bHasCateories = true; } - uno::Sequence< beans::PropertyValue > aArgs( 3 ); - aArgs[0] = beans::PropertyValue( - "CellRangeRepresentation", - -1, uno::makeAny( rRectangularRange ), - beans::PropertyState_DIRECT_VALUE ); - aArgs[1] = beans::PropertyValue( - "DataRowSource", - -1, uno::makeAny( eDataRowSource ), - beans::PropertyState_DIRECT_VALUE ); - aArgs[2] = beans::PropertyValue( - "FirstCellAsLabel", - -1, uno::makeAny( bFirstCellAsLabel ), - beans::PropertyState_DIRECT_VALUE ); + uno::Sequence< beans::PropertyValue > aArgs{ + beans::PropertyValue( + "CellRangeRepresentation", + -1, uno::makeAny( rRectangularRange ), + beans::PropertyState_DIRECT_VALUE ), + beans::PropertyValue( + "DataRowSource", + -1, uno::makeAny( eDataRowSource ), + beans::PropertyState_DIRECT_VALUE ), + beans::PropertyValue( + "FirstCellAsLabel", + -1, uno::makeAny( bFirstCellAsLabel ), + beans::PropertyState_DIRECT_VALUE ) + }; if( !sColTrans.isEmpty() || !sRowTrans.isEmpty() ) { aArgs.realloc( aArgs.getLength() + 1 ); - aArgs[ sal::static_int_cast<sal_uInt32>(aArgs.getLength()) - 1 ] = beans::PropertyValue( + aArgs.getArray()[ sal::static_int_cast<sal_uInt32>(aArgs.getLength()) - 1 ] = beans::PropertyValue( "SequenceMapping", -1, uno::makeAny( !sColTrans.isEmpty() ? lcl_getNumberSequenceFromString( sColTrans, bHasCateories && !xNewDoc->hasInternalDataProvider() ) @@ -683,7 +684,7 @@ static void lcl_ApplyDataFromRectangularRangeToDiagram( if( !aChartOleObjectName.isEmpty() ) { aArgs.realloc( aArgs.getLength() + 1 ); - aArgs[ sal::static_int_cast<sal_uInt32>(aArgs.getLength()) - 1 ] = beans::PropertyValue( + aArgs.getArray()[ sal::static_int_cast<sal_uInt32>(aArgs.getLength()) - 1 ] = beans::PropertyValue( "ChartOleObjectName", -1, uno::makeAny( aChartOleObjectName ), beans::PropertyState_DIRECT_VALUE ); @@ -694,11 +695,12 @@ static void lcl_ApplyDataFromRectangularRangeToDiagram( xDataProvider->createDataSource( aArgs )); aArgs.realloc( aArgs.getLength() + 2 ); - aArgs[ sal::static_int_cast<sal_uInt32>(aArgs.getLength()) - 2 ] = beans::PropertyValue( + auto pArgs = aArgs.getArray(); + pArgs[ sal::static_int_cast<sal_uInt32>(aArgs.getLength()) - 2 ] = beans::PropertyValue( "HasCategories", -1, uno::makeAny( bHasCateories ), beans::PropertyState_DIRECT_VALUE ); - aArgs[ sal::static_int_cast<sal_uInt32>(aArgs.getLength()) - 1 ] = beans::PropertyValue( + pArgs[ sal::static_int_cast<sal_uInt32>(aArgs.getLength()) - 1 ] = beans::PropertyValue( "UseCategoriesAsX", -1, uno::makeAny( false ),//categories in ODF files are not to be used as x values (independent from what is offered in our ui) beans::PropertyState_DIRECT_VALUE ); @@ -979,6 +981,7 @@ void SchXMLChartContext::MergeSeriesForStockChart() sal_Int32 nCandleStickCount = nSeriesCount / nSeriesPerCandleStick; OSL_ASSERT( nSeriesPerCandleStick * nCandleStickCount == nSeriesCount ); uno::Sequence< uno::Reference< chart2::XDataSeries > > aNewSeries( nCandleStickCount ); + auto aNewSeriesRange = asNonConstRange(aNewSeries); for( sal_Int32 i=0; i<nCandleStickCount; ++i ) { sal_Int32 nSeriesIndex = i*nSeriesPerCandleStick; @@ -986,7 +989,7 @@ void SchXMLChartContext::MergeSeriesForStockChart() { // open values lcl_setRoleAtFirstSequence( aSeriesSeq[ nSeriesIndex ], "values-first"); - aNewSeries[i] = aSeriesSeq[ nSeriesIndex ]; + aNewSeriesRange[i] = aSeriesSeq[ nSeriesIndex ]; // low values lcl_MoveDataToCandleStickSeries( uno::Reference< chart2::data::XDataSource >( aSeriesSeq[ ++nSeriesIndex ], uno::UNO_QUERY_THROW ), @@ -996,7 +999,7 @@ void SchXMLChartContext::MergeSeriesForStockChart() { // low values lcl_setRoleAtFirstSequence( aSeriesSeq[ nSeriesIndex ], "values-min"); - aNewSeries[i] = aSeriesSeq[ nSeriesIndex ]; + aNewSeriesRange[i] = aSeriesSeq[ nSeriesIndex ]; } // high values lcl_MoveDataToCandleStickSeries( diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index db8c7d6fc06e..8bc776e5e421 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -617,8 +617,9 @@ void lcl_getLabelStringSequence( Sequence< OUString >& rOutLabels, const Referen { Sequence< uno::Any > aAnies( xLabelSeq->getData()); rOutLabels.realloc( aAnies.getLength()); + auto pOutLabels = rOutLabels.getArray(); for( sal_Int32 i=0; i<aAnies.getLength(); ++i ) - aAnies[i] >>= rOutLabels[i]; + aAnies[i] >>= pOutLabels[i]; } } @@ -654,9 +655,10 @@ uno::Sequence< OUString > lcl_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; @@ -677,8 +679,9 @@ uno::Sequence< OUString > lcl_DataSequenceToStringSequence( { Sequence< uno::Any > aAnies( xSeq->getData() ); aValuesSequence.realloc( aAnies.getLength() ); + auto pValuesSequence = aValuesSequence.getArray(); for( sal_Int32 i=0; i<aAnies.getLength(); ++i ) - aAnies[i] >>= aValuesSequence[i]; + aAnies[i] >>= pValuesSequence[i]; } //special handling for x-values (if x-values do point to categories, indices are used instead ) @@ -871,10 +874,11 @@ lcl_TableData lcl_getDataForLocalTable( // iterate over all sequences size_t nSeqIdx = 0; Sequence< Sequence< OUString > > aComplexLabels(nNumSequences); + auto aComplexLabelsRange = asNonConstRange(aComplexLabels); for( const auto& rDataSequence : aSequencesToExport ) { OUString aRange; - Sequence< OUString >& rCurrentComplexLabel = aComplexLabels[nSeqIdx]; + Sequence< OUString >& rCurrentComplexLabel = aComplexLabelsRange[nSeqIdx]; if( rDataSequence.first.is()) { lcl_getLabelStringSequence( rCurrentComplexLabel, rDataSequence.first ); @@ -886,7 +890,7 @@ lcl_TableData lcl_getDataForLocalTable( else if( rDataSequence.second.is()) { rCurrentComplexLabel.realloc(1); - rLabels[nSeqIdx] = rCurrentComplexLabel[0] = lcl_flattenStringSequence( + rLabels[nSeqIdx] = rCurrentComplexLabel.getArray()[0] = lcl_flattenStringSequence( rDataSequence.second->generateLabel( chart2::data::LabelOrigin_SHORT_SIDE )); } if( bSeriesFromColumns ) @@ -920,13 +924,15 @@ lcl_TableData lcl_getDataForLocalTable( } Sequence< Sequence< Any > >& rComplexAnyLabels = bSeriesFromColumns ? aResult.aComplexColumnDescriptions : aResult.aComplexRowDescriptions;//#i116544# rComplexAnyLabels.realloc(aComplexLabels.getLength()); + auto pComplexAnyLabels = rComplexAnyLabels.getArray(); for( sal_Int32 nN=0; nN<aComplexLabels.getLength();nN++ ) { - Sequence< OUString >& rSource = aComplexLabels[nN]; - Sequence< Any >& rTarget = rComplexAnyLabels[nN]; + Sequence< OUString >& rSource = aComplexLabelsRange[nN]; + Sequence< Any >& rTarget = pComplexAnyLabels[nN]; rTarget.realloc( rSource.getLength() ); + auto pTarget = rTarget.getArray(); for( sal_Int32 i=0; i<rSource.getLength(); i++ ) - rTarget[i] <<= rSource[i]; + pTarget[i] <<= rSource[i]; } } catch( const uno::Exception & ) diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx index e1a19dc1b71a..a39f822450c0 100644 --- a/xmloff/source/chart/SchXMLImport.cxx +++ b/xmloff/source/chart/SchXMLImport.cxx @@ -205,8 +205,9 @@ Reference< chart2::XDataSeries > SchXMLImportHelper::GetNewDataSeries( { sal_Int32 nIndex( aChartTypes.getLength() - 1 ); aChartTypes.realloc( aChartTypes.getLength() + 1 ); - aChartTypes[ nIndex + 1 ] = aChartTypes[ nIndex ]; - aChartTypes[ nIndex ] = xCurrentType; + auto pChartTypes = aChartTypes.getArray(); + pChartTypes[ nIndex + 1 ] = aChartTypes[ nIndex ]; + pChartTypes[ nIndex ] = xCurrentType; xCTCnt->setChartTypes( aChartTypes ); } else diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index 94255c263c32..a23a2c0dbde7 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -1045,7 +1045,7 @@ static void lcl_setErrorBarSequence ( const uno::Reference< chart2::XChartDocume xDataSource->getDataSequences()); aSequences.realloc( aSequences.getLength() + 1 ); - aSequences[ aSequences.getLength() - 1 ] = xLabelSeq; + aSequences.getArray()[ aSequences.getLength() - 1 ] = xLabelSeq; xDataSink->setData( aSequences ); } diff --git a/xmloff/source/chart/SchXMLPropertyMappingContext.cxx b/xmloff/source/chart/SchXMLPropertyMappingContext.cxx index 29810fd185d4..b5c17713fd09 100644 --- a/xmloff/source/chart/SchXMLPropertyMappingContext.cxx +++ b/xmloff/source/chart/SchXMLPropertyMappingContext.cxx @@ -53,7 +53,7 @@ Reference< chart2::data::XLabeledDataSequence2 > createAndAddSequenceToSeries( c { Sequence< Reference< chart2::data::XLabeledDataSequence > > aData( xSeriesSource->getDataSequences()); aData.realloc( aData.getLength() + 1 ); - aData[ aData.getLength() - 1 ] = xLabeledSeq; + aData.getArray()[ aData.getLength() - 1 ] = xLabeledSeq; xSink->setData( aData ); } diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx index d706bb46c038..1370b07b4ff9 100644 --- a/xmloff/source/chart/SchXMLSeries2Context.cxx +++ b/xmloff/source/chart/SchXMLSeries2Context.cxx @@ -233,8 +233,9 @@ Reference< chart2::data::XLabeledDataSequence2 > lcl_createAndAddSequenceToSerie const Sequence< Reference< chart2::data::XLabeledDataSequence > > aOldSeq( xSeriesSource->getDataSequences()); sal_Int32 nOldCount = aOldSeq.getLength(); Sequence< Reference< chart2::data::XLabeledDataSequence > > aNewSeq( nOldCount + 1 ); - aNewSeq[0].set(xLabeledSeq, uno::UNO_QUERY_THROW); - std::copy(aOldSeq.begin(), aOldSeq.end(), std::next(aNewSeq.getArray())); + auto pNewSeq = aNewSeq.getArray(); + pNewSeq[0].set(xLabeledSeq, uno::UNO_QUERY_THROW); + std::copy(aOldSeq.begin(), aOldSeq.end(), std::next(pNewSeq)); xSeriesSink->setData( aNewSeq ); return xLabeledSeq; @@ -1219,11 +1220,12 @@ void SchXMLSeries2Context::setStylesToDataPoints( SeriesDefaultsAndStyles& rSeri auto& rCustomLabels = seriesStyle.mCustomLabels; Sequence< Reference<chart2::XDataPointCustomLabelField>> xLabels(nLabelCount); + auto pxLabels = xLabels.getArray(); Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); for( size_t j = 0; j < nLabelCount; ++j ) { Reference< chart2::XDataPointCustomLabelField > xCustomLabel = chart2::DataPointCustomLabelField::create(xContext); - xLabels[j] = xCustomLabel; + pxLabels[j] = xCustomLabel; xCustomLabel->setString(rCustomLabels.mLabels[j]); if ( j == 0 && rCustomLabels.mbDataLabelsRange) { diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx index 47cc4f573ed2..51c56b545a8d 100644 --- a/xmloff/source/chart/SchXMLTableContext.cxx +++ b/xmloff/source/chart/SchXMLTableContext.cxx @@ -73,10 +73,11 @@ struct lcl_ApplyCellToData { if( m_nIndex < m_nSize ) { + auto pData = m_rData.getArray(); if( rCell.eType == SCH_CELL_TYPE_FLOAT ) - m_rData[m_nIndex] = rCell.fValue; + pData[m_nIndex] = rCell.fValue; else - m_rData[m_nIndex] = std::numeric_limits<double>::quiet_NaN(); + pData[m_nIndex] = std::numeric_limits<double>::quiet_NaN(); } ++m_nIndex; } @@ -661,20 +662,19 @@ static void lcl_ApplyCellToComplexLabel( const SchXMLCell& rCell, Sequence< uno: { if( rCell.eType == SCH_CELL_TYPE_STRING ) { - rComplexLabel.realloc(1); - rComplexLabel[0] <<= rCell.aString; + rComplexLabel = { uno::Any(rCell.aString) }; } else if( rCell.aComplexString.hasElements() && rCell.eType == SCH_CELL_TYPE_COMPLEX_STRING ) { sal_Int32 nCount = rCell.aComplexString.getLength(); rComplexLabel.realloc( nCount ); + auto pComplexLabel = rComplexLabel.getArray(); for( sal_Int32 nN=0; nN<nCount; nN++) - rComplexLabel[nN] <<= (rCell.aComplexString)[nN]; + pComplexLabel[nN] <<= (rCell.aComplexString)[nN]; } else if( rCell.eType == SCH_CELL_TYPE_FLOAT ) { - rComplexLabel.realloc(1); - rComplexLabel[0] <<= rCell.fValue; + rComplexLabel = { uno::Any(rCell.fValue) }; } } @@ -706,10 +706,13 @@ void SchXMLTableHelper::applyTableToInternalDataProvider( } Sequence< Sequence< double > > aDataInRows( nNumRows ); + auto aDataInRowsRange = asNonConstRange(aDataInRows); Sequence< Sequence< uno::Any > > aComplexRowDescriptions( nNumRows ); + auto aComplexRowDescriptionsRange = asNonConstRange(aComplexRowDescriptions); Sequence< Sequence< uno::Any > > aComplexColumnDescriptions( nNumColumns ); + auto aComplexColumnDescriptionsRange = asNonConstRange(aComplexColumnDescriptions); for( sal_Int32 i=0; i<nNumRows; ++i ) - aDataInRows[i].realloc( nNumColumns ); + aDataInRowsRange[i].realloc( nNumColumns ); if( !rTable.aData.empty() ) { @@ -721,7 +724,7 @@ void SchXMLTableHelper::applyTableToInternalDataProvider( const sal_Int32 nMax = ::std::min< sal_Int32 >( nColumnLabelsSize, static_cast< sal_Int32 >( rFirstRow.size()) - nColOffset ); SAL_WARN_IF( nMax != nColumnLabelsSize, "xmloff.chart", "nMax != nColumnLabelsSize"); for( sal_Int32 i=0; i<nMax; ++i ) - lcl_ApplyCellToComplexLabel( rFirstRow[i+nColOffset], aComplexColumnDescriptions[i] ); + lcl_ApplyCellToComplexLabel( rFirstRow[i+nColOffset], aComplexColumnDescriptionsRange[i] ); } std::vector< ::std::vector< SchXMLCell > >::const_iterator aRowIter( rTable.aData.begin() + nRowOffset ); @@ -733,13 +736,14 @@ void SchXMLTableHelper::applyTableToInternalDataProvider( { // row label if( rTable.bHasHeaderColumn ) - lcl_ApplyCellToComplexLabel( rRow.front(), aComplexRowDescriptions[nRow] ); + lcl_ApplyCellToComplexLabel( rRow.front(), aComplexRowDescriptionsRange[nRow] ); // values - Sequence< double >& rTargetRow = aDataInRows[nRow]; + Sequence< double >& rTargetRow = aDataInRowsRange[nRow]; + auto pTargetRow = rTargetRow.getArray(); lcl_ApplyCellToData aApplyCellToData = ::std::for_each( rRow.begin() + nColOffset, rRow.end(), lcl_ApplyCellToData( rTargetRow ) ); for( sal_Int32 nCurrentIndex = aApplyCellToData.getCurrentIndex(); nCurrentIndex<nNumColumns; nCurrentIndex++ ) - rTargetRow[nCurrentIndex] = std::numeric_limits<double>::quiet_NaN();//#i110615# + pTargetRow[nCurrentIndex] = std::numeric_limits<double>::quiet_NaN();//#i110615# } } } diff --git a/xmloff/source/chart/SchXMLTextListContext.cxx b/xmloff/source/chart/SchXMLTextListContext.cxx index 8b60d895bdef..da70c24ed9f0 100644 --- a/xmloff/source/chart/SchXMLTextListContext.cxx +++ b/xmloff/source/chart/SchXMLTextListContext.cxx @@ -85,8 +85,9 @@ void SchXMLTextListContext::endFastElement(sal_Int32 ) { sal_Int32 nCount = m_aTextVector.size(); m_rTextList.realloc(nCount); + auto pTextList = m_rTextList.getArray(); for( sal_Int32 nN=0; nN<nCount; nN++ ) - m_rTextList[nN]=m_aTextVector[nN]; + pTextList[nN]=m_aTextVector[nN]; } css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLTextListContext::createFastChildContext( diff --git a/xmloff/source/core/DocumentSettingsContext.cxx b/xmloff/source/core/DocumentSettingsContext.cxx index b40ac306963a..9eb30779be6a 100644 --- a/xmloff/source/core/DocumentSettingsContext.cxx +++ b/xmloff/source/core/DocumentSettingsContext.cxx @@ -313,6 +313,7 @@ void XMLDocumentSettingsContext::endFastElement(sal_Int32 ) { if (!utl::ConfigManager::IsFuzzing() && !officecfg::Office::Common::Save::Document::LoadPrinter::get()) { + auto aSeqConfigPropsRange = asNonConstRange(aSeqConfigProps); sal_Int32 i = aSeqConfigProps.getLength() - 1; int nFound = 0; @@ -322,13 +323,13 @@ void XMLDocumentSettingsContext::endFastElement(sal_Int32 ) if ( sProp == "PrinterName" ) { - aSeqConfigProps[i].Value <<= OUString(); + aSeqConfigPropsRange[i].Value <<= OUString(); nFound++; } else if ( sProp == "PrinterSetup" ) { uno::Sequence< sal_Int8 > aEmpty; - aSeqConfigProps[i].Value <<= aEmpty; + aSeqConfigPropsRange[i].Value <<= aEmpty; nFound++; } diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 2fa78344835b..7233d0d3dc3e 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -43,6 +43,7 @@ #include <i18nlangtag/languagetag.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/propertysetinfo.hxx> +#include <comphelper/propertyvalue.hxx> #include <xmloff/attrlist.hxx> #include <xmloff/namespacemap.hxx> #include <xmloff/xmluconv.hxx> @@ -1266,11 +1267,7 @@ ErrCode SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) xConvPropSet ) : xConvPropSet; - Sequence<Any> aArgs( 3 ); - aArgs[0] <<= mxHandler; - aArgs[1] <<= xPropSet; - aArgs[2] <<= mxModel; - + Sequence<Any> aArgs{ Any(mxHandler), Any(xPropSet), Any(mxModel) }; // get filter component Reference< xml::sax::XDocumentHandler > xTmpDocHandler( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.comp.Oasis2OOoTransformer", aArgs, m_xContext), @@ -1747,10 +1744,7 @@ void SvXMLExport::GetViewSettingsAndViews(uno::Sequence<beans::PropertyValue>& r { sal_Int32 nOldLength(rProps.getLength()); rProps.realloc(nOldLength + 1); - beans::PropertyValue aProp; - aProp.Name = "Views"; - aProp.Value <<= xIndexAccess; - rProps[nOldLength] = aProp; + rProps.getArray()[nOldLength] = comphelper::makePropertyValue("Views", xIndexAccess); } } @@ -2043,9 +2037,7 @@ void SvXMLExport::ExportEmbeddedOwnObject( Reference< XComponent > const & rComp Reference < XDocumentHandler > xHdl = new XMLEmbeddedObjectExportFilter( mxHandler ); - Sequence < Any > aArgs( 1 ); - aArgs[0] <<= xHdl; - + Sequence < Any > aArgs{ Any(xHdl) }; Reference< document::XExporter > xExporter( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(sFilterService, aArgs, m_xContext), UNO_QUERY); diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index a306236ac13e..d02a5731ad25 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -621,7 +621,7 @@ void SdXMLExport::ImpPrepAutoLayoutInfos() return; OUString aStr; - + auto DrawPagesAutoLayoutNamesRange = asNonConstRange(maDrawPagesAutoLayoutNames); Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY ); if( xHandoutSupp.is() ) { @@ -629,7 +629,7 @@ void SdXMLExport::ImpPrepAutoLayoutInfos() if( xHandoutPage.is() ) { if(ImpPrepAutoLayoutInfo(xHandoutPage, aStr)) - maDrawPagesAutoLayoutNames[0] = aStr; + DrawPagesAutoLayoutNamesRange[0] = aStr; } } @@ -642,7 +642,7 @@ void SdXMLExport::ImpPrepAutoLayoutInfos() if((aAny >>= xDrawPage) && xDrawPage.is()) { if(ImpPrepAutoLayoutInfo(xDrawPage, aStr)) - maDrawPagesAutoLayoutNames[nCnt+1] = aStr; + DrawPagesAutoLayoutNamesRange[nCnt+1] = aStr; } } } diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index ae5dbf041d1e..d47ea15b2758 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -81,6 +81,7 @@ #include <comphelper/classids.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/storagehelper.hxx> #include <officecfg/Office/Common.hxx> @@ -232,13 +233,11 @@ uno::Reference< drawing::XShape > XMLShapeExport::checkForCustomShapeReplacement if ( !aEngine.isEmpty() ) { - uno::Sequence< uno::Any > aArgument( 1 ); - uno::Sequence< beans::PropertyValue > aPropValues( 2 ); - aPropValues[ 0 ].Name = "CustomShape"; - aPropValues[ 0 ].Value <<= xShape; - aPropValues[ 1 ].Name = "ForceGroupWithText"; - aPropValues[ 1 ].Value <<= true; - aArgument[ 0 ] <<= aPropValues; + uno::Sequence< beans::PropertyValue > aPropValues{ + comphelper::makePropertyValue("CustomShape", xShape), + comphelper::makePropertyValue("ForceGroupWithText", true) + }; + uno::Sequence< uno::Any > aArgument = { uno::Any(aPropValues) }; uno::Reference< uno::XInterface > xInterface( xContext->getServiceManager()->createInstanceWithArgumentsAndContext(aEngine, aArgument, xContext) ); if ( xInterface.is() ) @@ -4994,11 +4993,10 @@ void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape } uno::Reference< graphic::XGraphicProvider > xProvider( graphic::GraphicProvider::create(xContext) ); - uno::Sequence< beans::PropertyValue > aArgs( 2 ); - aArgs[ 0 ].Name = "MimeType"; - aArgs[ 0 ].Value <<= OUString( "image/x-vclgraphic" ); - aArgs[ 1 ].Name = "OutputStream"; - aArgs[ 1 ].Value <<= xPictureStream->getOutputStream(); + uno::Sequence< beans::PropertyValue > aArgs{ + comphelper::makePropertyValue("MimeType", OUString( "image/x-vclgraphic" )), + comphelper::makePropertyValue("OutputStream", xPictureStream->getOutputStream()) + }; xProvider->storeGraphic( xGraphic, aArgs ); if( xPictureStorage.is() ) diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx index ba4a5646c90f..76ac0075c564 100644 --- a/xmloff/source/draw/shapeimport.cxx +++ b/xmloff/source/draw/shapeimport.cxx @@ -639,6 +639,7 @@ void ShapeGroupContext::popGroupAndPostProcess() if( xShapes3.is()) { uno::Sequence<sal_Int32> aNewOrder(maZOrderList.size() + maUnsortedList.size()); + auto pNewOrder = aNewOrder.getArray(); sal_Int32 nIndex = 0; for (const ZOrderHint& rHint : maZOrderList) @@ -646,11 +647,11 @@ void ShapeGroupContext::popGroupAndPostProcess() // fill in the gaps from unordered list for (vector<ZOrderHint>::iterator aIt = maUnsortedList.begin(); aIt != maUnsortedList.end() && nIndex < rHint.nShould; ) { - aNewOrder[nIndex++] = (*aIt).nIs; + pNewOrder[nIndex++] = (*aIt).nIs; aIt = maUnsortedList.erase(aIt); } - aNewOrder[nIndex] = rHint.nIs; + pNewOrder[nIndex] = rHint.nIs; nIndex++; } diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 8b395ddd9757..c1f93885c9c7 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -355,21 +355,22 @@ void SdXMLShapeContext::endFastElement(sal_Int32 ) { Reference< XNameReplace > xEvents( xEventsSupplier->getEvents(), UNO_SET_THROW ); - uno::Sequence< beans::PropertyValue > aProperties( 3 ); - aProperties[0].Name = "EventType"; - aProperties[0].Handle = -1; - aProperties[0].Value <<= OUString( "Presentation" ); - aProperties[0].State = beans::PropertyState_DIRECT_VALUE; - - aProperties[1].Name = "ClickAction"; - aProperties[1].Handle = -1; - aProperties[1].Value <<= css::presentation::ClickAction_DOCUMENT; - aProperties[1].State = beans::PropertyState_DIRECT_VALUE; - - aProperties[2].Name = "Bookmark"; - aProperties[2].Handle = -1; - aProperties[2].Value <<= msHyperlink; - aProperties[2].State = beans::PropertyState_DIRECT_VALUE; + uno::Sequence< beans::PropertyValue > aProperties{ + { /* Name */ "EventType", + /* Handle */ -1, + /* Value */ uno::Any(OUString( "Presentation" )), + /* State */ beans::PropertyState_DIRECT_VALUE }, + + { /* Name */ "ClickAction", + /* Handle */ -1, + /* Value */ uno::Any(css::presentation::ClickAction_DOCUMENT), + /* State */ beans::PropertyState_DIRECT_VALUE }, + + { /* Name */ "Bookmark", + /* Handle */ -1, + /* Value */ uno::Any(msHyperlink), + /* State */ beans::PropertyState_DIRECT_VALUE } + }; xEvents->replaceByName( "OnClick", Any( aProperties ) ); } @@ -2810,10 +2811,11 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLAppletShapeContex { sal_Int32 nIndex = maParams.getLength(); maParams.realloc( nIndex + 1 ); - maParams[nIndex].Name = aParamName; - maParams[nIndex].Handle = -1; - maParams[nIndex].Value <<= aParamValue; - maParams[nIndex].State = beans::PropertyState_DIRECT_VALUE; + auto pParams = maParams.getArray(); + pParams[nIndex].Name = aParamName; + pParams[nIndex].Handle = -1; + pParams[nIndex].Value <<= aParamValue; + pParams[nIndex].State = beans::PropertyState_DIRECT_VALUE; } return new SvXMLImportContext( GetImport() ); @@ -3055,10 +3057,11 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLPluginShapeContex { sal_Int32 nIndex = maParams.getLength(); maParams.realloc( nIndex + 1 ); - maParams[nIndex].Name = aParamName; - maParams[nIndex].Handle = -1; - maParams[nIndex].Value <<= aParamValue; - maParams[nIndex].State = beans::PropertyState_DIRECT_VALUE; + auto pParams = maParams.getArray(); + pParams[nIndex].Name = aParamName; + pParams[nIndex].Handle = -1; + pParams[nIndex].Value <<= aParamValue; + pParams[nIndex].State = beans::PropertyState_DIRECT_VALUE; } return new SvXMLImportContext( GetImport() ); diff --git a/xmloff/source/forms/eventexport.cxx b/xmloff/source/forms/eventexport.cxx index f9ce49ee27c9..721796ffb509 100644 --- a/xmloff/source/forms/eventexport.cxx +++ b/xmloff/source/forms/eventexport.cxx @@ -62,23 +62,23 @@ namespace xmloff } // tree property values to describe one event ... rMappedEvent.realloc( sLibrary.isEmpty() ? 2 : 3 ); + auto pMappedEvent = rMappedEvent.getArray(); // ... the type - rMappedEvent[0] = PropertyValue(EVENT_TYPE, -1, makeAny(rEvent.ScriptType), PropertyState_DIRECT_VALUE); + pMappedEvent[0] = PropertyValue(EVENT_TYPE, -1, makeAny(rEvent.ScriptType), PropertyState_DIRECT_VALUE); // and the macro name - rMappedEvent[1] = PropertyValue(EVENT_LOCALMACRONAME, -1, makeAny(sLocalMacroName), PropertyState_DIRECT_VALUE); + pMappedEvent[1] = PropertyValue(EVENT_LOCALMACRONAME, -1, makeAny(sLocalMacroName), PropertyState_DIRECT_VALUE); // the library if ( !sLibrary.isEmpty() ) - rMappedEvent[2] = PropertyValue(EVENT_LIBRARY, -1, makeAny(sLibrary), PropertyState_DIRECT_VALUE); + pMappedEvent[2] = PropertyValue(EVENT_LIBRARY, -1, makeAny(sLibrary), PropertyState_DIRECT_VALUE); } else { - rMappedEvent.realloc( 2 ); - rMappedEvent[0] = PropertyValue(EVENT_TYPE, -1, makeAny(rEvent.ScriptType), PropertyState_DIRECT_VALUE); - // and the macro name - rMappedEvent[1] = PropertyValue(EVENT_SCRIPTURL, -1, makeAny(rEvent.ScriptCode), PropertyState_DIRECT_VALUE); + rMappedEvent = { PropertyValue(EVENT_TYPE, -1, makeAny(rEvent.ScriptType), PropertyState_DIRECT_VALUE), + // and the macro name + PropertyValue(EVENT_SCRIPTURL, -1, makeAny(rEvent.ScriptCode), PropertyState_DIRECT_VALUE) }; } } } diff --git a/xmloff/source/forms/formcellbinding.cxx b/xmloff/source/forms/formcellbinding.cxx index 31c8e19c4d53..7dd17785071a 100644 --- a/xmloff/source/forms/formcellbinding.cxx +++ b/xmloff/source/forms/formcellbinding.cxx @@ -381,9 +381,7 @@ Reference< XInterface > FormCellBindingHelper::createDocumentDependentInstance( aArg.Name = _rArgumentName; aArg.Value = _rArgumentValue; - Sequence< Any > aArgs( 1 ); - aArgs[ 0 ] <<= aArg; - + Sequence< Any > aArgs{ Any(aArg) }; xReturn = xDocumentFactory->createInstanceWithArguments( _rService, aArgs ); } else diff --git a/xmloff/source/forms/gridcolumnproptranslator.cxx b/xmloff/source/forms/gridcolumnproptranslator.cxx index b79263310010..aeb1de438815 100644 --- a/xmloff/source/forms/gridcolumnproptranslator.cxx +++ b/xmloff/source/forms/gridcolumnproptranslator.cxx @@ -149,7 +149,7 @@ namespace xmloff sal_Int32 nOldLength = aProperties.getLength(); aProperties.realloc( nOldLength + 1 ); - aProperties[ nOldLength ] = getPropertyByName( getParaAlignProperty() ); + aProperties.getArray()[ nOldLength ] = getPropertyByName( getParaAlignProperty() ); return aProperties; } @@ -254,8 +254,8 @@ namespace xmloff sal_Int32 nParaAlignPos = findStringElement( aTranslatedNames, getParaAlignProperty() ); if ( nParaAlignPos != -1 ) { - aTranslatedNames[ nParaAlignPos ] = getAlignProperty(); - valueParaAdjustToAlign( aTranslatedValues[ nParaAlignPos ] ); + aTranslatedNames.getArray()[ nParaAlignPos ] = getAlignProperty(); + valueParaAdjustToAlign( aTranslatedValues.getArray()[ nParaAlignPos ] ); } m_xGridColumn->setPropertyValues( aTranslatedNames, aTranslatedValues ); @@ -270,11 +270,11 @@ namespace xmloff Sequence< OUString > aTranslatedNames( aPropertyNames ); sal_Int32 nAlignPos = findStringElement( aTranslatedNames, getParaAlignProperty() ); if ( nAlignPos != -1 ) - aTranslatedNames[ nAlignPos ] = getAlignProperty(); + aTranslatedNames.getArray()[ nAlignPos ] = getAlignProperty(); aValues = m_xGridColumn->getPropertyValues( aPropertyNames ); if ( nAlignPos != -1 ) - valueAlignToParaAdjust( aValues[ nAlignPos ] ); + valueAlignToParaAdjust( aValues.getArray()[ nAlignPos ] ); return aValues; } diff --git a/xmloff/source/meta/MetaExportComponent.cxx b/xmloff/source/meta/MetaExportComponent.cxx index 376a844e204d..251cb5217646 100644 --- a/xmloff/source/meta/MetaExportComponent.cxx +++ b/xmloff/source/meta/MetaExportComponent.cxx @@ -97,10 +97,8 @@ ErrCode XMLMetaExportComponent::exportDoc( enum XMLTokenEnum ) xConvPropSet ) : getExportInfo(); - uno::Sequence< uno::Any > aArgs( 3 ); - aArgs[0] <<= xDocHandler; - aArgs[1] <<= xPropSet; - aArgs[2] <<= GetModel(); + uno::Sequence< uno::Any > aArgs{ uno::Any(xDocHandler), uno::Any(xPropSet), + uno::Any(GetModel()) }; // get filter component xDocHandler.set( diff --git a/xmloff/source/meta/xmlversion.cxx b/xmloff/source/meta/xmlversion.cxx index 833db28db721..2b332e2afe9d 100644 --- a/xmloff/source/meta/xmlversion.cxx +++ b/xmloff/source/meta/xmlversion.cxx @@ -194,7 +194,7 @@ XMLVersionContext::XMLVersionContext( XMLVersionListImport& rImport, uno::Sequence < util::RevisionTag >& aList = rImport.GetList(); sal_Int32 nLength = aList.getLength(); aList.realloc( nLength+1 ); - aList[nLength] = aInfo; + aList.getArray()[nLength] = aInfo; } XMLVersionContext::~XMLVersionContext() diff --git a/xmloff/source/script/xmlscripti.cxx b/xmloff/source/script/xmlscripti.cxx index 16bcfaee7281..73051469b896 100644 --- a/xmloff/source/script/xmlscripti.cxx +++ b/xmloff/source/script/xmlscripti.cxx @@ -109,8 +109,9 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLScriptContext::crea uno::Sequence< beans::PropertyValue > aMedDescr = m_xModel->getArgs(); sal_Int32 nNewLen = aMedDescr.getLength() + 1; aMedDescr.realloc( nNewLen ); - aMedDescr[nNewLen-1].Name = "BreakMacroSignature"; - aMedDescr[nNewLen-1].Value <<= true; + auto pMedDescr = aMedDescr.getArray(); + pMedDescr[nNewLen-1].Name = "BreakMacroSignature"; + pMedDescr[nNewLen-1].Value <<= true; m_xModel->attachResource( m_xModel->getURL(), aMedDescr ); return new XMLScriptChildContext( GetImport(), m_xModel, aLanguage ); diff --git a/xmloff/source/text/XMLAutoTextEventExport.cxx b/xmloff/source/text/XMLAutoTextEventExport.cxx index ca7c0282d452..21abaf0a7454 100644 --- a/xmloff/source/text/XMLAutoTextEventExport.cxx +++ b/xmloff/source/text/XMLAutoTextEventExport.cxx @@ -102,8 +102,7 @@ ErrCode XMLAutoTextEventExport::exportDoc( enum XMLTokenEnum ) try { - Sequence<Any> aArgs( 1 ); - aArgs[0] <<= GetDocHandler(); + Sequence<Any> aArgs{ Any(GetDocHandler()) }; // get filter component Reference< xml::sax::XDocumentHandler > xTmpDocHandler( diff --git a/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx b/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx index 7218f563a0c7..fdb2657fd3e0 100644 --- a/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx +++ b/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx @@ -149,8 +149,9 @@ void XMLIndexBibliographyEntryContext::FillPropertyValues( // bibliography data field sal_Int32 nIndex = m_bCharStyleNameOK ? 2 : 1; - rValues[nIndex].Name = "BibliographyDataField"; - rValues[nIndex].Value <<= nBibliographyInfo; + auto pValues = rValues.getArray(); + pValues[nIndex].Name = "BibliographyDataField"; + pValues[nIndex].Value <<= nBibliographyInfo; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx b/xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx index 4936a640b996..18355fe2e839 100644 --- a/xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx +++ b/xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx @@ -167,18 +167,19 @@ void XMLIndexChapterInfoEntryContext::FillPropertyValues( XMLIndexSimpleEntryContext::FillPropertyValues(rValues); sal_Int32 nIndex = m_bCharStyleNameOK ? 2 : 1; + auto pValues = rValues.getArray(); if( bChapterInfoOK ) { // chapter info field - rValues[nIndex].Name = "ChapterFormat"; - rValues[nIndex].Value <<= nChapterInfo; + pValues[nIndex].Name = "ChapterFormat"; + pValues[nIndex].Value <<= nChapterInfo; nIndex++; } if( bOutlineLevelOK ) { - rValues[nIndex].Name = "ChapterLevel"; - rValues[nIndex].Value <<= nOutlineLevel; + pValues[nIndex].Name = "ChapterLevel"; + pValues[nIndex].Value <<= nOutlineLevel; } } diff --git a/xmloff/source/text/XMLIndexSimpleEntryContext.cxx b/xmloff/source/text/XMLIndexSimpleEntryContext.cxx index be728eac98f8..aa29f4c695e1 100644 --- a/xmloff/source/text/XMLIndexSimpleEntryContext.cxx +++ b/xmloff/source/text/XMLIndexSimpleEntryContext.cxx @@ -103,19 +103,20 @@ void XMLIndexSimpleEntryContext::FillPropertyValues( // only use slot so-and-so. Any aAny; + auto pValues = rValues.getArray(); // token type - rValues[0].Name = "TokenType"; - rValues[0].Value <<= m_rEntryType; + pValues[0].Name = "TokenType"; + pValues[0].Value <<= m_rEntryType; // char style if (m_bCharStyleNameOK) { - rValues[1].Name = "CharacterStyleName"; + pValues[1].Name = "CharacterStyleName"; aAny <<= GetImport().GetStyleDisplayName( XmlStyleFamily::TEXT_TEXT, m_sCharStyleName ); - rValues[1].Value = aAny; + pValues[1].Value = aAny; } } diff --git a/xmloff/source/text/XMLIndexSpanEntryContext.cxx b/xmloff/source/text/XMLIndexSpanEntryContext.cxx index a846674b30b9..ba0c976cfc53 100644 --- a/xmloff/source/text/XMLIndexSpanEntryContext.cxx +++ b/xmloff/source/text/XMLIndexSpanEntryContext.cxx @@ -53,10 +53,11 @@ void XMLIndexSpanEntryContext::FillPropertyValues( XMLIndexSimpleEntryContext::FillPropertyValues(rValues); // content + auto pValues = rValues.getArray(); Any aAny; aAny <<= sContent.makeStringAndClear(); - rValues[m_nValues-1].Name = "Text"; - rValues[m_nValues-1].Value = aAny; + pValues[m_nValues-1].Name = "Text"; + pValues[m_nValues-1].Value = aAny; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/XMLIndexTOCStylesContext.cxx b/xmloff/source/text/XMLIndexTOCStylesContext.cxx index aee1b9c9f70b..5331b687a9f9 100644 --- a/xmloff/source/text/XMLIndexTOCStylesContext.cxx +++ b/xmloff/source/text/XMLIndexTOCStylesContext.cxx @@ -86,9 +86,10 @@ void XMLIndexTOCStylesContext::endFastElement(sal_Int32 ) // copy vector into sequence const sal_Int32 nCount = aStyleNames.size(); Sequence<OUString> aStyleNamesSequence(nCount); + auto aStyleNamesSequenceRange = asNonConstRange(aStyleNamesSequence); for(sal_Int32 i = 0; i < nCount; i++) { - aStyleNamesSequence[i] = GetImport().GetStyleDisplayName( + aStyleNamesSequenceRange[i] = GetImport().GetStyleDisplayName( XmlStyleFamily::TEXT_PARAGRAPH, aStyleNames[i] ); } diff --git a/xmloff/source/text/XMLIndexTemplateContext.cxx b/xmloff/source/text/XMLIndexTemplateContext.cxx index 1b9fff15aaad..8dfa4b1fd984 100644 --- a/xmloff/source/text/XMLIndexTemplateContext.cxx +++ b/xmloff/source/text/XMLIndexTemplateContext.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <algorithm> using namespace ::std; using namespace ::xmloff::token; @@ -131,10 +132,7 @@ void XMLIndexTemplateContext::endFastElement(sal_Int32 ) const sal_Int32 nCount = aValueVector.size(); Sequence<PropertyValues> aValueSequence(nCount); - for(sal_Int32 i = 0; i<nCount; i++) - { - aValueSequence[i] = aValueVector[i]; - } + std::copy(aValueVector.begin(), aValueVector.end(), aValueSequence.getArray()); // get LevelFormat IndexReplace ... Any aAny = rPropertySet->getPropertyValue("LevelFormat"); diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx index b983949c3b9a..ffcfad1d1d23 100644 --- a/xmloff/source/text/txtfldi.cxx +++ b/xmloff/source/text/txtfldi.cxx @@ -2997,9 +2997,10 @@ void XMLBibliographyFieldImportContext::PrepareField( // convert vector into sequence sal_Int32 nCount = aValues.size(); Sequence<PropertyValue> aValueSequence(nCount); + auto aValueSequenceRange = asNonConstRange(aValueSequence); for(sal_Int32 i = 0; i < nCount; i++) { - aValueSequence[i] = aValues[i]; + aValueSequenceRange[i] = aValues[i]; } // set sequence diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 9c05e72f9708..d8a90667b97d 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -1373,8 +1373,9 @@ OUString XMLTextImportHelper::SetStyleAndAttrs( xPropSet->getPropertyValue("ParaInteropGrabBag") >>= aGrabBag; sal_Int32 length = aGrabBag.getLength(); aGrabBag.realloc(length + 1); - aGrabBag[length].Name = "OutlineContentVisibleAttr"; - aGrabBag[length].Value <<= bool(bOutlineContentVisible); + auto pGrabBag = aGrabBag.getArray(); + pGrabBag[length].Name = "OutlineContentVisibleAttr"; + pGrabBag[length].Value <<= bool(bOutlineContentVisible); xPropSet->setPropertyValue("ParaInteropGrabBag", uno::makeAny(aGrabBag)); } // RFE: inserting headings into text documents (#i70748#) diff --git a/xmloff/source/transform/OOo2Oasis.cxx b/xmloff/source/transform/OOo2Oasis.cxx index 2a853c430646..2433d1ed8d54 100644 --- a/xmloff/source/transform/OOo2Oasis.cxx +++ b/xmloff/source/transform/OOo2Oasis.cxx @@ -1931,8 +1931,9 @@ void OOo2OasisTransformer::Initialize( if (xFilter.is()) { Sequence<Any> aArgs( 1 + rArguments.getLength() ); - aArgs[0] <<= xFilter; - std::copy(rArguments.begin(), rArguments.end(), std::next(aArgs.getArray())); + auto pArgs = aArgs.getArray(); + pArgs[0] <<= xFilter; + std::copy(rArguments.begin(), rArguments.end(), std::next(pArgs)); XMLTransformerBase::initialize( aArgs ); OSL_ENSURE( GetDocHandler() == xFilter, diff --git a/xmloff/source/xforms/xformsexport.cxx b/xmloff/source/xforms/xformsexport.cxx index 8ff457fcf289..b8708429d9a2 100644 --- a/xmloff/source/xforms/xformsexport.cxx +++ b/xmloff/source/xforms/xformsexport.cxx @@ -31,6 +31,7 @@ #include <sax/tools/converter.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <tools/diagnose_ex.h> #include <sal/log.hxx> @@ -780,18 +781,16 @@ void getXFormsSettings( const Reference< XNameAccess >& _rXForms, Sequence< Prop { Reference< XPropertySet > xModelProps( _rXForms->getByName( modelName ), UNO_QUERY_THROW ); - Sequence< PropertyValue > aModelSettings( 1 ); - aModelSettings[0].Name = "ExternalData"; - aModelSettings[0].Value = xModelProps->getPropertyValue( aModelSettings[0].Name ); + static constexpr OUStringLiteral sExternalData = u"ExternalData"; + Sequence<PropertyValue> aModelSettings{ comphelper::makePropertyValue( + sExternalData, xModelProps->getPropertyValue(sExternalData)) }; xModelSettings->insertByName( modelName, makeAny( aModelSettings ) ); } if ( xModelSettings->hasElements() ) { - _out_rSettings.realloc( 1 ); - _out_rSettings[0].Name = "XFormModels"; - _out_rSettings[0].Value <<= xModelSettings; + _out_rSettings = { comphelper::makePropertyValue("XFormModels", xModelSettings) }; } } catch( const Exception& ) |