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/source/helper | |
parent | b7e51c20770c99e43162c366ff665f8df1da732e (diff) |
tk: Constructor feature for last tk_ implementations.
Change-Id: I55fee30e64cdb591d73cfcadfd7a9efb10485ba9
Diffstat (limited to 'toolkit/source/helper')
-rw-r--r-- | toolkit/source/helper/registerservices.cxx | 126 |
1 files changed, 0 insertions, 126 deletions
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: */ |