diff options
-rw-r--r-- | basctl/Library_basctl.mk | 1 | ||||
-rw-r--r-- | basctl/source/basicide/register.cxx | 76 | ||||
-rw-r--r-- | basctl/source/basicide/unomodel.cxx | 32 | ||||
-rw-r--r-- | basctl/source/basicide/unomodel.hxx | 7 | ||||
-rw-r--r-- | basctl/util/basctl.component | 5 |
5 files changed, 16 insertions, 105 deletions
diff --git a/basctl/Library_basctl.mk b/basctl/Library_basctl.mk index c28907a0cd56..98f04c83e31c 100644 --- a/basctl/Library_basctl.mk +++ b/basctl/Library_basctl.mk @@ -94,7 +94,6 @@ $(eval $(call gb_Library_add_exception_objects,basctl,\ basctl/source/basicide/moduldl2 \ basctl/source/basicide/moduldlg \ basctl/source/basicide/ObjectCatalog \ - basctl/source/basicide/register \ basctl/source/basicide/sbxitem \ basctl/source/basicide/scriptdocument \ basctl/source/basicide/uiobject \ diff --git a/basctl/source/basicide/register.cxx b/basctl/source/basicide/register.cxx deleted file mode 100644 index c73c97eeadf8..000000000000 --- a/basctl/source/basicide/register.cxx +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> - -#include <cppuhelper/factory.hxx> - -#include "unomodel.hxx" - -namespace basctl -{ - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; - -extern "C" { - -SAL_DLLPUBLIC_EXPORT void* basctl_component_getFactory( const char* pImplementationName, - void* pServiceManager, - void* ) -{ - // Set default return value for this operation - if it failed. - void* pReturn = nullptr ; - - if ( - ( pImplementationName != nullptr ) && - ( pServiceManager != nullptr ) - ) - { - // Define variables which are used in following macros. - Reference< XSingleServiceFactory > xFactory ; - Reference< XMultiServiceFactory > xServiceManager( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ; - - if( SIDEModel::getImplementationName_Static().equalsAscii( pImplementationName ) ) - { - xFactory = ::cppu::createSingleFactory( xServiceManager, - SIDEModel::getImplementationName_Static(), - SIDEModel_createInstance, - SIDEModel::getSupportedServiceNames_Static() ); - } - - // Factory is valid - service was found. - if ( xFactory.is() ) - { - xFactory->acquire(); - pReturn = xFactory.get(); - } - } - - // Return with result of this operation. - return pReturn ; -} - -} // extern "C" - -} // namespace basctl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/unomodel.cxx b/basctl/source/basicide/unomodel.cxx index 8c559cccb5b2..f22634935fcc 100644 --- a/basctl/source/basicide/unomodel.cxx +++ b/basctl/source/basicide/unomodel.cxx @@ -80,11 +80,6 @@ uno::Sequence< uno::Type > SAL_CALL SIDEModel::getTypes( ) OUString SIDEModel::getImplementationName() { - return getImplementationName_Static(); -} - -OUString SIDEModel::getImplementationName_Static() -{ return "com.sun.star.comp.basic.BasicIDE"; } @@ -92,25 +87,12 @@ sal_Bool SIDEModel::supportsService(const OUString& rServiceName) { return cppu::supportsService(this, rServiceName); } -uno::Sequence< OUString > SIDEModel::getSupportedServiceNames() -{ - return getSupportedServiceNames_Static(); -} -uno::Sequence< OUString > SIDEModel::getSupportedServiceNames_Static() +uno::Sequence< OUString > SIDEModel::getSupportedServiceNames() { return { "com.sun.star.script.BasicIDE" }; } -uno::Reference< uno::XInterface > SIDEModel_createInstance( - const uno::Reference< lang::XMultiServiceFactory > & ) -{ - SolarMutexGuard aGuard; - EnsureIde(); - SfxObjectShell* pShell = new DocShell(); - return uno::Reference< uno::XInterface >( pShell->GetModel() ); -} - // XStorable void SAL_CALL SIDEModel::store() { @@ -135,4 +117,16 @@ void SIDEModel::notImplemented() } // namespace basctl +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +com_sun_star_comp_basic_BasicID_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) +{ + SolarMutexGuard aGuard; + basctl::EnsureIde(); + SfxObjectShell* pShell = new basctl::DocShell(); + auto pModel = pShell->GetModel(); + pModel->acquire(); + return pModel.get(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/unomodel.hxx b/basctl/source/basicide/unomodel.hxx index aab2481c2b36..47094fa2a854 100644 --- a/basctl/source/basicide/unomodel.hxx +++ b/basctl/source/basicide/unomodel.hxx @@ -54,15 +54,8 @@ public: const css::uno::Sequence< css::beans::PropertyValue >& seqArguments ) override; virtual void SAL_CALL storeToURL( const OUString& sURL, const css::uno::Sequence< css::beans::PropertyValue >& seqArguments ) override; - - static css::uno::Sequence< OUString > getSupportedServiceNames_Static(); - static OUString getImplementationName_Static(); }; -/// @throws com::sun::star::uno::Exception -css::uno::Reference< css::uno::XInterface > SIDEModel_createInstance( - const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr ); - } // namespace basctl /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/util/basctl.component b/basctl/util/basctl.component index 772cd0e5a300..3b1c169e73c1 100644 --- a/basctl/util/basctl.component +++ b/basctl/util/basctl.component @@ -18,8 +18,9 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="basctl" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.basic.BasicIDE"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.basic.BasicIDE" + constructor="com_sun_star_comp_basic_BasicID_get_implementation"> <service name="com.sun.star.script.BasicIDE"/> </implementation> </component> |