diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-24 11:29:54 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-24 12:21:25 +0100 |
commit | e515b8b1217cb60046738573742cd38aca4c8499 (patch) | |
tree | 34c30303bee059fa818e4afbf6d6a28154690a43 /toolkit | |
parent | b7e51c20770c99e43162c366ff665f8df1da732e (diff) |
tk: Constructor feature for last tk_ implementations.
Change-Id: I55fee30e64cdb591d73cfcadfd7a9efb10485ba9
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/Library_tk.mk | 1 | ||||
-rw-r--r-- | toolkit/source/controls/formattedcontrol.cxx | 16 | ||||
-rw-r--r-- | toolkit/source/helper/registerservices.cxx | 126 | ||||
-rw-r--r-- | toolkit/util/tk.component | 8 |
4 files changed, 21 insertions, 130 deletions
diff --git a/toolkit/Library_tk.mk b/toolkit/Library_tk.mk index 14d84eef0ab2..0fca5542278c 100644 --- a/toolkit/Library_tk.mk +++ b/toolkit/Library_tk.mk @@ -105,7 +105,6 @@ $(eval $(call gb_Library_add_exception_objects,tk,\ toolkit/source/helper/imagealign \ toolkit/source/helper/listenermultiplexer \ toolkit/source/helper/property \ - toolkit/source/helper/registerservices \ toolkit/source/helper/servicenames \ toolkit/source/helper/tkresmgr \ toolkit/source/helper/unopropertyarrayhelper \ diff --git a/toolkit/source/controls/formattedcontrol.cxx b/toolkit/source/controls/formattedcontrol.cxx index 9aa143b54560..57d1d0e7f0df 100644 --- a/toolkit/source/controls/formattedcontrol.cxx +++ b/toolkit/source/controls/formattedcontrol.cxx @@ -456,4 +456,20 @@ namespace toolkit } // namespace toolkit //........................................................................ +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +stardiv_Toolkit_UnoControlFormattedFieldModel_get_implementation( + css::uno::XComponentContext *context, + css::uno::Sequence<css::uno::Any> const &) +{ + return cppu::acquire(new toolkit::UnoControlFormattedFieldModel(context)); +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +stardiv_Toolkit_UnoFormattedFieldControl_get_implementation( + css::uno::XComponentContext *, + css::uno::Sequence<css::uno::Any> const &) +{ + return cppu::acquire(new toolkit::UnoFormattedFieldControl()); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx deleted file mode 100644 index a3a805a5cbfd..000000000000 --- a/toolkit/source/helper/registerservices.cxx +++ /dev/null @@ -1,126 +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/XSingleServiceFactory.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/registry/XRegistryKey.hpp> -#include <toolkit/controls/geometrycontrolmodel.hxx> -#include <comphelper/processfactory.hxx> -#include <cppuhelper/factory.hxx> -#include <cppuhelper/weak.hxx> -#include <osl/mutex.hxx> -#include <toolkit/helper/servicenames.hxx> -#include <toolkit/helper/macros.hxx> -#include <toolkit/awt/vclxmenu.hxx> -#include <toolkit/awt/vclxpointer.hxx> -#include <toolkit/awt/vclxprinter.hxx> -#include <toolkit/controls/dialogcontrol.hxx> -#include <toolkit/controls/unocontrolcontainer.hxx> -#include <toolkit/controls/unocontrolcontainermodel.hxx> -#include <toolkit/controls/stdtabcontroller.hxx> -#include <toolkit/controls/stdtabcontrollermodel.hxx> -#include <toolkit/controls/formattedcontrol.hxx> -#include <toolkit/controls/roadmapcontrol.hxx> -#include <toolkit/controls/tkscrollbar.hxx> -#include "toolkit/dllapi.h" -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> - -namespace toolkit -{ - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::registry; - - //......................................................................... - void* tryCreateFactory( const sal_Char* _pRequiredImplName, const sal_Char* _pComponentImplName, - const sal_Char* _pAsciiServiceName1, const sal_Char* _pAsciiServiceName2, - ::cppu::ComponentInstantiation _pInstantiation, const Reference< XMultiServiceFactory >& _rxServiceFactory ) - { - void* pReturn = NULL; - - if ( rtl_str_compare( _pRequiredImplName, _pComponentImplName ) == 0 ) - { - Sequence< OUString > aServiceNames( _pAsciiServiceName2 ? 2 : 1 ); - aServiceNames.getArray()[ 0 ] = OUString::createFromAscii( _pAsciiServiceName1 ); - if ( _pAsciiServiceName2 ) - aServiceNames.getArray()[ 1 ] = OUString::createFromAscii( _pAsciiServiceName2 ); - Reference< XSingleServiceFactory > xFactory( ::cppu::createSingleFactory( - _rxServiceFactory, OUString::createFromAscii( _pComponentImplName ), - _pInstantiation, aServiceNames - ) ); - if ( xFactory.is() ) - { - xFactory->acquire(); - pReturn = xFactory.get(); - } - } - - return pReturn; - } - - -} - -#define IMPL_CREATEINSTANCE( ImplName ) \ - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ) \ - { return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ImplName ); } - -#define IMPL_CREATEINSTANCE_CTX( ImplName ) \ - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ) \ - { return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ImplName( comphelper::getComponentContext(i_factory) ) ); } - -#define GET_FACTORY_WITH_IMPL_PREFIX( ClassName, ImplNamePrefix, ServiceName1, ServiceName2 ) \ - pRet = tryCreateFactory( sImplementationName, ImplNamePrefix "." #ClassName, \ - ServiceName1, ServiceName2, \ - ClassName##_CreateInstance, xServiceFactory \ - ); \ - if ( pRet ) \ - return pRet; \ - -#define GET_FACTORY( ImplName, ServiceName1, ServiceName2 ) \ - GET_FACTORY_WITH_IMPL_PREFIX( ImplName, "stardiv.Toolkit", ServiceName1, ServiceName2 ) - -using namespace toolkit; - -IMPL_CREATEINSTANCE_CTX( UnoControlFormattedFieldModel ) -IMPL_CREATEINSTANCE( UnoFormattedFieldControl ) - -extern "C" -{ - -TOOLKIT_DLLPUBLIC void* SAL_CALL tk_component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* ) -{ - - void* pRet = NULL; - - if ( _pServiceManager ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory = - static_cast< ::com::sun::star::lang::XMultiServiceFactory* >( _pServiceManager ); - GET_FACTORY( UnoFormattedFieldControl, szServiceName_UnoControlFormattedField, szServiceName2_UnoControlFormattedField ) - GET_FACTORY( UnoControlFormattedFieldModel, szServiceName_UnoControlFormattedFieldModel, szServiceName2_UnoControlFormattedFieldModel ) - } - return pRet; -} -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/util/tk.component b/toolkit/util/tk.component index 1d34d5e66481..c7b1d4f51c7c 100644 --- a/toolkit/util/tk.component +++ b/toolkit/util/tk.component @@ -18,7 +18,7 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="tk" xmlns="http://openoffice.org/2010/uno-components"> + xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.awt.comp.AsyncCallback" constructor="com_sun_star_awt_comp_AsyncCallback_get_implementation"> <service name="com.sun.star.awt.AsyncCallback"/> @@ -168,7 +168,8 @@ <service name="com.sun.star.awt.UnoControlFixedTextModel"/> <service name="stardiv.vcl.controlmodel.FixedText"/> </implementation> - <implementation name="stardiv.Toolkit.UnoControlFormattedFieldModel"> + <implementation name="stardiv.Toolkit.UnoControlFormattedFieldModel" + constructor="stardiv_Toolkit_UnoControlFormattedFieldModel_get_implementation"> <service name="com.sun.star.awt.UnoControlFormattedFieldModel"/> <service name="stardiv.vcl.controlmodel.FormattedField"/> </implementation> @@ -263,7 +264,8 @@ <service name="com.sun.star.awt.UnoControlFixedText"/> <service name="stardiv.vcl.control.FixedText"/> </implementation> - <implementation name="stardiv.Toolkit.UnoFormattedFieldControl"> + <implementation name="stardiv.Toolkit.UnoFormattedFieldControl" + constructor="stardiv_Toolkit_UnoFormattedFieldControl_get_implementation"> <service name="com.sun.star.awt.UnoControlFormattedField"/> <service name="stardiv.vcl.control.FormattedField"/> </implementation> |