diff options
author | Michaël Lefèvre <lefevre00@yahoo.fr> | 2015-01-26 14:46:36 +0100 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-01-28 06:21:55 +0000 |
commit | d57cd80479fac60a2486c74257a8840e36935e20 (patch) | |
tree | ba9706755777d84e95de18b35ac559c69edf94fc | |
parent | fe480d8136b204c8dc6c68916cce7e816f8b9c48 (diff) |
tdf#60739 code factorisation
Limit duplciation for SfxRequest SID_OPEN_XML_FILTERSETTINGS in sw shells
Change-Id: I316e7df50df5c6d24feb953415ebf61ca822066d
Reviewed-on: https://gerrit.libreoffice.org/14184
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | include/sfx2/shell.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/control/shell.cxx | 14 | ||||
-rw-r--r-- | sw/source/uibase/shells/annotsh.cxx | 11 | ||||
-rw-r--r-- | sw/source/uibase/shells/drawsh.cxx | 13 | ||||
-rw-r--r-- | sw/source/uibase/shells/drwtxtex.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/shells/frmsh.cxx | 12 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh1.cxx | 12 |
7 files changed, 20 insertions, 53 deletions
diff --git a/include/sfx2/shell.hxx b/include/sfx2/shell.hxx index b833ce17c335..6af0a02ede38 100644 --- a/include/sfx2/shell.hxx +++ b/include/sfx2/shell.hxx @@ -164,6 +164,7 @@ protected: SAL_DLLPRIVATE void Invalidate_Impl( SfxBindings& rBindings, sal_uInt16 nId ); SAL_DLLPRIVATE SfxShellObject* GetShellObj_Impl() const; SAL_DLLPRIVATE void SetShellObj_Impl( SfxShellObject* pObj ); + void HandleOpenXmlFilterSettings(SfxRequest &); public: TYPEINFO_OVERRIDE(); diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx index e6b40a6f4a1d..445780d93956 100644 --- a/sfx2/source/control/shell.cxx +++ b/sfx2/source/control/shell.cxx @@ -43,6 +43,7 @@ #include "statcach.hxx" #include <sfx2/msgpool.hxx> #include <sidebar/ContextChangeBroadcaster.hxx> +#include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp> #include <boost/ptr_container/ptr_map.hpp> #include <boost/ptr_container/ptr_vector.hpp> @@ -294,6 +295,19 @@ void SfxShell::Invalidate_Impl( SfxBindings& rBindings, sal_uInt16 nId ) } } +void SfxShell::HandleOpenXmlFilterSettings(SfxRequest & rReq) +{ + try + { + uno::Reference < ui::dialogs::XExecutableDialog > xDialog = ui::dialogs::XSLTFilterDialog::create( ::comphelper::getProcessComponentContext() ); + xDialog->execute(); + } + catch (const uno::Exception&) + { + } + rReq.Ignore (); +} + void SfxShell::DoActivate_Impl( SfxViewFrame *pFrame, bool bMDI ) { #ifdef DBG_UTIL diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index b41a6070f209..dea94dd5360f 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -116,7 +116,6 @@ #include "misc.hrc" #include <app.hrc> -#include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> #include <cppuhelper/bootstrap.hxx> @@ -462,15 +461,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) break; case SID_OPEN_XML_FILTERSETTINGS: { - try - { - uno::Reference < ui::dialogs::XExecutableDialog > xDialog = ui::dialogs::XSLTFilterDialog::create( ::comphelper::getProcessComponentContext() ); - xDialog->execute(); - } - catch (const uno::Exception&) - { - } - rReq.Ignore (); + HandleOpenXmlFilterSettings(rReq); } break; case FN_WORDCOUNT_DIALOG: diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx index 1b98e7bce1b8..056d7ce77469 100644 --- a/sw/source/uibase/shells/drawsh.cxx +++ b/sw/source/uibase/shells/drawsh.cxx @@ -42,9 +42,6 @@ #include <IDocumentStatistics.hxx> #include <tools/diagnose_ex.h> -#include <comphelper/processfactory.hxx> -#include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp> - #include <svx/svdoashp.hxx> #include <svx/xtable.hxx> #include <sfx2/sidebar/EnumContext.hxx> @@ -325,15 +322,7 @@ void SwDrawShell::Execute(SfxRequest &rReq) break; case SID_OPEN_XML_FILTERSETTINGS: { - try - { - uno::Reference < ui::dialogs::XExecutableDialog > xDialog = ui::dialogs::XSLTFilterDialog::create( ::comphelper::getProcessComponentContext() ); - xDialog->execute(); - } - catch (const uno::Exception&) - { - } - rReq.Ignore (); + HandleOpenXmlFilterSettings(rReq); } break; case FN_WORDCOUNT_DIALOG: diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index eb1b039f79ab..f31006202ee8 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -400,15 +400,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) break; case SID_OPEN_XML_FILTERSETTINGS: { - try - { - uno::Reference < ui::dialogs::XExecutableDialog > xDialog = ui::dialogs::XSLTFilterDialog::create( ::comphelper::getProcessComponentContext() ); - xDialog->execute(); - } - catch (const uno::Exception&) - { - } - rReq.Ignore (); + HandleOpenXmlFilterSettings(rReq); } break; case FN_WORDCOUNT_DIALOG: diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index cc6a8c805c61..6fdce9f151b1 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -67,8 +67,6 @@ #include <swwait.hxx> #include <docstat.hxx> #include <IDocumentStatistics.hxx> -#include <comphelper/processfactory.hxx> -#include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp> #include <helpid.h> #include <cmdid.h> @@ -263,15 +261,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) } case SID_OPEN_XML_FILTERSETTINGS: { - try - { - uno::Reference < ui::dialogs::XExecutableDialog > xDialog = ui::dialogs::XSLTFilterDialog::create(::comphelper::getProcessComponentContext()); - xDialog->execute(); - } - catch (const uno::Exception&) - { - } - rReq.Ignore (); + HandleOpenXmlFilterSettings(rReq); } break; case FN_WORDCOUNT_DIALOG: diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 970fad9f7658..30af9289b1e8 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -18,9 +18,7 @@ */ #include <com/sun/star/i18n/WordType.hpp> -#include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp> -#include <comphelper/processfactory.hxx> #include <hintids.hxx> #include <cmdid.h> #include <helpid.h> @@ -1321,15 +1319,7 @@ void SwTextShell::Execute(SfxRequest &rReq) break; case SID_OPEN_XML_FILTERSETTINGS: { - try - { - uno::Reference < ui::dialogs::XExecutableDialog > xDialog = ui::dialogs::XSLTFilterDialog::create( ::comphelper::getProcessComponentContext() ); - xDialog->execute(); - } - catch (const uno::Exception&) - { - } - rReq.Ignore (); + HandleOpenXmlFilterSettings(rReq); } break; case FN_FORMAT_APPLY_HEAD1: |