~ubuntu-branches/ubuntu/lucid/openoffice.org-l10n/lucid

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
diff --git basic/source/classes/sbunoobj.cxx basic/source/classes/sbunoobj.cxx
index 09858a6..b1935c3 100644
--- basic/source/classes/sbunoobj.cxx
+++ basic/source/classes/sbunoobj.cxx
@@ -63,6 +63,7 @@
 #include <com/sun/star/script/XInvocationAdapterFactory.hpp>
 #include <com/sun/star/script/XTypeConverter.hpp>
 #include <com/sun/star/script/XDefaultProperty.hpp>
+#include <com/sun/star/script/XDefaultMethod.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
 #include <com/sun/star/reflection/XIdlArray.hpp>
@@ -73,7 +74,7 @@
 #include <com/sun/star/bridge/oleautomation/Date.hpp>
 #include <com/sun/star/bridge/oleautomation/Decimal.hpp>
 #include <com/sun/star/bridge/oleautomation/Currency.hpp>
-
+#include <com/sun/star/script/XAutomationInvocation.hpp>
 
 using com::sun::star::uno::Reference;
 using namespace com::sun::star::uno;
@@ -1502,6 +1503,103 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
     return aRetVal;
 }
 
+void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, bool bOLEAutomation, UINT32 nParamCount )
+{
+	AutomationNamedArgsSbxArray* pArgNamesArray = NULL;
+	if( bOLEAutomation )
+		pArgNamesArray = PTR_CAST(AutomationNamedArgsSbxArray,pParams);
+
+	args.realloc( nParamCount );
+	Any* pAnyArgs = args.getArray();
+	bool bBlockConversionToSmallestType = pINST->IsCompatibility();
+	UINT32 i = 0;	
+	if( pArgNamesArray )
+	{
+		Sequence< ::rtl::OUString >& rNameSeq = pArgNamesArray->getNames();
+		::rtl::OUString* pNames = rNameSeq.getArray();
+		Any aValAny;
+		for( i = 0 ; i < nParamCount ; i++ )
+		{
+			USHORT iSbx = (USHORT)(i+1);
+	
+			// ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
+			aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ),
+			bBlockConversionToSmallestType );
+	
+			::rtl::OUString aParamName = pNames[iSbx];
+			if( aParamName.getLength() )
+			{
+				oleautomation::NamedArgument aNamedArgument;
+				aNamedArgument.Name = aParamName;
+				aNamedArgument.Value = aValAny;
+				pAnyArgs[i] <<= aNamedArgument;
+			}
+			else
+			{
+				pAnyArgs[i] = aValAny;
+			}
+		}
+	}
+	else
+	{
+		for( i = 0 ; i < nParamCount ; i++ )
+		{
+			// ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
+			pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (USHORT)(i+1) ),
+			bBlockConversionToSmallestType );
+		}
+	}
+
+}
+enum INVOKETYPE
+{
+   GetProp = 0, 
+   SetProp, 
+   Func
+};
+Any invokeAutomationMethod( const String& Name, Sequence< Any >& args, SbxArray* pParams, UINT32 nParamCount, Reference< XInvocation >& rxInvocation, INVOKETYPE invokeType = Func )
+{
+	Sequence< INT16 > OutParamIndex;
+	Sequence< Any > OutParam;
+    
+	Any aRetAny;
+	switch( invokeType )
+	{
+		case Func:
+			aRetAny = rxInvocation->invoke( Name, args, OutParamIndex, OutParam );
+			break;
+		case GetProp:
+			{
+				Reference< XAutomationInvocation > xAutoInv( rxInvocation, UNO_QUERY_THROW );
+				aRetAny = xAutoInv->invokeGetProperty( Name, args, OutParamIndex, OutParam );
+				break;
+			}
+		case SetProp:
+			{
+				Reference< XAutomationInvocation > xAutoInv( rxInvocation, UNO_QUERY_THROW );
+				aRetAny = xAutoInv->invokePutProperty( Name, args, OutParamIndex, OutParam );
+				break;
+			}
+		default:
+			break; // should introduce an error here
+	
+	}
+	const INT16* pIndices = OutParamIndex.getConstArray();
+	UINT32 nLen = OutParamIndex.getLength();
+	if( nLen )
+	{
+		const Any* pNewValues = OutParam.getConstArray();
+		for( UINT32 j = 0 ; j < nLen ; j++ )
+		{
+			INT16 iTarget = pIndices[ j ];
+			if( iTarget >= (INT16)nParamCount )
+				break;
+			unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pNewValues[ j ] );
+		}
+	}
+    return aRetAny;
+}
+
 // Dbg-Hilfsmethode zum Auslesen der in einem Object implementierten Interfaces
 String Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Reference< XIdlClass >& xClass, USHORT nRekLevel )
 {
@@ -2002,11 +2100,26 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
                 {
                     try
                     {
-                        // Wert holen
-                        Any aRetAny = mxInvocation->getValue( pProp->GetName() );
+						UINT32 nParamCount = pParams ? ((UINT32)pParams->Count() - 1) : 0;
+						sal_Bool bCanBeConsideredAMethod = mxInvocation->hasMethod( pProp->GetName() );
+						Any aRetAny;
+					   	if ( bCanBeConsideredAMethod && nParamCount )
+						{
+							// Automation properties have methods, so.. we need to invoke this through
+							// XInvocation
+							Sequence<Any> args;
+							processAutomationParams( pParams, args, true, nParamCount );
+							aRetAny = invokeAutomationMethod( pProp->GetName(), args, pParams, nParamCount, mxInvocation, GetProp );
+						}	
+						else
+							// Wert holen
+							aRetAny = mxInvocation->getValue( pProp->GetName() );
 
                         // Wert von Uno nach Sbx uebernehmen
                         unoToSbxValue( pVar, aRetAny );
+						if( pParams && bCanBeConsideredAMethod )
+							pVar->SetParameters( NULL );
+
                     }
                     catch( const Exception& )
                     {
@@ -2131,52 +2244,7 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
                 else if( bInvocation && pParams && mxInvocation.is() )
                 {
                     bool bOLEAutomation = true;
-                    // TODO: bOLEAutomation = xOLEAutomation.is()
-
-                    AutomationNamedArgsSbxArray* pArgNamesArray = NULL;
-                    if( bOLEAutomation )
-                        pArgNamesArray = PTR_CAST(AutomationNamedArgsSbxArray,pParams);
-
-                    args.realloc( nParamCount );
-                    Any* pAnyArgs = args.getArray();
-                    bool bBlockConversionToSmallestType = pINST->IsCompatibility();
-                    if( pArgNamesArray )
-                    {
-                        Sequence< ::rtl::OUString >& rNameSeq = pArgNamesArray->getNames();
-                        ::rtl::OUString* pNames = rNameSeq.getArray();
-
-                        Any aValAny;
-                        for( i = 0 ; i < nParamCount ; i++ )
-                        {
-                            USHORT iSbx = (USHORT)(i+1);
-
-                            // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
-                            aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ),
-                                                        bBlockConversionToSmallestType );
-
-                            ::rtl::OUString aParamName = pNames[iSbx];
-                            if( aParamName.getLength() )
-                            {
-                                oleautomation::NamedArgument aNamedArgument;
-                                aNamedArgument.Name = aParamName;
-                                aNamedArgument.Value = aValAny;
-                                pAnyArgs[i] <<= aNamedArgument;
-                            }
-                            else
-                            {
-                                pAnyArgs[i] = aValAny;
-                            }
-                        }
-                    }
-                    else
-                    {
-                        for( i = 0 ; i < nParamCount ; i++ )
-                        {
-                            // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
-                            pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (USHORT)(i+1) ),
-                                                            bBlockConversionToSmallestType );
-                        }
-                    }
+					processAutomationParams( pParams, args, bOLEAutomation, nParamCount );
                 }
 
                 // Methode callen
