[Libreoffice-commits] core.git: include/xmloff sc/inc sc/source sc/util solenv/bin xmloff/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun Jul 26 11:42:32 UTC 2020


 include/xmloff/xmlimp.hxx         |    6 +
 sc/inc/appluno.hxx                |   36 -----------
 sc/source/filter/xml/xmlimprt.cxx |  118 +++++++++++++++-----------------------
 sc/source/filter/xml/xmlimprt.hxx |    3 
 sc/source/ui/unoobj/appluno.cxx   |   94 +-----------------------------
 sc/source/ui/unoobj/unodoc.cxx    |   26 +++-----
 sc/util/sc.component              |   23 ++++---
 solenv/bin/native-code.py         |    8 ++
 xmloff/source/core/xmlimp.cxx     |   15 +++-
 9 files changed, 102 insertions(+), 227 deletions(-)

New commits:
commit 38bccb6928aaf4ed7eb2e146579fc0cf2446dc17
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Jul 26 10:42:37 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Jul 26 13:41:59 2020 +0200

    sc: create instances with uno constructors
    
    See tdf#74608 for motivation.
    
    Change-Id: Id4bf552c6a2580742bf46ccf6cdd2e09b0dbdebc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99455
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 351a05887ebd..c2e720b3391f 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -288,10 +288,14 @@ protected:
 
 public:
     // SvXMLImport( sal_uInt16 nImportFlags = IMPORT_ALL ) throw();
+    /**
+     * @param sSupportedServiceNames if this is empty we default to our normal supported service names
+     */
     SvXMLImport(
         const css::uno::Reference< css::uno::XComponentContext >& xContext,
         OUString const & implementationName,
-        SvXMLImportFlags nImportFlags = SvXMLImportFlags::ALL );
+        SvXMLImportFlags nImportFlags = SvXMLImportFlags::ALL,
+        const css::uno::Sequence< OUString > & sSupportedServiceNames = {});
 
     void cleanup() throw();
 
diff --git a/sc/inc/appluno.hxx b/sc/inc/appluno.hxx
index 0bf094057d00..739a7919553e 100644
--- a/sc/inc/appluno.hxx
+++ b/sc/inc/appluno.hxx
@@ -44,39 +44,6 @@ css::uno::Reference<css::uno::XInterface> SAL_CALL
     ScFunctionListObj_CreateInstance(
         const css::uno::Reference< css::lang::XMultiServiceFactory>& rSMgr );
 
-// Calc document
-css::uno::Sequence< OUString > ScDocument_getSupportedServiceNames() throw();
-OUString ScDocument_getImplementationName() throw();
-/// @throws css::uno::Exception
-css::uno::Reference< css::uno::XInterface > ScDocument_createInstance(
-            const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr, SfxModelFlags _nCreationFlags );
-
-// Calc XML import
-css::uno::Sequence< OUString > ScXMLImport_getSupportedServiceNames() throw();
-OUString ScXMLImport_getImplementationName() throw();
-/// @throws css::uno::Exception
-css::uno::Reference< css::uno::XInterface > ScXMLImport_createInstance(
-            const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr );
-css::uno::Sequence< OUString > ScXMLImport_Meta_getSupportedServiceNames() throw();
-OUString ScXMLImport_Meta_getImplementationName() throw();
-/// @throws css::uno::Exception
-css::uno::Reference< css::uno::XInterface > ScXMLImport_Meta_createInstance(
-            const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr );
-css::uno::Sequence< OUString > ScXMLImport_Styles_getSupportedServiceNames() throw();
-OUString ScXMLImport_Styles_getImplementationName() throw();
-/// @throws css::uno::Exception
-css::uno::Reference< css::uno::XInterface > ScXMLImport_Styles_createInstance(
-            const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr );
-css::uno::Sequence< OUString > ScXMLImport_Content_getSupportedServiceNames() throw();
-OUString ScXMLImport_Content_getImplementationName() throw();
-/// @throws css::uno::Exception
-css::uno::Reference< css::uno::XInterface > ScXMLImport_Content_createInstance(
-            const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr );
-css::uno::Sequence< OUString > ScXMLImport_Settings_getSupportedServiceNames() throw();
-OUString ScXMLImport_Settings_getImplementationName() throw();
-/// @throws css::uno::Exception
-css::uno::Reference< css::uno::XInterface > ScXMLImport_Settings_createInstance(
-            const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr );
 
 class ScSpreadsheetSettings final : public cppu::WeakImplHelper<
                                         css::sheet::XGlobalSheetSettings,
