summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2008-07-07 10:58:50 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2008-07-07 10:58:50 +0000
commit0d79166e5144fd4ae2a9435b954c17619c4f5bb4 (patch)
treeeba5e2fccd0da8a761ac8dd38a707d8dc46fa2b1 /basic
parent86af87eda6cca03d0e120f5597b1b398f899f5d8 (diff)
INTEGRATION: CWS ab53 (1.52.26); FILE MERGED
2008/06/25 09:43:50 tkr 1.52.26.2: #i91017# add CreateInstanceWithArguments methode 2008/06/06 11:36:50 ab 1.52.26.1: #i88930# Initialize bNeedIntrospection in initializer list
Diffstat (limited to 'basic')
-rw-r--r--basic/source/classes/sbunoobj.cxx63
1 files changed, 60 insertions, 3 deletions
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 2623e8d44a..7f7c63bb34 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: sbunoobj.cxx,v $
- * $Revision: 1.53 $
+ * $Revision: 1.54 $
*
* This file is part of OpenOffice.org.
*
@@ -2222,6 +2222,7 @@ Reference< XInvocation > createDynamicInvocationFor( const Any& aAny );
SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
: SbxObject( aName_ )
+ , bNeedIntrospection( TRUE )
{
static Reference< XIntrospection > xIntrospection;
@@ -2269,8 +2270,6 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
}
}
- // Introspection-Flag
- bNeedIntrospection = TRUE;
maTmpUnoObj = aUnoObj_;
@@ -2908,6 +2907,64 @@ void RTL_Impl_CreateUnoService( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
}
}
+void RTL_Impl_CreateUnoServiceWithArguments( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ // Wir brauchen mindestens 2 Parameter
+ if ( rPar.Count() < 3 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+
+ // Klassen-Name der struct holen
+ String aServiceName = rPar.Get(1)->GetString();
+ Any aArgAsAny = sbxToUnoValue( rPar.Get(2),
+ getCppuType( (Sequence<Any>*)0 ) );
+ Sequence< Any > aArgs;
+ aArgAsAny >>= aArgs;
+
+ // Service suchen und instanzieren
+ Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() );
+ Reference< XInterface > xInterface;
+ if ( xFactory.is() )
+ {
+ try
+ {
+ xInterface = xFactory->createInstanceWithArguments( aServiceName, aArgs );
+ }
+ catch( const Exception& )
+ {
+ implHandleAnyException( ::cppu::getCaughtException() );
+ }
+ }
+
+ SbxVariableRef refVar = rPar.Get(0);
+ if( xInterface.is() )
+ {
+ Any aAny;
+ aAny <<= xInterface;
+
+ // SbUnoObject daraus basteln und zurueckliefern
+ SbUnoObjectRef xUnoObj = new SbUnoObject( aServiceName, aAny );
+ if( xUnoObj->getUnoAny().getValueType().getTypeClass() != TypeClass_VOID )
+ {
+ // Objekt zurueckliefern
+ refVar->PutObject( (SbUnoObject*)xUnoObj );
+ }
+ else
+ {
+ refVar->PutObject( NULL );
+ }
+ }
+ else
+ {
+ refVar->PutObject( NULL );
+ }
+}
+
void RTL_Impl_GetProcessServiceManager( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
{
(void)pBasic;