diff options
Diffstat (limited to 'sc/source/ui/unoobj')
-rw-r--r-- | sc/source/ui/unoobj/appluno.cxx | 94 | ||||
-rw-r--r-- | sc/source/ui/unoobj/unodoc.cxx | 26 |
2 files changed, 15 insertions, 105 deletions
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: */ |