@@ -100,9 +67,6 @@ public:
                             ScSpreadsheetSettings();
     virtual                 ~ScSpreadsheetSettings() override;
 
-    static OUString  getImplementationName_Static();
-    static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
-
     // XGlobalSheetSettings
     virtual sal_Bool SAL_CALL getMoveSelection() override
         { return getPropertyBool("MoveSelection"); }
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 1a35ba93ed8f..da3624b2e5ce 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -110,89 +110,64 @@ using namespace com::sun::star;
 using namespace ::xmloff::token;
 using namespace ::formula;
 
-OUString ScXMLImport_getImplementationName() throw()
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+Calc_XMLOasisImporter_get_implementation(
+    css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
 {
-    return "com.sun.star.comp.Calc.XMLOasisImporter";
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(
+        new ScXMLImport(
+            context,
+            "com.sun.star.comp.Calc.XMLOasisImporter",
+            SvXMLImportFlags::ALL,
+            { "com.sun.star.comp.Calc.XMLOasisImporter" } )));
 }
 
-uno::Sequence< OUString > ScXMLImport_getSupportedServiceNames() throw()
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+Calc_XMLOasisMetaImporter_get_implementation(
+    css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
 {
-    return { ScXMLImport_getImplementationName() };
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(
+        new ScXMLImport(
+            context,
+            "com.sun.star.comp.Calc.XMLOasisMetaImporter",
+            SvXMLImportFlags::META,
+            { "com.sun.star.comp.Calc.XMLOasisMetaImporter" }  )));
 }
 
-uno::Reference< uno::XInterface > ScXMLImport_createInstance(
-    const uno::Reference< lang::XMultiServiceFactory > & rSMgr )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+Calc_XMLOasisStylesImporter_get_implementation(
+    css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
 {
-    // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_ALL);
-    return static_cast<cppu::OWeakObject*>(new ScXMLImport( comphelper::getComponentContext(rSMgr), ScXMLImport_getImplementationName(), SvXMLImportFlags::ALL ));
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(
+        new ScXMLImport(
+            context,
+            "com.sun.star.comp.Calc.XMLOasisStylesImporter",
+            SvXMLImportFlags::STYLES|SvXMLImportFlags::AUTOSTYLES|SvXMLImportFlags::MASTERSTYLES|SvXMLImportFlags::FONTDECLS,
+            { "com.sun.star.comp.Calc.XMLOasisStylesImporter" } )));
 }
 
-OUString ScXMLImport_Meta_getImplementationName() throw()
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+Calc_XMLOasisContentImporter_get_implementation(
+    css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
 {
-    return "com.sun.star.comp.Calc.XMLOasisMetaImporter";
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(new ScXMLImport(
+        context,
+        "com.sun.star.comp.Calc.XMLOasisContentImporter",
+        SvXMLImportFlags::AUTOSTYLES|SvXMLImportFlags::CONTENT|SvXMLImportFlags::SCRIPTS|SvXMLImportFlags::FONTDECLS,
+        uno::Sequence< OUString > { "com.sun.star.comp.Calc.XMLOasisContentImporter" })));
 }
 
