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

Add .component <implementation constructor="..." feature

...to directly call constructor functions of ComponentContext-based C++
implementations of (non-single-instance) UNO services.  The case where these
calls would need to be bridged across different environments (e.g., from gcc3
to gcc3:affine) is not yet implemented.

bootstrap.component and expwrap.component are adapted accordingly as a proof-of-
concept (which had previously been adapted to use the prefix="direct" feature,
which may become unnecessary again in the end, depending on how to handle
single-instance services/singletons).  More to follow.

Change-Id: I18682d75bcd29d3d427e31331b4ce8161dbb846d
üst 80d977b8
......@@ -11,11 +11,11 @@
extern "C"
__attribute__ ((visibility("default")))
const lib_to_component_mapping *
lo_get_library_map(void)
const lib_to_factory_mapping *
lo_get_factory_map(void)
{
static lib_to_component_mapping map[] = {
NON_APP_SPECIFIC_COMPONENT_MAP
static lib_to_factory_mapping map[] = {
NON_APP_SPECIFIC_FACTORY_MAP
{ "libanimcorelo.a", animcore_component_getFactory },
{ "libavmedialo.a", avmedia_component_getFactory },
{ "libdbalo.a", dba_component_getFactory },
......@@ -62,11 +62,11 @@ lo_get_library_map(void)
extern "C"
__attribute__ ((visibility("default")))
const lib_to_component_mapping *
lo_get_implementation_map(void)
const lib_to_constructor_mapping *
lo_get_constructor_map(void)
{
static lib_to_component_mapping map[] = {
NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
static lib_to_constructor_mapping map[] = {
NON_APP_SPECIFIC_CONSTRUCTOR_MAP
{ NULL, NULL }
};
......
......@@ -11,11 +11,11 @@
extern "C"
__attribute__ ((visibility("default")))
const lib_to_component_mapping *
lo_get_library_map(void)
const lib_to_factory_mapping *
lo_get_factory_map(void)
{
static lib_to_component_mapping map[] = {
NON_APP_SPECIFIC_COMPONENT_MAP
static lib_to_factory_mapping map[] = {
NON_APP_SPECIFIC_FACTORY_MAP
{ "libanimcorelo.a", animcore_component_getFactory },
{ "libavmedialo.a", avmedia_component_getFactory },
{ "libbasprov.uno.a", basprov_component_getFactory },
......@@ -80,11 +80,11 @@ lo_get_library_map(void)
extern "C"
__attribute__ ((visibility("default")))
const lib_to_component_mapping *
lo_get_implementation_map(void)
const lib_to_constructor_mapping *
lo_get_constructor_map(void)
{
static lib_to_component_mapping map[] = {
NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
static lib_to_constructor_mapping map[] = {
NON_APP_SPECIFIC_CONSTRUCTOR_MAP
{ NULL, NULL }
};
......
......@@ -11,11 +11,11 @@
extern "C"
__attribute__ ((visibility("default")))
const lib_to_component_mapping *
lo_get_library_map(void)
const lib_to_factory_mapping *
lo_get_factory_map(void)
{
static lib_to_component_mapping map[] = {
NON_APP_SPECIFIC_COMPONENT_MAP
static lib_to_factory_mapping map[] = {
NON_APP_SPECIFIC_FACTORY_MAP
{ "libanimcorelo.a", animcore_component_getFactory },
{ "libavmedialo.a", avmedia_component_getFactory },
{ "libbasprovlo.a", basprov_component_getFactory },
......@@ -92,11 +92,11 @@ lo_get_library_map(void)
extern "C"
__attribute__ ((visibility("default")))
const lib_to_component_mapping *
lo_get_implementation_map(void)
const lib_to_constructor_mapping *
lo_get_constructor_map(void)
{
static lib_to_component_mapping map[] = {
NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
static lib_to_constructor_mapping map[] = {
NON_APP_SPECIFIC_CONSTRUCTOR_MAP
{ NULL, NULL }
};
......
......@@ -14,18 +14,29 @@
#include <com/sun/star/uno/Reference.hxx>
#include <servicemanager.hxx>
namespace com { namespace sun { namespace star {
namespace lang { class XMultiServiceFactory; }
namespace uno { class XInterface; }
namespace uno {
class Environment;
class XInterface;
}
} } }
namespace rtl { class OUString; }
namespace cppuhelper { namespace detail {
css::uno::Reference<css::uno::XInterface> loadSharedLibComponentFactory(
css::uno::Environment getEnvironment(
rtl::OUString const & name, rtl::OUString const & implementation);
void loadSharedLibComponentFactory(
rtl::OUString const & uri, rtl::OUString const & environment,
rtl::OUString const & prefix, rtl::OUString const & rImplName,
css::uno::Reference<css::lang::XMultiServiceFactory> const & xMgr);
rtl::OUString const & prefix, rtl::OUString const & implementation,
rtl::OUString const & constructor,
css::uno::Reference<css::lang::XMultiServiceFactory> const & serviceManager,
ImplementationConstructorFn ** constructorFunction,
css::uno::Reference<css::uno::XInterface> * factory);
} }
......
......@@ -34,10 +34,20 @@
#include "registry/registry.hxx"
#include "rtl/ustring.hxx"
namespace com { namespace sun { namespace star { namespace lang {
class XSingleComponentFactory;
} } } }
namespace cppu { struct ContextEntry_Init; }
namespace cppuhelper {
extern "C" {
typedef css::uno::XInterface * SAL_CALL ImplementationConstructorFn(
css::uno::XComponentContext *, uno_Sequence *);
}
typedef cppu::WeakComponentImplHelper8<
css::lang::XServiceInfo, css::lang::XMultiServiceFactory,
css::lang::XMultiComponentFactory, css::container::XSet,
......@@ -55,13 +65,15 @@ public:
rtl::OUString const & theName, rtl::OUString const & theLoader,
rtl::OUString const & theUri,
rtl::OUString const & theEnvironment,
rtl::OUString const & theConstructor,
rtl::OUString const & thePrefix,
css::uno::Reference< css::uno::XComponentContext > const &
theAlienContext,
rtl::OUString const & theRdbFile):
name(theName), loader(theLoader), uri(theUri),
environment(theEnvironment), prefix(thePrefix),
alienContext(theAlienContext), rdbFile(theRdbFile)
environment(theEnvironment), constructor(theConstructor),
prefix(thePrefix), alienContext(theAlienContext),
rdbFile(theRdbFile)
{}
explicit ImplementationInfo(rtl::OUString const & theName):
......@@ -71,6 +83,7 @@ public:
rtl::OUString const loader;
rtl::OUString const uri;
rtl::OUString const environment;
rtl::OUString const constructor;
rtl::OUString const prefix;
css::uno::Reference< css::uno::XComponentContext > const
alienContext;
......@@ -83,15 +96,16 @@ public:
Implementation(
rtl::OUString const & name, rtl::OUString const & loader,
rtl::OUString const & uri, rtl::OUString const & environment,
rtl::OUString const & constructorName,
rtl::OUString const & prefix,
css::uno::Reference< css::uno::XComponentContext > const &
alienContext,
rtl::OUString const & rdbFile):
info(
new ImplementationInfo(
name, loader, uri, environment, prefix, alienContext,
rdbFile)),
loaded(false)
name, loader, uri, environment, constructorName, prefix,
alienContext, rdbFile)),
constructor(0), loaded(false)
{}
Implementation(
......@@ -102,11 +116,13 @@ public:
theFactory2,
css::uno::Reference< css::lang::XComponent > const &
theComponent):
info(new ImplementationInfo(name)), factory1(theFactory1),
factory2(theFactory2), component(theComponent), loaded(true)
info(new ImplementationInfo(name)), constructor(0),
factory1(theFactory1), factory2(theFactory2),
component(theComponent), loaded(true)
{}
boost::shared_ptr< ImplementationInfo > info;
ImplementationConstructorFn * constructor;
css::uno::Reference< css::lang::XSingleComponentFactory > factory1;
css::uno::Reference< css::lang::XSingleServiceFactory > factory2;
css::uno::Reference< css::lang::XComponent > component;
......@@ -160,6 +176,7 @@ public:
void loadImplementation(
css::uno::Reference< css::uno::XComponentContext > const & context,
boost::shared_ptr< Data::ImplementationInfo > const & info,
ImplementationConstructorFn ** constructor,
css::uno::Reference< css::lang::XSingleComponentFactory > * factory1,
css::uno::Reference< css::lang::XSingleServiceFactory > * factory2);
......
This diff is collapsed.
......@@ -29,16 +29,21 @@ extern "C" {
typedef struct {
const char *name;
void * (*component_getFactory_function)(const char *, void *, void *);
} lib_to_component_mapping;
} lib_to_factory_mapping;
const lib_to_component_mapping *lo_get_library_map(void);
const lib_to_component_mapping *lo_get_implementation_map(void);
typedef struct {
const char *name;
void * (*constructor_function)(void *, void *);
} lib_to_constructor_mapping;
const lib_to_factory_mapping *lo_get_factory_map(void);
const lib_to_constructor_mapping *lo_get_constructor_map(void);
#ifdef __cplusplus
}
#endif
#define NON_APP_SPECIFIC_COMPONENT_MAP \
#define NON_APP_SPECIFIC_FACTORY_MAP \
{ "libintrospectionlo.a", introspection_component_getFactory }, \
{ "libreflectionlo.a", reflection_component_getFactory }, \
{ "libstocserviceslo.a", stocservices_component_getFactory }, \
......@@ -60,19 +65,19 @@ const lib_to_component_mapping *lo_get_implementation_map(void);
{ "libvcllo.a", vcl_component_getFactory }, \
{ "libxstor.a", xstor_component_getFactory }, \
#define NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP \
{ "com.sun.star.comp.extensions.xml.sax.ParserExpat", com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory }, \
{ "com.sun.star.comp.extensions.xml.sax.FastParser", com_sun_star_comp_extensions_xml_sax_FastParser_component_getFactory }, \
{ "com.sun.star.comp.stoc.DLLComponentLoader.component.getFactory", com_sun_star_comp_stoc_DLLComponentLoader_component_getFactory }, \
{ "com.sun.star.comp.stoc.ImplementationRegistration.component.getFactory", com_sun_star_comp_stoc_ImplementationRegistration_component_getFactory }, \
{ "com.sun.star.comp.stoc.NestedRegistry.component.getFactory", com_sun_star_comp_stoc_NestedRegistry_component_getFactory }, \
{ "com.sun.star.comp.stoc.ORegistryServiceManager.component.getFactory", com_sun_star_comp_stoc_ORegistryServiceManager_component_getFactory }, \
{ "com.sun.star.comp.stoc.OServiceManager.component.getFactory", com_sun_star_comp_stoc_OServiceManager_component_getFactory }, \
{ "com.sun.star.comp.stoc.OServiceManagerWrapper.component.getFactory", com_sun_star_comp_stoc_OServiceManagerWrapper_component_getFactory }, \
{ "com.sun.star.comp.stoc.SimpleRegistry.component.getFactory", com_sun_star_comp_stoc_SimpleRegistry_component_getFactory }, \
{ "com.sun.star.extensions.xml.sax.Writer", com_sun_star_extensions_xml_sax_Writer_component_getFactory }, \
{ "com.sun.star.security.comp.stoc.AccessController.component.getFactory", com_sun_star_security_comp_stoc_AccessController_component_getFactory }, \
{ "com.sun.star.security.comp.stoc.FilePolicy.component.getFactory", com_sun_star_security_comp_stoc_FilePolicy_component_getFactory }, \
#define NON_APP_SPECIFIC_CONSTRUCTOR_MAP \
{ "com_sun_star_comp_extensions_xml_sax_ParserExpat", com_sun_star_comp_extensions_xml_sax_ParserExpat }, \
{ "com_sun_star_comp_extensions_xml_sax_FastParser", com_sun_star_comp_extensions_xml_sax_FastParser }, \
{ "com_sun_star_comp_stoc_DLLComponentLoader", com_sun_star_comp_stoc_DLLComponentLoader }, \
{ "com_sun_star_comp_stoc_ImplementationRegistration", com_sun_star_comp_stoc_ImplementationRegistration }, \
{ "com_sun_star_comp_stoc_NestedRegistry", com_sun_star_comp_stoc_NestedRegistry }, \
{ "com_sun_star_comp_stoc_ORegistryServiceManager", com_sun_star_comp_stoc_ORegistryServiceManager }, \
{ "com_sun_star_comp_stoc_OServiceManager", com_sun_star_comp_stoc_OServiceManager }, \
{ "com_sun_star_comp_stoc_OServiceManagerWrapper", com_sun_star_comp_stoc_OServiceManagerWrapper }, \
{ "com_sun_star_comp_stoc_SimpleRegistry", com_sun_star_comp_stoc_SimpleRegistry }, \
{ "com_sun_star_extensions_xml_sax_Writer", com_sun_star_extensions_xml_sax_Writer }, \
{ "com_sun_star_security_comp_stoc_AccessController", com_sun_star_security_comp_stoc_AccessController }, \
{ "com_sun_star_security_comp_stoc_FilePolicy", com_sun_star_security_comp_stoc_FilePolicy }, \
#endif /* DISABLE_DYNLOADING */
......
......@@ -17,11 +17,11 @@
#include <touch/touch.h>
extern "C"
const lib_to_component_mapping *
lo_get_library_map(void)
const lib_to_factory_mapping *
lo_get_factory_map(void)
{
static lib_to_component_mapping map[] = {
NON_APP_SPECIFIC_COMPONENT_MAP
static lib_to_factory_mapping map[] = {
NON_APP_SPECIFIC_FACTORY_MAP
{ "libanalysislo.a", analysis_component_getFactory },
{ "libanimcorelo.a", animcore_component_getFactory },
{ "libavmedialo.a", avmedia_component_getFactory },
......@@ -82,11 +82,11 @@ lo_get_library_map(void)
}
extern "C"
const lib_to_component_mapping *
lo_get_implementation_map(void)
const lib_to_constructor_mapping *
lo_get_constructor_map(void)
{
static lib_to_component_mapping map[] = {
NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
static lib_to_constructor_mapping map[] = {
NON_APP_SPECIFIC_CONSTRUCTOR_MAP
{ NULL, NULL }
};
......
......@@ -17,11 +17,11 @@
#include <touch/touch.h>
extern "C"
const lib_to_component_mapping *
lo_get_library_map(void)
const lib_to_factory_mapping *
lo_get_libmap(void)
{
static lib_to_component_mapping map[] = {
NON_APP_SPECIFIC_COMPONENT_MAP
static lib_to_factory_mapping map[] = {
NON_APP_SPECIFIC_FACTORY_MAP
{ "libanalysislo.a", analysis_component_getFactory },
{ "libanimcorelo.a", animcore_component_getFactory },
{ "libavmedialo.a", avmedia_component_getFactory },
......@@ -82,11 +82,11 @@ lo_get_library_map(void)
}
extern "C"
const lib_to_component_mapping *
lo_get_implementation_map(void)
const lib_to_constructor_mapping *
lo_get_constructor_map(void)
{
static lib_to_component_mapping map[] = {
NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
static lib_to_constructor_mapping map[] = {
NON_APP_SPECIFIC_CONSTRUCTOR_MAP
{ NULL, NULL }
};
......
......@@ -29,10 +29,10 @@ extern void * sc_component_getFactory( const char * pImplName, void * pServiceMa
extern void * scfilt_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
extern void * unoxml_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
const lib_to_component_mapping *
const lib_to_factory_mapping *
lo_get_libmap(void)
{
static lib_to_component_mapping map[] = {
static lib_to_factory_mapping map[] = {
{ "libanalysislo.a", analysis_component_getFactory },
{ "libdatelo.a", date_component_getFactory },
{ "libscfiltlo.a", scfilt_component_getFactory },
......
......@@ -23,11 +23,11 @@
#define MAP_LIB_LO_1(LIB) { "lib" #LIB "lo.a", LIB##1_component_getFactory }
extern "C"
const lib_to_component_mapping *
lo_get_library_map(void)
const lib_to_factory_mapping *
lo_get_factory_map(void)
{
static lib_to_component_mapping map[] = {
NON_APP_SPECIFIC_COMPONENT_MAP
static lib_to_factory_mapping map[] = {
NON_APP_SPECIFIC_FACTORY_MAP
//from IOS
......@@ -74,11 +74,11 @@ lo_get_library_map(void)
}
extern "C"
const lib_to_component_mapping *
lo_get_implementation_map(void)
const lib_to_constructor_mapping *
lo_get_constructor_map(void)
{
static lib_to_component_mapping map[] = {
NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
static lib_to_constructor_mapping map[] = {
NON_APP_SPECIFIC_CONSTRUCTOR_MAP
{ NULL, NULL }
};
......
......@@ -18,14 +18,17 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
prefix="direct" xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.extensions.xml.sax.ParserExpat">
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.extensions.xml.sax.ParserExpat"
constructor="com_sun_star_comp_extensions_xml_sax_ParserExpat">
<service name="com.sun.star.xml.sax.Parser"/>
</implementation>
<implementation name="com.sun.star.extensions.xml.sax.Writer">
<implementation name="com.sun.star.extensions.xml.sax.Writer"
constructor="com_sun_star_extensions_xml_sax_Writer">
<service name="com.sun.star.xml.sax.Writer"/>
</implementation>
<implementation name="com.sun.star.comp.extensions.xml.sax.FastParser">
<implementation name="com.sun.star.comp.extensions.xml.sax.FastParser"
constructor="com_sun_star_comp_extensions_xml_sax_FastParser">
<service name="com.sun.star.xml.sax.FastParser"/>
</implementation>
</component>
......@@ -19,6 +19,7 @@
#include <stdlib.h>
#include <string.h>
#include <sal/alloca.h>
#include <cassert>
#include <vector>
#include <osl/diagnose.h>
......@@ -30,7 +31,6 @@
#include <com/sun/star/xml/sax/SAXParseException.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/supportsservice.hxx>
......@@ -42,13 +42,16 @@ using namespace ::osl;
using namespace ::cppu;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::registry;
using namespace ::com::sun::star::xml::sax;
using namespace ::com::sun::star::io;
#include "attrlistimpl.hxx"
#include "xml2utf.hxx"
namespace com { namespace sun { namespace star { namespace uno {
class XComponentContext;
} } } }
namespace {
// Useful macros for correct String conversion depending on the choosen expat-mode
......@@ -129,17 +132,6 @@ OUString XmlChar2OUString( const XML_Char *p )
class SaxExpatParser_Impl;
OUString SaxExpatParser_getImplementationName() {
return OUString("com.sun.star.comp.extensions.xml.sax.ParserExpat");
}
Sequence< OUString > SaxExpatParser_getSupportedServiceNames(void)
{
Sequence<OUString> seq(1);
seq[0] = OUString("com.sun.star.xml.sax.Parser");
return seq;
}
// This class implements the external Parser interface
class SaxExpatParser
: public WeakImplHelper3< XInitialization
......@@ -598,7 +590,7 @@ void SaxExpatParser::setLocale( const Locale & locale ) throw (RuntimeException)
// XServiceInfo
OUString SaxExpatParser::getImplementationName() throw ()
{
return SaxExpatParser_getImplementationName();
return OUString("com.sun.star.comp.extensions.xml.sax.ParserExpat");
}
// XServiceInfo
......@@ -610,7 +602,9 @@ sal_Bool SaxExpatParser::supportsService(const OUString& ServiceName) throw ()
// XServiceInfo
Sequence< OUString > SaxExpatParser::getSupportedServiceNames(void) throw ()
{
return SaxExpatParser_getSupportedServiceNames();
Sequence<OUString> seq(1);
seq[0] = "com.sun.star.xml.sax.Parser";
return seq;
}
......@@ -1023,27 +1017,18 @@ void SaxExpatParser_Impl::callbackEndCDATA( void *pvThis )
CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS(pImpl,rExtendedDocumentHandler->endCDATA() );
}
Reference< XInterface > SAL_CALL SaxExpatParser_CreateInstance(
SAL_UNUSED_PARAMETER const Reference<css::uno::XComponentContext> & )
SAL_THROW((css::uno::Exception))
{
SaxExpatParser *p = new SaxExpatParser;
return Reference< XInterface > ( (OWeakObject * ) p );
}
} // namespace
extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory(
const char *, void *, void * )
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
com_sun_star_comp_extensions_xml_sax_ParserExpat(
SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
uno_Sequence * arguments)
{
Reference<css::lang::XSingleComponentFactory> xFactory(
cppu::createSingleComponentFactory(
&SaxExpatParser_CreateInstance,
SaxExpatParser_getImplementationName(),
SaxExpatParser_getSupportedServiceNames()));
xFactory->acquire();
return xFactory.get();
assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
css::uno::Reference<css::uno::XInterface> x(
static_cast<cppu::OWeakObject *>(new SaxExpatParser));
x->acquire();
return x.get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -19,8 +19,9 @@
#include <string.h>
#include <stack>
#include <cassert>
#include <set>
#include <stack>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/util/XCloneable.hpp>
......@@ -31,7 +32,6 @@
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/supportsservice.hxx>
......@@ -46,13 +46,16 @@ using namespace ::osl;
using namespace ::cppu;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::registry;
using namespace ::com::sun::star::xml::sax;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::io;
#include "xml2utf.hxx"
namespace com { namespace sun { namespace star { namespace uno {
class XComponentContext;
} } } }
#define LINEFEED 10
#define SEQUENCESIZE 1024
#define MAXCOLUMNCOUNT 72
......@@ -867,17 +870,6 @@ static inline sal_Int32 getFirstLineBreak( const OUString & str ) throw ()
return -1;
}
OUString SAXWriter_getImplementationName() {
return OUString("com.sun.star.extensions.xml.sax.Writer");
}
Sequence< OUString > SAXWriter_getSupportedServiceNames(void) throw ()
{
Sequence<OUString> seq(1);
seq.getArray()[0] = OUString("com.sun.star.xml.sax.Writer");
return seq;
}
class SAXWriter :
public WeakImplHelper2<
XWriter,
......@@ -998,7 +990,7 @@ static inline sal_Bool isFirstCharWhitespace( const sal_Unicode *p ) throw()
// XServiceInfo
OUString SAXWriter::getImplementationName() throw()
{
return SAXWriter_getImplementationName();
return OUString("com.sun.star.extensions.xml.sax.Writer");
}
// XServiceInfo
......@@ -1010,7 +1002,9 @@ sal_Bool SAXWriter::supportsService(const OUString& ServiceName) throw()
// XServiceInfo
Sequence< OUString > SAXWriter::getSupportedServiceNames(void) throw ()
{
return SAXWriter_getSupportedServiceNames();
Sequence<OUString> seq(1);
seq[0] = "com.sun.star.xml.sax.Writer";
return seq;
}
void SAXWriter::startDocument() throw(SAXException, RuntimeException )
......@@ -1376,26 +1370,18 @@ void SAXWriter::unknown(const OUString& sString) throw (SAXException, RuntimeExc
}
}
Reference < XInterface > SAL_CALL SAXWriter_CreateInstance(
SAL_UNUSED_PARAMETER const Reference<css::uno::XComponentContext> & )
SAL_THROW((css::uno::Exception))
{
SAXWriter *p = new SAXWriter;
return Reference< XInterface > ( (static_cast< OWeakObject * >(p)) );
}
} // namespace
extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
com_sun_star_extensions_xml_sax_Writer_component_getFactory(
const char *, void *, void * )
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
com_sun_star_extensions_xml_sax_Writer(
SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
uno_Sequence * arguments)
{
Reference<css::lang::XSingleComponentFactory > xFactory(
cppu::createSingleComponentFactory(
&SAXWriter_CreateInstance, SAXWriter_getImplementationName(),
SAXWriter_getSupportedServiceNames()));
xFactory->acquire();
return xFactory.get();
assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
css::uno::Reference<css::uno::XInterface> x(
static_cast<cppu::OWeakObject *>(new SAXWriter));
x->acquire();
return x.get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -27,7 +27,6 @@
#include <com/sun/star/xml/sax/XFastContextHandler.hpp>
#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
#include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <osl/conditn.hxx>
#include <osl/diagnose.h>
......@@ -42,9 +41,14 @@
#include <stack>
#include <vector>
#include <queue>
#include <cassert>
#include <cstring>
#include <expat.h>
namespace com { namespace sun { namespace star { namespace uno {
class XComponentContext;
} } } }
using namespace ::std;
using namespace ::osl;
using namespace ::cppu;
......@@ -57,17 +61,6 @@ using namespace sax_fastparser;
namespace {
OUString FastSaxParser_getImplementationName() {
return OUString("com.sun.star.comp.extensions.xml.sax.FastParser");
}
uno::Sequence<OUString> FastSaxParser_getSupportedServiceNames()
{
Sequence<OUString> seq(1);
seq.getArray()[0] = OUString("com.sun.star.xml.sax.FastParser");
return seq;
}
struct Event;
class FastLocatorImpl;
struct NamespaceDefine;
......@@ -1404,7 +1397,7 @@ void FastSaxParser::setLocale( const lang::Locale& rLocale )
OUString FastSaxParser::getImplementationName()
throw (uno::RuntimeException)
{
return FastSaxParser_getImplementationName();
return OUString("com.sun.star.comp.extensions.xml.sax.FastParser");
}
sal_Bool FastSaxParser::supportsService( const OUString& ServiceName )
......@@ -1416,7 +1409,9 @@ sal_Bool FastSaxParser::supportsService( const OUString& ServiceName )
uno::Sequence<OUString> FastSaxParser::getSupportedServiceNames()
throw (uno::RuntimeException)
{
return FastSaxParser_getSupportedServiceNames();
Sequence<OUString> seq(1);
seq[0] = OUString("com.sun.star.xml.sax.FastParser");
return seq;
}
bool FastSaxParser::hasNamespaceURL( const OUString& rPrefix ) const
......@@ -1426,25 +1421,16 @@ bool FastSaxParser::hasNamespaceURL( const OUString& rPrefix ) const
} // namespace sax_fastparser
static Reference< XInterface > SAL_CALL FastSaxParser_CreateInstance(
SAL_UNUSED_PARAMETER const Reference<css::uno::XComponentContext> & )
SAL_THROW((css::uno::Exception))
{
FastSaxParser *p = new FastSaxParser;
return Reference< XInterface > ( (OWeakObject * ) p );
}
extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
com_sun_star_comp_extensions_xml_sax_FastParser_component_getFactory(
const char *, void *, void * )
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
com_sun_star_comp_extensions_xml_sax_FastParser(
SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
uno_Sequence * arguments)
{
Reference<css::lang::XSingleComponentFactory> xFactory(
cppu::createSingleComponentFactory(
&FastSaxParser_CreateInstance,
FastSaxParser_getImplementationName(),