Kaydet (Commit) d8108c98 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

starmath: Convert many services to constructors.

Change-Id: Iadeb0723ec4f4d30996aa5677b936de9f11ffadc
üst 363ee152
...@@ -81,8 +81,6 @@ using namespace ::com::sun::star::uno; ...@@ -81,8 +81,6 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::xmloff::token; using namespace ::xmloff::token;
#define EXPORT_SVC_NAME "com.sun.star.xml.XMLExportFilter"
sal_Unicode ConvertMathToMathML( sal_Unicode cChar ) sal_Unicode ConvertMathToMathML( sal_Unicode cChar )
{ {
sal_Unicode cRes = cChar; sal_Unicode cRes = cChar;
...@@ -393,117 +391,40 @@ const uno::Sequence< sal_Int8 > & SmXMLExport::getUnoTunnelId() throw() ...@@ -393,117 +391,40 @@ const uno::Sequence< sal_Int8 > & SmXMLExport::getUnoTunnelId() throw()
return theSmXMLExportUnoTunnelId::get().getSeq(); return theSmXMLExportUnoTunnelId::get().getSeq();
} }
OUString SAL_CALL SmXMLExport_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.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()
{ {
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() extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
throw() 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( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
const uno::Reference< lang::XMultiServiceFactory > & rSMgr) Math_XMLOasisMetaExporter_get_implementation(css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const &)
throw( uno::Exception )
{ {
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() extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
throw() 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( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
const uno::Reference< lang::XMultiServiceFactory > & rSMgr) Math_XMLContentExporter_get_implementation(css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const &)
throw( uno::Exception )
{ {
// The EXPORT_OASIS flag is only required to avoid that a transformer is return cppu::acquire(new SmXMLExport(context, "com.sun.star.comp.Math.XMLContentExporter", SvXMLExportFlags::OASIS|SvXMLExportFlags::CONTENT));
// chanied in
return (cppu::OWeakObject*)new SmXMLExport( comphelper::getComponentContext(rSMgr), SmXMLExportContent_getImplementationName(), SvXMLExportFlags::OASIS|SvXMLExportFlags::CONTENT );
} }
sal_uInt32 SmXMLExport::exportDoc(enum XMLTokenEnum eClass) sal_uInt32 SmXMLExport::exportDoc(enum XMLTokenEnum eClass)
......
...@@ -58,13 +58,6 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL sm_component_getFactory( const sal_Char* pIm ...@@ -58,13 +58,6 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL sm_component_getFactory( const sal_Char* pIm
SmXMLImport_createInstance, SmXMLImport_createInstance,
SmXMLImport_getSupportedServiceNames() ); SmXMLImport_getSupportedServiceNames() );
} }
else if( SmXMLExport_getImplementationName().equalsAscii( pImplementationName ))
{
xFactory = ::cppu::createSingleFactory( xServiceManager,
SmXMLExport_getImplementationName(),
SmXMLExport_createInstance,
SmXMLExport_getSupportedServiceNames() );
}
else if( SmXMLImportMeta_getImplementationName().equalsAscii( pImplementationName )) else if( SmXMLImportMeta_getImplementationName().equalsAscii( pImplementationName ))
{ {
xFactory = ::cppu::createSingleFactory( xServiceManager, xFactory = ::cppu::createSingleFactory( xServiceManager,
...@@ -72,20 +65,6 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL sm_component_getFactory( const sal_Char* pIm ...@@ -72,20 +65,6 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL sm_component_getFactory( const sal_Char* pIm
SmXMLImportMeta_createInstance, SmXMLImportMeta_createInstance,
SmXMLImportMeta_getSupportedServiceNames() ); 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 )) else if( SmXMLImportSettings_getImplementationName().equalsAscii( pImplementationName ))
{ {
xFactory = ::cppu::createSingleFactory( xServiceManager, xFactory = ::cppu::createSingleFactory( xServiceManager,
...@@ -93,27 +72,6 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL sm_component_getFactory( const sal_Char* pIm ...@@ -93,27 +72,6 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL sm_component_getFactory( const sal_Char* pIm
SmXMLImportSettings_createInstance, SmXMLImportSettings_createInstance,
SmXMLImportSettings_getSupportedServiceNames() ); 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 )) else if( SmDocument_getImplementationName().equalsAscii( pImplementationName ))
{ {
xFactory = ::sfx2::createSfxModelFactory( xServiceManager, xFactory = ::sfx2::createSfxModelFactory( xServiceManager,
...@@ -122,7 +80,6 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL sm_component_getFactory( const sal_Char* pIm ...@@ -122,7 +80,6 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL sm_component_getFactory( const sal_Char* pIm
SmDocument_getSupportedServiceNames() ); SmDocument_getSupportedServiceNames() );
} }
// Factory is valid - service was found. // Factory is valid - service was found.
if ( xFactory.is() ) if ( xFactory.is() )
{ {
......
...@@ -50,44 +50,6 @@ OUString SAL_CALL SmXMLImportSettings_getImplementationName() throw(); ...@@ -50,44 +50,6 @@ OUString SAL_CALL SmXMLImportSettings_getImplementationName() throw();
css::uno::Reference< css::uno::XInterface > SAL_CALL css::uno::Reference< css::uno::XInterface > SAL_CALL
SmXMLImportSettings_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr) throw( css::uno::Exception ); 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 #endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -22,31 +22,37 @@ ...@@ -22,31 +22,37 @@
<implementation name="com.sun.star.comp.Math.FormulaDocument"> <implementation name="com.sun.star.comp.Math.FormulaDocument">
<service name="com.sun.star.formula.FormulaProperties"/> <service name="com.sun.star.formula.FormulaProperties"/>
</implementation> </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"/> <service name="com.sun.star.xml.XMLExportFilter"/>
</implementation> </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"/> <service name="com.sun.star.xml.XMLExportFilter"/>
</implementation> </implementation>
<implementation name="com.sun.star.comp.Math.XMLImporter"> <implementation name="com.sun.star.comp.Math.XMLImporter">
<service name="com.sun.star.xml.XMLImportFilter"/> <service name="com.sun.star.xml.XMLImportFilter"/>
</implementation> </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"/> <service name="com.sun.star.xml.XMLExportFilter"/>
</implementation> </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"/> <service name="com.sun.star.xml.XMLExportFilter"/>
</implementation> </implementation>
<implementation name="com.sun.star.comp.Math.XMLOasisMetaImporter"> <implementation name="com.sun.star.comp.Math.XMLOasisMetaImporter">
<service name="com.sun.star.xml.XMLImportFilter"/> <service name="com.sun.star.xml.XMLImportFilter"/>
</implementation> </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"/> <service name="com.sun.star.xml.XMLExportFilter"/>
</implementation> </implementation>
<implementation name="com.sun.star.comp.Math.XMLOasisSettingsImporter"> <implementation name="com.sun.star.comp.Math.XMLOasisSettingsImporter">
<service name="com.sun.star.xml.XMLImportFilter"/> <service name="com.sun.star.xml.XMLImportFilter"/>
</implementation> </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"/> <service name="com.sun.star.xml.XMLExportFilter"/>
</implementation> </implementation>
<implementation name="com.sun.star.comp.Math.MathTypeFilter" <implementation name="com.sun.star.comp.Math.MathTypeFilter"
......
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