-uno::Sequence< OUString > ScXMLImport_Meta_getSupportedServiceNames() throw()
-{
-    return { ScXMLImport_Meta_getImplementationName() };
-}
-
-uno::Reference< uno::XInterface > ScXMLImport_Meta_createInstance(
-    const uno::Reference< lang::XMultiServiceFactory > & rSMgr )
-{
-    // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_META);
-    return static_cast<cppu::OWeakObject*>(new ScXMLImport( comphelper::getComponentContext(rSMgr), ScXMLImport_Meta_getImplementationName(), SvXMLImportFlags::META ));
-}
-
-OUString ScXMLImport_Styles_getImplementationName() throw()
-{
-    return "com.sun.star.comp.Calc.XMLOasisStylesImporter";
-}
-
-uno::Sequence< OUString > ScXMLImport_Styles_getSupportedServiceNames() throw()
-{
-    return { ScXMLImport_Styles_getImplementationName() };
-}
-
-uno::Reference< uno::XInterface > ScXMLImport_Styles_createInstance(
-    const uno::Reference< lang::XMultiServiceFactory > & rSMgr )
-{
-    // return (cppu::OWeakObject*)new ScXMLImport(SvXMLImportFlagsSTYLES|SvXMLImportFlags::AUTOSTYLES|SvXMLImportFlags::MASTERSTYLES|SvXMLImportFlags::FONTDECLS);
-    return static_cast<cppu::OWeakObject*>(new ScXMLImport( comphelper::getComponentContext(rSMgr), ScXMLImport_Styles_getImplementationName(), SvXMLImportFlags::STYLES|SvXMLImportFlags::AUTOSTYLES|SvXMLImportFlags::MASTERSTYLES|SvXMLImportFlags::FONTDECLS));
-}
-
-OUString ScXMLImport_Content_getImplementationName() throw()
-{
-    return "com.sun.star.comp.Calc.XMLOasisContentImporter";
-}
-
-uno::Sequence< OUString > ScXMLImport_Content_getSupportedServiceNames() throw()
-{
-    return { ScXMLImport_Content_getImplementationName() };
-}
-
-uno::Reference< uno::XInterface > ScXMLImport_Content_createInstance(
-    const uno::Reference< lang::XMultiServiceFactory > & rSMgr )
-{
-    // return (cppu::OWeakObject*)new ScXMLImport(SvXMLImportFlags::META|SvXMLImportFlags::STYLES|SvXMLImportFlags::MASTERSTYLES|SvXMLImportFlags::AUTOSTYLES|SvXMLImportFlags::CONTENT|SvXMLImportFlags::SCRIPTS|SvXMLImportFlags::SETTINGS|SvXMLImportFlags::FONTDECLS);
-    return static_cast<cppu::OWeakObject*>(new ScXMLImport( comphelper::getComponentContext(rSMgr), ScXMLImport_Content_getImplementationName(), SvXMLImportFlags::AUTOSTYLES|SvXMLImportFlags::CONTENT|SvXMLImportFlags::SCRIPTS|SvXMLImportFlags::FONTDECLS));
-}
-
-OUString ScXMLImport_Settings_getImplementationName() throw()
-{
-    return "com.sun.star.comp.Calc.XMLOasisSettingsImporter";
-}
-
-uno::Sequence< OUString > ScXMLImport_Settings_getSupportedServiceNames() throw()
-{
-    return { ScXMLImport_Settings_getImplementationName() };
-}
 
-uno::Reference< uno::XInterface > ScXMLImport_Settings_createInstance(
-    const uno::Reference< lang::XMultiServiceFactory > & rSMgr )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+Calc_XMLOasisSettingsImporter_get_implementation(
+    css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
 {
-    // return (cppu::OWeakObject*)new ScXMLImport(SvXMLImportFlags::SETTINGS);
-    return static_cast<cppu::OWeakObject*>(new ScXMLImport( comphelper::getComponentContext(rSMgr), ScXMLImport_Settings_getImplementationName(), SvXMLImportFlags::SETTINGS ));
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(
+        new ScXMLImport(
+            context,
+            "com.sun.star.comp.Calc.XMLOasisSettingsImporter",
+            SvXMLImportFlags::SETTINGS,
+            { "com.sun.star.comp.Calc.XMLOasisSettingsImporter" } )));
 }
 
 const SvXMLTokenMap& ScXMLImport::GetTableRowCellAttrTokenMap()
@@ -581,8 +556,9 @@ constexpr OUStringLiteral gsCellStyle(SC_UNONAME_CELLSTYL);
 
 ScXMLImport::ScXMLImport(
     const css::uno::Reference< css::uno::XComponentContext >& rContext,
-    OUString const & implementationName, SvXMLImportFlags nImportFlag)
-:   SvXMLImport( rContext, implementationName, nImportFlag ),
+    OUString const & implementationName, SvXMLImportFlags nImportFlag,
+    const css::uno::Sequence< OUString > & sSupportedServiceNames)
+:   SvXMLImport( rContext, implementationName, nImportFlag, sSupportedServiceNames ),
     pDoc( nullptr ),
     mpPostProcessData(nullptr),
     aTables(*this),
diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx
index 1505e6e693e3..56a3386d914d 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -270,7 +270,8 @@ protected:
 public:
     ScXMLImport(
         const css::uno::Reference< css::uno::XComponentContext >& rContext,
-        OUString const & implementationName, SvXMLImportFlags nImportFlag);
+        OUString const & implementationName, SvXMLImportFlags nImportFlag,
+        const css::uno::Sequence< OUString > & sSupportedServiceNames = {});
 
     virtual ~ScXMLImport() throw() override;
 
diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx
index 4eebb81d8ff9..e13722131b42 100644
--- a/sc/source/ui/unoobj/appluno.cxx
+++ b/sc/source/ui/unoobj/appluno.cxx
@@ -88,84 +88,6 @@ SC_SIMPLE_SERVICE_INFO( ScFunctionListObj, "stardiv.StarCalc.ScFunctionListObj",
 SC_SIMPLE_SERVICE_INFO( ScRecentFunctionsObj, "stardiv.StarCalc.ScRecentFunctionsObj", SCRECENTFUNCTIONSOBJ_SERVICE )
 SC_SIMPLE_SERVICE_INFO( ScSpreadsheetSettings, "stardiv.StarCalc.ScSpreadsheetSettings", SCSPREADSHEETSETTINGS_SERVICE )
 
-extern "C" {
-
-SAL_DLLPUBLIC_EXPORT void * sc_component_getFactory(
-    const char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
-{
-    if (!pServiceManager)
-        return nullptr;
-
-    uno::Reference<lang::XSingleServiceFactory> xFactory;
-    OUString aImpl(OUString::createFromAscii(pImplName));
-
-    if ( aImpl == ScSpreadsheetSettings::getImplementationName_Static() )
-    {
-        xFactory.set(cppu::createOneInstanceFactory(
-                static_cast<lang::XMultiServiceFactory*>(pServiceManager),
-                ScSpreadsheetSettings::getImplementationName_Static(),
-                ScSpreadsheetSettings_CreateInstance,
-                ScSpreadsheetSettings::getSupportedServiceNames_Static() ));
-    }
-    else if ( aImpl == ScXMLImport_getImplementationName() )
-    {
-        xFactory.set(cppu::createSingleFactory(
-                static_cast<lang::XMultiServiceFactory*>(pServiceManager),
-                ScXMLImport_getImplementationName(),
-                ScXMLImport_createInstance,
-                ScXMLImport_getSupportedServiceNames() ));
-    }
-    else if ( aImpl == ScXMLImport_Meta_getImplementationName() )
-    {
-        xFactory.set(cppu::createSingleFactory(
-                static_cast<lang::XMultiServiceFactory*>(pServiceManager),
-                ScXMLImport_Meta_getImplementationName(),
-                ScXMLImport_Meta_createInstance,
-                ScXMLImport_Meta_getSupportedServiceNames() ));
-    }
-    else if ( aImpl == ScXMLImport_Styles_getImplementationName() )
-    {
-        xFactory.set(cppu::createSingleFactory(
-                static_cast<lang::XMultiServiceFactory*>(pServiceManager),
-                ScXMLImport_Styles_getImplementationName(),
-                ScXMLImport_Styles_createInstance,
-                ScXMLImport_Styles_getSupportedServiceNames() ));
-    }
-    else if ( aImpl == ScXMLImport_Content_getImplementationName() )
-    {
-        xFactory.set(cppu::createSingleFactory(
-                static_cast<lang::XMultiServiceFactory*>(pServiceManager),
-                ScXMLImport_Content_getImplementationName(),
-                ScXMLImport_Content_createInstance,
-                ScXMLImport_Content_getSupportedServiceNames() ));
-    }
-    else if ( aImpl == ScXMLImport_Settings_getImplementationName() )
-    {
-        xFactory.set(cppu::createSingleFactory(
-                static_cast<lang::XMultiServiceFactory*>(pServiceManager),
-                ScXMLImport_Settings_getImplementationName(),
-                ScXMLImport_Settings_createInstance,
-                ScXMLImport_Settings_getSupportedServiceNames() ));
-    }
-    else if ( aImpl == ScDocument_getImplementationName() )
-    {
-        xFactory.set(sfx2::createSfxModelFactory(
-                static_cast<lang::XMultiServiceFactory*>(pServiceManager),
-                ScDocument_getImplementationName(),
-                ScDocument_createInstance,
-                ScDocument_getSupportedServiceNames() ));
-    }
-
-    void* pRet = nullptr;
-    if (xFactory.is())
-    {
-        xFactory->acquire();
-        pRet = xFactory.get();
-    }
-    return pRet;
-}
-
-}   // extern C
 
 ScSpreadsheetSettings::ScSpreadsheetSettings() :
     aPropSet( lcl_GetSettingsPropertyMap() )
@@ -176,23 +98,15 @@ ScSpreadsheetSettings::~ScSpreadsheetSettings()
 {
 }
 
-uno::Reference<uno::XInterface> ScSpreadsheetSettings_CreateInstance(
-                        const uno::Reference<lang::XMultiServiceFactory>& /* rSMgr */ )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+Calc_ScSpreadsheetSettings_get_implementation(
+    css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
 {
     SolarMutexGuard aGuard;
     ScDLL::Init();
-    return static_cast<cppu::OWeakObject*>(new ScSpreadsheetSettings());
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(new ScSpreadsheetSettings()));
 }
 
-OUString ScSpreadsheetSettings::getImplementationName_Static()
-{
-    return "stardiv.StarCalc.ScSpreadsheetSettings";
-}
-
-uno::Sequence<OUString> ScSpreadsheetSettings::getSupportedServiceNames_Static()
-{
-    return { SCSPREADSHEETSETTINGS_SERVICE };
-}
 
 bool ScSpreadsheetSettings::getPropertyBool(const OUString& aPropertyName)
 {
diff --git a/sc/source/ui/unoobj/unodoc.cxx b/sc/source/ui/unoobj/unodoc.cxx
index 085d8d9595f3..7f26aa3cc6d3 100644
--- a/sc/source/ui/unoobj/unodoc.cxx
+++ b/sc/source/ui/unoobj/unodoc.cxx
@@ -29,24 +29,20 @@
 
 using namespace ::com::sun::star;
 
-OUString ScDocument_getImplementationName() throw()
-{
-    return "com.sun.star.comp.Calc.SpreadsheetDocument";
-}
-
-uno::Sequence< OUString > ScDocument_getSupportedServiceNames() throw()
-{
-    uno::Sequence<OUString> aSeq { "com.sun.star.sheet.SpreadsheetDocument" };
-    return aSeq;
-}
-
-uno::Reference< uno::XInterface > ScDocument_createInstance(
-                const uno::Reference< lang::XMultiServiceFactory > & /* rSMgr */, SfxModelFlags _nCreationFlags )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+Calc_SpreadsheetDocument_get_implementation(
+    css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const& args)
 {
     SolarMutexGuard aGuard;
     ScDLL::Init();
-    SfxObjectShell* pShell = new ScDocShell( _nCreationFlags );
-    return uno::Reference< uno::XInterface >( pShell->GetModel() );
+    css::uno::Reference<css::uno::XInterface> xInterface = sfx2::createSfxModelInstance(args,
+        [&](SfxModelFlags _nCreationFlags)
+        {
+            SfxObjectShell* pShell = new ScDocShell( _nCreationFlags );
+            return uno::Reference< uno::XInterface >( pShell->GetModel() );
+        });
+    xInterface->acquire();
+    return xInterface.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/util/sc.component b/sc/util/sc.component
index da55b90a565d..7f40cc642113 100644
--- a/sc/util/sc.component
+++ b/sc/util/sc.component
@@ -18,12 +18,13 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="sc" xmlns="http://openoffice.org/2010/uno-components">
+    xmlns="http://openoffice.org/2010/uno-components">
   <implementation name="com.sun.star.comp.Calc.FilterOptionsDialog"
       constructor="Calc_FilterOptionsDialog_get_implementation">
     <service name="com.sun.star.ui.dialogs.FilterOptionsDialog"/>
   </implementation>
-  <implementation name="com.sun.star.comp.Calc.SpreadsheetDocument">
+  <implementation name="com.sun.star.comp.Calc.SpreadsheetDocument"
+    constructor="Calc_SpreadsheetDocument_get_implementation">
     <service name="com.sun.star.sheet.SpreadsheetDocument"/>
   </implementation>
   <implementation name="com.sun.star.comp.Calc.XMLContentExporter"
@@ -42,35 +43,40 @@
       constructor="Calc_XMLOasisContentExporter_get_implementation">
     <service name="com.sun.star.comp.Calc.XMLOasisContentExporter"/>
   </implementation>
-  <implementation name="com.sun.star.comp.Calc.XMLOasisContentImporter">
+  <implementation name="com.sun.star.comp.Calc.XMLOasisContentImporter"
+    constructor="Calc_XMLOasisContentImporter_get_implementation">
     <service name="com.sun.star.comp.Calc.XMLOasisContentImporter"/>
   </implementation>
   <implementation name="com.sun.star.comp.Calc.XMLOasisExporter"
       constructor="Calc_XMLOasisExporter_get_implementation">
     <service name="com.sun.star.comp.Calc.XMLOasisExporter"/>
   </implementation>
-  <implementation name="com.sun.star.comp.Calc.XMLOasisImporter">
+  <implementation name="com.sun.star.comp.Calc.XMLOasisImporter"
+    constructor="Calc_XMLOasisImporter_get_implementation">
     <service name="com.sun.star.comp.Calc.XMLOasisImporter"/>
   </implementation>
   <implementation name="com.sun.star.comp.Calc.XMLOasisMetaExporter"
       constructor="Calc_XMLOasisMetaExporter_get_implementation">
     <service name="com.sun.star.comp.Calc.XMLOasisMetaExporter"/>
   </implementation>
-  <implementation name="com.sun.star.comp.Calc.XMLOasisMetaImporter">
+  <implementation name="com.sun.star.comp.Calc.XMLOasisMetaImporter"
+    constructor="Calc_XMLOasisMetaImporter_get_implementation">
     <service name="com.sun.star.comp.Calc.XMLOasisMetaImporter"/>
   </implementation>
   <implementation name="com.sun.star.comp.Calc.XMLOasisSettingsExporter"
       constructor="Calc_XMLOasisSettingsExporter_get_implementation">
     <service name="com.sun.star.comp.Calc.XMLOasisSettingsExporter"/>
   </implementation>
-  <implementation name="com.sun.star.comp.Calc.XMLOasisSettingsImporter">
+  <implementation name="com.sun.star.comp.Calc.XMLOasisSettingsImporter"
+    constructor="Calc_XMLOasisSettingsImporter_get_implementation">
     <service name="com.sun.star.comp.Calc.XMLOasisSettingsImporter"/>
   </implementation>
   <implementation name="com.sun.star.comp.Calc.XMLOasisStylesExporter"
       constructor="Calc_XMLOasisStylesExporter_get_implementation">
     <service name="com.sun.star.comp.Calc.XMLOasisStylesExporter"/>
   </implementation>
-  <implementation name="com.sun.star.comp.Calc.XMLOasisStylesImporter">
+  <implementation name="com.sun.star.comp.Calc.XMLOasisStylesImporter"
+    constructor="Calc_XMLOasisStylesImporter_get_implementation">
     <service name="com.sun.star.comp.Calc.XMLOasisStylesImporter"/>
   </implementation>
   <implementation name="com.sun.star.comp.Calc.XMLSettingsExporter"
@@ -97,7 +103,8 @@
       constructor="ScRecentFunctionsObj_get_implementation">
     <service name="com.sun.star.sheet.RecentFunctions"/>
   </implementation>
-  <implementation name="stardiv.StarCalc.ScSpreadsheetSettings">
+  <implementation name="stardiv.StarCalc.ScSpreadsheetSettings"
+    constructor="Calc_ScSpreadsheetSettings_get_implementation">
     <service name="com.sun.star.sheet.GlobalSheetSettings"/>
   </implementation>
   <implementation name="org.apache.openoffice.comp.sc.sidebar.ScPanelFactory"
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index b7176dfd93cd..5b08c22339ab 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -525,7 +525,6 @@ math_constructor_list = [
     ]
 
 calc_factory_list = [
-    ("libsclo.a", "sc_component_getFactory"),
     ]
 
 calc_constructor_list = [
@@ -533,6 +532,13 @@ calc_constructor_list = [
     "com_sun_star_comp_framework_SoundHandler_get_implementation",
 # sc/util/sc.component
     "ScPanelFactory_get_implementation",
+    "Calc_SpreadsheetDocument_get_implementation",
+    "Calc_XMLOasisContentImporter_get_implementation",
+    "Calc_XMLOasisImporter_get_implementation",
+    "Calc_XMLOasisMetaImporter_get_implementation",
+    "Calc_XMLOasisSettingsImporter_get_implementation",
+    "Calc_XMLOasisStylesImporter_get_implementation",
+    "Calc_ScSpreadsheetSettings_get_implementation",
 # sc/util/scd.component
     "com_sun_star_comp_calc_ExcelBiffFormatDetector_get_implementation",
     "com_sun_star_comp_calc_FormatDetector_get_implementation",
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 940fc20eaa73..9aca2c429b90 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -288,6 +288,7 @@ public:
 
     const uno::Reference< uno::XComponentContext > mxComponentContext;
     OUString implementationName;
+    css::uno::Sequence< OUString > maSupportedServiceNames;
 
     uno::Reference< embed::XStorage > mxSourceStorage;
 
@@ -296,7 +297,8 @@ public:
     std::unique_ptr< DocumentInfo > mpDocumentInfo;
 
     SvXMLImport_Impl( const uno::Reference< uno::XComponentContext >& rxContext,
-                      OUString const & theImplementationName)
+                      OUString const & theImplementationName,
+                      const css::uno::Sequence< OUString > & sSupportedServiceNames = {})
         : hBatsFontConv( nullptr )
         , hMathFontConv( nullptr )
         , mbOwnGraphicResolver( false )
@@ -307,11 +309,14 @@ public:
         , mbTextDocInOOoFileFormat( false )
         , mxComponentContext( rxContext )
         , implementationName(theImplementationName)
+        , maSupportedServiceNames(sSupportedServiceNames)
         , mpRDFaHelper() // lazy
         , mpDocumentInfo() // lazy
     {
         SAL_WARN_IF(!mxComponentContext.is(), "xmloff.core", "SvXMLImport: no ComponentContext");
         if (!mxComponentContext.is()) throw uno::RuntimeException();
+        if (!maSupportedServiceNames.hasElements())
+            maSupportedServiceNames = { "com.sun.star.document.ImportFilter", "com.sun.star.xml.XMLImportFilter" };
     }
 
     sal_uInt16 getGeneratorVersion( const SvXMLImport& rImport )
@@ -390,8 +395,10 @@ void SvXMLImport::InitCtor_()
 
 SvXMLImport::SvXMLImport(
     const css::uno::Reference< css::uno::XComponentContext >& xContext,
-    OUString const & implementationName, SvXMLImportFlags nImportFlags )
-:   mpImpl( new SvXMLImport_Impl(xContext, implementationName) ),
+    OUString const & implementationName,
+    SvXMLImportFlags nImportFlags,
+    const css::uno::Sequence< OUString > & sSupportedServiceNames )
+:   mpImpl( new SvXMLImport_Impl(xContext, implementationName, sSupportedServiceNames) ),
     mpNamespaceMap( new SvXMLNamespaceMap ),
 
     mpUnitConv( new SvXMLUnitConverter( xContext,
@@ -1150,7 +1157,7 @@ sal_Bool SAL_CALL SvXMLImport::supportsService( const OUString& rServiceName )
 
 uno::Sequence< OUString > SAL_CALL SvXMLImport::getSupportedServiceNames(  )
 {
-    return { "com.sun.star.document.ImportFilter", "com.sun.star.xml.XMLImportFilter" };
+    return mpImpl->maSupportedServiceNames;
 }
 
 XMLTextImportHelper* SvXMLImport::CreateTextImport()


More information about the Libreoffice-commits mailing list