diff options
-rw-r--r-- | extensions/source/abpilot/fieldmappingimpl.cxx | 42 | ||||
-rw-r--r-- | extensions/source/abpilot/fieldmappingimpl.hxx | 2 | ||||
-rw-r--r-- | extensions/source/abpilot/fieldmappingpage.cxx | 3 | ||||
-rw-r--r-- | offapi/UnoApi_offapi.mk | 1 | ||||
-rw-r--r-- | offapi/com/sun/star/ui/AddressBookSourceDialog.idl | 51 | ||||
-rw-r--r-- | svtools/source/uno/addrtempuno.cxx | 29 |
6 files changed, 95 insertions, 33 deletions
diff --git a/extensions/source/abpilot/fieldmappingimpl.cxx b/extensions/source/abpilot/fieldmappingimpl.cxx index e4e20f84dbd2..c872943400d6 100644 --- a/extensions/source/abpilot/fieldmappingimpl.cxx +++ b/extensions/source/abpilot/fieldmappingimpl.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> +#include <com/sun/star/ui/AddressBookSourceDialog.hpp> #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/sdb/CommandType.hpp> #include <tools/debug.hxx> @@ -45,6 +46,7 @@ namespace abp using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::sdb; + using namespace ::com::sun::star::ui; using namespace ::com::sun::star::ui::dialogs; //--------------------------------------------------------------------- @@ -67,7 +69,7 @@ namespace abp //..................................................................... //----------------------------------------------------------------- - sal_Bool invokeDialog( const Reference< XMultiServiceFactory >& _rxORB, class Window* _pParent, + sal_Bool invokeDialog( const Reference< XComponentContext >& _rxORB, class Window* _pParent, const Reference< XPropertySet >& _rxDataSource, AddressSettings& _rSettings ) SAL_THROW ( ( ) ) { _rSettings.aFieldMapping.clear(); @@ -80,37 +82,17 @@ namespace abp try { // ........................................................ - // the parameters for creating the dialog - Sequence< Any > aArguments(5); - Any* pArguments = aArguments.getArray(); - - // the parent window + // create an instance of the dialog service Reference< XWindow > xDialogParent = VCLUnoHelper::GetInterface( _pParent ); - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )), -1, makeAny( xDialogParent ), PropertyState_DIRECT_VALUE); - - // the data source to use - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DataSource" )), -1, makeAny( _rxDataSource ), PropertyState_DIRECT_VALUE); - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DataSourceName" )), -1, makeAny( (sal_Bool)_rSettings.bRegisterDataSource ? _rSettings.sRegisteredDataSourceName : _rSettings.sDataSourceName ), PropertyState_DIRECT_VALUE); - - // the table to use - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Command" )), -1, makeAny( _rSettings.sSelectedTable ), PropertyState_DIRECT_VALUE); - - // the title ::rtl::OUString sTitle = String( ModuleRes( RID_STR_FIELDDIALOGTITLE ) ); - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Title" )), -1, makeAny( sTitle ), PropertyState_DIRECT_VALUE); - - // ........................................................ - // create an instance of the dialog service - static ::rtl::OUString s_sAdressBookFieldAssignmentServiceName(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.AddressBookSourceDialog" )); - Reference< XExecutableDialog > xDialog( - _rxORB->createInstanceWithArguments( s_sAdressBookFieldAssignmentServiceName, aArguments ), - UNO_QUERY - ); - if ( !xDialog.is( ) ) - { - ShowServiceNotAvailableError( _pParent, s_sAdressBookFieldAssignmentServiceName, sal_True ); - return sal_False; - } + Reference< XExecutableDialog > xDialog = AddressBookSourceDialog::createWithDataSource(_rxORB, + // the parent window + xDialogParent, + _rxDataSource, + (sal_Bool)_rSettings.bRegisterDataSource ? _rSettings.sRegisteredDataSourceName : _rSettings.sDataSourceName, + // the table to use + _rSettings.sSelectedTable, + sTitle); // execute the dialog if ( xDialog->execute() ) diff --git a/extensions/source/abpilot/fieldmappingimpl.hxx b/extensions/source/abpilot/fieldmappingimpl.hxx index ffafaec1ac29..f3fb6af4f2b9 100644 --- a/extensions/source/abpilot/fieldmappingimpl.hxx +++ b/extensions/source/abpilot/fieldmappingimpl.hxx @@ -60,7 +60,7 @@ namespace abp field mapping dialog. */ sal_Bool invokeDialog( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB, class Window* _pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDataSource, AddressSettings& _rSettings diff --git a/extensions/source/abpilot/fieldmappingpage.cxx b/extensions/source/abpilot/fieldmappingpage.cxx index 60716a7e1d05..1e2077c36e71 100644 --- a/extensions/source/abpilot/fieldmappingpage.cxx +++ b/extensions/source/abpilot/fieldmappingpage.cxx @@ -21,6 +21,7 @@ #include "fieldmappingimpl.hxx" #include "addresssettings.hxx" #include "abspilot.hxx" +#include <comphelper/processfactory.hxx> //......................................................................... namespace abp @@ -91,7 +92,7 @@ namespace abp AddressSettings& rSettings = getSettings(); // invoke the dialog doing the mapping - if ( fieldmapping::invokeDialog( getORB(), this, getDialog()->getDataSource().getDataSource(), rSettings ) ) + if ( fieldmapping::invokeDialog( comphelper::getComponentContext(getORB()), this, getDialog()->getDataSource().getDataSource(), rSettings ) ) { if ( rSettings.aFieldMapping.size() ) getDialog()->travelNext(); diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 61c5da08925c..da456f444b9b 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -309,6 +309,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ucb,\ UniversalContentBroker \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ui,\ + AddressBookSourceDialog \ GlobalAcceleratorConfiguration \ ModuleUIConfigurationManagerSupplier \ UIElementFactoryManager \ diff --git a/offapi/com/sun/star/ui/AddressBookSourceDialog.idl b/offapi/com/sun/star/ui/AddressBookSourceDialog.idl new file mode 100644 index 000000000000..b986f3113c78 --- /dev/null +++ b/offapi/com/sun/star/ui/AddressBookSourceDialog.idl @@ -0,0 +1,51 @@ +/* -*- 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 . + */ + +#ifndef __com_sun_star_ui_AddressBookSourceDialog_idl__ +#define __com_sun_star_ui_AddressBookSourceDialog_idl__ + +#include <com/sun/star/ui/dialogs/XExecutableDialog.idl> +#include <com/sun/star/awt/XWindow.idl> +#include <com/sun/star/beans/XPropertySet.idl> + + +module com { module sun { module star { module ui { + + +/** This interface could be incomplete since I derived it from its places of use. + + @since LibreOffice 4.1 +*/ + +service AddressBookSourceDialog : com::sun::star::ui::dialogs::XExecutableDialog +{ + + createWithDataSource([in] com::sun::star::awt::XWindow ParentWindow, + [in] com::sun::star::beans::XPropertySet DataSource, + [in] string DataSourceName, + [in] string Command, + [in] string Title); +}; + +}; }; }; }; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/addrtempuno.cxx b/svtools/source/uno/addrtempuno.cxx index 2287b12b65bb..25e1dd89ab1e 100644 --- a/svtools/source/uno/addrtempuno.cxx +++ b/svtools/source/uno/addrtempuno.cxx @@ -76,6 +76,8 @@ namespace svt // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + void initialize(const Sequence< Any >& aArguments) throw(RuntimeException); + protected: // OGenericUnoDialog overridables virtual Dialog* createDialog(Window* _pParent); @@ -171,7 +173,32 @@ namespace svt if ( m_pDialog ) static_cast< AddressBookSourceDialog* >( m_pDialog )->getFieldMapping( m_aAliases ); } - + //------------------------------------------------------------------------------ + void OAddressBookSourceDialogUno::initialize(const Sequence< Any >& aArguments) throw(RuntimeException) + { + if( aArguments.getLength() == 5 ) + { + Reference<com::sun::star::awt::XWindow> xParentWindow; + Reference<com::sun::star::beans::XPropertySet> xDataSource; + rtl::OUString sDataSourceName; + rtl::OUString sCommand; + rtl::OUString sTitle; + if ( (aArguments[0] >>= xParentWindow) + && (aArguments[1] >>= xDataSource) + && (aArguments[2] >>= sDataSourceName) + && (aArguments[3] >>= sCommand) + && (aArguments[4] >>= sTitle) ) + { + setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ) ), makeAny( xParentWindow ) ); + setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataSource" ) ), makeAny( xDataSource ) ); + setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataSourceName" ) ), makeAny( sDataSourceName ) ); + setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Command" ) ), makeAny( sCommand ) ); + setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ), makeAny( sTitle ) ); + return; + } + } + OGenericUnoDialog::initialize(aArguments); + } //------------------------------------------------------------------------------ void OAddressBookSourceDialogUno::implInitialize(const com::sun::star::uno::Any& _rValue) { |