Prepare for removal of non-const operator[] from Sequence in vbahelper
Change-Id: I2450faf4b3e093b2046034e2a5e5657ff5144d98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124410 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
@@ -532,7 +532,7 @@ void SAL_CALL ScVbaControl::fireEvent( const script::ScriptEvent& rEvt )
|
||||
evt.ScriptCode = xNameQuery->getCodeNameForObject( xIf );
|
||||
// handle if we passed in our own arguments
|
||||
if ( !rEvt.Arguments.hasElements() )
|
||||
evt.Arguments[ 0 ] <<= aEvt;
|
||||
evt.Arguments.getArray()[ 0 ] <<= aEvt;
|
||||
xScriptListener->firing( evt );
|
||||
}
|
||||
else
|
||||
@@ -546,7 +546,7 @@ void SAL_CALL ScVbaControl::fireEvent( const script::ScriptEvent& rEvt )
|
||||
evt.Source = xThisControl;
|
||||
aEvt.Source = xControl;
|
||||
evt.ScriptCode = m_sLibraryAndCodeName;
|
||||
evt.Arguments[ 0 ] <<= aEvt;
|
||||
evt.Arguments.getArray()[ 0 ] <<= aEvt;
|
||||
xScriptListener->firing( evt );
|
||||
}
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ private:
|
||||
if ( nIndex >= msNames.getLength() )
|
||||
msNames.realloc( nIndex );
|
||||
|
||||
msNames[ nIndex ] = getControlName( xCtrl );
|
||||
msNames.getArray()[ nIndex ] = getControlName( xCtrl );
|
||||
mControls.push_back( xCtrl );
|
||||
mIndices[ msNames[ nIndex ] ] = nIndex;
|
||||
}
|
||||
@@ -382,8 +382,7 @@ uno::Any SAL_CALL ScVbaControls::Add( const uno::Any& Object, const uno::Any& St
|
||||
{
|
||||
uno::Reference< script::XInvocation > xControlInvoke( xNewControl, uno::UNO_QUERY_THROW );
|
||||
|
||||
uno::Sequence< uno::Any > aArgs( 1 );
|
||||
aArgs[0] <<= aComServiceName;
|
||||
uno::Sequence< uno::Any > aArgs{ uno::Any(aComServiceName) };
|
||||
uno::Sequence< sal_Int16 > aOutIDDummy;
|
||||
uno::Sequence< uno::Any > aOutDummy;
|
||||
xControlInvoke->invoke( "SOAddAXControl" , aArgs, aOutIDDummy, aOutDummy );
|
||||
|
@@ -187,9 +187,10 @@ ScVbaListBox::setValueEvent( const uno::Any& value )
|
||||
{
|
||||
if( !bValue )
|
||||
{
|
||||
auto pList = nList.getArray();
|
||||
for( ; i < nLength - 1; i++ )
|
||||
{
|
||||
nList[i] = nList[i + 1];
|
||||
pList[i] = nList[i + 1];
|
||||
}
|
||||
nList.realloc( nLength - 1 );
|
||||
//m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
|
||||
@@ -205,12 +206,11 @@ ScVbaListBox::setValueEvent( const uno::Any& value )
|
||||
if( getMultiSelect() )
|
||||
{
|
||||
nList.realloc( nLength + 1 );
|
||||
nList[nLength] = nIndex;
|
||||
nList.getArray()[nLength] = nIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
nList.realloc( 1 );
|
||||
nList[0] = nIndex;
|
||||
nList = { nIndex };
|
||||
}
|
||||
//m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
|
||||
fireClickEvent();
|
||||
|
@@ -75,10 +75,11 @@ uno::Any ListPropListener::getValueEvent()
|
||||
else // List() ( e.g. no args )
|
||||
{
|
||||
uno::Sequence< uno::Sequence< OUString > > sReturnArray( nLength );
|
||||
auto pReturnArray = sReturnArray.getArray();
|
||||
for ( sal_Int32 i = 0; i < nLength; ++i )
|
||||
{
|
||||
sReturnArray[ i ].realloc( 10 );
|
||||
sReturnArray[ i ][ 0 ] = sList[ i ];
|
||||
pReturnArray[ i ].realloc( 10 );
|
||||
pReturnArray[ i ].getArray()[ 0 ] = sList[ i ];
|
||||
}
|
||||
aRet <<= sReturnArray;
|
||||
}
|
||||
@@ -107,7 +108,7 @@ ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargInde
|
||||
{
|
||||
sal_Int32 nOldSize = sList.getLength();
|
||||
sList.realloc( nOldSize + 1 );
|
||||
sList[ nOldSize ] = sString;
|
||||
sList.getArray()[ nOldSize ] = sString;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -357,6 +357,7 @@ uno::Any SAL_CALL VbaApplicationBase::Run( const OUString& MacroName, const uno:
|
||||
|
||||
int nArg = SAL_N_ELEMENTS( aArgsPtrArray );
|
||||
uno::Sequence< uno::Any > aArgs( nArg );
|
||||
auto pArgs = aArgs.getArray();
|
||||
|
||||
const uno::Any** pArg = aArgsPtrArray;
|
||||
const uno::Any** pArgEnd = aArgsPtrArray + nArg;
|
||||
@@ -364,7 +365,7 @@ uno::Any SAL_CALL VbaApplicationBase::Run( const OUString& MacroName, const uno:
|
||||
sal_Int32 nArgProcessed = 0;
|
||||
|
||||
for ( ; pArg != pArgEnd; ++pArg, ++nArgProcessed )
|
||||
aArgs[ nArgProcessed ] = **pArg;
|
||||
pArgs[ nArgProcessed ] = **pArg;
|
||||
|
||||
// resize array to position of last param with value
|
||||
aArgs.realloc( nArgProcessed + 1 );
|
||||
@@ -418,8 +419,7 @@ uno::Any SAL_CALL VbaApplicationBase::getVBE()
|
||||
try // return empty object on error
|
||||
{
|
||||
// "VBE" object does not have a parent, but pass document model to be able to determine application type
|
||||
uno::Sequence< uno::Any > aArgs( 1 );
|
||||
aArgs[ 0 ] <<= getCurrentDocument();
|
||||
uno::Sequence< uno::Any > aArgs{ uno::Any(getCurrentDocument()) };
|
||||
uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW );
|
||||
uno::Reference< uno::XInterface > xVBE = xServiceManager->createInstanceWithArgumentsAndContext(
|
||||
"ooo.vba.vbide.VBE" , aArgs, mxContext );
|
||||
|
@@ -19,6 +19,8 @@
|
||||
#include "vbacommandbarcontrols.hxx"
|
||||
#include "vbacommandbarcontrol.hxx"
|
||||
#include <com/sun/star/lang/XSingleComponentFactory.hpp>
|
||||
|
||||
#include <comphelper/propertyvalue.hxx>
|
||||
#include <rtl/ref.hxx>
|
||||
|
||||
using namespace com::sun::star;
|
||||
@@ -63,22 +65,15 @@ uno::Sequence< beans::PropertyValue > ScVbaCommandBarControls::CreateMenuItemDat
|
||||
bool isVisible,
|
||||
bool isEnabled )
|
||||
{
|
||||
uno::Sequence< beans::PropertyValue > aProps(7);
|
||||
|
||||
aProps[0].Name = ITEM_DESCRIPTOR_COMMANDURL;
|
||||
aProps[0].Value <<= sCommandURL;
|
||||
aProps[1].Name = ITEM_DESCRIPTOR_HELPURL;
|
||||
aProps[1].Value <<= sHelpURL;
|
||||
aProps[2].Name = ITEM_DESCRIPTOR_LABEL;
|
||||
aProps[2].Value <<= sLabel;
|
||||
aProps[3].Name = ITEM_DESCRIPTOR_TYPE;
|
||||
aProps[3].Value <<= nType;
|
||||
aProps[4].Name = ITEM_DESCRIPTOR_CONTAINER;
|
||||
aProps[4].Value = aSubMenu;
|
||||
aProps[5].Name = ITEM_DESCRIPTOR_ISVISIBLE;
|
||||
aProps[5].Value <<= isVisible;
|
||||
aProps[6].Name = ITEM_DESCRIPTOR_ENABLED;
|
||||
aProps[6].Value <<= isEnabled;
|
||||
uno::Sequence< beans::PropertyValue > aProps{
|
||||
comphelper::makePropertyValue(ITEM_DESCRIPTOR_COMMANDURL, sCommandURL),
|
||||
comphelper::makePropertyValue(ITEM_DESCRIPTOR_HELPURL, sHelpURL),
|
||||
comphelper::makePropertyValue(ITEM_DESCRIPTOR_LABEL, sLabel),
|
||||
comphelper::makePropertyValue(ITEM_DESCRIPTOR_TYPE, nType),
|
||||
comphelper::makePropertyValue(ITEM_DESCRIPTOR_CONTAINER, aSubMenu),
|
||||
comphelper::makePropertyValue(ITEM_DESCRIPTOR_ISVISIBLE, isVisible),
|
||||
comphelper::makePropertyValue(ITEM_DESCRIPTOR_ENABLED, isEnabled)
|
||||
};
|
||||
|
||||
return aProps;
|
||||
}
|
||||
@@ -91,22 +86,15 @@ uno::Sequence< beans::PropertyValue > ScVbaCommandBarControls::CreateToolbarItem
|
||||
bool isVisible,
|
||||
sal_Int32 nStyle )
|
||||
{
|
||||
uno::Sequence< beans::PropertyValue > aProps(7);
|
||||
|
||||
aProps[0].Name = ITEM_DESCRIPTOR_COMMANDURL;
|
||||
aProps[0].Value <<= sCommandURL;
|
||||
aProps[1].Name = ITEM_DESCRIPTOR_HELPURL;
|
||||
aProps[1].Value <<= sHelpURL;
|
||||
aProps[2].Name = ITEM_DESCRIPTOR_LABEL;
|
||||
aProps[2].Value <<= sLabel;
|
||||
aProps[3].Name = ITEM_DESCRIPTOR_TYPE;
|
||||
aProps[3].Value <<= nType;
|
||||
aProps[4].Name = ITEM_DESCRIPTOR_CONTAINER;
|
||||
aProps[4].Value = aSubMenu;
|
||||
aProps[5].Name = ITEM_DESCRIPTOR_ISVISIBLE;
|
||||
aProps[5].Value <<= isVisible;
|
||||
aProps[6].Name = ITEM_DESCRIPTOR_STYLE;
|
||||
aProps[6].Value <<= nStyle;
|
||||
uno::Sequence< beans::PropertyValue > aProps{
|
||||
comphelper::makePropertyValue(ITEM_DESCRIPTOR_COMMANDURL, sCommandURL),
|
||||
comphelper::makePropertyValue(ITEM_DESCRIPTOR_HELPURL, sHelpURL),
|
||||
comphelper::makePropertyValue(ITEM_DESCRIPTOR_LABEL, sLabel),
|
||||
comphelper::makePropertyValue(ITEM_DESCRIPTOR_TYPE, nType),
|
||||
comphelper::makePropertyValue(ITEM_DESCRIPTOR_CONTAINER, aSubMenu),
|
||||
comphelper::makePropertyValue(ITEM_DESCRIPTOR_ISVISIBLE, isVisible),
|
||||
comphelper::makePropertyValue(ITEM_DESCRIPTOR_STYLE, nStyle)
|
||||
};
|
||||
|
||||
return aProps;
|
||||
}
|
||||
|
@@ -278,9 +278,8 @@ VbaDocumentBase::getVBProject()
|
||||
{
|
||||
uno::Reference< XApplicationBase > xApp( Application(), uno::UNO_QUERY_THROW );
|
||||
uno::Reference< XInterface > xVBE( xApp->getVBE(), uno::UNO_QUERY_THROW );
|
||||
uno::Sequence< uno::Any > aArgs( 2 );
|
||||
aArgs[ 0 ] <<= xVBE; // the VBE
|
||||
aArgs[ 1 ] <<= getModel(); // document model for script container access
|
||||
uno::Sequence< uno::Any > aArgs{ uno::Any(xVBE), // the VBE
|
||||
uno::Any(getModel()) }; // document model for script container access
|
||||
uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW );
|
||||
mxVBProject = xServiceManager->createInstanceWithArgumentsAndContext(
|
||||
"ooo.vba.vbide.VBProject", aArgs, mxContext );
|
||||
|
@@ -288,8 +288,9 @@ uno::Any VbaDocumentsBase::openDocument( const OUString& rFileName, const uno::A
|
||||
|
||||
uno::Sequence< beans::PropertyValue > sProps( rProps );
|
||||
sProps.realloc( sProps.getLength() + 1 );
|
||||
sProps[ sProps.getLength() - 1 ].Name = "MacroExecutionMode";
|
||||
sProps[ sProps.getLength() - 1 ].Value <<= document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN;
|
||||
auto pProps = sProps.getArray();
|
||||
pProps[ sProps.getLength() - 1 ].Name = "MacroExecutionMode";
|
||||
pProps[ sProps.getLength() - 1 ].Value <<= document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN;
|
||||
|
||||
if ( ReadOnly.hasValue() )
|
||||
{
|
||||
@@ -298,8 +299,9 @@ uno::Any VbaDocumentsBase::openDocument( const OUString& rFileName, const uno::A
|
||||
if ( bIsReadOnly )
|
||||
{
|
||||
sProps.realloc( sProps.getLength() + 1 );
|
||||
sProps[ sProps.getLength() - 1 ].Name = "ReadOnly";
|
||||
sProps[ sProps.getLength() - 1 ].Value <<= true;
|
||||
pProps = sProps.getArray();
|
||||
pProps[ sProps.getLength() - 1 ].Name = "ReadOnly";
|
||||
pProps[ sProps.getLength() - 1 ].Value <<= true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -107,7 +107,7 @@ sal_Bool SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, cons
|
||||
{
|
||||
if( rInfo.mnCancelIndex >= aVbaArgs.getLength() )
|
||||
throw lang::IllegalArgumentException();
|
||||
aVbaArgs[ rInfo.mnCancelIndex ] <<= bCancel;
|
||||
aVbaArgs.getArray()[ rInfo.mnCancelIndex ] <<= bCancel;
|
||||
}
|
||||
// execute the event handler
|
||||
uno::Any aRet, aCaller;
|
||||
|
@@ -752,8 +752,9 @@ void setOrAppendPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, con
|
||||
// append the property
|
||||
sal_Int32 nLength = aProp.getLength();
|
||||
aProp.realloc( nLength + 1 );
|
||||
aProp[ nLength ].Name = aName;
|
||||
aProp[ nLength ].Value = aValue;
|
||||
auto pProp = aProp.getArray();
|
||||
pProp[ nLength ].Name = aName;
|
||||
pProp[ nLength ].Value = aValue;
|
||||
}
|
||||
|
||||
// ====UserFormGeomentryHelper====
|
||||
|
Reference in New Issue
Block a user