diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-12 11:44:23 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-23 13:06:14 +0200 |
commit | b30ee83058793ea8fbb020e5ac8f118bd20853d5 (patch) | |
tree | c187507f36c6288e5f4ede78a0d5e33876f7b3f1 /scripting | |
parent | 5e48667f6bdd2f5e05b3f41d080fda06bd3d7c16 (diff) |
fdo#46808, use service constructor for beans::Introspection
Change-Id: Ieb49277020d31779979d8eb508391d6f8b97bf94
Diffstat (limited to 'scripting')
-rw-r--r-- | scripting/source/dlgprov/dlgprov.cxx | 36 | ||||
-rw-r--r-- | scripting/source/vbaevents/eventhelper.cxx | 50 |
2 files changed, 30 insertions, 56 deletions
diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx index e1703f47665c..964c595e0be9 100644 --- a/scripting/source/dlgprov/dlgprov.cxx +++ b/scripting/source/dlgprov/dlgprov.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/script/XLibraryContainer.hpp> #include <cppuhelper/implementationentry.hxx> #include <cppuhelper/exc_hlp.hxx> -#include <com/sun/star/beans/XIntrospection.hpp> +#include <com/sun/star/beans/Introspection.hpp> #include <com/sun/star/resource/XStringResourceSupplier.hpp> #include <com/sun/star/resource/XStringResourceManager.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -578,34 +578,20 @@ static ::rtl::OUString aResourceResolverPropName("ResourceResolver"); if( !xIntrospection.is() ) { - Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager(), UNO_QUERY ); - if ( !xSMgr.is() ) - { - throw RuntimeException( - ::rtl::OUString( "DialogProviderImpl::getIntrospectionAccess: Couldn't instantiate MultiComponent factory" ), - Reference< XInterface >() ); - } - // Get introspection service - Reference< XInterface > xI = xSMgr->createInstanceWithContext - ( rtl::OUString("com.sun.star.beans.Introspection"), m_xContext ); - if (xI.is()) - xIntrospection = Reference< XIntrospection >::query( xI ); + xIntrospection = Introspection::create( m_xContext ); } - if( xIntrospection.is() ) + // Do introspection + try { - // Do introspection - try - { - Any aHandlerAny; - aHandlerAny <<= rxHandler; - xIntrospectionAccess = xIntrospection->inspect( aHandlerAny ); - } - catch( RuntimeException& ) - { - xIntrospectionAccess.clear(); - } + Any aHandlerAny; + aHandlerAny <<= rxHandler; + xIntrospectionAccess = xIntrospection->inspect( aHandlerAny ); + } + catch( RuntimeException& ) + { + xIntrospectionAccess.clear(); } return xIntrospectionAccess; } diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx index ef33f8c5172f..ee1768af053d 100644 --- a/scripting/source/vbaevents/eventhelper.cxx +++ b/scripting/source/vbaevents/eventhelper.cxx @@ -26,7 +26,7 @@ #include <ooo/vba/XVBAToOOEventDescGen.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/beans/XIntrospection.hpp> +#include <com/sun/star/beans/Introspection.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> @@ -376,40 +376,28 @@ ScriptEventHelper::ScriptEventHelper( const Reference< XInterface >& xControl ): Sequence< rtl::OUString > ScriptEventHelper::getEventListeners() { - Reference< lang::XMultiComponentFactory > xMFac( - m_xCtx->getServiceManager(), UNO_QUERY ); std::list< rtl::OUString > eventMethods; - if ( xMFac.is() ) - { - Reference< beans::XIntrospection > xIntrospection( - xMFac->createInstanceWithContext( rtl::OUString( - "com.sun.star.beans.Introspection" ), m_xCtx ), UNO_QUERY ); + Reference< beans::XIntrospection > xIntrospection = beans::Introspection::create( m_xCtx ); - Reference< beans::XIntrospectionAccess > xIntrospectionAccess; - if ( xIntrospection.is() ) + Reference< beans::XIntrospectionAccess > xIntrospectionAccess = + xIntrospection->inspect( makeAny( m_xControl ) ); + Sequence< Type > aControlListeners = + xIntrospectionAccess->getSupportedListeners(); + sal_Int32 nLength = aControlListeners.getLength(); + for ( sal_Int32 i = 0; i< nLength; ++i ) { - xIntrospectionAccess = xIntrospection->inspect( - makeAny( m_xControl ) ); - Sequence< Type > aControlListeners = - xIntrospectionAccess->getSupportedListeners(); - sal_Int32 nLength = aControlListeners.getLength(); - for ( sal_Int32 i = 0; i< nLength; ++i ) - { - Type& listType = aControlListeners[ i ]; - rtl::OUString sFullTypeName = listType.getTypeName(); - Sequence< ::rtl::OUString > sMeths = - comphelper::getEventMethodsForType( listType ); - sal_Int32 sMethLen = sMeths.getLength(); - for ( sal_Int32 j=0 ; j < sMethLen; ++j ) - { - rtl::OUString sEventMethod = sFullTypeName; - sEventMethod += DELIM; - sEventMethod += sMeths[ j ]; - eventMethods.push_back( sEventMethod ); - } - } - + Type& listType = aControlListeners[ i ]; + rtl::OUString sFullTypeName = listType.getTypeName(); + Sequence< ::rtl::OUString > sMeths = + comphelper::getEventMethodsForType( listType ); + sal_Int32 sMethLen = sMeths.getLength(); + for ( sal_Int32 j=0 ; j < sMethLen; ++j ) + { + rtl::OUString sEventMethod = sFullTypeName; + sEventMethod += DELIM; + sEventMethod += sMeths[ j ]; + eventMethods.push_back( sEventMethod ); } } |