diff options
Diffstat (limited to 'vbahelper')
-rw-r--r-- | vbahelper/source/msforms/vbacontrol.cxx | 4 | ||||
-rw-r--r-- | vbahelper/source/msforms/vbacontrols.cxx | 5 | ||||
-rw-r--r-- | vbahelper/source/msforms/vbalistbox.cxx | 8 | ||||
-rw-r--r-- | vbahelper/source/msforms/vbalistcontrolhelper.cxx | 7 | ||||
-rw-r--r-- | vbahelper/source/vbahelper/vbaapplicationbase.cxx | 6 | ||||
-rw-r--r-- | vbahelper/source/vbahelper/vbacommandbarcontrols.cxx | 52 | ||||
-rw-r--r-- | vbahelper/source/vbahelper/vbadocumentbase.cxx | 5 | ||||
-rw-r--r-- | vbahelper/source/vbahelper/vbadocumentsbase.cxx | 10 | ||||
-rw-r--r-- | vbahelper/source/vbahelper/vbaeventshelperbase.cxx | 2 | ||||
-rw-r--r-- | vbahelper/source/vbahelper/vbahelper.cxx | 5 |
10 files changed, 47 insertions, 57 deletions
diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx index 1c70be2c987d..b0b33543e059 100644 --- a/vbahelper/source/msforms/vbacontrol.cxx +++ b/vbahelper/source/msforms/vbacontrol.cxx @@ -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 ); } } diff --git a/vbahelper/source/msforms/vbacontrols.cxx b/vbahelper/source/msforms/vbacontrols.cxx index 2b7c92374fcf..6f36280aa26f 100644 --- a/vbahelper/source/msforms/vbacontrols.cxx +++ b/vbahelper/source/msforms/vbacontrols.cxx @@ -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 ); diff --git a/vbahelper/source/msforms/vbalistbox.cxx b/vbahelper/source/msforms/vbalistbox.cxx index cfa9e54a6134..57ccc38b942c 100644 --- a/vbahelper/source/msforms/vbalistbox.cxx +++ b/vbahelper/source/msforms/vbalistbox.cxx @@ -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(); diff --git a/vbahelper/source/msforms/vbalistcontrolhelper.cxx b/vbahelper/source/msforms/vbalistcontrolhelper.cxx index d8ea543bf4ca..9e45b5cc81e0 100644 --- a/vbahelper/source/msforms/vbalistcontrolhelper.cxx +++ b/vbahelper/source/msforms/vbalistcontrolhelper.cxx @@ -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 { diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx index 7f1de5b89681..61529cec2b18 100644 --- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -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 ); diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx index 1b35964446b0..7936247ac541 100644 --- a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx +++ b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx @@ -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; } diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx index bf199764b0c4..d27804012bca 100644 --- a/vbahelper/source/vbahelper/vbadocumentbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx @@ -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 ); diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx index 65ef6b6019e4..f2b23997a8da 100644 --- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx @@ -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; } } diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx index 8c8515d8fa1c..1f92e449a156 100644 --- a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx +++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx @@ -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; diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index 9ed61ba32685..25da3beca4d4 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -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==== |