summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-10-29 09:57:41 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-10-30 21:55:53 +0200
commitf528fff9b58e95ed572b226c0fec29f9a0464725 (patch)
treea5cfb66c337ea68c6559ef8d450cc77d5a5f0ca6 /sc/source
parent9a668129259eeba1a05745b7cd820fccf3043f45 (diff)
Prepare for removal of non-const operator[] from Sequence in sc
Change-Id: Ic49c0fda3e98aeda471e674b68d40464ddac1ea1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124382 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/documen3.cxx3
-rw-r--r--sc/source/core/data/documen5.cxx30
-rw-r--r--sc/source/core/data/dpfilteredcache.cxx9
-rw-r--r--sc/source/core/data/dpobject.cxx9
-rw-r--r--sc/source/core/data/dpoutput.cxx8
-rw-r--r--sc/source/core/data/dptabsrc.cxx7
-rw-r--r--sc/source/core/data/table5.cxx14
-rw-r--r--sc/source/core/data/validat.cxx22
-rw-r--r--sc/source/core/tool/charthelper.cxx7
-rw-r--r--sc/source/core/tool/formulaparserpool.cxx3
-rw-r--r--sc/source/core/tool/interpr4.cxx5
-rw-r--r--sc/source/filter/excel/xichart.cxx7
-rw-r--r--sc/source/filter/excel/xiescher.cxx10
-rw-r--r--sc/source/filter/excel/xltoolbar.cxx6
-rw-r--r--sc/source/filter/excel/xltracer.cxx5
-rw-r--r--sc/source/filter/ftools/fapihelper.cxx5
-rw-r--r--sc/source/filter/inc/xltracer.hxx2
-rw-r--r--sc/source/filter/oox/autofilterbuffer.cxx20
-rw-r--r--sc/source/filter/oox/drawingfragment.cxx9
-rw-r--r--sc/source/filter/oox/viewsettings.cxx7
-rw-r--r--sc/source/filter/oox/workbooksettings.cxx18
-rw-r--r--sc/source/filter/xml/XMLCodeNameProvider.cxx10
-rw-r--r--sc/source/filter/xml/xmldrani.cxx2
-rw-r--r--sc/source/filter/xml/xmldrani.hxx2
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx13
-rw-r--r--sc/source/filter/xml/xmlimprt.cxx6
-rw-r--r--sc/source/filter/xml/xmlsorti.cxx39
-rw-r--r--sc/source/ui/Accessibility/AccessibleCsvControl.cxx24
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocument.cxx6
-rw-r--r--sc/source/ui/Accessibility/AccessiblePreviewTable.cxx2
-rw-r--r--sc/source/ui/cctrl/tbzoomsliderctrl.cxx10
-rw-r--r--sc/source/ui/docshell/docsh.cxx26
-rw-r--r--sc/source/ui/docshell/docsh4.cxx15
-rw-r--r--sc/source/ui/drawfunc/fuins2.cxx27
-rw-r--r--sc/source/ui/miscdlgs/optsolver.cxx5
-rw-r--r--sc/source/ui/miscdlgs/solveroptions.cxx3
-rw-r--r--sc/source/ui/miscdlgs/solverutil.cxx7
-rw-r--r--sc/source/ui/unoobj/PivotTableDataSequence.cxx11
-rw-r--r--sc/source/ui/unoobj/cellvaluebinding.cxx17
-rw-r--r--sc/source/ui/unoobj/chartuno.cxx27
-rw-r--r--sc/source/ui/unoobj/condformatuno.cxx19
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx3
-rw-r--r--sc/source/ui/unoobj/datauno.cxx14
-rw-r--r--sc/source/ui/unoobj/docuno.cxx55
-rw-r--r--sc/source/ui/unoobj/eventuno.cxx3
-rw-r--r--sc/source/ui/unoobj/linkuno.cxx9
-rw-r--r--sc/source/ui/unoobj/servuno.cxx22
-rw-r--r--sc/source/ui/unoobj/shapeuno.cxx13
-rw-r--r--sc/source/ui/unoobj/tokenuno.cxx3
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx21
-rw-r--r--sc/source/ui/vba/vbaeventshelper.cxx65
-rw-r--r--sc/source/ui/vba/vbaglobals.cxx11
-rw-r--r--sc/source/ui/vba/vbapagesetup.cxx3
-rw-r--r--sc/source/ui/vba/vbarange.cxx107
-rw-r--r--sc/source/ui/vba/vbatitle.hxx7
-rw-r--r--sc/source/ui/vba/vbaworkbook.cxx12
-rw-r--r--sc/source/ui/vba/vbaworkbooks.cxx24
-rw-r--r--sc/source/ui/vba/vbawsfunction.cxx10
-rw-r--r--sc/source/ui/view/gridwin.cxx3
-rw-r--r--sc/source/ui/view/viewfun4.cxx6
-rw-r--r--sc/source/ui/view/viewfunc.cxx5
61 files changed, 417 insertions, 456 deletions
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 6ab518566663..244293510b4c 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -680,8 +680,7 @@ bool ScDocument::HasSheetEventScript( SCTAB nTab, ScSheetEventId nEvent, bool bW
// check if VBA event handlers exist
if (bWithVbaEvents && mxVbaEvents.is()) try
{
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[ 0 ] <<= nTab;
+ uno::Sequence< uno::Any > aArgs{ uno::Any(nTab) };
if (mxVbaEvents->hasVbaEventHandler( ScSheetEvents::GetVbaSheetEventId( nEvent ), aArgs ) ||
mxVbaEvents->hasVbaEventHandler( ScSheetEvents::GetVbaDocumentEventId( nEvent ), uno::Sequence< uno::Any >() ))
return true;
diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx
index 045f67f91424..67421451e99e 100644
--- a/sc/source/core/data/documen5.cxx
+++ b/sc/source/core/data/documen5.cxx
@@ -80,19 +80,20 @@ static void lcl_SetChartParameters( const uno::Reference< chart2::data::XDataRec
if ( !xReceiver.is() )
return;
- uno::Sequence< beans::PropertyValue > aArgs( 4 );
- aArgs[0] = beans::PropertyValue(
- "CellRangeRepresentation", -1,
- uno::makeAny( rRanges ), beans::PropertyState_DIRECT_VALUE );
- aArgs[1] = beans::PropertyValue(
- "HasCategories", -1,
- uno::makeAny( bHasCategories ), beans::PropertyState_DIRECT_VALUE );
- aArgs[2] = beans::PropertyValue(
- "FirstCellAsLabel", -1,
- uno::makeAny( bFirstCellAsLabel ), beans::PropertyState_DIRECT_VALUE );
- aArgs[3] = beans::PropertyValue(
- "DataRowSource", -1,
- uno::makeAny( eDataRowSource ), beans::PropertyState_DIRECT_VALUE );
+ uno::Sequence< beans::PropertyValue > aArgs{
+ beans::PropertyValue(
+ "CellRangeRepresentation", -1,
+ uno::makeAny( rRanges ), beans::PropertyState_DIRECT_VALUE ),
+ beans::PropertyValue(
+ "HasCategories", -1,
+ uno::makeAny( bHasCategories ), beans::PropertyState_DIRECT_VALUE ),
+ beans::PropertyValue(
+ "FirstCellAsLabel", -1,
+ uno::makeAny( bFirstCellAsLabel ), beans::PropertyState_DIRECT_VALUE ),
+ beans::PropertyValue(
+ "DataRowSource", -1,
+ uno::makeAny( eDataRowSource ), beans::PropertyState_DIRECT_VALUE )
+ };
xReceiver->setArguments( aArgs );
}
@@ -189,12 +190,13 @@ void ScDocument::SetChartRanges( std::u16string_view rChartName, const ::std::ve
sal_Int32 nCount = static_cast<sal_Int32>( rRangesVector.size() );
uno::Sequence< OUString > aRangeStrings(nCount);
+ auto aRangeStringsRange = asNonConstRange(aRangeStrings);
for( sal_Int32 nN=0; nN<nCount; nN++ )
{
ScRangeList aScRangeList( rRangesVector[nN] );
OUString sRangeStr;
aScRangeList.Format( sRangeStr, ScRefFlags::RANGE_ABS_3D, *this, GetAddressConvention() );
- aRangeStrings[nN]=sRangeStr;
+ aRangeStringsRange[nN]=sRangeStr;
}
ScChartHelper::SetChartRanges( xChartDoc, aRangeStrings );
}
diff --git a/sc/source/core/data/dpfilteredcache.cxx b/sc/source/core/data/dpfilteredcache.cxx
index 19b1782076c2..b47fc43aeb8c 100644
--- a/sc/source/core/data/dpfilteredcache.cxx
+++ b/sc/source/core/data/dpfilteredcache.cxx
@@ -303,12 +303,13 @@ void ScDPFilteredCache::filterTable(const vector<Criterion>& rCriteria, Sequence
// Header first.
Sequence<Any> headerRow(nColSize);
+ auto pRow = headerRow.getArray();
for (SCCOL nCol = 0; nCol < nColSize; ++nCol)
{
OUString str = getFieldName( nCol);
Any any;
any <<= str;
- headerRow[nCol] = any;
+ pRow[nCol] = any;
}
tableData.push_back(headerRow);
@@ -328,6 +329,7 @@ void ScDPFilteredCache::filterTable(const vector<Criterion>& rCriteria, Sequence
// Insert this row into table.
Sequence<Any> row(nColSize);
+ pRow = row.getArray();
for (SCCOL nCol = 0; nCol < nColSize; ++nCol)
{
Any any;
@@ -340,7 +342,7 @@ void ScDPFilteredCache::filterTable(const vector<Criterion>& rCriteria, Sequence
OUString string (pData->GetString() );
any <<= string;
}
- row[nCol] = any;
+ pRow[nCol] = any;
}
tableData.push_back(row);
}
@@ -348,8 +350,9 @@ void ScDPFilteredCache::filterTable(const vector<Criterion>& rCriteria, Sequence
// convert vector to Sequence
sal_Int32 nTabSize = static_cast<sal_Int32>(tableData.size());
rTabData.realloc(nTabSize);
+ auto pTabData = rTabData.getArray();
for (sal_Int32 i = 0; i < nTabSize; ++i)
- rTabData[i] = tableData[i];
+ pTabData[i] = tableData[i];
}
void ScDPFilteredCache::clear()
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 1bab5ce8ba40..a5ff421649fd 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -1002,8 +1002,9 @@ bool ScDPObject::GetMemberNames( sal_Int32 nDim, Sequence<OUString>& rNames )
size_t n = aMembers.size();
rNames.realloc(n);
+ auto pNames = rNames.getArray();
for (size_t i = 0; i < n; ++i)
- rNames[i] = aMembers[i].maName;
+ pNames[i] = aMembers[i].maName;
return true;
}
@@ -1148,8 +1149,9 @@ bool ScDPObject::GetDataFieldPositionData(
sal_Int32 n = static_cast<sal_Int32>(aFilters.size());
rFilters.realloc(n);
+ auto pFilters = rFilters.getArray();
for (sal_Int32 i = 0; i < n; ++i)
- rFilters[i] = aFilters[i];
+ pFilters[i] = aFilters[i];
return true;
}
@@ -1385,8 +1387,9 @@ double ScDPObject::GetPivotData(const OUString& rDataFieldName, std::vector<shee
size_t n = rFilters.size();
uno::Sequence<sheet::DataPilotFieldFilter> aFilters(n);
+ auto aFiltersRange = asNonConstRange(aFilters);
for (size_t i = 0; i < n; ++i)
- aFilters[i] = rFilters[i];
+ aFiltersRange[i] = rFilters[i];
uno::Sequence<double> aRes = xDPResults->getFilteredResults(aFilters);
if (static_cast<sal_Int32>(nDataIndex) >= aRes.getLength())
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx
index ada646b361fc..1297fb136afb 100644
--- a/sc/source/core/data/dpoutput.cxx
+++ b/sc/source/core/data/dpoutput.cxx
@@ -18,6 +18,8 @@
*/
#include <scitems.hxx>
+
+#include <comphelper/sequence.hxx>
#include <editeng/borderline.hxx>
#include <editeng/boxitem.hxx>
#include <editeng/wghtitem.hxx>
@@ -1302,13 +1304,9 @@ void ScDPOutput::GetPositionData(const ScAddress& rPos, DataPilotTablePositionDa
{
vector<DataPilotFieldFilter> aFilters;
GetDataResultPositionData(aFilters, rPos);
- sal_Int32 nSize = aFilters.size();
DataPilotTableResultData aResData;
- aResData.FieldFilters.realloc(nSize);
- for (sal_Int32 i = 0; i < nSize; ++i)
- aResData.FieldFilters[i] = aFilters[i];
-
+ aResData.FieldFilters = comphelper::containerToSequence(aFilters);
aResData.DataFieldIndex = 0;
Reference<beans::XPropertySet> xPropSet(xSource, UNO_QUERY);
if (xPropSet.is())
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index 03b3d2280e79..60dfde3a03bf 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -396,12 +396,7 @@ uno::Sequence<double> ScDPSource::getFilteredResults(
const ScDPResultTree::ValuesType* pVals = maResFilterSet.getResults(aFilters);
if (pVals && !pVals->empty())
{
- size_t n = pVals->size();
- uno::Sequence<double> aRet(n);
- for (size_t i = 0; i < n; ++i)
- aRet[i] = (*pVals)[i];
-
- return aRet;
+ return comphelper::containerToSequence(*pVals);
}
if (aFilters.getLength() == 1)
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index e885f4c704bd..9c030ae1ac6f 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -467,24 +467,16 @@ void ScTable::SetColBreak(SCCOL nCol, bool bPage, bool bManual)
Sequence<TablePageBreakData> ScTable::GetRowBreakData() const
{
- using ::std::copy;
using ::std::inserter;
set<SCROW> aRowBreaks = maRowPageBreaks;
copy(maRowManualBreaks.begin(), maRowManualBreaks.end(),
inserter(aRowBreaks, aRowBreaks.begin()));
- sal_Int32 i = 0;
Sequence<TablePageBreakData> aSeq(aRowBreaks.size());
-
- for (const SCROW nRow : aRowBreaks)
- {
- TablePageBreakData aData;
- aData.Position = nRow;
- aData.ManualBreak = HasRowManualBreak(nRow);
- aSeq[i] = aData;
- ++i;
- }
+ std::transform(aRowBreaks.begin(), aRowBreaks.end(), aSeq.getArray(), [this](const SCROW nRow) {
+ return TablePageBreakData(nRow, HasRowManualBreak(nRow));
+ });
return aSeq;
}
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 150a5d187d2a..594f28c5f738 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -193,29 +193,21 @@ bool ScValidationData::DoScript( const ScAddress& rPos, const OUString& rInput,
bool bScriptReturnedFalse = false; // default: do not abort
- // Set up parameters
- css::uno::Sequence< css::uno::Any > aParams(2);
-
// 1) entered or calculated value
- OUString aValStr = rInput;
- double nValue;
- bool bIsValue = false;
+ css::uno::Any aParam0(rInput);
if ( pCell ) // if cell exists, call interpret
{
- bIsValue = pCell->IsValue();
- if ( bIsValue )
- nValue = pCell->GetValue();
+ if ( pCell->IsValue() )
+ aParam0 <<= pCell->GetValue();
else
- aValStr = pCell->GetString().getString();
+ aParam0 <<= pCell->GetString().getString();
}
- if ( bIsValue )
- aParams[0] <<= nValue;
- else
- aParams[0] <<= aValStr;
// 2) Position of the cell
OUString aPosStr(rPos.Format(ScRefFlags::VALID | ScRefFlags::TAB_3D, pDocument, pDocument->GetAddressConvention()));
- aParams[1] <<= aPosStr;
+
+ // Set up parameters
+ css::uno::Sequence< css::uno::Any > aParams{ aParam0, css::uno::Any(aPosStr) };
// use link-update flag to prevent closing the document
// while the macro is running
diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx
index b3bda1c529f0..32315565ace5 100644
--- a/sc/source/core/tool/charthelper.cxx
+++ b/sc/source/core/tool/charthelper.cxx
@@ -24,6 +24,7 @@
#include <chartlis.hxx>
#include <docuno.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <svx/svditer.hxx>
#include <svx/svdoole2.hxx>
#include <svx/svdpage.hxx>
@@ -415,9 +416,9 @@ void ScChartHelper::CreateProtectedChartListenersAndNotify( ScDocument& rDoc, co
ScRange aRange( rDoc.GetRange( nTab, aRectangle ) );
ScRangeList aChangeRanges( aRange );
- uno::Sequence< beans::PropertyValue > aProperties( 1 );
- aProperties[ 0 ].Name = "Name";
- aProperties[ 0 ].Value <<= aChartName;
+ uno::Sequence< beans::PropertyValue > aProperties{
+ comphelper::makePropertyValue("Name", aChartName)
+ };
pModelObj->NotifyChanges( "insert-chart", aChangeRanges, aProperties );
}
diff --git a/sc/source/core/tool/formulaparserpool.cxx b/sc/source/core/tool/formulaparserpool.cxx
index 94c47fa903e8..00c5c9108063 100644
--- a/sc/source/core/tool/formulaparserpool.cxx
+++ b/sc/source/core/tool/formulaparserpool.cxx
@@ -90,8 +90,7 @@ Reference< XFormulaParser > ScParserFactoryMap::createFormulaParser(
FactoryMap::const_iterator aIt = maFactories.find( rNamespace );
if( aIt != maFactories.end() ) try
{
- Sequence< Any > aArgs( 1 );
- aArgs[ 0 ] <<= rxComponent;
+ Sequence< Any > aArgs{ Any(rxComponent) };
xParser.set( aIt->second->createInstanceWithArgumentsAndContext( aArgs, mxContext ), UNO_QUERY_THROW );
}
catch( Exception& )
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 93fb46657fb4..929844886b66 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3134,9 +3134,8 @@ static bool lcl_setVBARange( const ScRange& aRange, const ScDocument& rDok, SbxV
{
uno::Reference< uno::XInterface > xVBARange;
uno::Reference<table::XCellRange> xCellRange = ScCellRangeObj::CreateRangeFromDoc( rDok, aRange );
- uno::Sequence< uno::Any > aArgs(2);
- aArgs[0] = lcl_getSheetModule( xCellRange, &rDok );
- aArgs[1] <<= xCellRange;
+ uno::Sequence< uno::Any > aArgs{ lcl_getSheetModule( xCellRange, &rDok ),
+ uno::Any(xCellRange) };
xVBARange = ooo::vba::createVBAUnoAPIServiceWithArgs( rDok.GetDocumentShell(), "ooo.vba.excel.Range", aArgs );
if ( xVBARange.is() )
{
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index 718d34559068..bf6ffd4a2c23 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -2399,10 +2399,9 @@ Reference< XChartType > XclImpChType::CreateChartType( Reference< XDiagram > con
case EXC_CHTYPECATEG_BAR:
{
ScfPropertySet aTypeProp( xChartType );
- Sequence< sal_Int32 > aInt32Seq( 2 );
- aInt32Seq[ 0 ] = aInt32Seq[ 1 ] = -maData.mnOverlap;
+ Sequence< sal_Int32 > aInt32Seq{ -maData.mnOverlap, -maData.mnOverlap };
aTypeProp.SetProperty( EXC_CHPROP_OVERLAPSEQ, aInt32Seq );
- aInt32Seq[ 0 ] = aInt32Seq[ 1 ] = maData.mnGap;
+ aInt32Seq = { maData.mnGap, maData.mnGap };
aTypeProp.SetProperty( EXC_CHPROP_GAPWIDTHSEQ, aInt32Seq );
}
break;
@@ -3117,7 +3116,7 @@ void XclImpChValueRange::Convert( ScaleData& rScaleData, bool bMirrorOrient ) co
// minor increment
Sequence< SubIncrement >& rSubIncrementSeq = rIncrementData.SubIncrements;
rSubIncrementSeq.realloc( 1 );
- Any& rIntervalCount = rSubIncrementSeq[ 0 ].IntervalCount;
+ Any& rIntervalCount = rSubIncrementSeq.getArray()[ 0 ].IntervalCount;
rIntervalCount.clear();
if( bLogScale )
{
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 883c77beaf0c..01ee80649778 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -51,6 +51,7 @@
#include <vcl/wmf.hxx>
#include <comphelper/classids.hxx>
#include <comphelper/documentinfo.hxx>
+#include <o3tl/safeint.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
@@ -1926,8 +1927,7 @@ void XclImpControlHelper::ApplySheetLinkProps() const
aValue.Name = SC_UNONAME_BOUNDCELL;
aValue.Value <<= aApiAddress;
- Sequence< Any > aArgs( 1 );
- aArgs[ 0 ] <<= aValue;
+ Sequence< Any > aArgs{ Any(aValue) };
// create the CellValueBinding instance and set at the control model
OUString aServiceName;
@@ -1960,8 +1960,7 @@ void XclImpControlHelper::ApplySheetLinkProps() const
aValue.Name = SC_UNONAME_CELLRANGE;
aValue.Value <<= aApiRange;
- Sequence< Any > aArgs( 1 );
- aArgs[ 0 ] <<= aValue;
+ Sequence< Any > aArgs{ Any(aValue) };
// create the EntrySource instance and set at the control model
Reference< XListEntrySource > xEntrySource( xFactory->createInstanceWithArguments(
@@ -2897,8 +2896,7 @@ void XclImpDropDownObj::DoProcessControl( ScfPropertySet& rPropSet ) const
// selection (do not set, if dropdown is linked to a cell)
if( !HasCellLink() && (mnSelEntry > 0) )
{
- Sequence< sal_Int16 > aSelSeq( 1 );
- aSelSeq[ 0 ] = mnSelEntry - 1;
+ Sequence< sal_Int16 > aSelSeq{ o3tl::narrowing<sal_Int16>(mnSelEntry - 1) };
rPropSet.SetProperty( "DefaultSelection", aSelSeq );
}
}
diff --git a/sc/source/filter/excel/xltoolbar.cxx b/sc/source/filter/excel/xltoolbar.cxx
index c4178ccafea1..40759538405a 100644
--- a/sc/source/filter/excel/xltoolbar.cxx
+++ b/sc/source/filter/excel/xltoolbar.cxx
@@ -15,6 +15,7 @@
#include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/ItemType.hpp>
#include <comphelper/processfactory.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <comphelper/sequence.hxx>
#include <map>
@@ -315,9 +316,8 @@ bool ScTBC::ImportToolBarControl( ScCTBWrapper& rWrapper, const css::uno::Refere
if ( bBeginGroup )
{
// insert spacer
- uno::Sequence< beans::PropertyValue > sProps( 1 );
- sProps[ 0 ].Name = "Type";
- sProps[ 0 ].Value <<= ui::ItemType::SEPARATOR_LINE;
+ uno::Sequence sProps{ comphelper::makePropertyValue("Type",
+ ui::ItemType::SEPARATOR_LINE) };
toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
}
toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( comphelper::containerToSequence(props) ) );
diff --git a/sc/source/filter/excel/xltracer.cxx b/sc/source/filter/excel/xltracer.cxx
index c04d186a5a60..c6931dbf01d8 100644
--- a/sc/source/filter/excel/xltracer.cxx
+++ b/sc/source/filter/excel/xltracer.cxx
@@ -25,13 +25,10 @@
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::beans::PropertyValue;
-XclTracer::XclTracer(const OUString& rDocUrl)
+XclTracer::XclTracer(std::u16string_view /*rDocUrl*/)
: mbEnabled(false)
, maFirstTimes(eTraceLength, true)
{
- Sequence<PropertyValue> aConfigData(1);
- aConfigData[0].Name = "DocumentURL";
- aConfigData[0].Value <<= rDocUrl;
}
XclTracer::~XclTracer() {}
diff --git a/sc/source/filter/ftools/fapihelper.cxx b/sc/source/filter/ftools/fapihelper.cxx
index b08f3bed1c5a..1d6e982120e4 100644
--- a/sc/source/filter/ftools/fapihelper.cxx
+++ b/sc/source/filter/ftools/fapihelper.cxx
@@ -288,6 +288,7 @@ ScfPropSetHelper::ScfPropSetHelper( const char* const* ppcPropNames ) :
// resize member sequences
size_t nSize = aPropNameVec.size();
maNameSeq.realloc( static_cast< sal_Int32 >( nSize ) );
+ auto pNameSeq = maNameSeq.getArray();
maValueSeq.realloc( static_cast< sal_Int32 >( nSize ) );
maNameOrder.resize( nSize );
@@ -295,7 +296,7 @@ ScfPropSetHelper::ScfPropSetHelper( const char* const* ppcPropNames ) :
sal_Int32 nSeqIdx = 0;
for( auto& aPropName : aPropNameVec )
{
- maNameSeq[ nSeqIdx ] = aPropName.first;
+ pNameSeq[ nSeqIdx ] = aPropName.first;
maNameOrder[ aPropName.second ] = nSeqIdx;
++nSeqIdx;
}
@@ -361,7 +362,7 @@ Any* ScfPropSetHelper::GetNextAny()
OSL_ENSURE( mnNextIdx < maNameOrder.size(), "ScfPropSetHelper::GetNextAny - sequence overflow" );
Any* pAny = nullptr;
if( mnNextIdx < maNameOrder.size() )
- pAny = &maValueSeq[ maNameOrder[ mnNextIdx++ ] ];
+ pAny = &maValueSeq.getArray()[ maNameOrder[ mnNextIdx++ ] ];
return pAny;
}
diff --git a/sc/source/filter/inc/xltracer.hxx b/sc/source/filter/inc/xltracer.hxx
index 3286d45f46d0..eef1901398f3 100644
--- a/sc/source/filter/inc/xltracer.hxx
+++ b/sc/source/filter/inc/xltracer.hxx
@@ -50,7 +50,7 @@ enum XclTracerId
class XclTracer final
{
public:
- explicit XclTracer( const OUString& rDocUrl );
+ explicit XclTracer( std::u16string_view rDocUrl );
~XclTracer();
/** Returns true, if tracing is enabled. */
diff --git a/sc/source/filter/oox/autofilterbuffer.cxx b/sc/source/filter/oox/autofilterbuffer.cxx
index 5779bd1e5e9c..6bffe8e53b25 100644
--- a/sc/source/filter/oox/autofilterbuffer.cxx
+++ b/sc/source/filter/oox/autofilterbuffer.cxx
@@ -170,8 +170,9 @@ void ApiFilterSettings::appendField( bool bAnd, sal_Int32 nOperator, double fVal
rFilterField.Connection = bAnd ? FilterConnection_AND : FilterConnection_OR;
rFilterField.Operator = nOperator;
rFilterField.Values.realloc(1);
- rFilterField.Values[0].FilterType = FilterFieldType::NUMERIC;
- rFilterField.Values[0].NumericValue = fValue;
+ auto pValues = rFilterField.Values.getArray();
+ pValues[0].FilterType = FilterFieldType::NUMERIC;
+ pValues[0].NumericValue = fValue;
}
void ApiFilterSettings::appendField( bool bAnd, sal_Int32 nOperator, const OUString& rValue )
@@ -181,8 +182,9 @@ void ApiFilterSettings::appendField( bool bAnd, sal_Int32 nOperator, const OUStr
rFilterField.Connection = bAnd ? FilterConnection_AND : FilterConnection_OR;
rFilterField.Operator = nOperator;
rFilterField.Values.realloc(1);
- rFilterField.Values[0].FilterType = FilterFieldType::STRING;
- rFilterField.Values[0].StringValue = rValue;
+ auto pValues = rFilterField.Values.getArray();
+ pValues[0].FilterType = FilterFieldType::STRING;
+ pValues[0].StringValue = rValue;
}
void ApiFilterSettings::appendField(bool bAnd, util::Color aColor, bool bIsBackgroundColor)
@@ -192,9 +194,10 @@ void ApiFilterSettings::appendField(bool bAnd, util::Color aColor, bool bIsBackg
rFilterField.Connection = bAnd ? FilterConnection_AND : FilterConnection_OR;
rFilterField.Operator = FilterOperator2::EQUAL;
rFilterField.Values.realloc(1);
- rFilterField.Values[0].FilterType
+ auto pValues = rFilterField.Values.getArray();
+ pValues[0].FilterType
= bIsBackgroundColor ? FilterFieldType::BACKGROUND_COLOR : FilterFieldType::TEXT_COLOR;
- rFilterField.Values[0].ColorValue = aColor;
+ pValues[0].ColorValue = aColor;
}
void ApiFilterSettings::appendField( bool bAnd, const std::vector<std::pair<OUString, bool>>& rValues )
@@ -204,12 +207,13 @@ void ApiFilterSettings::appendField( bool bAnd, const std::vector<std::pair<OUSt
rFilterField.Connection = bAnd ? FilterConnection_AND : FilterConnection_OR;
rFilterField.Operator = FilterOperator2::EQUAL;
rFilterField.Values.realloc(rValues.size());
+ auto pValues = rFilterField.Values.getArray();
size_t i = 0;
for( auto const& it : rValues )
{
- rFilterField.Values[i].StringValue = it.first;
- rFilterField.Values[i++].FilterType
+ pValues[i].StringValue = it.first;
+ pValues[i++].FilterType
= it.second ? FilterFieldType::DATE : FilterFieldType::STRING;
}
}
diff --git a/sc/source/filter/oox/drawingfragment.cxx b/sc/source/filter/oox/drawingfragment.cxx
index a366b17e0dd4..10927027d65e 100644
--- a/sc/source/filter/oox/drawingfragment.cxx
+++ b/sc/source/filter/oox/drawingfragment.cxx
@@ -20,6 +20,8 @@
#include <drawingfragment.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <comphelper/propertyvalue.hxx>
+
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
@@ -80,11 +82,8 @@ void ShapeMacroAttacher::attachMacro( const OUString& rMacroUrl )
{
Reference< XEventsSupplier > xSupplier( mxShape, UNO_QUERY_THROW );
Reference< XNameReplace > xEvents( xSupplier->getEvents(), UNO_SET_THROW );
- Sequence< PropertyValue > aEventProps( 2 );
- aEventProps[ 0 ].Name = "EventType";
- aEventProps[ 0 ].Value <<= OUString( "Script" );
- aEventProps[ 1 ].Name = "Script";
- aEventProps[ 1 ].Value <<= rMacroUrl;
+ Sequence aEventProps{ comphelper::makePropertyValue("EventType", OUString( "Script" )),
+ comphelper::makePropertyValue("Script", rMacroUrl) };
xEvents->replaceByName( "OnClick", Any( aEventProps ) );
}
catch( Exception& )
diff --git a/sc/source/filter/oox/viewsettings.cxx b/sc/source/filter/oox/viewsettings.cxx
index 926289134d16..45a6a8fbcdd8 100644
--- a/sc/source/filter/oox/viewsettings.cxx
+++ b/sc/source/filter/oox/viewsettings.cxx
@@ -626,11 +626,8 @@ void ViewSettings::finalizeImport()
if( aRangeProp.getProperty( aPos, PROP_Position ) && aRangeProp.getProperty( aSize, PROP_Size ) )
{
// set the visible area as sequence of long at the media descriptor
- Sequence< sal_Int32 > aWinExtent( 4 );
- aWinExtent[ 0 ] = aPos.X;
- aWinExtent[ 1 ] = aPos.Y;
- aWinExtent[ 2 ] = aPos.X + aSize.Width;
- aWinExtent[ 3 ] = aPos.Y + aSize.Height;
+ Sequence< sal_Int32 > aWinExtent{ aPos.X, aPos.Y,
+ aPos.X + aSize.Width, aPos.Y + aSize.Height };
getBaseFilter().getMediaDescriptor()[ "WinExtent" ] <<= aWinExtent;
}
}
diff --git a/sc/source/filter/oox/workbooksettings.cxx b/sc/source/filter/oox/workbooksettings.cxx
index ae2aa82e1a31..f23afc412012 100644
--- a/sc/source/filter/oox/workbooksettings.cxx
+++ b/sc/source/filter/oox/workbooksettings.cxx
@@ -24,6 +24,8 @@
#include <com/sun/star/util/Date.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <comphelper/propertyvalue.hxx>
#include <unotools/mediadescriptor.hxx>
#include <oox/core/binarycodec.hxx>
#include <oox/core/filterbase.hxx>
@@ -212,16 +214,12 @@ void WorkbookSettings::finalizeImport()
if (!maFileSharing.maHashValue.isEmpty())
{
- Sequence<PropertyValue> aResult;
- aResult.realloc(4);
- aResult[0].Name = "algorithm-name";
- aResult[0].Value <<= maFileSharing.maAlgorithmName;
- aResult[1].Name = "salt";
- aResult[1].Value <<= maFileSharing.maSaltValue;
- aResult[2].Name = "iteration-count";
- aResult[2].Value <<= maFileSharing.mnSpinCount;
- aResult[3].Name = "hash";
- aResult[3].Value <<= maFileSharing.maHashValue;
+ Sequence<PropertyValue> aResult{
+ comphelper::makePropertyValue("algorithm-name", maFileSharing.maAlgorithmName),
+ comphelper::makePropertyValue("salt", maFileSharing.maSaltValue),
+ comphelper::makePropertyValue("iteration-count", maFileSharing.mnSpinCount),
+ comphelper::makePropertyValue("hash", maFileSharing.maHashValue)
+ };
aSettingsProp.setProperty(PROP_ModifyPasswordInfo, aResult);
}
diff --git a/sc/source/filter/xml/XMLCodeNameProvider.cxx b/sc/source/filter/xml/XMLCodeNameProvider.cxx
index 103a157e447a..063729d5c2f8 100644
--- a/sc/source/filter/xml/XMLCodeNameProvider.cxx
+++ b/sc/source/filter/xml/XMLCodeNameProvider.cxx
@@ -20,6 +20,8 @@
#include "XMLCodeNameProvider.hxx"
#include <document.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include <comphelper/propertyvalue.hxx>
#include <comphelper/sequence.hxx>
using namespace com::sun::star;
@@ -80,13 +82,10 @@ sal_Bool SAL_CALL XMLCodeNameProvider::hasByName( const OUString& aName )
uno::Any SAL_CALL XMLCodeNameProvider::getByName( const OUString& aName )
{
uno::Any aRet;
- uno::Sequence<beans::PropertyValue> aProps(1);
- aProps[0].Name = gsCodeNameProp;
if( aName == gsDocName )
{
OUString sUCodeName( mpDoc->GetCodeName() );
- aProps[0].Value <<= sUCodeName;
- aRet <<= aProps;
+ aRet <<= uno::Sequence{ comphelper::makePropertyValue(gsCodeNameProp, sUCodeName) };
return aRet;
}
@@ -97,8 +96,7 @@ uno::Any SAL_CALL XMLCodeNameProvider::getByName( const OUString& aName )
if( mpDoc->GetName( i, sSheetName ) && sSheetName == aName )
{
mpDoc->GetCodeName( i, sCodeName );
- aProps[0].Value <<= sCodeName;
- aRet <<= aProps;
+ aRet <<= uno::Sequence{ comphelper::makePropertyValue(gsCodeNameProp, sCodeName) };
return aRet;
}
}
diff --git a/sc/source/filter/xml/xmldrani.cxx b/sc/source/filter/xml/xmldrani.cxx
index 9d596740ef74..a44168aebe7b 100644
--- a/sc/source/filter/xml/xmldrani.cxx
+++ b/sc/source/filter/xml/xmldrani.cxx
@@ -302,7 +302,7 @@ std::unique_ptr<ScDBData> ScXMLDatabaseRangeContext::ConvertToDBData(const OUStr
table::TableOrientation eOrient = mpQueryParam->bByRow ?
table::TableOrientation_ROWS : table::TableOrientation_COLUMNS;
aProperty.Value <<= eOrient;
- aSortSequence[nOldSize] = aProperty;
+ aSortSequence.getArray()[nOldSize] = aProperty;
ScSortParam aParam;
ScSortDescriptor::FillSortParam(aParam, aSortSequence);
diff --git a/sc/source/filter/xml/xmldrani.hxx b/sc/source/filter/xml/xmldrani.hxx
index 25e6d8c39d7d..a35074117c28 100644
--- a/sc/source/filter/xml/xmldrani.hxx
+++ b/sc/source/filter/xml/xmldrani.hxx
@@ -232,7 +232,7 @@ public:
void AddSubTotalColumn(const css::sheet::SubTotalColumn& rSubTotalColumn)
{
aSubTotalRule.aSubTotalColumns.realloc(aSubTotalRule.aSubTotalColumns.getLength() + 1);
- aSubTotalRule.aSubTotalColumns[aSubTotalRule.aSubTotalColumns.getLength() - 1] = rSubTotalColumn;
+ aSubTotalRule.aSubTotalColumns.getArray()[aSubTotalRule.aSubTotalColumns.getLength() - 1] = rSubTotalColumn;
}
};
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 1de7927c9634..cf68ebfb1854 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -5238,22 +5238,23 @@ void ScXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>&
sal_Int32 nCount(rProps.getLength());
rProps.realloc(nCount + nPropsToAdd);
+ auto pProps = rProps.getArray();
if (!aTrackedChangesKey.isEmpty())
{
- rProps[nCount].Name = "TrackedChangesProtectionKey";
- rProps[nCount].Value <<= aTrackedChangesKey.makeStringAndClear();
+ pProps[nCount].Name = "TrackedChangesProtectionKey";
+ pProps[nCount].Value <<= aTrackedChangesKey.makeStringAndClear();
++nCount;
}
if( bVBACompat )
{
- rProps[nCount].Name = "VBACompatibilityMode";
- rProps[nCount].Value <<= bVBACompat;
+ pProps[nCount].Name = "VBACompatibilityMode";
+ pProps[nCount].Value <<= bVBACompat;
++nCount;
}
if( xCodeNameAccess.is() )
{
- rProps[nCount].Name = "ScriptConfiguration";
- rProps[nCount].Value <<= xCodeNameAccess;
+ pProps[nCount].Name = "ScriptConfiguration";
+ pProps[nCount].Value <<= xCodeNameAccess;
++nCount;
}
}
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 1658d4781a25..d2d36d634caf 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -749,6 +749,7 @@ void ScXMLImport::SetConfigurationSettings(const uno::Sequence<beans::PropertyVa
sal_Int32 nCount(aConfigProps.getLength());
css::uno::Sequence<css::beans::PropertyValue> aFilteredProps(nCount);
+ auto pFilteredProps = aFilteredProps.getArray();
sal_Int32 nFilteredPropsLen = 0;
for (sal_Int32 i = nCount - 1; i >= 0; --i)
{
@@ -786,7 +787,7 @@ void ScXMLImport::SetConfigurationSettings(const uno::Sequence<beans::PropertyVa
}
if (aConfigProps[i].Name != "LinkUpdateMode")
{
- aFilteredProps[nFilteredPropsLen++] = aConfigProps[i];
+ pFilteredProps[nFilteredPropsLen++] = aConfigProps[i];
}
}
aFilteredProps.realloc(nFilteredPropsLen);
@@ -1693,8 +1694,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportFODS(SvStream &rStream)
{
{ "UserData", uno::Any(aUserData) },
}));
- css::uno::Sequence<uno::Any> aOuterArgs(1);
- aOuterArgs[0] <<= aAdaptorArgs;
+ css::uno::Sequence<uno::Any> aOuterArgs{ uno::Any(aAdaptorArgs) };
uno::Reference<lang::XInitialization> xInit(xInterface, uno::UNO_QUERY_THROW);
xInit->initialize(aOuterArgs);
diff --git a/sc/source/filter/xml/xmlsorti.cxx b/sc/source/filter/xml/xmlsorti.cxx
index db12134a38b6..6fab95c1d383 100644
--- a/sc/source/filter/xml/xmlsorti.cxx
+++ b/sc/source/filter/xml/xmlsorti.cxx
@@ -134,29 +134,30 @@ void SAL_CALL ScXMLSortContext::endFastElement( sal_Int32 /*nElement*/ )
if (nAlgoLength)
++i;
uno::Sequence <beans::PropertyValue> aSortDescriptor(7 + i);
- aSortDescriptor[0].Name = SC_UNONAME_BINDFMT;
- aSortDescriptor[0].Value <<= bBindFormatsToContent;
- aSortDescriptor[1].Name = SC_UNONAME_COPYOUT;
- aSortDescriptor[1].Value <<= bCopyOutputData;
- aSortDescriptor[2].Name = SC_UNONAME_ISCASE;
- aSortDescriptor[2].Value <<= bIsCaseSensitive;
- aSortDescriptor[3].Name = SC_UNONAME_ISULIST;
- aSortDescriptor[3].Value <<= bEnabledUserList;
- aSortDescriptor[4].Name = SC_UNONAME_OUTPOS;
- aSortDescriptor[4].Value <<= aOutputPosition;
- aSortDescriptor[5].Name = SC_UNONAME_UINDEX;
- aSortDescriptor[5].Value <<= nUserListIndex;
- aSortDescriptor[6].Name = SC_UNONAME_SORTFLD;
- aSortDescriptor[6].Value <<= aSortFields;
+ auto pSortDescriptor = aSortDescriptor.getArray();
+ pSortDescriptor[0].Name = SC_UNONAME_BINDFMT;
+ pSortDescriptor[0].Value <<= bBindFormatsToContent;
+ pSortDescriptor[1].Name = SC_UNONAME_COPYOUT;
+ pSortDescriptor[1].Value <<= bCopyOutputData;
+ pSortDescriptor[2].Name = SC_UNONAME_ISCASE;
+ pSortDescriptor[2].Value <<= bIsCaseSensitive;
+ pSortDescriptor[3].Name = SC_UNONAME_ISULIST;
+ pSortDescriptor[3].Value <<= bEnabledUserList;
+ pSortDescriptor[4].Name = SC_UNONAME_OUTPOS;
+ pSortDescriptor[4].Value <<= aOutputPosition;
+ pSortDescriptor[5].Name = SC_UNONAME_UINDEX;
+ pSortDescriptor[5].Value <<= nUserListIndex;
+ pSortDescriptor[6].Name = SC_UNONAME_SORTFLD;
+ pSortDescriptor[6].Value <<= aSortFields;
if (!maLanguageTagODF.isEmpty())
{
- aSortDescriptor[7].Name = SC_UNONAME_COLLLOC;
- aSortDescriptor[7].Value <<= maLanguageTagODF.getLanguageTag().getLocale( false);
+ pSortDescriptor[7].Name = SC_UNONAME_COLLLOC;
+ pSortDescriptor[7].Value <<= maLanguageTagODF.getLanguageTag().getLocale( false);
}
if (nAlgoLength)
{
- aSortDescriptor[6 + i].Name = SC_UNONAME_COLLALG;
- aSortDescriptor[6 + i].Value <<= sAlgorithm;
+ pSortDescriptor[6 + i].Name = SC_UNONAME_COLLALG;
+ pSortDescriptor[6 + i].Value <<= sAlgorithm;
}
pDatabaseRangeContext->SetSortSequence(aSortDescriptor);
}
@@ -192,7 +193,7 @@ void ScXMLSortContext::AddSortField(const OUString& sFieldNumber, const OUString
aSortField.FieldType = util::SortFieldType_NUMERIC;
}
aSortFields.realloc(aSortFields.getLength() + 1);
- aSortFields[aSortFields.getLength() - 1] = aSortField;
+ aSortFields.getArray()[aSortFields.getLength() - 1] = aSortField;
}
ScXMLSortByContext::ScXMLSortByContext( ScXMLImport& rImport,
diff --git a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
index 8bd4cef661bd..7db93dbe6d25 100644
--- a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
@@ -237,13 +237,14 @@ static void lcl_FillFontAttributes( Sequence< PropertyValue >& rSeq, const vcl::
SvxLanguageItem aLangItem( rFont.GetLanguage(), ATTR_FONT_LANGUAGE );
sal_Int32 nIndex = lcl_ExpandSequence( rSeq, 7 );
- lcl_FillProperty( rSeq[ nIndex++ ], "CharFontName", aFontItem, MID_FONT_FAMILY_NAME );
- lcl_FillProperty( rSeq[ nIndex++ ], "CharFontFamily", aFontItem, MID_FONT_FAMILY );
- lcl_FillProperty( rSeq[ nIndex++ ], "CharFontStyleName", aFontItem, MID_FONT_STYLE_NAME );
- lcl_FillProperty( rSeq[ nIndex++ ], "CharFontCharSet", aFontItem, MID_FONT_PITCH );
- lcl_FillProperty( rSeq[ nIndex++ ], "CharFontPitch", aFontItem, MID_FONT_CHAR_SET );
- lcl_FillProperty( rSeq[ nIndex++ ], "CharHeight", aHeightItem, MID_FONTHEIGHT );
- lcl_FillProperty( rSeq[ nIndex++ ], "CharLocale", aLangItem, MID_LANG_LOCALE );
+ auto pSeq = rSeq.getArray();
+ lcl_FillProperty( pSeq[ nIndex++ ], "CharFontName", aFontItem, MID_FONT_FAMILY_NAME );
+ lcl_FillProperty( pSeq[ nIndex++ ], "CharFontFamily", aFontItem, MID_FONT_FAMILY );
+ lcl_FillProperty( pSeq[ nIndex++ ], "CharFontStyleName", aFontItem, MID_FONT_STYLE_NAME );
+ lcl_FillProperty( pSeq[ nIndex++ ], "CharFontCharSet", aFontItem, MID_FONT_PITCH );
+ lcl_FillProperty( pSeq[ nIndex++ ], "CharFontPitch", aFontItem, MID_FONT_CHAR_SET );
+ lcl_FillProperty( pSeq[ nIndex++ ], "CharHeight", aHeightItem, MID_FONTHEIGHT );
+ lcl_FillProperty( pSeq[ nIndex++ ], "CharLocale", aLangItem, MID_LANG_LOCALE );
}
ScAccessibleCsvRuler::ScAccessibleCsvRuler(ScCsvRuler& rRuler)
@@ -300,8 +301,7 @@ Reference< XAccessibleRelationSet > SAL_CALL ScAccessibleCsvRuler::getAccessible
css::uno::Reference<css::accessibility::XAccessible> xAccObj(static_cast<ScAccessibleCsvGrid*>(rGrid.GetAccessible()));
if( xAccObj.is() )
{
- Sequence< Reference< XInterface > > aSeq( 1 );
- aSeq[ 0 ] = xAccObj;
+ Sequence< Reference< XInterface > > aSeq{ xAccObj };
pRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::CONTROLLER_FOR, aSeq ) );
}
@@ -862,8 +862,7 @@ Reference< XAccessibleRelationSet > SAL_CALL ScAccessibleCsvGrid::getAccessibleR
css::uno::Reference<css::accessibility::XAccessible> xAccObj(static_cast<ScAccessibleCsvGrid*>(rRuler.GetAccessible()));
if( xAccObj.is() )
{
- Sequence< Reference< XInterface > > aSeq( 1 );
- aSeq[ 0 ] = xAccObj;
+ Sequence< Reference< XInterface > > aSeq{ xAccObj };
pRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::CONTROLLED_BY, aSeq ) );
}
}
@@ -959,11 +958,12 @@ Sequence< sal_Int32 > SAL_CALL ScAccessibleCsvGrid::getSelectedAccessibleColumns
ScCsvGrid& rGrid = implGetGrid();
Sequence< sal_Int32 > aSeq( implGetColumnCount() );
+ auto pSeq = aSeq.getArray();
sal_Int32 nSeqIx = 0;
sal_uInt32 nColIx = rGrid.GetFirstSelected();
for( ; nColIx != CSV_COLUMN_INVALID; ++nSeqIx, nColIx = rGrid.GetNextSelected( nColIx ) )
- aSeq[ nSeqIx ] = lcl_GetApiColumn( nColIx );
+ pSeq[ nSeqIx ] = lcl_GetApiColumn( nColIx );
aSeq.realloc( nSeqIx );
return aSeq;
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 0ac7d931d6e6..913a2984421f 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -900,8 +900,7 @@ rtl::Reference<utl::AccessibleRelationSetHelper> ScChildrenShapes::GetRelationSe
pRelationSet = new utl::AccessibleRelationSetHelper();
AccessibleRelation aRelation;
- aRelation.TargetSet.realloc(1);
- aRelation.TargetSet[0] = Get(pAccShapeData);
+ aRelation.TargetSet = { Get(pAccShapeData) };
aRelation.RelationType = AccessibleRelationType::CONTROLLER_FOR;
pRelationSet->AddRelation(aRelation);
@@ -1154,8 +1153,7 @@ uno::Reference<XAccessibleRelationSet> ScChildrenShapes::GetRelationSet(const Sc
}
}
AccessibleRelation aRelation;
- aRelation.TargetSet.realloc(1);
- aRelation.TargetSet[0] = xAccessible;
+ aRelation.TargetSet = { xAccessible };
aRelation.RelationType = AccessibleRelationType::CONTROLLED_BY;
pRelationSet->AddRelation(aRelation);
}
diff --git a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx
index 09f6cf59e522..2f2cb48f6b5c 100644
--- a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx
+++ b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx
@@ -536,7 +536,7 @@ uno::Sequence<OUString> SAL_CALL ScAccessiblePreviewTable::getSupportedServiceNa
sal_Int32 nOldSize(aSequence.getLength());
aSequence.realloc(nOldSize + 1);
- aSequence[nOldSize] = "com.sun.star.table.AccessibleTableView";
+ aSequence.getArray()[nOldSize] = "com.sun.star.table.AccessibleTableView";
return aSequence;
}
diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
index 9ec585712587..7d3443bb029c 100644
--- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
+++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
@@ -17,6 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <tbzoomsliderctrl.hxx>
+
+#include <comphelper/propertyvalue.hxx>
#include <vcl/InterimItemWindow.hxx>
#include <vcl/event.hxx>
#include <vcl/image.hxx>
@@ -261,9 +263,7 @@ bool ScZoomSlider::MouseButtonDown( const MouseEvent& rMEvt )
css::uno::Any a;
aZoomSliderItem.QueryValue( a );
- css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 );
- aArgs[0].Name = "ScalingFactor";
- aArgs[0].Value = a;
+ css::uno::Sequence aArgs{ comphelper::makePropertyValue("ScalingFactor", a) };
SfxToolBoxControl::Dispatch( m_xDispatchProvider, ".uno:ScalingFactor", aArgs );
@@ -298,9 +298,7 @@ bool ScZoomSlider::MouseMove( const MouseEvent& rMEvt )
css::uno::Any a;
aZoomSliderItem.QueryValue( a );
- css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 );
- aArgs[0].Name = "ScalingFactor";
- aArgs[0].Value = a;
+ css::uno::Sequence aArgs{ comphelper::makePropertyValue("ScalingFactor", a) };
SfxToolBoxControl::Dispatch( m_xDispatchProvider, ".uno:ScalingFactor", aArgs );
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 7b7c727e8e1e..f0f82517a844 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -26,6 +26,7 @@
#include <editeng/justifyitem.hxx>
#include <comphelper/fileformat.h>
#include <comphelper/classids.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <formula/errorcodes.hxx>
#include <vcl/stdtext.hxx>
#include <vcl/svapp.hxx>
@@ -648,8 +649,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents = m_aDocument.GetVbaEventProcessor();
if ( xVbaEvents.is() ) try
{
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[0] <<= pScHint->GetTab1();
+ uno::Sequence< uno::Any > aArgs{ uno::Any(pScHint->GetTab1()) };
xVbaEvents->processVbaEvent( script::vba::VBAEventId::WORKBOOK_NEWSHEET, aArgs );
}
catch( uno::Exception& )
@@ -893,16 +893,19 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
uno::Reference< frame::XStorable > xStor( GetModel(), uno::UNO_QUERY_THROW );
// TODO/LATER: More entries from the MediaDescriptor might be interesting for the merge
- uno::Sequence< beans::PropertyValue > aValues(1);
- aValues[0].Name = "FilterName";
- aValues[0].Value <<= GetMedium()->GetFilter()->GetFilterName();
+ uno::Sequence< beans::PropertyValue > aValues{
+ comphelper::makePropertyValue(
+ "FilterName",
+ GetMedium()->GetFilter()->GetFilterName())
+ };
const SfxStringItem* pPasswordItem = SfxItemSet::GetItem<SfxStringItem>(GetMedium()->GetItemSet(), SID_PASSWORD, false);
if ( pPasswordItem && !pPasswordItem->GetValue().isEmpty() )
{
aValues.realloc( 2 );
- aValues[1].Name = "Password";
- aValues[1].Value <<= pPasswordItem->GetValue();
+ auto pValues = aValues.getArray();
+ pValues[1].Name = "Password";
+ pValues[1].Value <<= pPasswordItem->GetValue();
}
SC_MOD()->SetInSharedDocSaving( true );
@@ -1049,8 +1052,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
uno::Any aWorkbook;
aWorkbook <<= mxAutomationWorkbookObject;
- uno::Sequence< uno::Any > aArgs(1);
- aArgs[0] = aWorkbook;
+ uno::Sequence< uno::Any > aArgs{ aWorkbook };
SC_MOD()->CallAutomationApplicationEventSinks( "NewWorkbook", aArgs );
}
break;
@@ -1058,8 +1060,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
uno::Any aWorkbook;
aWorkbook <<= mxAutomationWorkbookObject;
- uno::Sequence< uno::Any > aArgs(1);
- aArgs[0] = aWorkbook;
+ uno::Sequence< uno::Any > aArgs{ aWorkbook };
SC_MOD()->CallAutomationApplicationEventSinks( "WorkbookOpen", aArgs );
}
break;
@@ -2718,8 +2719,7 @@ bool ScDocShell::QuerySlotExecutable( sal_uInt16 nSlotId )
case SID_SAVEDOC:
case SID_SAVEASDOC:
nVbaEventId = VBAEventId::WORKBOOK_BEFORESAVE;
- aArgs.realloc( 1 );
- aArgs[ 0 ] <<= (nSlotId == SID_SAVEASDOC);
+ aArgs = { uno::Any(nSlotId == SID_SAVEASDOC) };
break;
case SID_PRINTDOC:
case SID_PRINTDOCDIRECT:
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index bba2d90a0a71..e4fb0ee54627 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -60,6 +60,7 @@ using namespace ::com::sun::star;
#include <comphelper/lok.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <docuno.hxx>
#include <docsh.hxx>
@@ -2724,9 +2725,7 @@ uno::Reference< frame::XModel > ScDocShell::LoadSharedDocument()
{
SC_MOD()->SetInSharedDocLoading( true );
uno::Reference< frame::XDesktop2 > xLoader = frame::Desktop::create( ::comphelper::getProcessComponentContext() );
- uno::Sequence < beans::PropertyValue > aArgs( 1 );
- aArgs[0].Name = "Hidden";
- aArgs[0].Value <<= true;
+ uno::Sequence aArgs{ comphelper::makePropertyValue("Hidden", true) };
if ( GetMedium() )
{
@@ -2734,15 +2733,17 @@ uno::Reference< frame::XModel > ScDocShell::LoadSharedDocument()
if ( pPasswordItem && !pPasswordItem->GetValue().isEmpty() )
{
aArgs.realloc( 2 );
- aArgs[1].Name = "Password";
- aArgs[1].Value <<= pPasswordItem->GetValue();
+ auto pArgs = aArgs.getArray();
+ pArgs[1].Name = "Password";
+ pArgs[1].Value <<= pPasswordItem->GetValue();
}
const SfxUnoAnyItem* pEncryptionItem = SfxItemSet::GetItem<SfxUnoAnyItem>(GetMedium()->GetItemSet(), SID_ENCRYPTIONDATA, false);
if (pEncryptionItem)
{
aArgs.realloc(aArgs.getLength() + 1);
- aArgs[aArgs.getLength() - 1].Name = "EncryptionData";
- aArgs[aArgs.getLength() - 1].Value = pEncryptionItem->GetValue();
+ auto pArgs = aArgs.getArray();
+ pArgs[aArgs.getLength() - 1].Name = "EncryptionData";
+ pArgs[aArgs.getLength() - 1].Value = pEncryptionItem->GetValue();
}
}
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index 3b46a14e190d..df7a0c37d474 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -180,19 +180,20 @@ void lcl_ChartInit(const uno::Reference <embed::XEmbeddedObject>& xObj, ScViewDa
}
}
- uno::Sequence< beans::PropertyValue > aArgs( 4 );
- aArgs[0] = beans::PropertyValue(
- "CellRangeRepresentation", -1,
- uno::makeAny( aRangeString ), beans::PropertyState_DIRECT_VALUE );
- aArgs[1] = beans::PropertyValue(
- "HasCategories", -1,
- uno::makeAny( bHasCategories ), beans::PropertyState_DIRECT_VALUE );
- aArgs[2] = beans::PropertyValue(
- "FirstCellAsLabel", -1,
- uno::makeAny( bFirstCellAsLabel ), beans::PropertyState_DIRECT_VALUE );
- aArgs[3] = beans::PropertyValue(
- "DataRowSource", -1,
- uno::makeAny( eDataRowSource ), beans::PropertyState_DIRECT_VALUE );
+ uno::Sequence< beans::PropertyValue > aArgs{
+ beans::PropertyValue(
+ "CellRangeRepresentation", -1,
+ uno::makeAny( aRangeString ), beans::PropertyState_DIRECT_VALUE ),
+ beans::PropertyValue(
+ "HasCategories", -1,
+ uno::makeAny( bHasCategories ), beans::PropertyState_DIRECT_VALUE ),
+ beans::PropertyValue(
+ "FirstCellAsLabel", -1,
+ uno::makeAny( bFirstCellAsLabel ), beans::PropertyState_DIRECT_VALUE ),
+ beans::PropertyValue(
+ "DataRowSource", -1,
+ uno::makeAny( eDataRowSource ), beans::PropertyState_DIRECT_VALUE )
+ };
try
{
diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx
index c331dddcb539..0905e67f91af 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -921,6 +921,7 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal
sal_Int32 nAdd = ( aLeftRange.aEnd.Col() - aLeftRange.aStart.Col() + 1 ) *
( aLeftRange.aEnd.Row() - aLeftRange.aStart.Row() + 1 );
aConstraints.realloc( nConstrPos + nAdd );
+ auto pConstraints = aConstraints.getArray();
for (SCROW nRow = aLeftRange.aStart.Row(); nRow <= aLeftRange.aEnd.Row(); ++nRow)
for (SCCOL nCol = aLeftRange.aStart.Col(); nCol <= aLeftRange.aEnd.Col(); ++nCol)
@@ -931,7 +932,7 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal
aRightRange.aStart.Col() + ( nCol - aLeftRange.aStart.Col() ),
aRightRange.aStart.Row() + ( nRow - aLeftRange.aStart.Row() ) );
- aConstraints[nConstrPos++] = aConstraint;
+ pConstraints[nConstrPos++] = aConstraint;
}
}
}
@@ -964,7 +965,7 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal
}
aConstraints.realloc( nConstrPos + 1 );
- aConstraints[nConstrPos++] = aConstraint;
+ aConstraints.getArray()[nConstrPos++] = aConstraint;
}
// copy old document values
diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx
index 770520785b39..35d5f956797e 100644
--- a/sc/source/ui/miscdlgs/solveroptions.cxx
+++ b/sc/source/ui/miscdlgs/solveroptions.cxx
@@ -125,9 +125,10 @@ const uno::Sequence<beans::PropertyValue>& ScSolverOptionsDialog::GetProperties(
sal_Int32 nEntryCount = maProperties.getLength();
if (nEntryCount == m_xLbSettings->n_children())
{
+ auto maPropertiesRange = asNonConstRange(maProperties);
for (sal_Int32 nEntryPos=0; nEntryPos<nEntryCount; ++nEntryPos)
{
- uno::Any& rValue = maProperties[nEntryPos].Value;
+ uno::Any& rValue = maPropertiesRange[nEntryPos].Value;
if (ScSolverOptionsString* pStringItem = reinterpret_cast<ScSolverOptionsString*>(m_xLbSettings->get_id(nEntryPos).toInt64()))
{
if (pStringItem->IsDouble())
diff --git a/sc/source/ui/miscdlgs/solverutil.cxx b/sc/source/ui/miscdlgs/solverutil.cxx
index df9fa8ae9883..6ba2707867e5 100644
--- a/sc/source/ui/miscdlgs/solverutil.cxx
+++ b/sc/source/ui/miscdlgs/solverutil.cxx
@@ -81,9 +81,9 @@ void ScSolverUtil::GetImplementations( uno::Sequence<OUString>& rImplNames,
sDescription = sName; // use implementation name if no description available
rImplNames.realloc( nCount+1 );
- rImplNames[nCount] = sName;
+ rImplNames.getArray()[nCount] = sName;
rDescriptions.realloc( nCount+1 );
- rDescriptions[nCount] = sDescription;
+ rDescriptions.getArray()[nCount] = sDescription;
++nCount;
}
catch (const css::uno::Exception&)
@@ -155,6 +155,7 @@ uno::Sequence<beans::PropertyValue> ScSolverUtil::GetDefaults( std::u16string_vi
const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties();
const sal_Int32 nSize = aPropSeq.getLength();
aDefaults.realloc(nSize);
+ auto pDefaults = aDefaults.getArray();
sal_Int32 nValid = 0;
for (const beans::Property& rProp : aPropSeq)
{
@@ -162,7 +163,7 @@ uno::Sequence<beans::PropertyValue> ScSolverUtil::GetDefaults( std::u16string_vi
uno::TypeClass eClass = aValue.getValueTypeClass();
// only use properties of supported types
if ( eClass == uno::TypeClass_BOOLEAN || eClass == uno::TypeClass_LONG || eClass == uno::TypeClass_DOUBLE )
- aDefaults[nValid++] = beans::PropertyValue( rProp.Name, -1, aValue, beans::PropertyState_DIRECT_VALUE );
+ pDefaults[nValid++] = beans::PropertyValue( rProp.Name, -1, aValue, beans::PropertyState_DIRECT_VALUE );
}
aDefaults.realloc(nValid);
diff --git a/sc/source/ui/unoobj/PivotTableDataSequence.cxx b/sc/source/ui/unoobj/PivotTableDataSequence.cxx
index 330cca25dfb8..64384fb8962d 100644
--- a/sc/source/ui/unoobj/PivotTableDataSequence.cxx
+++ b/sc/source/ui/unoobj/PivotTableDataSequence.cxx
@@ -74,14 +74,15 @@ uno::Sequence<uno::Any> SAL_CALL PivotTableDataSequence::getData()
throw uno::RuntimeException();
uno::Sequence<uno::Any> aSeq(m_aData.size());
+ auto pSeq = aSeq.getArray();
size_t i = 0;
for (ValueAndFormat const & rItem : m_aData)
{
if (rItem.m_eType == ValueType::Numeric)
- aSeq[i] <<= double(rItem.m_fValue);
+ pSeq[i] <<= double(rItem.m_fValue);
else if (rItem.m_eType == ValueType::String)
- aSeq[i] <<= rItem.m_aString;
+ pSeq[i] <<= rItem.m_aString;
i++;
}
@@ -97,11 +98,12 @@ uno::Sequence<double> SAL_CALL PivotTableDataSequence::getNumericalData()
throw uno::RuntimeException();
uno::Sequence<double> aSeq(m_aData.size());
+ auto pSeq = aSeq.getArray();
size_t i = 0;
for (ValueAndFormat const & rItem : m_aData)
{
- aSeq[i] = rItem.m_fValue;
+ pSeq[i] = rItem.m_fValue;
i++;
}
return aSeq;
@@ -116,12 +118,13 @@ uno::Sequence<OUString> SAL_CALL PivotTableDataSequence::getTextualData()
throw uno::RuntimeException();
uno::Sequence<OUString> aSeq(m_aData.size());
+ auto pSeq = aSeq.getArray();
size_t i = 0;
for (ValueAndFormat const & rItem : m_aData)
{
if (rItem.m_eType == ValueType::String)
- aSeq[i] = rItem.m_aString;
+ pSeq[i] = rItem.m_aString;
i++;
}
return aSeq;
diff --git a/sc/source/ui/unoobj/cellvaluebinding.cxx b/sc/source/ui/unoobj/cellvaluebinding.cxx
index ba72cf8e6c51..cba68f9cbc35 100644
--- a/sc/source/ui/unoobj/cellvaluebinding.cxx
+++ b/sc/source/ui/unoobj/cellvaluebinding.cxx
@@ -141,19 +141,21 @@ namespace calc
Sequence< Type > aTypes( nCount );
if ( m_xCell.is() )
{
+ auto pTypes = aTypes.getArray();
+
// an XCell can be used to set/get "double" values
- aTypes[0] = ::cppu::UnoType<double>::get();
+ pTypes[0] = ::cppu::UnoType<double>::get();
if ( m_xCellText.is() )
{
// an XTextRange can be used to set/get "string" values
- aTypes[1] = ::cppu::UnoType<OUString>::get();
+ pTypes[1] = ::cppu::UnoType<OUString>::get();
// and additionally, we use it to handle booleans
- aTypes[2] = ::cppu::UnoType<sal_Bool>::get();
+ pTypes[2] = ::cppu::UnoType<sal_Bool>::get();
}
// add sal_Int32 only if constructed as ListPositionCellBinding
if ( m_bListPos )
- aTypes[nCount-1] = cppu::UnoType<sal_Int32>::get();
+ pTypes[nCount-1] = cppu::UnoType<sal_Int32>::get();
}
return aTypes;
@@ -429,10 +431,11 @@ namespace calc
Sequence< OUString > SAL_CALL OCellValueBinding::getSupportedServiceNames( )
{
Sequence< OUString > aServices( m_bListPos ? 3 : 2 );
- aServices[ 0 ] = "com.sun.star.table.CellValueBinding";
- aServices[ 1 ] = "com.sun.star.form.binding.ValueBinding";
+ auto pServices = aServices.getArray();
+ pServices[ 0 ] = "com.sun.star.table.CellValueBinding";
+ pServices[ 1 ] = "com.sun.star.form.binding.ValueBinding";
if ( m_bListPos )
- aServices[ 2 ] = "com.sun.star.table.ListPositionCellBinding";
+ pServices[ 2 ] = "com.sun.star.table.ListPositionCellBinding";
return aServices;
}
diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx
index 5300f91a0d3c..1de57336b2b4 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -223,19 +223,20 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName,
xReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier );
// set arguments
- uno::Sequence< beans::PropertyValue > aArgs( 4 );
- aArgs[0] = beans::PropertyValue(
- "CellRangeRepresentation", -1,
- uno::makeAny( sRangeStr ), beans::PropertyState_DIRECT_VALUE );
- aArgs[1] = beans::PropertyValue(
- "HasCategories", -1,
- uno::makeAny( bRowHeaders ), beans::PropertyState_DIRECT_VALUE );
- aArgs[2] = beans::PropertyValue(
- "FirstCellAsLabel", -1,
- uno::makeAny( bColumnHeaders ), beans::PropertyState_DIRECT_VALUE );
- aArgs[3] = beans::PropertyValue(
- "DataRowSource", -1,
- uno::makeAny( chart::ChartDataRowSource_COLUMNS ), beans::PropertyState_DIRECT_VALUE );
+ uno::Sequence< beans::PropertyValue > aArgs{
+ beans::PropertyValue(
+ "CellRangeRepresentation", -1,
+ uno::makeAny( sRangeStr ), beans::PropertyState_DIRECT_VALUE ),
+ beans::PropertyValue(
+ "HasCategories", -1,
+ uno::makeAny( bRowHeaders ), beans::PropertyState_DIRECT_VALUE ),
+ beans::PropertyValue(
+ "FirstCellAsLabel", -1,
+ uno::makeAny( bColumnHeaders ), beans::PropertyState_DIRECT_VALUE ),
+ beans::PropertyValue(
+ "DataRowSource", -1,
+ uno::makeAny( chart::ChartDataRowSource_COLUMNS ), beans::PropertyState_DIRECT_VALUE )
+ };
xReceiver->setArguments( aArgs );
}
diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx
index 573d70a75794..4654efa6caf6 100644
--- a/sc/source/ui/unoobj/condformatuno.cxx
+++ b/sc/source/ui/unoobj/condformatuno.cxx
@@ -7,6 +7,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <sal/config.h>
+
+#include <algorithm>
#include <memory>
#include <condformatuno.hxx>
@@ -375,13 +378,9 @@ uno::Sequence<uno::Reference<sheet::XConditionalFormat> > ScCondFormatsObj::getC
ScConditionalFormatList* pFormatList = getCoreObject();
size_t n = pFormatList->size();
uno::Sequence<uno::Reference<sheet::XConditionalFormat> > aCondFormats(n);
- sal_Int32 i = 0;
- for (const auto& rFormat : *pFormatList)
- {
- uno::Reference<sheet::XConditionalFormat> xCondFormat(new ScCondFormatObj(mpDocShell, this, rFormat->GetKey()));
- aCondFormats[i] = xCondFormat;
- ++i;
- }
+ std::transform(pFormatList->begin(), pFormatList->end(), aCondFormats.getArray(),
+ [this](const auto& rFormat)
+ { return uno::Reference(new ScCondFormatObj(mpDocShell, this, rFormat->GetKey())); });
return aCondFormats;
}
@@ -954,9 +953,10 @@ uno::Any SAL_CALL ScColorScaleFormatObj::getPropertyValue( const OUString& aProp
case ColorScaleEntries:
{
uno::Sequence<uno::Reference<sheet::XColorScaleEntry> > aEntries(getCoreObject()->size());
+ auto aEntriesRange = asNonConstRange(aEntries);
for (size_t i = 0; i < getCoreObject()->size(); ++i)
{
- aEntries[i] = new ScColorScaleEntryObj(this, i);
+ aEntriesRange[i] = new ScColorScaleEntryObj(this, i);
}
aAny <<= aEntries;
}
@@ -1638,9 +1638,10 @@ uno::Any SAL_CALL ScIconSetFormatObj::getPropertyValue( const OUString& aPropert
{
size_t nSize = getCoreObject()->size();
uno::Sequence<uno::Reference<sheet::XIconSetEntry> > aEntries(nSize);
+ auto aEntriesRange = asNonConstRange(aEntries);
for (size_t i = 0; i < nSize; ++i)
{
- aEntries[i] = new ScIconSetEntryObj(this, i);
+ aEntriesRange[i] = new ScIconSetEntryObj(this, i);
}
aAny <<= aEntries;
}
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 99de5a326b62..7d5a6e46a0ec 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -2043,8 +2043,9 @@ Sequence< sal_Int16 > ScDataPilotFieldObj::getSubtotals() const
if ( nCount > 0 )
{
aRet.realloc( nCount );
+ auto pRet = aRet.getArray();
for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
- aRet[ nIdx ] = static_cast<sal_Int16>(pDim->GetSubTotalFunc( nIdx ));
+ pRet[ nIdx ] = static_cast<sal_Int16>(pDim->GetSubTotalFunc( nIdx ));
}
}
}
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index e493a6b175c9..985f07cf47d4 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -1267,14 +1267,14 @@ uno::Sequence<sheet::TableFilterField3> SAL_CALL ScFilterDescriptorBase::getFilt
{
aField.Operator = sheet::FilterOperator2::EMPTY;
aField.Values.realloc(1);
- aField.Values[0].NumericValue = 0;
+ aField.Values.getArray()[0].NumericValue = 0;
bByEmpty = true;
}
else if (rEntry.IsQueryByNonEmpty())
{
aField.Operator = sheet::FilterOperator2::NOT_EMPTY;
aField.Values.realloc(1);
- aField.Values[0].NumericValue = 0;
+ aField.Values.getArray()[0].NumericValue = 0;
bByEmpty = true;
}
}
@@ -1284,12 +1284,13 @@ uno::Sequence<sheet::TableFilterField3> SAL_CALL ScFilterDescriptorBase::getFilt
const ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems();
size_t nItemCount = rItems.size();
aField.Values.realloc(nItemCount);
+ auto pValues = aField.Values.getArray();
size_t j = 0;
for (const auto& rItem : rItems)
{
- aField.Values[j].IsNumeric = rItem.meType != ScQueryEntry::ByString;
- aField.Values[j].StringValue = rItem.maString.getString();
- aField.Values[j].NumericValue = rItem.mfVal;
+ pValues[j].IsNumeric = rItem.meType != ScQueryEntry::ByString;
+ pValues[j].StringValue = rItem.maString.getString();
+ pValues[j].NumericValue = rItem.mfVal;
++j;
}
}
@@ -2285,10 +2286,11 @@ uno::Sequence<OUString> SAL_CALL ScDatabaseRangesObj::getElementNames()
{
const ScDBCollection::NamedDBs& rDBs = pNames->getNamedDBs();
uno::Sequence<OUString> aSeq(rDBs.size());
+ auto aSeqRange = asNonConstRange(aSeq);
size_t i = 0;
for (const auto& rDB : rDBs)
{
- aSeq[i] = rDB->GetName();
+ aSeqRange[i] = rDB->GetName();
++i;
}
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 6a9d0d890556..11016aafb202 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -20,6 +20,8 @@
#include <config_feature_opencl.h>
#include <scitems.hxx>
+
+#include <comphelper/propertyvalue.hxx>
#include <comphelper/sequence.hxx>
#include <editeng/brushitem.hxx>
#include <editeng/editview.hxx>
@@ -297,15 +299,10 @@ ScPrintUIOptions::ScPrintUIOptions()
// create a choice for the range to print
OUString aPrintRangeName( "PrintRange" );
- aChoices.realloc( 2 );
- aHelpIds.realloc( 2 );
- uno::Sequence< OUString > aWidgetIds( 2 );
- aChoices[0] = ScResId( SCSTR_PRINTOPT_PRINTALLPAGES );
- aHelpIds[0] = ".HelpID:vcl:PrintDialog:PrintRange:RadioButton:0";
- aWidgetIds[0] = "rbAllPages";
- aChoices[1] = ScResId( SCSTR_PRINTOPT_PRINTPAGES );
- aHelpIds[1] = ".HelpID:vcl:PrintDialog:PrintRange:RadioButton:1";
- aWidgetIds[1] = "rbRangePages";
+ aChoices = { ScResId( SCSTR_PRINTOPT_PRINTALLPAGES ), ScResId( SCSTR_PRINTOPT_PRINTPAGES ) };
+ aHelpIds = { ".HelpID:vcl:PrintDialog:PrintRange:RadioButton:0",
+ ".HelpID:vcl:PrintDialog:PrintRange:RadioButton:1" };
+ uno::Sequence< OUString > aWidgetIds{ "rbAllPages", "rbRangePages" };
m_aUIProperties[nIdx++].Value = setChoiceRadiosControlOpt(aWidgetIds, OUString(),
aHelpIds,
aPrintRangeName,
@@ -2585,19 +2582,15 @@ uno::Reference< container::XIndexAccess > SAL_CALL ScModelObj::getViewData( )
uno::Reference < container::XIndexContainer > xCont = document::IndexedPropertyValues::create( ::comphelper::getProcessComponentContext() );
xRet.set( xCont, uno::UNO_QUERY_THROW );
- uno::Sequence< beans::PropertyValue > aSeq;
- aSeq.realloc(3);
OUString sName;
pDocShell->GetDocument().GetName( pDocShell->GetDocument().GetVisibleTab(), sName );
- OUString sOUName(sName);
- aSeq[0].Name = SC_ACTIVETABLE;
- aSeq[0].Value <<= sOUName;
SCCOL nPosLeft = pDocShell->GetDocument().GetPosLeft();
- aSeq[1].Name = SC_POSITIONLEFT;
- aSeq[1].Value <<= nPosLeft;
SCROW nPosTop = pDocShell->GetDocument().GetPosTop();
- aSeq[2].Name = SC_POSITIONTOP;
- aSeq[2].Value <<= nPosTop;
+ uno::Sequence< beans::PropertyValue > aSeq{
+ comphelper::makePropertyValue(SC_ACTIVETABLE, sName),
+ comphelper::makePropertyValue(SC_POSITIONLEFT, nPosLeft),
+ comphelper::makePropertyValue(SC_POSITIONTOP, nPosTop)
+ };
xCont->insertByIndex( 0, uno::makeAny( aSeq ) );
}
}
@@ -3163,6 +3156,7 @@ void ScModelObj::NotifyChanges( const OUString& rOperation, const ScRangeList& r
size_t nRangeCount = rRanges.size();
aEvent.Changes.realloc( static_cast< sal_Int32 >( nRangeCount ) );
+ auto pChanges = aEvent.Changes.getArray();
for ( size_t nIndex = 0; nIndex < nRangeCount; ++nIndex )
{
uno::Reference< table::XCellRange > xRangeObj;
@@ -3177,7 +3171,7 @@ void ScModelObj::NotifyChanges( const OUString& rOperation, const ScRangeList& r
xRangeObj.set( new ScCellRangeObj( pDocShell, rRange ) );
}
- util::ElementChange& rChange = aEvent.Changes[ static_cast< sal_Int32 >( nIndex ) ];
+ util::ElementChange& rChange = pChanges[ static_cast< sal_Int32 >( nIndex ) ];
rChange.Accessor <<= rOperation;
rChange.Element <<= rProperties;
rChange.ReplacedElement <<= xRangeObj;
@@ -3238,8 +3232,7 @@ void ScModelObj::NotifyChanges( const OUString& rOperation, const ScRangeList& r
else
xTarget.set( static_cast<cppu::OWeakObject*>( new ScCellRangesObj( pDocShell, aTabRanges ) ) );
- uno::Sequence<uno::Any> aParams(1);
- aParams[0] <<= xTarget;
+ uno::Sequence<uno::Any> aParams{ uno::Any(xTarget) };
uno::Any aRet;
uno::Sequence<sal_Int16> aOutArgsIndex;
@@ -3282,8 +3275,7 @@ void ScModelObj::HandleCalculateEvents()
try
{
uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW );
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[ 0 ] <<= nTab;
+ uno::Sequence< uno::Any > aArgs{ uno::Any(nTab) };
xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( ScSheetEventId::CALCULATE ), aArgs );
}
catch( uno::Exception& )
@@ -3406,18 +3398,20 @@ uno::Sequence< sheet::opencl::OpenCLPlatform > ScModelObj::getOpenCLPlatforms()
sc::FormulaGroupInterpreter::fillOpenCLInfo(aPlatformInfo);
uno::Sequence<sheet::opencl::OpenCLPlatform> aRet(aPlatformInfo.size());
+ auto aRetRange = asNonConstRange(aRet);
for(size_t i = 0; i < aPlatformInfo.size(); ++i)
{
- aRet[i].Name = aPlatformInfo[i].maName;
- aRet[i].Vendor = aPlatformInfo[i].maVendor;
+ aRetRange[i].Name = aPlatformInfo[i].maName;
+ aRetRange[i].Vendor = aPlatformInfo[i].maVendor;
- aRet[i].Devices.realloc(aPlatformInfo[i].maDevices.size());
+ aRetRange[i].Devices.realloc(aPlatformInfo[i].maDevices.size());
+ auto pDevices = aRetRange[i].Devices.getArray();
for(size_t j = 0; j < aPlatformInfo[i].maDevices.size(); ++j)
{
const OpenCLDeviceInfo& rDevice = aPlatformInfo[i].maDevices[j];
- aRet[i].Devices[j].Name = rDevice.maName;
- aRet[i].Devices[j].Vendor = rDevice.maVendor;
- aRet[i].Devices[j].Driver = rDevice.maDriver;
+ pDevices[j].Name = rDevice.maName;
+ pDevices[j].Vendor = rDevice.maVendor;
+ pDevices[j].Driver = rDevice.maDriver;
}
}
@@ -3848,10 +3842,11 @@ uno::Sequence < uno::Reference< table::XCellRange > > SAL_CALL ScTableSheetsObj:
throw lang::IllegalArgumentException();
xRet.realloc(nCount);
+ auto pRet = xRet.getArray();
for( size_t nIndex = 0; nIndex < nCount; nIndex++ )
{
const ScRange & rRange = aRangeList[ nIndex ];
- xRet[nIndex] = new ScCellRangeObj(pDocShell, rRange);
+ pRet[nIndex] = new ScCellRangeObj(pDocShell, rRange);
}
return xRet;
diff --git a/sc/source/ui/unoobj/eventuno.cxx b/sc/source/ui/unoobj/eventuno.cxx
index c1d37d1d4490..48512812b164 100644
--- a/sc/source/ui/unoobj/eventuno.cxx
+++ b/sc/source/ui/unoobj/eventuno.cxx
@@ -145,8 +145,9 @@ uno::Sequence<OUString> SAL_CALL ScSheetEventsObj::getElementNames()
{
SolarMutexGuard aGuard;
auto aNames = uno::Sequence<OUString>(int(ScSheetEventId::COUNT));
+ auto pNames = aNames.getArray();
for (sal_Int32 nEvent=0; nEvent<int(ScSheetEventId::COUNT); ++nEvent)
- aNames[nEvent] = ScSheetEvents::GetEventName(static_cast<ScSheetEventId>(nEvent));
+ pNames[nEvent] = ScSheetEvents::GetEventName(static_cast<ScSheetEventId>(nEvent));
return aNames;
}
diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx
index d58e19fc0b3e..8bafd796a430 100644
--- a/sc/source/ui/unoobj/linkuno.cxx
+++ b/sc/source/ui/unoobj/linkuno.cxx
@@ -1454,8 +1454,9 @@ Sequence< sal_Int32 > SAL_CALL ScExternalSheetCacheObj::getAllRows()
mpTable->getAllRows(aRows);
size_t nSize = aRows.size();
Sequence<sal_Int32> aRowsSeq(nSize);
+ auto aRowsSeqRange = asNonConstRange(aRowsSeq);
for (size_t i = 0; i < nSize; ++i)
- aRowsSeq[i] = aRows[i];
+ aRowsSeqRange[i] = aRows[i];
return aRowsSeq;
}
@@ -1470,8 +1471,9 @@ Sequence< sal_Int32 > SAL_CALL ScExternalSheetCacheObj::getAllColumns(sal_Int32
mpTable->getAllCols(static_cast<SCROW>(nRow), aCols);
size_t nSize = aCols.size();
Sequence<sal_Int32> aColsSeq(nSize);
+ auto aColsSeqRange = asNonConstRange(aColsSeq);
for (size_t i = 0; i < nSize; ++i)
- aColsSeq[i] = aCols[i];
+ aColsSeqRange[i] = aCols[i];
return aColsSeq;
}
@@ -1634,10 +1636,11 @@ Sequence< OUString > SAL_CALL ScExternalDocLinksObj::getElementNames()
SolarMutexGuard aGuard;
sal_uInt16 n = mpRefMgr->getExternalFileCount();
Sequence<OUString> aSeq(n);
+ auto aSeqRange = asNonConstRange(aSeq);
for (sal_uInt16 i = 0; i < n; ++i)
{
const OUString* pName = mpRefMgr->getExternalFileName(i);
- aSeq[i] = pName ? *pName : OUString();
+ aSeqRange[i] = pName ? *pName : OUString();
}
return aSeq;
diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx
index a66050487a34..15170405134d 100644
--- a/sc/source/ui/unoobj/servuno.cxx
+++ b/sc/source/ui/unoobj/servuno.cxx
@@ -92,10 +92,11 @@ class ScVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper< container:
public:
explicit ScVbaObjectForCodeNameProvider( ScDocShell* pDocShell ) : mpDocShell( pDocShell )
{
- uno::Sequence< uno::Any > aArgs(2);
- // access the application object ( parent for workbook )
- aArgs[0] <<= ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.Application", uno::Sequence< uno::Any >() );
- aArgs[1] <<= mpDocShell->GetModel();
+ uno::Sequence< uno::Any > aArgs{
+ // access the application object ( parent for workbook )
+ uno::Any(ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.Application", {} )),
+ uno::Any(mpDocShell->GetModel())
+ };
maWorkbook <<= ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.excel.Workbook", aArgs );
}
@@ -128,10 +129,7 @@ public:
uno::Reference<sheet::XSpreadsheets > xSheets( xSpreadDoc->getSheets(), uno::UNO_SET_THROW );
uno::Reference< container::XIndexAccess > xIndexAccess( xSheets, uno::UNO_QUERY_THROW );
uno::Reference< sheet::XSpreadsheet > xSheet( xIndexAccess->getByIndex( i ), uno::UNO_QUERY_THROW );
- uno::Sequence< uno::Any > aArgs(3);
- aArgs[0] = maWorkbook;
- aArgs[1] <<= xModel;
- aArgs[2] <<= sSheetName;
+ uno::Sequence< uno::Any > aArgs{ maWorkbook, uno::Any(xModel), uno::Any(sSheetName) };
// use the convenience function
maCachedObject <<= ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.excel.Worksheet", aArgs );
break;
@@ -155,14 +153,15 @@ public:
ScDocument& rDoc = mpDocShell->GetDocument();
SCTAB nCount = rDoc.GetTableCount();
uno::Sequence< OUString > aNames( nCount + 1 );
+ auto pNames = aNames.getArray();
SCTAB index = 0;
OUString sCodeName;
for( ; index < nCount; ++index )
{
rDoc.GetCodeName( index, sCodeName );
- aNames[ index ] = sCodeName;
+ pNames[ index ] = sCodeName;
}
- aNames[ index ] = rDoc.GetCodeName();
+ pNames[ index ] = rDoc.GetCodeName();
return aNames;
}
// XElemenAccess
@@ -585,8 +584,7 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
uno::Any aGlobs;
if ( !pDocShell->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aGlobs ) )
{
- uno::Sequence< uno::Any > aArgs(1);
- aArgs[ 0 ] <<= pDocShell->GetModel();
+ uno::Sequence< uno::Any > aArgs{ uno::Any(pDocShell->GetModel()) };
xRet = ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( "ooo.vba.excel.Globals", aArgs );
pDocShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", uno::Any( xRet ) );
BasicManager* pAppMgr = SfxApplication::GetBasicManager();
diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index 5649fe26060a..83bd4a0ecaac 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -19,6 +19,7 @@
#include <sal/config.h>
+#include <comphelper/propertyvalue.hxx>
#include <comphelper/sequence.hxx>
#include <svtools/unoevent.hxx>
#include <svtools/unoimap.hxx>
@@ -1373,11 +1374,9 @@ public:
if ( pInfo && !pInfo->GetMacro().isEmpty() )
{
- aProperties.realloc( 2 );
- aProperties[ 0 ].Name = SC_EVENTACC_EVENTTYPE;
- aProperties[ 0 ].Value <<= OUString(SC_EVENTACC_SCRIPT);
- aProperties[ 1 ].Name = SC_EVENTACC_SCRIPT;
- aProperties[ 1 ].Value <<= pInfo->GetMacro();
+ aProperties = { comphelper::makePropertyValue(SC_EVENTACC_EVENTTYPE,
+ OUString(SC_EVENTACC_SCRIPT)),
+ comphelper::makePropertyValue(SC_EVENTACC_SCRIPT, pInfo->GetMacro()) };
}
return uno::Any( aProperties );
@@ -1434,12 +1433,12 @@ uno::Sequence< OUString > SAL_CALL ScShapeObj::getSupportedServiceNames( )
aSupported = xSI->getSupportedServiceNames();
aSupported.realloc( aSupported.getLength() + 1 );
- aSupported[ aSupported.getLength() - 1 ] = "com.sun.star.sheet.Shape";
+ aSupported.getArray()[ aSupported.getLength() - 1 ] = "com.sun.star.sheet.Shape";
if( bIsNoteCaption )
{
aSupported.realloc( aSupported.getLength() + 1 );
- aSupported[ aSupported.getLength() - 1 ] = "com.sun.star.sheet.CellAnnotationShape";
+ aSupported.getArray()[ aSupported.getLength() - 1 ] = "com.sun.star.sheet.CellAnnotationShape";
}
return aSupported;
diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx
index 96f882d282ea..c788cb28b045 100644
--- a/sc/source/ui/unoobj/tokenuno.cxx
+++ b/sc/source/ui/unoobj/tokenuno.cxx
@@ -387,10 +387,11 @@ void ScTokenConversion::ConvertToTokenSequence( const ScDocument& rDoc,
if ( pTokens )
{
rSequence.realloc(nLen);
+ auto pSequence = rSequence.getArray();
for (sal_Int32 nPos=0; nPos<nLen; nPos++)
{
const formula::FormulaToken& rToken = *pTokens[nPos];
- sheet::FormulaToken& rAPI = rSequence[nPos];
+ sheet::FormulaToken& rAPI = pSequence[nPos];
OpCode eOpCode = rToken.GetOpCode();
// eOpCode may be changed in the following switch/case
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 3d2df9af72df..0992594a2b37 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -522,8 +522,7 @@ static void lcl_CallActivate( ScDocShell* pDocSh, SCTAB nTab, ScSheetEventId nEv
{
uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW );
// the parameter is the clicked object, as in the mousePressed call above
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[ 0 ] <<= nTab;
+ uno::Sequence< uno::Any > aArgs{ uno::Any(nTab) };
xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( nEvent ), aArgs );
}
catch( uno::Exception& )
@@ -1184,8 +1183,7 @@ bool ScTabViewObj::MousePressed( const awt::MouseEvent& e )
if (pScript)
{
// the macro parameter is the clicked object, as in the mousePressed call above
- uno::Sequence<uno::Any> aParams(1);
- aParams[0] <<= xTarget;
+ uno::Sequence<uno::Any> aParams{ uno::Any(xTarget) };
uno::Any aRet;
uno::Sequence<sal_Int16> aOutArgsIndex;
@@ -1205,8 +1203,7 @@ bool ScTabViewObj::MousePressed( const awt::MouseEvent& e )
{
uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW );
// the parameter is the clicked object, as in the mousePressed call above
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[ 0 ] <<= xTarget;
+ uno::Sequence< uno::Any > aArgs{ uno::Any(xTarget) };
xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( nEvent ), aArgs );
}
catch( util::VetoException& )
@@ -1232,8 +1229,7 @@ bool ScTabViewObj::MouseReleased( const awt::MouseEvent& e )
ScDocShell* pDocSh = rViewData.GetDocShell();
ScDocument& rDoc = pDocSh->GetDocument();
uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW );
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[ 0 ] = getSelection();
+ uno::Sequence< uno::Any > aArgs{ getSelection() };
xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( ScSheetEventId::SELECT ), aArgs );
}
catch( uno::Exception& )
@@ -1666,8 +1662,7 @@ void ScTabViewObj::SelectionChanged()
if (pScript)
{
// the macro parameter is the selection as returned by getSelection
- uno::Sequence<uno::Any> aParams(1);
- aParams[0] = getSelection();
+ uno::Sequence<uno::Any> aParams{ getSelection() };
uno::Any aRet;
uno::Sequence<sal_Int16> aOutArgsIndex;
uno::Sequence<uno::Any> aOutArgs;
@@ -1683,8 +1678,7 @@ void ScTabViewObj::SelectionChanged()
try
{
uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW );
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[ 0 ] = getSelection();
+ uno::Sequence< uno::Any > aArgs{ getSelection() };
xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( ScSheetEventId::SELECT ), aArgs );
}
catch( uno::Exception& )
@@ -2109,10 +2103,11 @@ namespace {
uno::Sequence<sal_Int32> toSequence(const ScMarkData::MarkedTabsType& rSelected)
{
uno::Sequence<sal_Int32> aRet(rSelected.size());
+ auto aRetRange = asNonConstRange(aRet);
size_t i = 0;
for (const auto& rTab : rSelected)
{
- aRet[i] = static_cast<sal_Int32>(rTab);
+ aRetRange[i] = static_cast<sal_Int32>(rTab);
++i;
}
diff --git a/sc/source/ui/vba/vbaeventshelper.cxx b/sc/source/ui/vba/vbaeventshelper.cxx
index e5acba5fff5f..bd00fdcac3bd 100644
--- a/sc/source/ui/vba/vbaeventshelper.cxx
+++ b/sc/source/ui/vba/vbaeventshelper.cxx
@@ -368,8 +368,7 @@ void SAL_CALL ScVbaEventListener::changesOccurred( const util::ChangesEvent& rEv
aChange.ReplacedElement >>= xRangeObj;
if( xRangeObj.is() )
{
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[0] <<= xRangeObj;
+ uno::Sequence< uno::Any > aArgs{ uno::Any(xRangeObj) };
mrVbaEvents.processVbaEventNoThrow( WORKSHEET_CHANGE, aArgs );
}
return;
@@ -396,8 +395,7 @@ void SAL_CALL ScVbaEventListener::changesOccurred( const util::ChangesEvent& rEv
if (!aRangeList.empty())
{
uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( mpDocShell, aRangeList ) );
- uno::Sequence< uno::Any > aArgs(1);
- aArgs[0] <<= xRanges;
+ uno::Sequence< uno::Any > aArgs{ uno::Any(xRanges) };
mrVbaEvents.processVbaEventNoThrow( WORKSHEET_CHANGE, aArgs );
}
}
@@ -460,8 +458,7 @@ void ScVbaEventListener::processWindowActivateEvent( vcl::Window* pWindow, bool
uno::Reference< frame::XController > xController = getControllerForWindow( pWindow );
if( xController.is() )
{
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[ 0 ] <<= xController;
+ uno::Sequence< uno::Any > aArgs{ uno::Any(xController) };
mrVbaEvents.processVbaEventNoThrow( bActivate ? WORKBOOK_WINDOWACTIVATE : WORKBOOK_WINDOWDEACTIVATE, aArgs );
}
}
@@ -500,8 +497,7 @@ IMPL_LINK( ScVbaEventListener, processWindowResizeEvent, void*, p, void )
uno::Reference< frame::XController > xController = getControllerForWindow( pWindow );
if( xController.is() )
{
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[ 0 ] <<= xController;
+ uno::Sequence< uno::Any > aArgs{ uno::Any(xController) };
// #163419# do not throw exceptions into application core
mrVbaEvents.processVbaEventNoThrow( WORKBOOK_WINDOWRESIZE, aArgs );
}
@@ -592,16 +588,14 @@ void SAL_CALL ScVbaEventsHelper::notifyEvent( const css::document::EventObject&
(rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::SAVEASDOCDONE )) ||
(rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::SAVETODOCDONE )) )
{
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[ 0 ] <<= true;
+ uno::Sequence< uno::Any > aArgs{ uno::Any(true) };
processVbaEventNoThrow( WORKBOOK_AFTERSAVE, aArgs );
}
else if( (rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::SAVEDOCFAILED )) ||
(rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::SAVEASDOCFAILED )) ||
(rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::SAVETODOCFAILED )) )
{
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[ 0 ] <<= false;
+ uno::Sequence< uno::Any > aArgs{ uno::Any(false) };
processVbaEventNoThrow( WORKBOOK_AFTERSAVE, aArgs );
}
else if( rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::CLOSEDOC ) )
@@ -611,8 +605,7 @@ void SAL_CALL ScVbaEventsHelper::notifyEvent( const css::document::EventObject&
uno::Reference< frame::XController > xController( mxModel->getCurrentController() );
if( xController.is() )
{
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[ 0 ] <<= xController;
+ uno::Sequence< uno::Any > aArgs{ uno::Any(xController) };
processVbaEventNoThrow( WORKBOOK_WINDOWDEACTIVATE, aArgs );
}
processVbaEventNoThrow( WORKBOOK_DEACTIVATE, saEmptyArgs );
@@ -664,8 +657,7 @@ bool ScVbaEventsHelper::implPrepareEvent( EventQueue& rEventQueue,
{
// execute delayed Activate event too (see above)
rEventQueue.emplace_back(WORKBOOK_ACTIVATE );
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[ 0 ] <<= mxModel->getCurrentController();
+ uno::Sequence< uno::Any > aArgs{ uno::Any(mxModel->getCurrentController()) };
rEventQueue.emplace_back( WORKBOOK_WINDOWACTIVATE, aArgs );
rEventQueue.emplace_back(AUTO_OPEN );
// remember initial selection
@@ -714,28 +706,24 @@ uno::Sequence< uno::Any > ScVbaEventsHelper::implBuildArgumentList( const EventH
break;
// 2 args: saveAs, cancel
case WORKBOOK_BEFORESAVE:
- aVbaArgs.realloc( 2 );
checkArgumentType< bool >( rArgs, 0 );
- aVbaArgs[ 0 ] = rArgs[ 0 ];
+ aVbaArgs = { rArgs[ 0 ], {} };
// current cancel state will be inserted by caller
break;
// 1 arg: success
case WORKBOOK_AFTERSAVE:
- aVbaArgs.realloc( 1 );
checkArgumentType< bool >( rArgs, 0 );
- aVbaArgs[ 0 ] = rArgs[ 0 ];
+ aVbaArgs = { rArgs[ 0 ] };
break;
// 1 arg: window
case WORKBOOK_WINDOWACTIVATE:
case WORKBOOK_WINDOWDEACTIVATE:
case WORKBOOK_WINDOWRESIZE:
- aVbaArgs.realloc( 1 );
- aVbaArgs[ 0 ] = createWindow( rArgs, 0 );
+ aVbaArgs = { createWindow( rArgs, 0 ) };
break;
// 1 arg: worksheet
case WORKBOOK_NEWSHEET:
- aVbaArgs.realloc( 1 );
- aVbaArgs[ 0 ] = createWorksheet( rArgs, 0 );
+ aVbaArgs = { createWorksheet( rArgs, 0 ) };
break;
// *** Worksheet ***
@@ -748,20 +736,17 @@ uno::Sequence< uno::Any > ScVbaEventsHelper::implBuildArgumentList( const EventH
// 1 arg: range
case WORKSHEET_CHANGE:
case WORKSHEET_SELECTIONCHANGE:
- aVbaArgs.realloc( 1 );
- aVbaArgs[ 0 ] = createRange( rArgs, 0 );
+ aVbaArgs = { createRange( rArgs, 0 ) };
break;
// 2 args: range, cancel
case WORKSHEET_BEFOREDOUBLECLICK:
case WORKSHEET_BEFORERIGHTCLICK:
- aVbaArgs.realloc( 2 );
- aVbaArgs[ 0 ] = createRange( rArgs, 0 );
+ aVbaArgs = { createRange( rArgs, 0 ), {} };
// current cancel state will be inserted by caller
break;
// 1 arg: hyperlink
case WORKSHEET_FOLLOWHYPERLINK:
- aVbaArgs.realloc( 1 );
- aVbaArgs[ 0 ] = createHyperlink( rArgs, 0 );
+ aVbaArgs = { createHyperlink( rArgs, 0 ) };
break;
}
@@ -870,16 +855,14 @@ uno::Any ScVbaEventsHelper::createRange( const uno::Sequence< uno::Any >& rArgs,
if ( !xRanges.is() && !xRange.is() )
throw lang::IllegalArgumentException();
- uno::Sequence< uno::Any > aArgs( 2 );
+ uno::Sequence< uno::Any > aArgs;
if ( xRanges.is() )
{
- aArgs[ 0 ] <<= excel::getUnoSheetModuleObj( xRanges );
- aArgs[ 1 ] <<= xRanges;
+ aArgs = { uno::Any(excel::getUnoSheetModuleObj( xRanges )), uno::Any(xRanges) };
}
else
{
- aArgs[ 0 ] <<= excel::getUnoSheetModuleObj( xRange );
- aArgs[ 1 ] <<= xRange;
+ aArgs = { uno::Any(excel::getUnoSheetModuleObj( xRange )), uno::Any(xRange) };
}
xVbaRange.set( createVBAUnoAPIServiceWithArgs( mpShell, "ooo.vba.excel.Range", aArgs ), uno::UNO_QUERY_THROW );
}
@@ -889,19 +872,17 @@ uno::Any ScVbaEventsHelper::createRange( const uno::Sequence< uno::Any >& rArgs,
uno::Any ScVbaEventsHelper::createHyperlink( const uno::Sequence< uno::Any >& rArgs, sal_Int32 nIndex ) const
{
uno::Reference< table::XCell > xCell = getXSomethingFromArgs< table::XCell >( rArgs, nIndex, false );
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[ 0 ] <<= excel::getUnoSheetModuleObj( xCell );
- aArgs[ 1 ] <<= xCell;
+ uno::Sequence< uno::Any > aArgs{ uno::Any(excel::getUnoSheetModuleObj( xCell )),
+ uno::Any(xCell) };
uno::Reference< uno::XInterface > xHyperlink( createVBAUnoAPIServiceWithArgs( mpShell, "ooo.vba.excel.Hyperlink", aArgs ), uno::UNO_SET_THROW );
return uno::Any( xHyperlink );
}
uno::Any ScVbaEventsHelper::createWindow( const uno::Sequence< uno::Any >& rArgs, sal_Int32 nIndex ) const
{
- uno::Sequence< uno::Any > aArgs( 3 );
- aArgs[ 0 ] <<= getVBADocument( mxModel );
- aArgs[ 1 ] <<= mxModel;
- aArgs[ 2 ] <<= getXSomethingFromArgs< frame::XController >( rArgs, nIndex, false );
+ uno::Sequence< uno::Any > aArgs{ uno::Any(getVBADocument( mxModel )),
+ uno::Any(mxModel),
+ uno::Any(getXSomethingFromArgs< frame::XController >( rArgs, nIndex, false )) };
uno::Reference< uno::XInterface > xWindow( createVBAUnoAPIServiceWithArgs( mpShell, "ooo.vba.excel.Window", aArgs ), uno::UNO_SET_THROW );
return uno::Any( xWindow );
}
diff --git a/sc/source/ui/vba/vbaglobals.cxx b/sc/source/ui/vba/vbaglobals.cxx
index 86b1332b6709..734553d50db8 100644
--- a/sc/source/ui/vba/vbaglobals.cxx
+++ b/sc/source/ui/vba/vbaglobals.cxx
@@ -35,13 +35,14 @@ using namespace ::ooo::vba;
ScVbaGlobals::ScVbaGlobals( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& rxContext ) : ScVbaGlobals_BASE( uno::Reference< XHelperInterface >(), rxContext, "ExcelDocumentContext" )
{
- uno::Sequence< beans::PropertyValue > aInitArgs( aArgs.getLength() + 1 );
- aInitArgs[ 0 ].Name = "Application";
- aInitArgs[ 0 ].Value <<= getApplication();
+ uno::Sequence< beans::PropertyValue > aInitArgs( aArgs.hasElements() ? 2 : 1 );
+ auto pInitArgs = aInitArgs.getArray();
+ pInitArgs[ 0 ].Name = "Application";
+ pInitArgs[ 0 ].Value <<= getApplication();
if ( aArgs.hasElements() )
{
- aInitArgs[ 1 ].Name = "ExcelDocumentContext";
- aInitArgs[ 1 ].Value <<= getXSomethingFromArgs< frame::XModel >( aArgs, 0 );
+ pInitArgs[ 1 ].Name = "ExcelDocumentContext";
+ pInitArgs[ 1 ].Value <<= getXSomethingFromArgs< frame::XModel >( aArgs, 0 );
}
init( aInitArgs );
}
diff --git a/sc/source/ui/vba/vbapagesetup.cxx b/sc/source/ui/vba/vbapagesetup.cxx
index 8f96df5df1cc..112522b8155a 100644
--- a/sc/source/ui/vba/vbapagesetup.cxx
+++ b/sc/source/ui/vba/vbapagesetup.cxx
@@ -100,12 +100,13 @@ void SAL_CALL ScVbaPageSetup::setPrintArea( const OUString& rAreas )
if( getScRangeListForAddress( rAreas, excel::getDocShell( mxModel ) , aRange, aCellRanges ) )
{
uno::Sequence< table::CellRangeAddress > aSeq( aCellRanges.size() );
+ auto aSeqRange = asNonConstRange(aSeq);
for ( size_t i = 0, nRanges = aCellRanges.size(); i < nRanges; ++i )
{
ScRange & rRange = aCellRanges[ i ];
table::CellRangeAddress aRangeAddress;
ScUnoConversion::FillApiRange( aRangeAddress, rRange );
- aSeq[ i++ ] = aRangeAddress;
+ aSeqRange[ i++ ] = aRangeAddress;
}
xPrintAreas->setPrintAreas( aSeq );
}
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index e2bb00124bc0..693e63c2bcd4 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -253,8 +253,7 @@ void ScVbaRange::fireChangeEvent()
const uno::Reference< script::vba::XVBAEventProcessor >& xVBAEvents = rDoc.GetVbaEventProcessor();
if( xVBAEvents.is() ) try
{
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[ 0 ] <<= uno::Reference< excel::XRange >( this );
+ uno::Sequence< uno::Any > aArgs{ uno::Any(uno::Reference< excel::XRange >( this )) };
xVBAEvents->processVbaEvent( script::vba::VBAEventId::WORKSHEET_CHANGE, aArgs );
}
catch( uno::Exception& )
@@ -944,7 +943,7 @@ protected:
void processValue( sal_Int32 x, sal_Int32 y, const uno::Any& aValue )
{
uno::Sequence< uno::Sequence< uno::Any > >& aMatrix = const_cast<css::uno::Sequence<css::uno::Sequence<css::uno::Any>> &>(*o3tl::doAccess<uno::Sequence<uno::Sequence<uno::Any>>>(maValue));
- aMatrix[x][y] = aValue;
+ aMatrix.getArray()[x].getArray()[y] = aValue;
}
public:
@@ -952,8 +951,9 @@ public:
{
uno::Sequence< uno::Sequence< uno::Any > > aMatrix;
aMatrix.realloc( nRowCount );
+ auto pMatrix = aMatrix.getArray();
for ( sal_Int32 index = 0; index < nRowCount; ++index )
- aMatrix[index].realloc( nColCount );
+ pMatrix[index].realloc( nColCount );
maValue <<= aMatrix;
}
void visitNode( sal_Int32 x, sal_Int32 y, const uno::Reference< table::XCell >& xCell ) override
@@ -3520,29 +3520,30 @@ ScVbaRange::Sort( const uno::Any& Key1, const uno::Any& Order1, const uno::Any&
uno::Reference< util::XSortable > xSort( mxRange, uno::UNO_QUERY_THROW );
uno::Sequence< beans::PropertyValue > sortDescriptor = xSort->createSortDescriptor();
+ auto psortDescriptor = sortDescriptor.getArray();
sal_Int32 nTableSortFieldIndex = findSortPropertyIndex( sortDescriptor, "SortFields" );
uno::Sequence< table::TableSortField > sTableFields(1);
sal_Int32 nTableIndex = 0;
- updateTableSortField( mxRange, xKey1, nOrder1, sTableFields[ nTableIndex++ ], bIsSortColumns, bMatchCase );
+ updateTableSortField( mxRange, xKey1, nOrder1, sTableFields.getArray()[ nTableIndex++ ], bIsSortColumns, bMatchCase );
if ( xKey2.is() )
{
sTableFields.realloc( sTableFields.getLength() + 1 );
- updateTableSortField( mxRange, xKey2, nOrder2, sTableFields[ nTableIndex++ ], bIsSortColumns, bMatchCase );
+ updateTableSortField( mxRange, xKey2, nOrder2, sTableFields.getArray()[ nTableIndex++ ], bIsSortColumns, bMatchCase );
}
if ( xKey3.is() )
{
sTableFields.realloc( sTableFields.getLength() + 1 );
- updateTableSortField( mxRange, xKey3, nOrder3, sTableFields[ nTableIndex++ ], bIsSortColumns, bMatchCase );
+ updateTableSortField( mxRange, xKey3, nOrder3, sTableFields.getArray()[ nTableIndex++ ], bIsSortColumns, bMatchCase );
}
- sortDescriptor[ nTableSortFieldIndex ].Value <<= sTableFields;
+ psortDescriptor[ nTableSortFieldIndex ].Value <<= sTableFields;
sal_Int32 nIndex = findSortPropertyIndex( sortDescriptor, "IsSortColumns" );
- sortDescriptor[ nIndex ].Value <<= bIsSortColumns;
+ psortDescriptor[ nIndex ].Value <<= bIsSortColumns;
nIndex = findSortPropertyIndex( sortDescriptor, "ContainsHeader" );
- sortDescriptor[ nIndex ].Value <<= bContainsHeader;
+ psortDescriptor[ nIndex ].Value <<= bContainsHeader;
rDoc.SetSortParam( aSortParam, nTab );
xSort->sort( sortDescriptor );
@@ -4517,11 +4518,13 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const
bool bAcceptCriteria2 = true;
bool bAll = false;
uno::Sequence< sheet::TableFilterField2 > sTabFilts;
+ sheet::TableFilterField2* pTabFilts = nullptr;
uno::Reference< beans::XPropertySet > xDescProps( xDesc, uno::UNO_QUERY_THROW );
if ( Criteria1.hasValue() )
{
sTabFilts.realloc( 1 );
- sTabFilts[0].Operator = sheet::FilterOperator2::EQUAL;// sensible default
+ pTabFilts = sTabFilts.getArray();
+ pTabFilts[0].Operator = sheet::FilterOperator2::EQUAL;// sensible default
if ( !bCritHasNumericValue )
{
Criteria1 >>= sCriteria1;
@@ -4535,12 +4538,14 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const
// When sequence is provided for Criteria1 don't care about Criteria2
bAcceptCriteria2 = false;
+ auto pCriteria1 = aCriteria1.getArray();
sTabFilts.realloc( nLength );
+ pTabFilts = sTabFilts.getArray();
for ( sal_uInt16 i = 0; i < nLength; ++i )
{
- lcl_setTableFieldsFromCriteria( aCriteria1[i], xDescProps, sTabFilts[i] );
- sTabFilts[i].Connection = sheet::FilterConnection_OR;
- sTabFilts[i].Field = (nField - 1);
+ lcl_setTableFieldsFromCriteria( pCriteria1[i], xDescProps, pTabFilts[i] );
+ pTabFilts[i].Connection = sheet::FilterConnection_OR;
+ pTabFilts[i].Field = (nField - 1);
}
}
else
@@ -4548,17 +4553,17 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const
}
else
{
- sTabFilts[0].IsNumeric = bCritHasNumericValue;
+ pTabFilts[0].IsNumeric = bCritHasNumericValue;
if ( bHasCritValue && !sCriteria1.isEmpty() )
- lcl_setTableFieldsFromCriteria( sCriteria1, xDescProps, sTabFilts[0] );
+ lcl_setTableFieldsFromCriteria( sCriteria1, xDescProps, pTabFilts[0] );
else
bAll = true;
}
}
else // numeric
{
- sTabFilts[0].IsNumeric = true;
- sTabFilts[0].NumericValue = nCriteria1;
+ pTabFilts[0].IsNumeric = true;
+ pTabFilts[0].NumericValue = nCriteria1;
}
}
else // no value specified
@@ -4571,23 +4576,23 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const
// is no value specified for criteria1 set it to 10
if ( !bCritHasNumericValue && sCriteria1.isEmpty() && ( nOperator != excel::XlAutoFilterOperator::xlOr ) && ( nOperator != excel::XlAutoFilterOperator::xlAnd ) )
{
- sTabFilts[0].IsNumeric = true;
- sTabFilts[0].NumericValue = 10;
+ pTabFilts[0].IsNumeric = true;
+ pTabFilts[0].NumericValue = 10;
bAll = false;
}
switch ( nOperator )
{
case excel::XlAutoFilterOperator::xlBottom10Items:
- sTabFilts[0].Operator = sheet::FilterOperator2::BOTTOM_VALUES;
+ pTabFilts[0].Operator = sheet::FilterOperator2::BOTTOM_VALUES;
break;
case excel::XlAutoFilterOperator::xlBottom10Percent:
- sTabFilts[0].Operator = sheet::FilterOperator2::BOTTOM_PERCENT;
+ pTabFilts[0].Operator = sheet::FilterOperator2::BOTTOM_PERCENT;
break;
case excel::XlAutoFilterOperator::xlTop10Items:
- sTabFilts[0].Operator = sheet::FilterOperator2::TOP_VALUES;
+ pTabFilts[0].Operator = sheet::FilterOperator2::TOP_VALUES;
break;
case excel::XlAutoFilterOperator::xlTop10Percent:
- sTabFilts[0].Operator = sheet::FilterOperator2::TOP_PERCENT;
+ pTabFilts[0].Operator = sheet::FilterOperator2::TOP_PERCENT;
break;
case excel::XlAutoFilterOperator::xlOr:
nConn = sheet::FilterConnection_OR;
@@ -4603,15 +4608,16 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const
}
if ( !bAll && bAcceptCriteria2 )
{
- sTabFilts[0].Connection = sheet::FilterConnection_AND;
- sTabFilts[0].Field = (nField - 1);
+ pTabFilts[0].Connection = sheet::FilterConnection_AND;
+ pTabFilts[0].Field = (nField - 1);
uno::Sequence< OUString > aCriteria2;
if ( Criteria2.hasValue() ) // there is a Criteria2
{
sTabFilts.realloc(2);
- sTabFilts[1].Field = sTabFilts[0].Field;
- sTabFilts[1].Connection = nConn;
+ pTabFilts = sTabFilts.getArray();
+ pTabFilts[1].Field = sTabFilts[0].Field;
+ pTabFilts[1].Connection = nConn;
OUString sCriteria2;
if ( Criteria2 >>= sCriteria2 )
@@ -4619,8 +4625,8 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const
if ( !sCriteria2.isEmpty() )
{
uno::Reference< beans::XPropertySet > xProps;
- lcl_setTableFieldsFromCriteria( sCriteria2, xProps, sTabFilts[1] );
- sTabFilts[1].IsNumeric = false;
+ lcl_setTableFieldsFromCriteria( sCriteria2, xProps, pTabFilts[1] );
+ pTabFilts[1].IsNumeric = false;
}
}
else if ( Criteria2 >>= aCriteria2 )
@@ -4629,14 +4635,14 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const
if ( nLength )
{
// For compatibility use only the last value from the sequence
- lcl_setTableFieldsFromCriteria( aCriteria2[nLength - 1], xDescProps, sTabFilts[1] );
+ lcl_setTableFieldsFromCriteria( aCriteria2.getArray()[nLength - 1], xDescProps, pTabFilts[1] );
}
}
else // numeric
{
- Criteria2 >>= sTabFilts[1].NumericValue;
- sTabFilts[1].IsNumeric = true;
- sTabFilts[1].Operator = sheet::FilterOperator2::EQUAL;
+ Criteria2 >>= pTabFilts[1].NumericValue;
+ pTabFilts[1].IsNumeric = true;
+ pTabFilts[1].Operator = sheet::FilterOperator2::EQUAL;
}
}
}
@@ -4994,6 +5000,7 @@ ScVbaRange::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any&
sal_Int32 nItems = m_Areas->getCount();
uno::Sequence< table::CellRangeAddress > printAreas( nItems );
+ auto printAreasRange = asNonConstRange(printAreas);
uno::Reference< sheet::XPrintAreas > xPrintAreas;
for ( sal_Int32 index=1; index <= nItems; ++index )
{
@@ -5008,7 +5015,7 @@ ScVbaRange::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any&
pShell = getDocShellFromRange( pRange->mxRange );
xPrintAreas.set( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
}
- printAreas[ index - 1 ] = rangeAddress;
+ printAreasRange[ index - 1 ] = rangeAddress;
}
if ( pShell && xPrintAreas.is() )
{
@@ -5573,46 +5580,47 @@ ScVbaRange::Subtotal( ::sal_Int32 _nGroupBy, ::sal_Int32 _nFunction, const uno::
xSubDescPropertySet->setPropertyValue("InsertPageBreaks", uno::makeAny( bAddPageBreaks));
sal_Int32 nLen = _nTotalList.getLength();
uno::Sequence< sheet::SubTotalColumn > aColumns( nLen );
+ auto aColumnsRange = asNonConstRange(aColumns);
for (int i = 0; i < nLen; i++)
{
- aColumns[i].Column = _nTotalList[i] - 1;
+ aColumnsRange[i].Column = _nTotalList[i] - 1;
switch (_nFunction)
{
case excel::XlConsolidationFunction::xlAverage:
- aColumns[i].Function = sheet::GeneralFunction_AVERAGE;
+ aColumnsRange[i].Function = sheet::GeneralFunction_AVERAGE;
break;
case excel::XlConsolidationFunction::xlCount:
- aColumns[i].Function = sheet::GeneralFunction_COUNT;
+ aColumnsRange[i].Function = sheet::GeneralFunction_COUNT;
break;
case excel::XlConsolidationFunction::xlCountNums:
- aColumns[i].Function = sheet::GeneralFunction_COUNTNUMS;
+ aColumnsRange[i].Function = sheet::GeneralFunction_COUNTNUMS;
break;
case excel::XlConsolidationFunction::xlMax:
- aColumns[i].Function = sheet::GeneralFunction_MAX;
+ aColumnsRange[i].Function = sheet::GeneralFunction_MAX;
break;
case excel::XlConsolidationFunction::xlMin:
- aColumns[i].Function = sheet::GeneralFunction_MIN;
+ aColumnsRange[i].Function = sheet::GeneralFunction_MIN;
break;
case excel::XlConsolidationFunction::xlProduct:
- aColumns[i].Function = sheet::GeneralFunction_PRODUCT;
+ aColumnsRange[i].Function = sheet::GeneralFunction_PRODUCT;
break;
case excel::XlConsolidationFunction::xlStDev:
- aColumns[i].Function = sheet::GeneralFunction_STDEV;
+ aColumnsRange[i].Function = sheet::GeneralFunction_STDEV;
break;
case excel::XlConsolidationFunction::xlStDevP:
- aColumns[i].Function = sheet::GeneralFunction_STDEVP;
+ aColumnsRange[i].Function = sheet::GeneralFunction_STDEVP;
break;
case excel::XlConsolidationFunction::xlSum:
- aColumns[i].Function = sheet::GeneralFunction_SUM;
+ aColumnsRange[i].Function = sheet::GeneralFunction_SUM;
break;
case excel::XlConsolidationFunction::xlUnknown:
- aColumns[i].Function = sheet::GeneralFunction_NONE;
+ aColumnsRange[i].Function = sheet::GeneralFunction_NONE;
break;
case excel::XlConsolidationFunction::xlVar:
- aColumns[i].Function = sheet::GeneralFunction_VAR;
+ aColumnsRange[i].Function = sheet::GeneralFunction_VAR;
break;
case excel::XlConsolidationFunction::xlVarP:
- aColumns[i].Function = sheet::GeneralFunction_VARP;
+ aColumnsRange[i].Function = sheet::GeneralFunction_VARP;
break;
default:
DebugHelper::basicexception(ERRCODE_BASIC_BAD_PARAMETER, {}) ;
@@ -5647,9 +5655,8 @@ ScVbaRange::hasError()
uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
uno::Reference< script::XInvocation > xInvoc( xApplication->WorksheetFunction(), uno::UNO_QUERY_THROW );
- uno::Sequence< uno::Any > Params(1);
uno::Reference< excel::XRange > aRange( this );
- Params[0] <<= aRange;
+ uno::Sequence< uno::Any > Params{ uno::Any(aRange) };
uno::Sequence< sal_Int16 > OutParamIndex;
uno::Sequence< uno::Any > OutParam;
xInvoc->invoke( "IsError", Params, OutParamIndex, OutParam ) >>= dResult;
diff --git a/sc/source/ui/vba/vbatitle.hxx b/sc/source/ui/vba/vbatitle.hxx
index 5c3114d53670..21fe9fba1079 100644
--- a/sc/source/ui/vba/vbatitle.hxx
+++ b/sc/source/ui/vba/vbatitle.hxx
@@ -133,12 +133,7 @@ public:
}
css::uno::Sequence< OUString > getServiceNames() override
{
- static css::uno::Sequence< OUString > aServiceNames;
- if ( !aServiceNames.hasElements() )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = "ooo.vba.excel.XTitle";
- }
+ static const css::uno::Sequence< OUString > aServiceNames{ "ooo.vba.excel.XTitle" };
return aServiceNames;
}
};
diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx
index 8b2b9fbc724f..3818689b9a9e 100644
--- a/sc/source/ui/vba/vbaworkbook.cxx
+++ b/sc/source/ui/vba/vbaworkbook.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <comphelper/propertyvalue.hxx>
#include <tools/urlobj.hxx>
#include <com/sun/star/util/XProtectable.hpp>
@@ -299,9 +302,8 @@ ScVbaWorkbook::SaveCopyAs( const OUString& sFileName )
OUString aURL;
osl::FileBase::getFileURLFromSystemPath( sFileName, aURL );
uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW );
- uno::Sequence< beans::PropertyValue > storeProps(1);
- storeProps[0].Name = "FilterName";
- storeProps[0].Value <<= OUString( "MS Excel 97" );
+ uno::Sequence< beans::PropertyValue > storeProps{ comphelper::makePropertyValue(
+ "FilterName", OUString( "MS Excel 97" )) };
xStor->storeToURL( aURL, storeProps );
}
@@ -343,9 +345,7 @@ ScVbaWorkbook::SaveAs( const uno::Any& FileName, const uno::Any& FileFormat, con
sal_Int32 nFileFormat = excel::XlFileFormat::xlExcel9795;
FileFormat >>= nFileFormat;
- uno::Sequence< beans::PropertyValue > storeProps(1);
- storeProps[0].Name = "FilterName" ;
-
+ uno::Sequence storeProps{ comphelper::makePropertyValue("FilterName", uno::Any()) };
setFilterPropsFromFormat( nFileFormat, storeProps );
uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW );
diff --git a/sc/source/ui/vba/vbaworkbooks.cxx b/sc/source/ui/vba/vbaworkbooks.cxx
index facfc89fe23c..bd52292cfa5a 100644
--- a/sc/source/ui/vba/vbaworkbooks.cxx
+++ b/sc/source/ui/vba/vbaworkbooks.cxx
@@ -30,6 +30,7 @@
#include "vbaworkbooks.hxx"
#include <vbahelper/vbahelper.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <o3tl/string_view.hxx>
#include <osl/file.hxx>
#include <rtl/ref.hxx>
@@ -178,9 +179,7 @@ OUString
ScVbaWorkbooks::getFileFilterType( const OUString& rFileName )
{
uno::Reference< document::XTypeDetection > xTypeDetect( mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.document.TypeDetection", mxContext), uno::UNO_QUERY_THROW );
- uno::Sequence< beans::PropertyValue > aMediaDesc(1);
- aMediaDesc[ 0 ].Name = "URL";
- aMediaDesc[ 0 ].Value <<= rFileName;
+ uno::Sequence aMediaDesc{ comphelper::makePropertyValue("URL", rFileName) };
OUString sType = xTypeDetect->queryTypeByDescriptor( aMediaDesc, true );
return sType;
}
@@ -199,13 +198,12 @@ ScVbaWorkbooks::Open( const OUString& rFileName, const uno::Any& /*UpdateLinks*/
else
osl::FileBase::getFileURLFromSystemPath( rFileName, aURL );
- uno::Sequence< beans::PropertyValue > sProps(0);
+ uno::Sequence< beans::PropertyValue > sProps;
OUString sType = getFileFilterType( aURL );
// A text file means it needs to be processed as a csv file
if ( isTextFile( sType ) )
{
- sal_Int32 nIndex = 0;
// Values for format
// 1 Tabs
// 2 Commas
@@ -214,8 +212,6 @@ ScVbaWorkbooks::Open( const OUString& rFileName, const uno::Any& /*UpdateLinks*/
// 5 Nothing
// 6 Custom character (see the Delimiter argument
// no format means use the current delimiter
- sProps.realloc( 3 );
- sProps[ nIndex ].Name = "FilterOptions";
sal_Int16 const delims[] { 0 /*default not used*/, 9/*tab*/, 44/*comma*/, 32/*space*/, 59/*semicolon*/ };
OUString sFormat;
@@ -252,13 +248,13 @@ ScVbaWorkbooks::Open( const OUString& rFileName, const uno::Any& /*UpdateLinks*/
getCurrentDelim() = nDelim; //set new current
sFormat = OUString::number( nDelim ) + ",34,0,1";
- sProps[ nIndex++ ].Value <<= sFormat;
- sProps[ nIndex ].Name = "FilterName";
- sProps[ nIndex++ ].Value <<= OUString( SC_TEXT_CSV_FILTER_NAME );
- // Ensure WORKAROUND_CSV_TXT_BUG_i60158 gets called in typedetection.cxx so
- // csv is forced for deep detected 'writerxxx' types
- sProps[ nIndex ].Name = "DocumentService";
- sProps[ nIndex ].Value <<= OUString("com.sun.star.sheet.SpreadsheetDocument");
+
+ sProps = { comphelper::makePropertyValue("FilterOptions", sFormat),
+ comphelper::makePropertyValue("FilterName", OUString( SC_TEXT_CSV_FILTER_NAME )),
+ // Ensure WORKAROUND_CSV_TXT_BUG_i60158 gets called in typedetection.cxx so
+ // csv is forced for deep detected 'writerxxx' types
+ comphelper::makePropertyValue(
+ "DocumentService", OUString("com.sun.star.sheet.SpreadsheetDocument")) };
}
else if ( !isSpreadSheetFile( sType ) )
throw uno::RuntimeException("Bad Format" );
diff --git a/sc/source/ui/vba/vbawsfunction.cxx b/sc/source/ui/vba/vbawsfunction.cxx
index e9119c67a0ba..6af173223240 100644
--- a/sc/source/ui/vba/vbawsfunction.cxx
+++ b/sc/source/ui/vba/vbawsfunction.cxx
@@ -97,31 +97,31 @@ ScVbaWSFunction::invoke(const OUString& FunctionName, const uno::Sequence< uno::
if ( aType.equals( cppu::UnoType<uno::Sequence<sal_Int16>>::get() ) )
{
uno::Sequence< uno::Sequence< sal_Int16 > > aTmp(1);
- rArray >>= aTmp[ 0 ];
+ rArray >>= aTmp.getArray()[ 0 ];
rArray <<= aTmp;
}
else if ( aType.equals( cppu::UnoType<uno::Sequence<sal_Int32>>::get() ) )
{
uno::Sequence< uno::Sequence< sal_Int32 > > aTmp(1);
- rArray >>= aTmp[ 0 ];
+ rArray >>= aTmp.getArray()[ 0 ];
rArray <<= aTmp;
}
else if ( aType.equals( cppu::UnoType<uno::Sequence<double>>::get() ) )
{
uno::Sequence< uno::Sequence< double > > aTmp(1);
- rArray >>= aTmp[ 0 ];
+ rArray >>= aTmp.getArray()[ 0 ];
rArray <<= aTmp;
}
else if ( aType.equals( cppu::UnoType<uno::Sequence<OUString>>::get() ) )
{
uno::Sequence< uno::Sequence< OUString > > aTmp(1);
- rArray >>= aTmp[ 0 ];
+ rArray >>= aTmp.getArray()[ 0 ];
rArray <<= aTmp;
}
else if ( aType.equals( cppu::UnoType<uno::Sequence<uno::Any>>::get() ) )
{
uno::Sequence< uno::Sequence<uno::Any > > aTmp(1);
- rArray >>= aTmp[ 0 ];
+ rArray >>= aTmp.getArray()[ 0 ];
rArray <<= aTmp;
}
}
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 9282acef724d..8913437e46df 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2394,8 +2394,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
ScAddress aCellPos( nPosX, nPosY, nTab );
uno::Reference< table::XCell > xCell( new ScCellObj( mrViewData.GetDocShell(), aCellPos ) );
- uno::Sequence< uno::Any > aArgs(1);
- aArgs[0] <<= xCell;
+ uno::Sequence< uno::Any > aArgs{ uno::Any(xCell) };
xVbaEvents->processVbaEvent( script::vba::VBAEventId::WORKSHEET_FOLLOWHYPERLINK, aArgs );
}
}
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 0fa16227d574..14d4fc8d43aa 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -46,6 +46,7 @@
#include <avmedia/mediawindow.hxx>
#include <osl/diagnose.h>
+#include <comphelper/propertyvalue.hxx>
#include <comphelper/storagehelper.hxx>
#include <viewfunc.hxx>
@@ -662,9 +663,8 @@ bool ScViewFunc::PasteFile( const Point& rPos, const OUString& rFile, bool bLink
//TODO/LATER: what about "bLink"?
- uno::Sequence < beans::PropertyValue > aMedium(1);
- aMedium[0].Name = "URL";
- aMedium[0].Value <<= aStrURL;
+ uno::Sequence < beans::PropertyValue > aMedium{ comphelper::makePropertyValue("URL",
+ aStrURL) };
comphelper::EmbeddedObjectContainer aCnt( xStorage );
OUString aName;
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index b6c1e92ea5c7..4c1f8fb78313 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1260,8 +1260,9 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bCursor
css::uno::Any aVal;
pItem->QueryValue( aVal, pEntry->nMemberId );
aProperties.realloc( nCount + 1 );
- aProperties[ nCount ].Name = pEntry->aName;
- aProperties[ nCount ].Value = aVal;
+ auto pProperties = aProperties.getArray();
+ pProperties[ nCount ].Name = pEntry->aName;
+ pProperties[ nCount ].Value = aVal;
++nCount;
}
}