summaryrefslogtreecommitdiff
path: root/sc/source/ui
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/ui
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/ui')
-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
34 files changed, 290 insertions, 305 deletions
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;
}
}