Kaydet (Commit) e3aef4dc authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Some simplifications, using UNO_QUERY_THROW

Change-Id: Ib973a403a830a3ecf8e57a5e70a581ba06f96a05
Reviewed-on: https://gerrit.libreoffice.org/34264Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 57c4fe05
...@@ -1709,9 +1709,7 @@ PyRef PyUNO_new ( ...@@ -1709,9 +1709,7 @@ PyRef PyUNO_new (
{ {
PyThreadDetach antiguard; PyThreadDetach antiguard;
xInvocation.set( xInvocation.set(
ssf->createInstanceWithArguments( Sequence<Any>( &targetInterface, 1 ) ), UNO_QUERY ); ssf->createInstanceWithArguments( Sequence<Any>( &targetInterface, 1 ) ), css::uno::UNO_QUERY_THROW );
if( !xInvocation.is() )
throw RuntimeException("XInvocation2 not implemented, cannot interact with object");
Reference<XUnoTunnel> xUnoTunnel ( Reference<XUnoTunnel> xUnoTunnel (
xInvocation->getIntrospection()->queryAdapter(cppu::UnoType<XUnoTunnel>::get()), UNO_QUERY ); xInvocation->getIntrospection()->queryAdapter(cppu::UnoType<XUnoTunnel>::get()), UNO_QUERY );
......
...@@ -267,9 +267,7 @@ PyRef stRuntimeImpl::create( const Reference< XComponentContext > &ctx ) ...@@ -267,9 +267,7 @@ PyRef stRuntimeImpl::create( const Reference< XComponentContext > &ctx )
ctx->getServiceManager()->createInstanceWithContext( ctx->getServiceManager()->createInstanceWithContext(
"com.sun.star.script.Invocation", "com.sun.star.script.Invocation",
ctx ), ctx ),
UNO_QUERY ); css::uno::UNO_QUERY_THROW );
if( ! c->xInvocation.is() )
throw RuntimeException( "pyuno: couldn't instantiate invocation service" );
c->xTypeConverter = Converter::create(ctx); c->xTypeConverter = Converter::create(ctx);
if( ! c->xTypeConverter.is() ) if( ! c->xTypeConverter.is() )
...@@ -792,15 +790,8 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con ...@@ -792,15 +790,8 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con
else if( PyObject_IsInstance( o, getPyUnoStructClass().get() ) ) else if( PyObject_IsInstance( o, getPyUnoStructClass().get() ) )
{ {
PyUNO* o_pi = reinterpret_cast<PyUNO*>(o); PyUNO* o_pi = reinterpret_cast<PyUNO*>(o);
Reference<XMaterialHolder> my_mh (o_pi->members->xInvocation, UNO_QUERY); Reference<XMaterialHolder> my_mh (o_pi->members->xInvocation, css::uno::UNO_QUERY_THROW);
a = my_mh->getMaterial();
if (!my_mh.is())
{
throw RuntimeException(
"struct wrapper does not support XMaterialHolder" );
}
else
a = my_mh->getMaterial();
} }
else if( PyObject_IsInstance( o, getCharClass( runtime ).get() ) ) else if( PyObject_IsInstance( o, getCharClass( runtime ).get() ) )
{ {
......
...@@ -368,10 +368,7 @@ PyRef PyUNOStruct_new ( ...@@ -368,10 +368,7 @@ PyRef PyUNOStruct_new (
{ {
PyThreadDetach antiguard; PyThreadDetach antiguard;
xInvocation.set( xInvocation.set(
ssf->createInstanceWithArguments( Sequence<Any>( &targetInterface, 1 ) ), UNO_QUERY ); ssf->createInstanceWithArguments( Sequence<Any>( &targetInterface, 1 ) ), css::uno::UNO_QUERY_THROW );
OSL_ASSERT( xInvocation.is() );
if( !xInvocation.is() )
throw RuntimeException("XInvocation2 not implemented, cannot interact with object");
} }
if( !Py_IsInitialized() ) if( !Py_IsInitialized() )
throw RuntimeException(); throw RuntimeException();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment