[Libreoffice-commits] core.git: solenv/bin stoc/source
Stephan Bergmann
sbergman at redhat.com
Fri Mar 7 02:11:46 PST 2014
solenv/bin/native-code.py | 3
stoc/source/inspect/introspection.component | 5 -
stoc/source/inspect/introspection.cxx | 90 ++++++++--------------------
3 files changed, 31 insertions(+), 67 deletions(-)
New commits:
commit 03fcda48819219d89d92db0ebd3d0515b2b9b002
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Mar 7 11:03:55 2014 +0100
Convert com.sun.star.comp.stoc.Introspection to direct construction
Change-Id: Ia01efee8c7cc28d1f71fd87c735a6cbc205b3eaf
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 4bd729b..12162cc 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -18,7 +18,6 @@ from optparse import OptionParser
core_factory_list = [
("libembobj.a", "embobj_component_getFactory"),
- ("libintrospectionlo.a", "introspection_component_getFactory"),
("libreflectionlo.a", "reflection_component_getFactory"),
("libstocserviceslo.a", "stocservices_component_getFactory"),
("libchartcontrollerlo.a", "chartcontroller_component_getFactory"),
@@ -100,6 +99,8 @@ core_constructor_list = [
"com_sun_star_comp_Draw_GraphicExporter_get_implementation",
"com_sun_star_comp_Svx_GraphicExportHelper_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
"stardiv_Toolkit_VCLXToolkit_get_implementation",
# uui/util/uui.component
diff --git a/stoc/source/inspect/introspection.component b/stoc/source/inspect/introspection.component
index 954979c..4cf0635 100644
--- a/stoc/source/inspect/introspection.component
+++ b/stoc/source/inspect/introspection.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="introspection" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.stoc.Introspection">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.Introspection"
+ constructor="com_sun_star_comp_stoc_Introspection_get_implementation">
<service name="com.sun.star.beans.Introspection"/>
<singleton name="com.sun.star.beans.theIntrospection"/>
</implementation>
diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx
index ffb7243..7e3f941 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -35,7 +35,6 @@
#include <com/sun/star/uno/DeploymentException.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/XEventListener.hpp>
#include <com/sun/star/reflection/XIdlReflection.hpp>
@@ -74,10 +73,7 @@ using namespace com::sun::star::beans::MethodConcept;
using namespace cppu;
using namespace osl;
-#define IMPLEMENTATION_NAME "com.sun.star.comp.stoc.Introspection"
-#define SERVICE_NAME "com.sun.star.beans.Introspection"
-
-namespace stoc_inspect
+namespace
{
typedef WeakImplHelper3< XIntrospectionAccess, XMaterialHolder, XExactName > IntrospectionAccessHelper;
@@ -1593,9 +1589,6 @@ class ImplIntrospection : public XIntrospection
// Implementation der Introspection.
rtl::Reference< IntrospectionAccessStatic_Impl > implInspect(const Any& aToInspectObj);
- // Save XMultiServiceFactory from createComponent
- Reference<XMultiServiceFactory> m_xSMgr;
-
// CoreReflection halten
Reference< XIdlReflection > mxCoreReflection;
@@ -1616,7 +1609,7 @@ class ImplIntrospection : public XIntrospection
TypeProviderAccessCacheMap* mpTypeProviderCache;
public:
- ImplIntrospection( const Reference<XMultiServiceFactory> & rXSMgr );
+ ImplIntrospection( const Reference<XComponentContext> & context );
// Methoden von XInterface
virtual Any SAL_CALL queryInterface( const Type& rType ) throw( RuntimeException, std::exception );
@@ -1631,8 +1624,6 @@ public:
OUString SAL_CALL getImplementationName() throw(std::exception);
sal_Bool SAL_CALL supportsService(const OUString& ServiceName) 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
virtual Reference<XIntrospectionAccess> SAL_CALL inspect(const Any& aToInspectObj)
@@ -1653,16 +1644,15 @@ enum MethodType
};
// Ctor
-ImplIntrospection::ImplIntrospection( const Reference<XMultiServiceFactory> & rXSMgr )
+ImplIntrospection::ImplIntrospection( const Reference<XComponentContext> & context )
: OComponentHelper( m_mutex )
- , m_xSMgr( rXSMgr )
{
mnCacheEntryCount = 0;
mnTPCacheEntryCount = 0;
mpCache = NULL;
mpTypeProviderCache = NULL;
- Reference< XPropertySet > xProps( rXSMgr, UNO_QUERY );
+ Reference< XPropertySet > xProps( context->getServiceManager(), UNO_QUERY );
OSL_ASSERT( xProps.is() );
if (xProps.is())
{
@@ -1771,7 +1761,7 @@ Sequence< sal_Int8 > ImplIntrospection::getImplementationId()
// XServiceInfo
OUString ImplIntrospection::getImplementationName() throw(std::exception)
{
- return getImplementationName_Static();
+ return OUString("com.sun.star.comp.stoc.Introspection");
}
// XServiceInfo
@@ -1783,26 +1773,11 @@ sal_Bool ImplIntrospection::supportsService(const OUString& ServiceName) throw(s
// XServiceInfo
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
Reference<XIntrospectionAccess> ImplIntrospection::inspect(const Any& aToInspectObj)
throw( RuntimeException, std::exception )
@@ -2841,42 +2816,29 @@ rtl::Reference< IntrospectionAccessStatic_Impl > ImplIntrospection::implInspect(
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 )
- throw( RuntimeException )
-{
- Reference< XInterface > xService = (OWeakObject*)(OComponentHelper*)new ImplIntrospection( rSMgr );
- return xService;
-}
+ rtl::Reference<cppu::OWeakObject> instance;
+};
+
+struct Singleton:
+ public rtl::StaticWithArg<
+ Instance, css::uno::Reference<css::uno::XComponentContext>, Singleton>
+{};
}
-extern "C"
-{
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL introspection_component_getFactory(
- const sal_Char * pImplName, void * pServiceManager,
- SAL_UNUSED_PARAMETER void * )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_stoc_Introspection_get_implementation(
+ css::uno::XComponentContext * context,
+ css::uno::Sequence<css::uno::Any> const & arguments)
{
- void * pRet = 0;
-
- 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;
-}
+ assert(!arguments.hasElements());
+ return cppu::acquire(Singleton::get(context).instance.get());
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list