1
diff --git basic/source/classes/sbunoobj.cxx basic/source/classes/sbunoobj.cxx
2
index 09858a6..b1935c3 100644
3
--- basic/source/classes/sbunoobj.cxx
4
+++ basic/source/classes/sbunoobj.cxx
6
#include <com/sun/star/script/XInvocationAdapterFactory.hpp>
7
#include <com/sun/star/script/XTypeConverter.hpp>
8
#include <com/sun/star/script/XDefaultProperty.hpp>
9
+#include <com/sun/star/script/XDefaultMethod.hpp>
10
#include <com/sun/star/container/XNameAccess.hpp>
11
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
12
#include <com/sun/star/reflection/XIdlArray.hpp>
14
#include <com/sun/star/bridge/oleautomation/Date.hpp>
15
#include <com/sun/star/bridge/oleautomation/Decimal.hpp>
16
#include <com/sun/star/bridge/oleautomation/Currency.hpp>
18
+#include <com/sun/star/script/XAutomationInvocation.hpp>
20
using com::sun::star::uno::Reference;
21
using namespace com::sun::star::uno;
22
@@ -1502,6 +1503,103 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
26
+void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, bool bOLEAutomation, UINT32 nParamCount )
28
+ AutomationNamedArgsSbxArray* pArgNamesArray = NULL;
29
+ if( bOLEAutomation )
30
+ pArgNamesArray = PTR_CAST(AutomationNamedArgsSbxArray,pParams);
32
+ args.realloc( nParamCount );
33
+ Any* pAnyArgs = args.getArray();
34
+ bool bBlockConversionToSmallestType = pINST->IsCompatibility();
36
+ if( pArgNamesArray )
38
+ Sequence< ::rtl::OUString >& rNameSeq = pArgNamesArray->getNames();
39
+ ::rtl::OUString* pNames = rNameSeq.getArray();
41
+ for( i = 0 ; i < nParamCount ; i++ )
43
+ USHORT iSbx = (USHORT)(i+1);
45
+ // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
46
+ aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ),
47
+ bBlockConversionToSmallestType );
49
+ ::rtl::OUString aParamName = pNames[iSbx];
50
+ if( aParamName.getLength() )
52
+ oleautomation::NamedArgument aNamedArgument;
53
+ aNamedArgument.Name = aParamName;
54
+ aNamedArgument.Value = aValAny;
55
+ pAnyArgs[i] <<= aNamedArgument;
59
+ pAnyArgs[i] = aValAny;
65
+ for( i = 0 ; i < nParamCount ; i++ )
67
+ // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
68
+ pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (USHORT)(i+1) ),
69
+ bBlockConversionToSmallestType );
80
+Any invokeAutomationMethod( const String& Name, Sequence< Any >& args, SbxArray* pParams, UINT32 nParamCount, Reference< XInvocation >& rxInvocation, INVOKETYPE invokeType = Func )
82
+ Sequence< INT16 > OutParamIndex;
83
+ Sequence< Any > OutParam;
86
+ switch( invokeType )
89
+ aRetAny = rxInvocation->invoke( Name, args, OutParamIndex, OutParam );
93
+ Reference< XAutomationInvocation > xAutoInv( rxInvocation, UNO_QUERY_THROW );
94
+ aRetAny = xAutoInv->invokeGetProperty( Name, args, OutParamIndex, OutParam );
99
+ Reference< XAutomationInvocation > xAutoInv( rxInvocation, UNO_QUERY_THROW );
100
+ aRetAny = xAutoInv->invokePutProperty( Name, args, OutParamIndex, OutParam );
104
+ break; // should introduce an error here
107
+ const INT16* pIndices = OutParamIndex.getConstArray();
108
+ UINT32 nLen = OutParamIndex.getLength();
111
+ const Any* pNewValues = OutParam.getConstArray();
112
+ for( UINT32 j = 0 ; j < nLen ; j++ )
114
+ INT16 iTarget = pIndices[ j ];
115
+ if( iTarget >= (INT16)nParamCount )
117
+ unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pNewValues[ j ] );
123
// Dbg-Hilfsmethode zum Auslesen der in einem Object implementierten Interfaces
124
String Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Reference< XIdlClass >& xClass, USHORT nRekLevel )
126
@@ -2002,11 +2100,26 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
131
- Any aRetAny = mxInvocation->getValue( pProp->GetName() );
132
+ UINT32 nParamCount = pParams ? ((UINT32)pParams->Count() - 1) : 0;
133
+ sal_Bool bCanBeConsideredAMethod = mxInvocation->hasMethod( pProp->GetName() );
135
+ if ( bCanBeConsideredAMethod && nParamCount )
137
+ // Automation properties have methods, so.. we need to invoke this through
139
+ Sequence<Any> args;
140
+ processAutomationParams( pParams, args, true, nParamCount );
141
+ aRetAny = invokeAutomationMethod( pProp->GetName(), args, pParams, nParamCount, mxInvocation, GetProp );
145
+ aRetAny = mxInvocation->getValue( pProp->GetName() );
147
// Wert von Uno nach Sbx uebernehmen
148
unoToSbxValue( pVar, aRetAny );
149
+ if( pParams && bCanBeConsideredAMethod )
150
+ pVar->SetParameters( NULL );
153
catch( const Exception& )
155
@@ -2131,52 +2244,7 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
156
else if( bInvocation && pParams && mxInvocation.is() )
158
bool bOLEAutomation = true;
159
- // TODO: bOLEAutomation = xOLEAutomation.is()
161
- AutomationNamedArgsSbxArray* pArgNamesArray = NULL;
162
- if( bOLEAutomation )
163
- pArgNamesArray = PTR_CAST(AutomationNamedArgsSbxArray,pParams);
165
- args.realloc( nParamCount );
166
- Any* pAnyArgs = args.getArray();
167
- bool bBlockConversionToSmallestType = pINST->IsCompatibility();
168
- if( pArgNamesArray )
170
- Sequence< ::rtl::OUString >& rNameSeq = pArgNamesArray->getNames();
171
- ::rtl::OUString* pNames = rNameSeq.getArray();
174
- for( i = 0 ; i < nParamCount ; i++ )
176
- USHORT iSbx = (USHORT)(i+1);
178
- // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
179
- aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ),
180
- bBlockConversionToSmallestType );
182
- ::rtl::OUString aParamName = pNames[iSbx];
183
- if( aParamName.getLength() )
185
- oleautomation::NamedArgument aNamedArgument;
186
- aNamedArgument.Name = aParamName;
187
- aNamedArgument.Value = aValAny;
188
- pAnyArgs[i] <<= aNamedArgument;
192
- pAnyArgs[i] = aValAny;
198
- for( i = 0 ; i < nParamCount ; i++ )
200
- // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
201
- pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (USHORT)(i+1) ),
202
- bBlockConversionToSmallestType );
205
+ processAutomationParams( pParams, args, bOLEAutomation, nParamCount );
209
@@ -2211,26 +2279,8 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
211
else if( bInvocation && mxInvocation.is() )
213
- Sequence< INT16 > OutParamIndex;
214
- Sequence< Any > OutParam;
215
- Any aRetAny = mxInvocation->invoke( pMeth->GetName(), args, OutParamIndex, OutParam );
217
- // Wert von Uno nach Sbx uebernehmen
218
+ Any aRetAny = invokeAutomationMethod( pMeth->GetName(), args, pParams, nParamCount, mxInvocation );
219
unoToSbxValue( pVar, aRetAny );
221
- const INT16* pIndices = OutParamIndex.getConstArray();
222
- UINT32 nLen = OutParamIndex.getLength();
225
- const Any* pNewValues = OutParam.getConstArray();
226
- for( UINT32 j = 0 ; j < nLen ; j++ )
228
- INT16 iTarget = pIndices[ j ];
229
- if( iTarget >= (INT16)nParamCount )
231
- unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pNewValues[ j ] );
236
// #55460, Parameter hier weghauen, da das in unoToSbxValue()
237
diff --git basic/source/comp/dim.cxx basic/source/comp/dim.cxx
238
index b8b6a54..36cca2c 100644
239
--- basic/source/comp/dim.cxx
240
+++ basic/source/comp/dim.cxx
241
@@ -406,7 +406,10 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
243
SbiOpcode eOp_ = pDef->IsNew() ? _CREATE : _TCREATE;
244
aGen.Gen( eOp_, pDef->GetId(), pDef->GetTypeId() );
246
+ if ( bVBASupportOn )
247
+ aGen.Gen( _VBASET );
253
diff --git udkapi/com/sun/star/script/XAutomationInvocation.idl udkapi/com/sun/star/script/XAutomationInvocation.idl
255
index 0000000..9dcf61b
257
+++ udkapi/com/sun/star/script/XAutomationInvocation.idl
259
+/*************************************************************************
261
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
263
+ * Copyright 2008 by Sun Microsystems, Inc.
265
+ * OpenOffice.org - a multi-platform office productivity suite
267
+ * $RCSfile: XInvocation2.idl,v $
268
+ * $Revision: 1.10 $
270
+ * This file is part of OpenOffice.org.
272
+ * OpenOffice.org is free software: you can redistribute it and/or modify
273
+ * it under the terms of the GNU Lesser General Public License version 3
274
+ * only, as published by the Free Software Foundation.
276
+ * OpenOffice.org is distributed in the hope that it will be useful,
277
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
278
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
279
+ * GNU Lesser General Public License version 3 for more details
280
+ * (a copy is included in the LICENSE file that accompanied this code).
282
+ * You should have received a copy of the GNU Lesser General Public License
283
+ * version 3 along with OpenOffice.org. If not, see
284
+ * <http://www.openoffice.org/license.html>
285
+ * for a copy of the LGPLv3 License.
287
+ ************************************************************************/
288
+#ifndef __com_sun_star_script_XAutomationInvocation_idl__
289
+#define __com_sun_star_script_XAutomationInvocation_idl__
291
+#ifndef __com_sun_star_script_XInvocation_idl__
292
+#include <com/sun/star/script/XInvocation.idl>
296
+ module com { module sun { module star { module script {
298
+interface XAutomationInvocation: com::sun::star::script::XInvocation
300
+ any invokeGetProperty( [in] string aFunctionName, [in] sequence<any> aParams, [out] sequence<short> aOutParamIndex, [out] sequence<any> aOutParam ) raises( com::sun::star::lang::IllegalArgumentException, com::sun::star::script::CannotConvertException, com::sun::star::reflection::InvocationTargetException );
301
+ any invokePutProperty( [in] string aFunctionName, [in] sequence<any> aParams, [out] sequence<short> aOutParamIndex, [out] sequence<any> aOutParam ) raises( com::sun::star::lang::IllegalArgumentException, com::sun::star::script::CannotConvertException, com::sun::star::reflection::InvocationTargetException );
305
+//=============================================================================
310
diff --git udkapi/com/sun/star/script/makefile.mk udkapi/com/sun/star/script/makefile.mk
311
index 52a3214..8b8f53a 100644
312
--- udkapi/com/sun/star/script/makefile.mk
313
+++ udkapi/com/sun/star/script/makefile.mk
314
@@ -85,6 +85,7 @@ IDLFILES=\
315
XScriptEventsAttacher.idl\
317
XDefaultProperty.idl\
318
+ XAutomationInvocation.idl\