diff options
author | Noel Grandin <noel@peralex.com> | 2013-03-05 14:58:29 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-03-07 08:23:42 +0200 |
commit | e70c068ba413564067f17107b0773910ced760d1 (patch) | |
tree | ababedc2d118cfb1c404833a198be1bda540fbd6 /sfx2 | |
parent | 30caf94d816dfcf9a5bc8cb5198c977d7021c369 (diff) |
fdo#46808, Convert text:: and drawing:: ModuleDispatcher service to new style
The services already existing, just needed to create the IDL files
Change-Id: Ifedd46722ba0bae2985e82d18827c61c1d12cd62
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/appserv.cxx | 64 |
1 files changed, 26 insertions, 38 deletions
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 55d74f354adb..1fb305a28d71 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -18,6 +18,7 @@ */ #include <com/sun/star/document/XEmbeddedScripts.hpp> +#include <com/sun/star/drawing/ModuleDispatcher.hpp> #include <com/sun/star/embed/XStorage.hpp> #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/frame/Desktop.hpp> @@ -34,6 +35,7 @@ #include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <com/sun/star/system/SystemShellExecuteException.hpp> #include <com/sun/star/task/XJobExecutor.hpp> +#include <com/sun/star/text/ModuleDispatcher.hpp> #include <com/sun/star/ui/dialogs/AddressBookSourcePilot.hpp> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/util/XCloseable.hpp> @@ -1376,26 +1378,19 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) return; } - Reference< com::sun::star::lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory(); Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - Reference< com::sun::star::frame::XDispatchProvider > xProv( - xORB->createInstance( ::rtl::OUString("com.sun.star.drawing.ModuleDispatcher")), UNO_QUERY ); - - if ( xProv.is() ) - { - ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() ); - Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) ); - Sequence < com::sun::star::beans::PropertyValue > aSeq; - if ( rReq.GetArgs() ) - TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq ); - Any aResult = xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aSeq ); - ::com::sun::star::frame::DispatchResultEvent aEvent; - sal_Bool bSuccess = ( - (aResult >>= aEvent) && - (aEvent.State == ::com::sun::star::frame::DispatchResultState::SUCCESS) - ); - rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) ); - } + Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext ); + + ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() ); + Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) ); + Sequence < beans::PropertyValue > aSeq; + if ( rReq.GetArgs() ) + TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq ); + Any aResult = xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aSeq ); + frame::DispatchResultEvent aEvent; + sal_Bool bSuccess = (aResult >>= aEvent) && + (aEvent.State == frame::DispatchResultState::SUCCESS); + rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) ); } break; @@ -1403,26 +1398,19 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) case FN_BUSINESS_CARD : case FN_XFORMS_INIT : { - Reference< com::sun::star::lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory(); Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - Reference< com::sun::star::frame::XDispatchProvider > xProv( - xORB->createInstance( ::rtl::OUString("com.sun.star.text.ModuleDispatcher")), UNO_QUERY ); - - if ( xProv.is() ) - { - ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() ); - Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) ); - Sequence < com::sun::star::beans::PropertyValue > aSeq; - if ( rReq.GetArgs() ) - TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq ); - Any aResult = xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aSeq ); - ::com::sun::star::frame::DispatchResultEvent aEvent; - sal_Bool bSuccess = ( - (aResult >>= aEvent) && - (aEvent.State == ::com::sun::star::frame::DispatchResultState::SUCCESS) - ); - rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) ); - } + Reference< frame::XDispatchProvider > xProv = text::ModuleDispatcher::create( xContext ); + + ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() ); + Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) ); + Sequence < beans::PropertyValue > aSeq; + if ( rReq.GetArgs() ) + TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq ); + Any aResult = xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aSeq ); + frame::DispatchResultEvent aEvent; + sal_Bool bSuccess = (aResult >>= aEvent) && + (aEvent.State == frame::DispatchResultState::SUCCESS); + rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) ); } break; |