summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorMikhail Voytenko <mav@openoffice.org>2010-07-06 15:41:44 +0200
committerMikhail Voytenko <mav@openoffice.org>2010-07-06 15:41:44 +0200
commitf04dcac7750da85761a89e27e534032c0ce10b8d (patch)
tree127f2f1f270ea59009a5684a25acd0f3839afdfa /extensions
parent6d6a5c8567d7d43a882aa2e2be88b1992a6b4f55 (diff)
mib17: #162858# allow to transport COM objects without TypeInfo as before
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/ole/oleobjw.cxx95
1 files changed, 55 insertions, 40 deletions
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index 0e203309407b..2d83d695be72 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -1193,52 +1193,67 @@ void SAL_CALL IUnknownWrapper_Impl::initialize( const Sequence< Any >& aArgument
aArguments[1] >>= m_bOriginalDispatch;
aArguments[2] >>= m_seqTypes;
+
+ ITypeInfo* pType = NULL;
try
{
- ITypeInfo* pType= getTypeInfo();
- // Get Default member
- CComBSTR defaultMemberName;
- if ( SUCCEEDED( pType->GetDocumentation(0, &defaultMemberName, 0, 0, 0 ) ) )
+ // a COM object implementation that has no TypeInfo is still a legal COM object;
+ // such objects can at least be transported through UNO using the bridge
+ // so we should allow to create wrappers for them as well
+ pType = getTypeInfo();
+ }
+ catch( BridgeRuntimeError& )
+ {}
+ catch( Exception& )
+ {}
+
+ if ( pType )
+ {
+ try
{
- OUString usName(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(defaultMemberName)));
- FuncDesc aDescGet(pType);
- FuncDesc aDescPut(pType);
- VarDesc aVarDesc(pType);
- // see if this is a property first ( more likely to be a property then a method )
- getPropDesc( usName, & aDescGet, & aDescPut, & aVarDesc);
-
- if ( !aDescGet && !aDescPut )
+ // Get Default member
+ CComBSTR defaultMemberName;
+ if ( SUCCEEDED( pType->GetDocumentation(0, &defaultMemberName, 0, 0, 0 ) ) )
{
- getFuncDesc( usName, &aDescGet );
- if ( !aDescGet )
- throw BridgeRuntimeError( OUSTR("[automation bridge]IUnknownWrapper_Impl::initialize() Failed to get Function or Property desc. for " ) + usName );
+ OUString usName(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(defaultMemberName)));
+ FuncDesc aDescGet(pType);
+ FuncDesc aDescPut(pType);
+ VarDesc aVarDesc(pType);
+ // see if this is a property first ( more likely to be a property then a method )
+ getPropDesc( usName, & aDescGet, & aDescPut, & aVarDesc);
+
+ if ( !aDescGet && !aDescPut )
+ {
+ getFuncDesc( usName, &aDescGet );
+ if ( !aDescGet )
+ throw BridgeRuntimeError( OUSTR("[automation bridge]IUnknownWrapper_Impl::initialize() Failed to get Function or Property desc. for " ) + usName );
+ }
+ // now for some funny heuristics to make basic understand what to do
+ // a single aDescGet ( that doesn't take any params ) would be
+ // a read only ( defaultmember ) property e.g. this object
+ // should implement XDefaultProperty
+ // a single aDescGet ( that *does* ) take params is basically a
+ // default method e.g. implement XDefaultMethod
+
+ // a DescPut ( I guess we only really support a default param with '1' param ) as a setValue ( but I guess we can leave it through, the object will fail if we don't get it right anyway )
+ if ( aDescPut || ( aDescGet && aDescGet->cParams == 0 ) )
+ m_bHasDfltProperty = true;
+ if ( aDescGet->cParams > 0 )
+ m_bHasDfltMethod = true;
+ if ( m_bHasDfltProperty || m_bHasDfltMethod )
+ m_sDefaultMember = usName;
}
- // now for some funny heuristics to make basic understand what to do
- // a single aDescGet ( that doesn't take any params ) would be
- // a read only ( defaultmember ) property e.g. this object
- // should implement XDefaultProperty
- // a single aDescGet ( that *does* ) take params is basically a
- // default method e.g. implement XDefaultMethod
-
- // a DescPut ( I guess we only really support a default param with '1' param ) as a setValue ( but I guess we can leave it through, the object will fail if we don't get it right anyway )
- if ( aDescPut || ( aDescGet && aDescGet->cParams == 0 ) )
- m_bHasDfltProperty = true;
- if ( aDescGet->cParams > 0 )
- m_bHasDfltMethod = true;
- if ( m_bHasDfltProperty || m_bHasDfltMethod )
- m_sDefaultMember = usName;
}
- }
- catch (BridgeRuntimeError & e)
- {
- // #i110821 Hot Fix: Fails for some objects that have
- // worked before, will be evaluated in follow up issue.
- //throw RuntimeException(e.message, Reference<XInterface>());
- }
- catch( Exception& e)
- {
- throw RuntimeException(OUSTR("[automation bridge] unexpected exception in IUnknownWrapper_Impl::initialiase() error message: \n") +
- e.Message, Reference<XInterface>());
+ catch ( BridgeRuntimeError & e )
+ {
+ throw RuntimeException( e.message, Reference<XInterface>() );
+ }
+ catch( Exception& e )
+ {
+ throw RuntimeException(
+ OUSTR("[automation bridge] unexpected exception in IUnknownWrapper_Impl::initialiase() error message: \n") + e.Message,
+ Reference<XInterface>() );
+ }
}
}