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
commit9aff5bfafccfe7452de999c8558c5173234af94d (patch)
tree69b312308abe84a05592b5ec946d7a21050c9244 /basic
parent3f11fc7c094436f6d4f299e9919619ccd8ccb49f (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 0d203db718f6..bf249731dc59 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;