diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-08 18:10:34 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-16 10:24:53 +0100 |
commit | 881c3dfaef958476c353b44ed5e9fbf123a94512 (patch) | |
tree | fbfe9113fca1d1d13f9653747d45105e6e7e4e30 /svtools | |
parent | 67bb39e3809ef4921eca427adcba2e05d3d2a2c3 (diff) |
svt: Use constructor feature for OAddressBookSourceDialogUno.
Change-Id: Ie046b43f40bd704090bbca4d14ea5321ff7639d9
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/Library_svt.mk | 1 | ||||
-rw-r--r-- | svtools/source/uno/addrtempuno.cxx | 65 | ||||
-rw-r--r-- | svtools/source/uno/miscservices.cxx | 84 | ||||
-rw-r--r-- | svtools/util/svt.component | 5 |
4 files changed, 21 insertions, 134 deletions
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 47628080b2c3..4690961c25de 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -230,7 +230,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/uno/framestatuslistener \ svtools/source/uno/generictoolboxcontroller \ svtools/source/uno/genericunodialog \ - svtools/source/uno/miscservices \ svtools/source/uno/popupmenucontrollerbase \ svtools/source/uno/popupwindowcontroller \ svtools/source/uno/statusbarcontroller \ diff --git a/svtools/source/uno/addrtempuno.cxx b/svtools/source/uno/addrtempuno.cxx index 1bea46d4ce3c..73b2c18ec010 100644 --- a/svtools/source/uno/addrtempuno.cxx +++ b/svtools/source/uno/addrtempuno.cxx @@ -17,18 +17,18 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "svtools/genericunodialog.hxx" #include <svtools/addresstemplate.hxx> +#include <svtools/genericunodialog.hxx> #include <comphelper/extract.hxx> #include <cppuhelper/typeprovider.hxx> #include <comphelper/property.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/sdbc/XDataSource.hpp> +#include <rtl/ref.hxx> -// ....................................................................... -namespace svt -{ -// ....................................................................... +using namespace svt; + +namespace { #define UNODIALOG_PROPERTY_ID_ALIASES 100 #define UNODIALOG_PROPERTY_ALIASES "FieldMapping" @@ -39,24 +39,20 @@ namespace svt using namespace com::sun::star::beans; using namespace com::sun::star::sdbc; - //========================================================================= - //= OAddressBookSourceDialogUno - //========================================================================= typedef OGenericUnoDialog OAddressBookSourceDialogUnoBase; class OAddressBookSourceDialogUno :public OAddressBookSourceDialogUnoBase ,public ::comphelper::OPropertyArrayUsageHelper< OAddressBookSourceDialogUno > { - protected: + private: Sequence< AliasProgrammaticPair > m_aAliases; Reference< XDataSource > m_xDataSource; OUString m_sDataSourceName; OUString m_sTable; - protected: + public: OAddressBookSourceDialogUno(const Reference< XComponentContext >& _rxORB); - public: // XTypeProvider virtual Sequence<sal_Int8> SAL_CALL getImplementationId( ) throw(RuntimeException); @@ -64,12 +60,6 @@ namespace svt virtual OUString SAL_CALL getImplementationName() throw(RuntimeException); virtual ::comphelper::StringSequence SAL_CALL getSupportedServiceNames() throw(RuntimeException); - // XServiceInfo - static methods - static Sequence< OUString > getSupportedServiceNames_Static(void) throw( RuntimeException ); - static OUString getImplementationName_Static(void) throw( RuntimeException ); - static Reference< XInterface > - SAL_CALL Create(const Reference< com::sun::star::lang::XMultiServiceFactory >&); - // XPropertySet virtual Reference< XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(RuntimeException); virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); @@ -88,15 +78,6 @@ namespace svt virtual void executedDialog(sal_Int16 _nExecutionResult); }; - - //========================================================================= - //= OAddressBookSourceDialogUno - //========================================================================= - Reference< XInterface > SAL_CALL OAddressBookSourceDialogUno_CreateInstance( const Reference< XMultiServiceFactory >& _rxFactory) - { - return OAddressBookSourceDialogUno::Create(_rxFactory); - } - //------------------------------------------------------------------------- OAddressBookSourceDialogUno::OAddressBookSourceDialogUno(const Reference< XComponentContext >& _rxORB) :OGenericUnoDialog(_rxORB) @@ -113,32 +94,14 @@ namespace svt } //------------------------------------------------------------------------- - Reference< XInterface > SAL_CALL OAddressBookSourceDialogUno::Create(const Reference< XMultiServiceFactory >& _rxFactory) - { - return *(new OAddressBookSourceDialogUno( comphelper::getComponentContext(_rxFactory))); - } - - //------------------------------------------------------------------------- OUString SAL_CALL OAddressBookSourceDialogUno::getImplementationName() throw(RuntimeException) { - return getImplementationName_Static(); - } - - //------------------------------------------------------------------------- - OUString OAddressBookSourceDialogUno::getImplementationName_Static() throw(RuntimeException) - { return OUString( "com.sun.star.comp.svtools.OAddressBookSourceDialogUno" ); } //------------------------------------------------------------------------- ::comphelper::StringSequence SAL_CALL OAddressBookSourceDialogUno::getSupportedServiceNames() throw(RuntimeException) { - return getSupportedServiceNames_Static(); - } - - //------------------------------------------------------------------------- - ::comphelper::StringSequence OAddressBookSourceDialogUno::getSupportedServiceNames_Static() throw(RuntimeException) - { ::comphelper::StringSequence aSupported(1); aSupported.getArray()[0] = "com.sun.star.ui.AddressBookSourceDialog"; return aSupported; @@ -258,8 +221,16 @@ namespace svt return new AddressBookSourceDialog( _pParent, m_aContext ); } -// ....................................................................... -} // namespace svt -// ....................................................................... +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_svtools_OAddressBookSourceDialogUno_get_implementation( + css::uno::XComponentContext * context, + css::uno::Sequence<css::uno::Any> const &) +{ + rtl::Reference<OAddressBookSourceDialogUno> x(new OAddressBookSourceDialogUno(context)); + x->acquire(); + return static_cast<cppu::OWeakObject *>(x.get()); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx deleted file mode 100644 index 2a9671941951..000000000000 --- a/svtools/source/uno/miscservices.cxx +++ /dev/null @@ -1,84 +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 "sal/types.h" -#include "rtl/ustring.hxx" -#include <cppuhelper/factory.hxx> -#include <cppuhelper/weak.hxx> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/registry/XRegistryKey.hpp> -#include <osl/diagnose.h> -#include <uno/mapping.hxx> -#include "hatchwindow.hxx" - -#include "comphelper/servicedecl.hxx" - -#include "cppuhelper/implementationentry.hxx" - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::registry; -using namespace ::com::sun::star::lang; - -// for CreateInstance functions implemented elsewhere, while the function is within a namespace -#define DECLARE_CREATEINSTANCE_NAMESPACE( nmspe, ImplName ) \ - namespace nmspe { \ - Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); \ - } - -DECLARE_CREATEINSTANCE_NAMESPACE( svt, OAddressBookSourceDialogUno ) - -extern "C" -{ - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL svt_component_getFactory ( - const sal_Char * pImplementationName, void * _pServiceManager, void * ) -{ - void * pResult = 0; - if ( _pServiceManager ) - { - Reference< XMultiServiceFactory > xSMgr(reinterpret_cast< XMultiServiceFactory * >( _pServiceManager ) ); - - Reference< XSingleServiceFactory > xFactory; - if (rtl_str_compare ( - pImplementationName, "com.sun.star.comp.svtools.OAddressBookSourceDialogUno") == 0) - { - Sequence< OUString > aServiceNames(1); - aServiceNames.getArray()[0] = - OUString( "com.sun.star.ui.AddressBookSourceDialog" ); - - xFactory = ::cppu::createSingleFactory (xSMgr, - OUString::createFromAscii( pImplementationName ), - svt::OAddressBookSourceDialogUno_CreateInstance, - aServiceNames); - } - - if ( xFactory.is() ) - { - xFactory->acquire(); - pResult = xFactory.get(); - } - } - return pResult; -} - -} // "C" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/util/svt.component b/svtools/util/svt.component index ccb0dff116d8..5e5438ef7a07 100644 --- a/svtools/util/svt.component +++ b/svtools/util/svt.component @@ -18,7 +18,7 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="svt" xmlns="http://openoffice.org/2010/uno-components"> + xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.graphic.GraphicProvider" constructor="com_sun_star_comp_graphic_GraphicProvider_get_implementation"> <service name="com.sun.star.graphic.GraphicProvider"/> @@ -27,7 +27,8 @@ constructor="com_sun_star_comp_graphic_GraphicRendererVCL_get_implementation"> <service name="com.sun.star.graphic.GraphicRendererVCL"/> </implementation> - <implementation name="com.sun.star.comp.svtools.OAddressBookSourceDialogUno"> + <implementation name="com.sun.star.comp.svtools.OAddressBookSourceDialogUno" + constructor="com_sun_star_comp_svtools_OAddressBookSourceDialogUno_get_implementation"> <service name="com.sun.star.ui.AddressBookSourceDialog"/> </implementation> <implementation name="com.sun.star.comp.svtools.uno.Wizard" |