File vba-macro-properties-3.1.1.diff of Package OpenOffice_org-libs-core
diff --git svx/source/msfilter/msvbahelper.cxx svx/source/msfilter/msvbahelper.cxx
index 7919fb6..3761b62 100644
--- svx/source/msfilter/msvbahelper.cxx
+++ svx/source/msfilter/msvbahelper.cxx
@@ -361,40 +361,24 @@ sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Se
uno::Sequence< uno::Any > aOutArgs;
try
- {
- uno::Reference< script::provider::XScriptProvider > xScriptProvider;
- uno::Reference< script::provider::XScriptProviderSupplier > xSPS( pShell->GetModel(), uno::UNO_QUERY_THROW );
-
- xScriptProvider.set( xSPS->getScriptProvider(), uno::UNO_QUERY_THROW );
-
- uno::Reference< script::provider::XScript > xScript( xScriptProvider->getScript( sUrl ), uno::UNO_QUERY_THROW );
-
- if ( aCaller.hasValue() )
+ { ErrCode nErr( ERRCODE_BASIC_INTERNAL_ERROR );
+ if ( pShell )
{
- uno::Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY );
- if ( xProps.is() )
+ uno::Any aRet;
+ nErr = pShell->CallXScript( sUrl,
+ aArgs, aRet, aOutArgsIndex, aOutArgs, false, const_cast<uno::Any*> (&aCaller) );
+ sal_Int32 nLen = aOutArgs.getLength();
+ // convert any out params to seem like they were inouts
+ if ( nLen )
{
- uno::Sequence< uno::Any > aCallerHack(1);
- aCallerHack[ 0 ] = aCaller;
- xProps->setPropertyValue( rtl::OUString::createFromAscii( "Caller" ), uno::makeAny( aCallerHack ) );
- }
- }
-
-
- xScript->invoke( aArgs, aOutArgsIndex, aOutArgs );
-
- sal_Int32 nLen = aOutArgs.getLength();
- // convert any out params to seem like they were inouts
- if ( nLen )
- {
- for ( sal_Int32 index=0; index < nLen; ++index )
- {
- sal_Int32 nOutIndex = aOutArgsIndex[ index ];
- aArgs[ nOutIndex ] = aOutArgs[ index ];
- }
+ for ( sal_Int32 index=0; index < nLen; ++index )
+ {
+ sal_Int32 nOutIndex = aOutArgsIndex[ index ];
+ aArgs[ nOutIndex ] = aOutArgs[ index ];
+ }
+ }
}
-
- bRes = sal_True;
+ bRes = ( nErr == ERRCODE_NONE );
}
catch ( uno::Exception& e )
{