From 71c49bcfa0677f013684030defbf5ead21695d85 Mon Sep 17 00:00:00 2001 From: Michaël Lefèvre Date: Tue, 3 Feb 2015 22:18:17 +0100 Subject: tdf#60739 code factorisation Limit duplication for SfxRequest FN_NUMBERING_OUTLINE_DLG in sw shells Change-Id: Ibbf58480232f3b393d13548508b7cdbc98690847 Reviewed-on: https://gerrit.libreoffice.org/14313 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sw/source/uibase/inc/view.hxx | 1 + sw/source/uibase/shells/annotsh.cxx | 9 +-------- sw/source/uibase/shells/drawsh.cxx | 9 +-------- sw/source/uibase/shells/drwtxtex.cxx | 9 +-------- sw/source/uibase/shells/frmsh.cxx | 9 +-------- sw/source/uibase/shells/textsh1.cxx | 9 +-------- sw/source/uibase/uiview/view0.cxx | 13 +++++++++++++ 7 files changed, 19 insertions(+), 40 deletions(-) diff --git a/sw/source/uibase/inc/view.hxx b/sw/source/uibase/inc/view.hxx index 81d2a9ffe1ba..3301a19e9a96 100644 --- a/sw/source/uibase/inc/view.hxx +++ b/sw/source/uibase/inc/view.hxx @@ -546,6 +546,7 @@ public: void StateStatusLine(SfxItemSet&); void UpdateWordCount(SfxShell*, sal_uInt16); void ExecFormatFootnote(); + void ExecNumberingOutline(SfxItemPool &); // functions for drawing void SetDrawFuncPtr(SwDrawBase* pFuncPtr); diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index 28ce00665db0..f00737290dd4 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -441,14 +441,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) } case FN_NUMBERING_OUTLINE_DLG: { - SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1); - SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "Dialog creation failed!"); - boost::scoped_ptr pDlg(pFact->CreateSwTabDialog( DLG_TAB_OUTLINE, - rView.GetWindow(), &aTmp, rView.GetWrtShell())); - OSL_ENSURE(pDlg, "Dialog creation failed!"); - pDlg->Execute(); - pDlg.reset(); + rView.ExecNumberingOutline(GetPool()); rReq.Done(); } break; diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx index 12e4ee082d8e..e1384184f62d 100644 --- a/sw/source/uibase/shells/drawsh.cxx +++ b/sw/source/uibase/shells/drawsh.cxx @@ -303,14 +303,7 @@ void SwDrawShell::Execute(SfxRequest &rReq) } case FN_NUMBERING_OUTLINE_DLG: { - SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1); - SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "Dialog creation failed!"); - boost::scoped_ptr pDlg(pFact->CreateSwTabDialog( DLG_TAB_OUTLINE, - GetView().GetWindow(), &aTmp, GetView().GetWrtShell())); - OSL_ENSURE(pDlg, "Dialog creation failed!"); - pDlg->Execute(); - pDlg.reset(); + GetView().ExecNumberingOutline(GetPool()); rReq.Done(); } break; diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 86e96432b728..291328d2fae9 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -381,14 +381,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) } case FN_NUMBERING_OUTLINE_DLG: { - SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1); - SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert(pFact && "Dialog creation failed!"); - boost::scoped_ptr pDlg(pFact->CreateSwTabDialog( DLG_TAB_OUTLINE, - GetView().GetWindow(), &aTmp, GetView().GetWrtShell())); - assert(pDlg && "Dialog creation failed!"); - pDlg->Execute(); - pDlg.reset(); + GetView().ExecNumberingOutline(GetPool()); rReq.Done(); } break; diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index eba9627784a4..eeaffff0d49d 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -242,14 +242,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) } case FN_NUMBERING_OUTLINE_DLG: { - SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1); - SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert(pFact); - boost::scoped_ptr pDlg(pFact->CreateSwTabDialog( DLG_TAB_OUTLINE, - GetView().GetWindow(), &aTmp, GetView().GetWrtShell())); - assert(pDlg); - pDlg->Execute(); - pDlg.reset(); + GetView().ExecNumberingOutline(GetPool()); rReq.Done(); break; } diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index d4bdd65c1225..0d3d360159dd 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -695,14 +695,7 @@ void SwTextShell::Execute(SfxRequest &rReq) break; case FN_NUMBERING_OUTLINE_DLG: { - SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1); - SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "Dialog creation failed!"); - boost::scoped_ptr pDlg(pFact->CreateSwTabDialog( DLG_TAB_OUTLINE, - GetView().GetWindow(), &aTmp, rWrtSh)); - OSL_ENSURE(pDlg, "Dialog creation failed!"); - pDlg->Execute(); - pDlg.reset(); + GetView().ExecNumberingOutline(GetPool()); rReq.Done(); } break; diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index a821f04e3609..1c7bf5cbecce 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -79,6 +79,7 @@ using namespace ::com::sun::star; #include #include #include "swabstdlg.hxx" +#include "misc.hrc" SFX_IMPL_NAMED_VIEWFACTORY(SwView, "Default") { @@ -605,4 +606,16 @@ void SwView::ExecFormatFootnote() pDlg->Execute(); } +void SwView::ExecNumberingOutline(SfxItemPool & rPool) +{ + SfxItemSet aTmp(rPool, FN_PARAM_1, FN_PARAM_1); + SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); + OSL_ENSURE(pFact, "Dialog creation failed!"); + boost::scoped_ptr pDlg(pFact->CreateSwTabDialog( DLG_TAB_OUTLINE, + GetWindow(), &aTmp, GetWrtShell())); + OSL_ENSURE(pDlg, "Dialog creation failed!"); + pDlg->Execute(); + pDlg.reset(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3