diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-02-07 12:03:03 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-02-07 12:03:03 +0100 |
commit | bd20500cf3d88d0bd81d7e57df01b0130e7166f6 (patch) | |
tree | 63e6f08b5c17bcab3e3a2c57c6f4063033f3f52c /basic | |
parent | 41324964f5a2200fd5763a51204b20ff0fa1034b (diff) |
Simplify access to theCoreReflection singleton
Change-Id: I9901991a320b87895230a92095c9c7d3109380a6
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/classes/sbunoobj.cxx | 25 | ||||
-rw-r--r-- | basic/source/comp/dim.cxx | 17 |
2 files changed, 6 insertions, 36 deletions
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 667d7ab244ef..15d869f1a4a9 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -61,6 +61,7 @@ #include <com/sun/star/reflection/XIdlArray.hpp> #include <com/sun/star/reflection/XIdlReflection.hpp> #include <com/sun/star/reflection/XServiceConstructorDescription.hpp> +#include <com/sun/star/reflection/theCoreReflection.hpp> #include <com/sun/star/bridge/oleautomation/NamedArgument.hpp> #include <com/sun/star/bridge/oleautomation/Date.hpp> #include <com/sun/star/bridge/oleautomation/Decimal.hpp> @@ -168,28 +169,8 @@ void SetSbUnoObjectDfltPropName( SbxObject* pObj ) // save CoreReflection statically Reference< XIdlReflection > getCoreReflection_Impl( void ) { - static Reference< XIdlReflection > xCoreReflection; - - // Do we have already CoreReflection; if not obtain it - if( !xCoreReflection.is() ) - { - Reference< XComponentContext > xContext( - comphelper::getProcessComponentContext() ); - if( xContext.is() ) - { - xContext->getValueByName( - OUString( "/singletons/com.sun.star.reflection.theCoreReflection" ) ) - >>= xCoreReflection; - OSL_ENSURE( xCoreReflection.is(), "### CoreReflection singleton not accessible!?" ); - } - if( !xCoreReflection.is() ) - { - throw DeploymentException( - OUString( "/singletons/com.sun.star.reflection.theCoreReflection singleton not accessible" ), - Reference< XInterface >() ); - } - } - return xCoreReflection; + return css::reflection::theCoreReflection::get( + comphelper::getProcessComponentContext()); } // save CoreReflection statically diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx index faa521abfc40..1987e92890cf 100644 --- a/basic/source/comp/dim.cxx +++ b/basic/source/comp/dim.cxx @@ -21,7 +21,7 @@ #include "sbcomp.hxx" #include "sbunoobj.hxx" #include <svtools/miscopt.hxx> -#include <com/sun/star/reflection/XIdlReflection.hpp> +#include <com/sun/star/reflection/theCoreReflection.hpp> #include <comphelper/namedvaluecollection.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/configurationhelper.hxx> @@ -1335,19 +1335,8 @@ bool SbiParser::IsUnoInterface(const OUString& sTypeName) { try { - Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), UNO_SET_THROW ); - Reference< reflection::XIdlReflection > xRefl( xFactory->createInstance("com.sun.star.reflection.CoreReflection"), UNO_QUERY_THROW ); - //DBG_ASSERT(xRefl.Is(), "No reflection class!"); ??? - if( !xRefl.is() ) - { - return false; - } - Reference< reflection::XIdlClass > xClass = xRefl->forName(sTypeName); - if( xClass != NULL ) - { - return true; - } - return false; + return css::reflection::theCoreReflection::get( + comphelper::getProcessComponentContext())->forName(sTypeName).is(); } catch(const Exception&) { |