summaryrefslogtreecommitdiff
path: root/basic/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-10-28 16:09:55 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-10-29 06:50:32 +0200
commit81a7d46d9f89252146bf3ba4074625bdfe3345f8 (patch)
treeaecb50de3e630b2041cab18889df83e275a29f6b /basic/source
parent86d11097cd4a2ae4a6b4e6b35e28a6075376d67a (diff)
Prepare for removal of non-const operator[] from Sequence in basic
Change-Id: If048bc301c38ac5ac5412a7d8f69231705088a50 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124343 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basic/source')
-rw-r--r--basic/source/classes/sbunoobj.cxx17
-rw-r--r--basic/source/classes/sbxmod.cxx8
-rw-r--r--basic/source/runtime/comenumwrapper.cxx4
-rw-r--r--basic/source/runtime/methods1.cxx6
-rw-r--r--basic/source/uno/dlgcont.cxx4
-rw-r--r--basic/source/uno/modsizeexceeded.cxx4
-rw-r--r--basic/source/uno/namecont.cxx16
7 files changed, 21 insertions, 38 deletions
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index c1753a67aca0..f9d378ea8865 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -542,6 +542,7 @@ static void implSequenceToMultiDimArray( SbxDimArray*& pArray, Sequence< sal_Int
sal_Int32 nLen = xIdlArray->getLen( aValue );
for ( sal_Int32 index = 0; index < nLen; ++index )
{
+ auto pindices = indices.getArray();
Any aElementAny = xIdlArray->get( aValue, static_cast<sal_uInt32>(index) );
// This detects the dimension were currently processing
if ( dimCopy == dimension )
@@ -550,15 +551,16 @@ static void implSequenceToMultiDimArray( SbxDimArray*& pArray, Sequence< sal_Int
if ( sizes.getLength() < dimCopy )
{
sizes.realloc( sizes.getLength() + 1 );
- sizes[ sizes.getLength() - 1 ] = nLen;
+ sizes.getArray()[ sizes.getLength() - 1 ] = nLen;
indices.realloc( indices.getLength() + 1 );
+ pindices = indices.getArray();
}
}
if ( bIsZeroIndex )
- indices[ dimCopy - 1 ] = index;
+ pindices[ dimCopy - 1 ] = index;
else
- indices[ dimCopy - 1] = index + 1;
+ pindices[ dimCopy - 1] = index + 1;
implSequenceToMultiDimArray( pArray, indices, sizes, aElementAny, dimCopy, bIsZeroIndex, &aElementType );
}
@@ -4385,10 +4387,7 @@ Reference< XInterface > createComListener( const Any& aControlAny, const OUStrin
Reference< XInvocation > xProxy = new ModuleInvocationProxy( aPrefix, xScopeObj );
- Sequence<Any> args( 3 );
- args[0] = aControlAny;
- args[1] <<= aVBAType;
- args[2] <<= xProxy;
+ Sequence<Any> args{ aControlAny, Any(aVBAType), Any(xProxy) };
try
{
@@ -4524,9 +4523,7 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP
}
Reference< XInvocation > xProxy = new ModuleInvocationProxy( aPureIfaceName, pProxyClassModuleObject );
- Sequence<Any> args( 2 );
- args[0] <<= aIfaceName;
- args[1] <<= xProxy;
+ Sequence<Any> args{ Any(aIfaceName), Any(xProxy) };
Reference< XInterface > xRet;
try
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 75c323afe848..cdd05c0c1f14 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -2450,9 +2450,10 @@ void SbUserFormModule::triggerMethod( const OUString& aMethodToRun, Sequence< An
SbxValues aVals;
pMeth->Get( aVals );
+ auto pArguments = aArguments.getArray();
for ( sal_Int32 i = 0; i < aArguments.getLength(); ++i )
{
- aArguments[i] = sbxToUnoValue(xArray->Get(static_cast<sal_uInt32>(i) + 1));
+ pArguments[i] = sbxToUnoValue(xArray->Get(static_cast<sal_uInt32>(i) + 1));
}
pMeth->SetParameters( nullptr );
}
@@ -2536,10 +2537,7 @@ void SbUserFormModule::Unload()
{
sal_Int8 nCancel = 0;
- Sequence< Any > aParams;
- aParams.realloc(2);
- aParams[0] <<= nCancel;
- aParams[1] <<= sal_Int8(::ooo::vba::VbQueryClose::vbFormCode);
+ Sequence< Any > aParams = { Any(nCancel), Any(sal_Int8(::ooo::vba::VbQueryClose::vbFormCode)) };
triggerMethod( "Userform_QueryClose", aParams);
diff --git a/basic/source/runtime/comenumwrapper.cxx b/basic/source/runtime/comenumwrapper.cxx
index 7e2432e43b15..b7881a1b9ade 100644
--- a/basic/source/runtime/comenumwrapper.cxx
+++ b/basic/source/runtime/comenumwrapper.cxx
@@ -47,9 +47,7 @@ uno::Any SAL_CALL ComEnumerationWrapper::nextElement()
{
uno::Sequence< sal_Int16 > aNamedParamIndex;
uno::Sequence< uno::Any > aNamedParam;
- uno::Sequence< uno::Any > aArgs( 1 );
-
- aArgs[0] <<= m_nCurInd++;
+ uno::Sequence< uno::Any > aArgs{ uno::Any(m_nCurInd++) };
return m_xInvocation->invoke( "item",
aArgs,
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 8351100c9b62..a7212fc13151 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -2630,7 +2630,7 @@ void SbRtl_NPV(StarBASIC *, SbxArray & rPar, bool)
// convert for calc functions
Sequence< Sequence< double > > sValues(1);
- aValues >>= sValues[ 0 ];
+ aValues >>= sValues.getArray()[ 0 ];
aValues <<= sValues;
Sequence< Any > aParams
@@ -2703,7 +2703,7 @@ void SbRtl_MIRR(StarBASIC *, SbxArray & rPar, bool)
// convert for calc functions
Sequence< Sequence< double > > sValues(1);
- aValues >>= sValues[ 0 ];
+ aValues >>= sValues.getArray()[ 0 ];
aValues <<= sValues;
Sequence< Any > aParams
@@ -2731,7 +2731,7 @@ void SbRtl_IRR(StarBASIC *, SbxArray & rPar, bool)
// convert for calc functions
Sequence< Sequence< double > > sValues(1);
- aValues >>= sValues[ 0 ];
+ aValues >>= sValues.getArray()[ 0 ];
aValues <<= sValues;
// set default values for Optional args
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index 56305e820870..31c64aef95f5 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -121,9 +121,7 @@ static bool writeOasis2OOoLibraryElement(
xWriter->setOutputStream( xOutput );
- Sequence<Any> aArgs( 1 );
- aArgs[0] <<= xWriter;
-
+ Sequence<Any> aArgs{ Any(xWriter) };
Reference< xml::sax::XDocumentHandler > xHandler(
xSMgr->createInstanceWithArgumentsAndContext(
"com.sun.star.comp.Oasis2OOoTransformer",
diff --git a/basic/source/uno/modsizeexceeded.cxx b/basic/source/uno/modsizeexceeded.cxx
index 897c460f5940..27c795934961 100644
--- a/basic/source/uno/modsizeexceeded.cxx
+++ b/basic/source/uno/modsizeexceeded.cxx
@@ -36,9 +36,7 @@ ModuleSizeExceeded::ModuleSizeExceeded(const std::vector<OUString>& sModules)
m_xAbort = new comphelper::OInteractionAbort;
m_xApprove = new comphelper::OInteractionApprove;
- m_lContinuations.realloc(2);
- m_lContinuations[0] = m_xApprove;
- m_lContinuations[1] = m_xAbort;
+ m_lContinuations = { m_xApprove, m_xAbort };
}
bool ModuleSizeExceeded::isAbort() const
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 98b999ecf29e..a2cb37611f08 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -172,10 +172,7 @@ void NameContainer::replaceByName( const OUString& aName, const Any& aElement )
ChangesEvent aEvent;
aEvent.Source = mpxEventSource;
aEvent.Base <<= aEvent.Source;
- aEvent.Changes.realloc( 1 );
- aEvent.Changes[ 0 ].Accessor <<= aName;
- aEvent.Changes[ 0 ].Element = aElement;
- aEvent.Changes[ 0 ].ReplacedElement = aOldElement;
+ aEvent.Changes = { { Any(aName), aElement, aOldElement } };
maChangesListeners.notifyEach( &XChangesListener::changesOccurred, aEvent );
}
}
@@ -223,9 +220,7 @@ void NameContainer::insertNoCheck(const OUString& aName, const Any& aElement)
ChangesEvent aEvent;
aEvent.Source = mpxEventSource;
aEvent.Base <<= aEvent.Source;
- aEvent.Changes.realloc( 1 );
- aEvent.Changes[ 0 ].Accessor <<= aName;
- aEvent.Changes[ 0 ].Element = aElement;
+ aEvent.Changes = { { Any(aName), aElement, {} } };
maChangesListeners.notifyEach( &XChangesListener::changesOccurred, aEvent );
}
}
@@ -277,10 +272,9 @@ void NameContainer::removeByName( const OUString& aName )
ChangesEvent aEvent;
aEvent.Source = mpxEventSource;
aEvent.Base <<= aEvent.Source;
- aEvent.Changes.realloc( 1 );
- aEvent.Changes[ 0 ].Accessor <<= aName;
- // aEvent.Changes[ 0 ].Element remains empty (meaning "replaced with nothing")
- aEvent.Changes[ 0 ].ReplacedElement = aOldElement;
+ aEvent.Changes = { { Any(aName),
+ {}, // Element remains empty (meaning "replaced with nothing")
+ aOldElement } };
maChangesListeners.notifyEach( &XChangesListener::changesOccurred, aEvent );
}
}