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

Convert com.sun.star.comp.stoc.Introspection to direct construction

Change-Id: Ia01efee8c7cc28d1f71fd87c735a6cbc205b3eaf
üst a77f0e5e
...@@ -18,7 +18,6 @@ from optparse import OptionParser ...@@ -18,7 +18,6 @@ from optparse import OptionParser
core_factory_list = [ core_factory_list = [
("libembobj.a", "embobj_component_getFactory"), ("libembobj.a", "embobj_component_getFactory"),
("libintrospectionlo.a", "introspection_component_getFactory"),
("libreflectionlo.a", "reflection_component_getFactory"), ("libreflectionlo.a", "reflection_component_getFactory"),
("libstocserviceslo.a", "stocservices_component_getFactory"), ("libstocserviceslo.a", "stocservices_component_getFactory"),
("libchartcontrollerlo.a", "chartcontroller_component_getFactory"), ("libchartcontrollerlo.a", "chartcontroller_component_getFactory"),
...@@ -100,6 +99,8 @@ core_constructor_list = [ ...@@ -100,6 +99,8 @@ core_constructor_list = [
"com_sun_star_comp_Draw_GraphicExporter_get_implementation", "com_sun_star_comp_Draw_GraphicExporter_get_implementation",
"com_sun_star_comp_Svx_GraphicExportHelper_get_implementation", "com_sun_star_comp_Svx_GraphicExportHelper_get_implementation",
"com_sun_star_comp_Svx_GraphicImportHelper_get_implementation", "com_sun_star_comp_Svx_GraphicImportHelper_get_implementation",
# stoc/source/inspect/introspection.component
"com_sun_star_comp_stoc_Introspection_get_implementation",
# toolkit/util/tk.component # toolkit/util/tk.component
"stardiv_Toolkit_VCLXToolkit_get_implementation", "stardiv_Toolkit_VCLXToolkit_get_implementation",
# uui/util/uui.component # uui/util/uui.component
......
...@@ -18,8 +18,9 @@ ...@@ -18,8 +18,9 @@
--> -->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
prefix="introspection" xmlns="http://openoffice.org/2010/uno-components"> xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.stoc.Introspection"> <implementation name="com.sun.star.comp.stoc.Introspection"
constructor="com_sun_star_comp_stoc_Introspection_get_implementation">
<service name="com.sun.star.beans.Introspection"/> <service name="com.sun.star.beans.Introspection"/>
<singleton name="com.sun.star.beans.theIntrospection"/> <singleton name="com.sun.star.beans.theIntrospection"/>
</implementation> </implementation>
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include <com/sun/star/uno/DeploymentException.hpp> #include <com/sun/star/uno/DeploymentException.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/reflection/XIdlReflection.hpp> #include <com/sun/star/reflection/XIdlReflection.hpp>
...@@ -74,10 +73,7 @@ using namespace com::sun::star::beans::MethodConcept; ...@@ -74,10 +73,7 @@ using namespace com::sun::star::beans::MethodConcept;
using namespace cppu; using namespace cppu;
using namespace osl; using namespace osl;
#define IMPLEMENTATION_NAME "com.sun.star.comp.stoc.Introspection" namespace
#define SERVICE_NAME "com.sun.star.beans.Introspection"
namespace stoc_inspect
{ {
typedef WeakImplHelper3< XIntrospectionAccess, XMaterialHolder, XExactName > IntrospectionAccessHelper; typedef WeakImplHelper3< XIntrospectionAccess, XMaterialHolder, XExactName > IntrospectionAccessHelper;
...@@ -1593,9 +1589,6 @@ class ImplIntrospection : public XIntrospection ...@@ -1593,9 +1589,6 @@ class ImplIntrospection : public XIntrospection
// Implementation der Introspection. // Implementation der Introspection.
rtl::Reference< IntrospectionAccessStatic_Impl > implInspect(const Any& aToInspectObj); rtl::Reference< IntrospectionAccessStatic_Impl > implInspect(const Any& aToInspectObj);
// Save XMultiServiceFactory from createComponent
Reference<XMultiServiceFactory> m_xSMgr;
// CoreReflection halten // CoreReflection halten
Reference< XIdlReflection > mxCoreReflection; Reference< XIdlReflection > mxCoreReflection;
...@@ -1616,7 +1609,7 @@ class ImplIntrospection : public XIntrospection ...@@ -1616,7 +1609,7 @@ class ImplIntrospection : public XIntrospection
TypeProviderAccessCacheMap* mpTypeProviderCache; TypeProviderAccessCacheMap* mpTypeProviderCache;
public: public:
ImplIntrospection( const Reference<XMultiServiceFactory> & rXSMgr ); ImplIntrospection( const Reference<XComponentContext> & context );
// Methoden von XInterface // Methoden von XInterface
virtual Any SAL_CALL queryInterface( const Type& rType ) throw( RuntimeException, std::exception ); virtual Any SAL_CALL queryInterface( const Type& rType ) throw( RuntimeException, std::exception );
...@@ -1631,8 +1624,6 @@ public: ...@@ -1631,8 +1624,6 @@ public:
OUString SAL_CALL getImplementationName() throw(std::exception); OUString SAL_CALL getImplementationName() throw(std::exception);
sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(std::exception); sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(std::exception);
Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw(std::exception); Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw(std::exception);
static OUString SAL_CALL getImplementationName_Static( );
static Sequence< OUString > SAL_CALL getSupportedServiceNames_Static(void) throw();
// Methoden von XIntrospection // Methoden von XIntrospection
virtual Reference<XIntrospectionAccess> SAL_CALL inspect(const Any& aToInspectObj) virtual Reference<XIntrospectionAccess> SAL_CALL inspect(const Any& aToInspectObj)
...@@ -1653,16 +1644,15 @@ enum MethodType ...@@ -1653,16 +1644,15 @@ enum MethodType
}; };
// Ctor // Ctor
ImplIntrospection::ImplIntrospection( const Reference<XMultiServiceFactory> & rXSMgr ) ImplIntrospection::ImplIntrospection( const Reference<XComponentContext> & context )
: OComponentHelper( m_mutex ) : OComponentHelper( m_mutex )
, m_xSMgr( rXSMgr )
{ {
mnCacheEntryCount = 0; mnCacheEntryCount = 0;
mnTPCacheEntryCount = 0; mnTPCacheEntryCount = 0;
mpCache = NULL; mpCache = NULL;
mpTypeProviderCache = NULL; mpTypeProviderCache = NULL;
Reference< XPropertySet > xProps( rXSMgr, UNO_QUERY ); Reference< XPropertySet > xProps( context->getServiceManager(), UNO_QUERY );
OSL_ASSERT( xProps.is() ); OSL_ASSERT( xProps.is() );
if (xProps.is()) if (xProps.is())
{ {
...@@ -1771,7 +1761,7 @@ Sequence< sal_Int8 > ImplIntrospection::getImplementationId() ...@@ -1771,7 +1761,7 @@ Sequence< sal_Int8 > ImplIntrospection::getImplementationId()
// XServiceInfo // XServiceInfo
OUString ImplIntrospection::getImplementationName() throw(std::exception) OUString ImplIntrospection::getImplementationName() throw(std::exception)
{ {
return getImplementationName_Static(); return OUString("com.sun.star.comp.stoc.Introspection");
} }
// XServiceInfo // XServiceInfo
...@@ -1783,26 +1773,11 @@ sal_Bool ImplIntrospection::supportsService(const OUString& ServiceName) throw(s ...@@ -1783,26 +1773,11 @@ sal_Bool ImplIntrospection::supportsService(const OUString& ServiceName) throw(s
// XServiceInfo // XServiceInfo
Sequence< OUString > ImplIntrospection::getSupportedServiceNames(void) throw(std::exception) Sequence< OUString > ImplIntrospection::getSupportedServiceNames(void) throw(std::exception)
{ {
return getSupportedServiceNames_Static(); Sequence<OUString> s(1);
s[0] = "com.sun.star.beans.Introspection";
return s;
} }
// Helper XServiceInfo
OUString ImplIntrospection::getImplementationName_Static( )
{
return OUString::createFromAscii( IMPLEMENTATION_NAME );
}
// ORegistryServiceManager_Static
Sequence< OUString > ImplIntrospection::getSupportedServiceNames_Static(void) throw()
{
Sequence< OUString > aSNS( 1 );
aSNS.getArray()[0] = OUString::createFromAscii( SERVICE_NAME );
return aSNS;
}
// Methoden von XIntrospection // Methoden von XIntrospection
Reference<XIntrospectionAccess> ImplIntrospection::inspect(const Any& aToInspectObj) Reference<XIntrospectionAccess> ImplIntrospection::inspect(const Any& aToInspectObj)
throw( RuntimeException, std::exception ) throw( RuntimeException, std::exception )
...@@ -2841,42 +2816,29 @@ rtl::Reference< IntrospectionAccessStatic_Impl > ImplIntrospection::implInspect( ...@@ -2841,42 +2816,29 @@ rtl::Reference< IntrospectionAccessStatic_Impl > ImplIntrospection::implInspect(
return pAccess; return pAccess;
} }
struct Instance {
explicit Instance(
css::uno::Reference<css::uno::XComponentContext> const & context):
instance(new ImplIntrospection(context))
{}
Reference< XInterface > SAL_CALL ImplIntrospection_CreateInstance( const Reference< XMultiServiceFactory > & rSMgr ) rtl::Reference<cppu::OWeakObject> instance;
throw( RuntimeException ) };
{
Reference< XInterface > xService = (OWeakObject*)(OComponentHelper*)new ImplIntrospection( rSMgr ); struct Singleton:
return xService; public rtl::StaticWithArg<
} Instance, css::uno::Reference<css::uno::XComponentContext>, Singleton>
{};
} }
extern "C" extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
{ com_sun_star_comp_stoc_Introspection_get_implementation(
SAL_DLLPUBLIC_EXPORT void * SAL_CALL introspection_component_getFactory( css::uno::XComponentContext * context,
const sal_Char * pImplName, void * pServiceManager, css::uno::Sequence<css::uno::Any> const & arguments)
SAL_UNUSED_PARAMETER void * )
{ {
void * pRet = 0; assert(!arguments.hasElements());
return cppu::acquire(Singleton::get(context).instance.get());
if (pServiceManager && rtl_str_compare( pImplName, IMPLEMENTATION_NAME ) == 0)
{
Reference< XSingleServiceFactory > xFactory( createOneInstanceFactory(
reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
OUString::createFromAscii( pImplName ),
stoc_inspect::ImplIntrospection_CreateInstance,
stoc_inspect::ImplIntrospection::getSupportedServiceNames_Static() ) );
if (xFactory.is())
{
xFactory->acquire();
pRet = xFactory.get();
}
}
return pRet;
}
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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