@@ -2211,26 +2279,8 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
                     }
                     else if( bInvocation && mxInvocation.is() )
                     {
-                        Sequence< INT16 > OutParamIndex;
-                        Sequence< Any > OutParam;
-                        Any aRetAny = mxInvocation->invoke( pMeth->GetName(), args, OutParamIndex, OutParam );
-
-                        // Wert von Uno nach Sbx uebernehmen
+						Any aRetAny = invokeAutomationMethod( pMeth->GetName(), args, pParams, nParamCount, mxInvocation );
                         unoToSbxValue( pVar, aRetAny );
-
-                        const INT16* pIndices = OutParamIndex.getConstArray();
-                        UINT32 nLen = OutParamIndex.getLength();
-                        if( nLen )
-                        {
-                            const Any* pNewValues = OutParam.getConstArray();
-                            for( UINT32 j = 0 ; j < nLen ; j++ )
-                            {
-                                INT16 iTarget = pIndices[ j ];
-                                if( iTarget >= (INT16)nParamCount )
-                                    break;
-                                unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pNewValues[ j ] );
-                            }
-                        }
                     }
 
                     // #55460, Parameter hier weghauen, da das in unoToSbxValue()
diff --git basic/source/comp/dim.cxx basic/source/comp/dim.cxx
index b8b6a54..36cca2c 100644
--- basic/source/comp/dim.cxx
+++ basic/source/comp/dim.cxx
@@ -406,7 +406,10 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
                 aExpr.Gen();
                 SbiOpcode eOp_ = pDef->IsNew() ? _CREATE : _TCREATE;
                 aGen.Gen( eOp_, pDef->GetId(), pDef->GetTypeId() );
-                aGen.Gen( _SET );
+				if ( bVBASupportOn )
+					aGen.Gen( _VBASET );
+				else	
+					aGen.Gen( _SET );
             }
         }
         else
diff --git udkapi/com/sun/star/script/XAutomationInvocation.idl udkapi/com/sun/star/script/XAutomationInvocation.idl
new file mode 100644
index 0000000..9dcf61b
--- /dev/null
+++ udkapi/com/sun/star/script/XAutomationInvocation.idl
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XInvocation2.idl,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __com_sun_star_script_XAutomationInvocation_idl__ 
+#define __com_sun_star_script_XAutomationInvocation_idl__
+ 
+#ifndef __com_sun_star_script_XInvocation_idl__ 
+#include <com/sun/star/script/XInvocation.idl> 
+#endif 
+ 
+ 
+ module com {  module sun {  module star {  module script {  
+ 
+interface XAutomationInvocation: com::sun::star::script::XInvocation
+{ 
+    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 );
+    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 );
+ 
+}; 
+ 
+//============================================================================= 
+ 
+}; }; }; };  
+ 
+#endif 
diff --git udkapi/com/sun/star/script/makefile.mk udkapi/com/sun/star/script/makefile.mk
index 52a3214..8b8f53a 100644
--- udkapi/com/sun/star/script/makefile.mk
+++ udkapi/com/sun/star/script/makefile.mk
@@ -85,6 +85,7 @@ IDLFILES=\
     XScriptEventsAttacher.idl\
     XDefaultMethod.idl\
     XDefaultProperty.idl\
+	XAutomationInvocation.idl\
     ModuleInfo.idl\
     ModuleType.idl\
     XErrorQuery.idl\