summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2015-05-03 17:08:28 +0200
committerJan Holesovsky <kendy@collabora.com>2015-05-03 18:04:24 +0200
commit2d6e16fd17233f0ded2e700b7421afcf911ee95d (patch)
treeec6914df7c4e067d010cfa15fcf7a0636216ac60
parentsc: Avoid registering controls. (diff)
downloadcore-distro/collabora/viewer2.tar.gz
core-distro/collabora/viewer2.zip
starmath: Convert many services to constructors. distro/collabora/viewer2
Change-Id: Iadeb0723ec4f4d30996aa5677b936de9f11ffadc
-rw-r--r--starmath/source/mathmlexport.cxx115
-rw-r--r--starmath/source/register.cxx43
-rw-r--r--starmath/source/register.hxx38
-rw-r--r--starmath/util/sm.component18
4 files changed, 30 insertions, 184 deletions
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index 98bbbe4a8651..de064135d8dc 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -81,8 +81,6 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star;
using namespace ::xmloff::token;
-#define EXPORT_SVC_NAME "com.sun.star.xml.XMLExportFilter"
-
sal_Unicode ConvertMathToMathML( sal_Unicode cChar )
{
sal_Unicode cRes = cChar;
@@ -393,117 +391,40 @@ const uno::Sequence< sal_Int8 > & SmXMLExport::getUnoTunnelId() throw()
return theSmXMLExportUnoTunnelId::get().getSeq();
}
-OUString SAL_CALL SmXMLExport_getImplementationName() throw()
-{
- return OUString( "com.sun.star.comp.Math.XMLExporter" );
-}
-
-uno::Sequence< OUString > SAL_CALL SmXMLExport_getSupportedServiceNames()
- throw()
-{
- return uno::Sequence<OUString>{ EXPORT_SVC_NAME };
-}
-
-uno::Reference< uno::XInterface > SAL_CALL SmXMLExport_createInstance(
- const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
- throw( uno::Exception )
-{
- // EXPORT_OASIS is required here although there is no difference between
- // OOo and OASIS, because without the flag, a transformation to OOo would
- // be chained in.
- return (cppu::OWeakObject*)new SmXMLExport( comphelper::getComponentContext(rSMgr), SmXMLExport_getImplementationName(), SvXMLExportFlags::OASIS|SvXMLExportFlags::ALL );
-}
-
-OUString SAL_CALL SmXMLExportMetaOOO_getImplementationName() throw()
-{
- return OUString( "com.sun.star.comp.Math.XMLMetaExporter" );
-}
-
-uno::Sequence< OUString > SAL_CALL SmXMLExportMetaOOO_getSupportedServiceNames()
- throw()
-{
- return uno::Sequence<OUString>{ EXPORT_SVC_NAME };
-}
-
-uno::Reference< uno::XInterface > SAL_CALL SmXMLExportMetaOOO_createInstance(
- const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
-throw( uno::Exception )
-{
- return (cppu::OWeakObject*)new SmXMLExport( comphelper::getComponentContext(rSMgr), SmXMLExportMetaOOO_getImplementationName(), SvXMLExportFlags::META );
-}
-
-OUString SAL_CALL SmXMLExportMeta_getImplementationName() throw()
-{
- return OUString( "com.sun.star.comp.Math.XMLOasisMetaExporter" );
-}
-
-uno::Sequence< OUString > SAL_CALL SmXMLExportMeta_getSupportedServiceNames()
-throw()
-{
- return uno::Sequence<OUString>{ EXPORT_SVC_NAME };
-}
-
-uno::Reference< uno::XInterface > SAL_CALL SmXMLExportMeta_createInstance(
- const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
-throw( uno::Exception )
-{
- return (cppu::OWeakObject*)new SmXMLExport( comphelper::getComponentContext(rSMgr), SmXMLExportMeta_getImplementationName(), SvXMLExportFlags::OASIS|SvXMLExportFlags::META );
-}
-
-OUString SAL_CALL SmXMLExportSettingsOOO_getImplementationName() throw()
-{
- return OUString( "com.sun.star.comp.Math.XMLSettingsExporter" );
-}
-
-uno::Sequence< OUString > SAL_CALL SmXMLExportSettingsOOO_getSupportedServiceNames()
-throw()
-{
- return uno::Sequence<OUString>{ EXPORT_SVC_NAME };
-}
-
-uno::Reference< uno::XInterface > SAL_CALL SmXMLExportSettingsOOO_createInstance(
- const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
-throw( uno::Exception )
-{
- return (cppu::OWeakObject*)new SmXMLExport( comphelper::getComponentContext(rSMgr), SmXMLExportSettingsOOO_getImplementationName(), SvXMLExportFlags::SETTINGS );
-}
-
-OUString SAL_CALL SmXMLExportSettings_getImplementationName() throw()
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
+Math_XMLExporter_get_implementation(css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const &)
{
- return OUString( "com.sun.star.comp.Math.XMLOasisSettingsExporter" );
+ return cppu::acquire(new SmXMLExport(context, "com.sun.star.comp.Math.XMLExporter", SvXMLExportFlags::OASIS|SvXMLExportFlags::ALL));
}
-uno::Sequence< OUString > SAL_CALL SmXMLExportSettings_getSupportedServiceNames()
-throw()
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
+Math_XMLMetaExporter_get_implementation(css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const &)
{
- return uno::Sequence<OUString>{ EXPORT_SVC_NAME };
+ return cppu::acquire(new SmXMLExport(context, "com.sun.star.comp.Math.XMLMetaExporter", SvXMLExportFlags::META));
}
-uno::Reference< uno::XInterface > SAL_CALL SmXMLExportSettings_createInstance(
- const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
-throw( uno::Exception )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
+Math_XMLOasisMetaExporter_get_implementation(css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const &)
{
- return (cppu::OWeakObject*)new SmXMLExport( comphelper::getComponentContext(rSMgr), SmXMLExportSettings_getImplementationName(), SvXMLExportFlags::OASIS|SvXMLExportFlags::SETTINGS );
+ return cppu::acquire(new SmXMLExport(context, "com.sun.star.comp.Math.XMLOasisMetaExporter", SvXMLExportFlags::OASIS|SvXMLExportFlags::META));
}
-OUString SAL_CALL SmXMLExportContent_getImplementationName() throw()
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
+Math_XMLSettingsExporter_get_implementation(css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const &)
{
- return OUString( "com.sun.star.comp.Math.XMLContentExporter" );
+ return cppu::acquire(new SmXMLExport(context, "com.sun.star.comp.Math.XMLSettingsExporter", SvXMLExportFlags::SETTINGS));
}
-uno::Sequence< OUString > SAL_CALL SmXMLExportContent_getSupportedServiceNames()
- throw()
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
+Math_XMLOasisSettingsExporter_get_implementation(css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const &)
{
- return uno::Sequence<OUString>{ EXPORT_SVC_NAME };
+ return cppu::acquire(new SmXMLExport(context, "com.sun.star.comp.Math.XMLOasisSettingsExporter", SvXMLExportFlags::OASIS|SvXMLExportFlags::SETTINGS));
}
-uno::Reference< uno::XInterface > SAL_CALL SmXMLExportContent_createInstance(
- const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
-throw( uno::Exception )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
+Math_XMLContentExporter_get_implementation(css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const &)
{
- // The EXPORT_OASIS flag is only required to avoid that a transformer is
- // chanied in
- return (cppu::OWeakObject*)new SmXMLExport( comphelper::getComponentContext(rSMgr), SmXMLExportContent_getImplementationName(), SvXMLExportFlags::OASIS|SvXMLExportFlags::CONTENT );
+ return cppu::acquire(new SmXMLExport(context, "com.sun.star.comp.Math.XMLContentExporter", SvXMLExportFlags::OASIS|SvXMLExportFlags::CONTENT));
}
sal_uInt32 SmXMLExport::exportDoc(enum XMLTokenEnum eClass)
diff --git a/starmath/source/register.cxx b/starmath/source/register.cxx
index 8bd00e8b4081..6f6062caea41 100644
--- a/starmath/source/register.cxx
+++ b/starmath/source/register.cxx
@@ -58,13 +58,6 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL sm_component_getFactory( const sal_Char* pIm
SmXMLImport_createInstance,
SmXMLImport_getSupportedServiceNames() );
}
- else if( SmXMLExport_getImplementationName().equalsAscii( pImplementationName ))
- {
- xFactory = ::cppu::createSingleFactory( xServiceManager,
- SmXMLExport_getImplementationName(),
- SmXMLExport_createInstance,
- SmXMLExport_getSupportedServiceNames() );
- }
else if( SmXMLImportMeta_getImplementationName().equalsAscii( pImplementationName ))
{
xFactory = ::cppu::createSingleFactory( xServiceManager,
@@ -72,20 +65,6 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL sm_component_getFactory( const sal_Char* pIm
SmXMLImportMeta_createInstance,
SmXMLImportMeta_getSupportedServiceNames() );
}
- else if( SmXMLExportMetaOOO_getImplementationName().equalsAscii( pImplementationName ))
- {
- xFactory = ::cppu::createSingleFactory( xServiceManager,
- SmXMLExportMetaOOO_getImplementationName(),
- SmXMLExportMetaOOO_createInstance,
- SmXMLExportMetaOOO_getSupportedServiceNames() );
- }
- else if( SmXMLExportMeta_getImplementationName().equalsAscii( pImplementationName ))
- {
- xFactory = ::cppu::createSingleFactory( xServiceManager,
- SmXMLExportMeta_getImplementationName(),
- SmXMLExportMeta_createInstance,
- SmXMLExportMeta_getSupportedServiceNames() );
- }
else if( SmXMLImportSettings_getImplementationName().equalsAscii( pImplementationName ))
{
xFactory = ::cppu::createSingleFactory( xServiceManager,
@@ -93,27 +72,6 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL sm_component_getFactory( const sal_Char* pIm
SmXMLImportSettings_createInstance,
SmXMLImportSettings_getSupportedServiceNames() );
}
- else if( SmXMLExportSettingsOOO_getImplementationName().equalsAscii( pImplementationName ))
- {
- xFactory = ::cppu::createSingleFactory( xServiceManager,
- SmXMLExportSettingsOOO_getImplementationName(),
- SmXMLExportSettingsOOO_createInstance,
- SmXMLExportSettingsOOO_getSupportedServiceNames() );
- }
- else if( SmXMLExportSettings_getImplementationName().equalsAscii( pImplementationName ))
- {
- xFactory = ::cppu::createSingleFactory( xServiceManager,
- SmXMLExportSettings_getImplementationName(),
- SmXMLExportSettings_createInstance,
- SmXMLExportSettings_getSupportedServiceNames() );
- }
- else if( SmXMLExportContent_getImplementationName().equalsAscii( pImplementationName ))
- {
- xFactory = ::cppu::createSingleFactory( xServiceManager,
- SmXMLExportContent_getImplementationName(),
- SmXMLExportContent_createInstance,
- SmXMLExportContent_getSupportedServiceNames() );
- }
else if( SmDocument_getImplementationName().equalsAscii( pImplementationName ))
{
xFactory = ::sfx2::createSfxModelFactory( xServiceManager,
@@ -122,7 +80,6 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL sm_component_getFactory( const sal_Char* pIm
SmDocument_getSupportedServiceNames() );
}
-
// Factory is valid - service was found.
if ( xFactory.is() )
{
diff --git a/starmath/source/register.hxx b/starmath/source/register.hxx
index 97b4692eb319..988ba69a1d6e 100644
--- a/starmath/source/register.hxx
+++ b/starmath/source/register.hxx
@@ -50,44 +50,6 @@ OUString SAL_CALL SmXMLImportSettings_getImplementationName() throw();
css::uno::Reference< css::uno::XInterface > SAL_CALL
SmXMLImportSettings_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr) throw( css::uno::Exception );
-//MathML export
-css::uno::Sequence< OUString > SAL_CALL
- SmXMLExport_getSupportedServiceNames() throw();
-OUString SAL_CALL
- SmXMLExport_getImplementationName() throw();
-css::uno::Reference< css::uno::XInterface > SAL_CALL
- SmXMLExport_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr) throw( css::uno::Exception );
-css::uno::Sequence< OUString > SAL_CALL
- SmXMLExportMetaOOO_getSupportedServiceNames() throw();
-OUString SAL_CALL
- SmXMLExportMetaOOO_getImplementationName() throw();
-css::uno::Reference< css::uno::XInterface > SAL_CALL
- SmXMLExportMetaOOO_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr) throw( css::uno::Exception );
-css::uno::Sequence< OUString > SAL_CALL
- SmXMLExportMeta_getSupportedServiceNames() throw();
-OUString SAL_CALL
- SmXMLExportMeta_getImplementationName() throw();
-css::uno::Reference< css::uno::XInterface > SAL_CALL
- SmXMLExportMeta_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr) throw( css::uno::Exception );
-css::uno::Sequence< OUString > SAL_CALL
- SmXMLExportSettingsOOO_getSupportedServiceNames() throw();
-OUString SAL_CALL
- SmXMLExportSettingsOOO_getImplementationName() throw();
-css::uno::Reference< css::uno::XInterface > SAL_CALL
- SmXMLExportSettingsOOO_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr) throw( css::uno::Exception );
-css::uno::Sequence< OUString > SAL_CALL
- SmXMLExportSettings_getSupportedServiceNames() throw();
-OUString SAL_CALL
- SmXMLExportSettings_getImplementationName() throw();
-css::uno::Reference< css::uno::XInterface > SAL_CALL
- SmXMLExportSettings_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr) throw( css::uno::Exception );
-css::uno::Sequence< OUString > SAL_CALL
- SmXMLExportContent_getSupportedServiceNames() throw();
-OUString SAL_CALL
- SmXMLExportContent_getImplementationName() throw();
-css::uno::Reference< css::uno::XInterface > SAL_CALL
- SmXMLExportContent_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr) throw( css::uno::Exception );
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/starmath/util/sm.component b/starmath/util/sm.component
index 2c7507f07f91..7444bb05385d 100644
--- a/starmath/util/sm.component
+++ b/starmath/util/sm.component
@@ -22,31 +22,37 @@
<implementation name="com.sun.star.comp.Math.FormulaDocument">
<service name="com.sun.star.formula.FormulaProperties"/>
</implementation>
- <implementation name="com.sun.star.comp.Math.XMLContentExporter">
+ <implementation name="com.sun.star.comp.Math.XMLContentExporter"
+ constructor="Math_XMLContentExporter_get_implementation">
<service name="com.sun.star.xml.XMLExportFilter"/>
</implementation>
- <implementation name="com.sun.star.comp.Math.XMLExporter">
+ <implementation name="com.sun.star.comp.Math.XMLExporter"
+ constructor="Math_XMLExporter_get_implementation">
<service name="com.sun.star.xml.XMLExportFilter"/>
</implementation>
<implementation name="com.sun.star.comp.Math.XMLImporter">
<service name="com.sun.star.xml.XMLImportFilter"/>
</implementation>
- <implementation name="com.sun.star.comp.Math.XMLMetaExporter">
+ <implementation name="com.sun.star.comp.Math.XMLMetaExporter"
+ constructor="Math_XMLMetaExporter_get_implementation">
<service name="com.sun.star.xml.XMLExportFilter"/>
</implementation>
- <implementation name="com.sun.star.comp.Math.XMLOasisMetaExporter">
+ <implementation name="com.sun.star.comp.Math.XMLOasisMetaExporter"
+ constructor="Math_XMLOasisMetaExporter_get_implementation">
<service name="com.sun.star.xml.XMLExportFilter"/>
</implementation>
<implementation name="com.sun.star.comp.Math.XMLOasisMetaImporter">
<service name="com.sun.star.xml.XMLImportFilter"/>
</implementation>
- <implementation name="com.sun.star.comp.Math.XMLOasisSettingsExporter">
+ <implementation name="com.sun.star.comp.Math.XMLOasisSettingsExporter"
+ constructor="Math_XMLOasisSettingsExporter_get_implementation">
<service name="com.sun.star.xml.XMLExportFilter"/>
</implementation>
<implementation name="com.sun.star.comp.Math.XMLOasisSettingsImporter">
<service name="com.sun.star.xml.XMLImportFilter"/>
</implementation>
- <implementation name="com.sun.star.comp.Math.XMLSettingsExporter">
+ <implementation name="com.sun.star.comp.Math.XMLSettingsExporter"
+ constructor="Math_XMLSettingsExporter_get_implementation">
<service name="com.sun.star.xml.XMLExportFilter"/>
</implementation>
</component>