diff options
author | Michaël Lefèvre <lefevre00@yahoo.fr> | 2015-02-03 21:45:53 +0100 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-02-05 11:11:49 +0000 |
commit | 0473818b3ebd8446a40cffa6a83b985dc3d9d1a0 (patch) | |
tree | a932e2f3730035ae658e6063a9464e3b5eed8bf6 /sw/source | |
parent | 530226ca69f58bdb780a6864372f9de329c93e5b (diff) |
tdf#60739 code factorisation
Limit duplication for SfxRequest FN_FORMAT_FOOTNOTE_DLG in sw shells
Change-Id: I6f1ce98acf44a3811e4666a6bd9952232429f55a
Reviewed-on: https://gerrit.libreoffice.org/14312
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/uibase/inc/view.hxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/shells/annotsh.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/shells/drawsh.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/shells/drwtxtex.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/shells/frmsh.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh1.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view0.cxx | 11 |
7 files changed, 17 insertions, 30 deletions
diff --git a/sw/source/uibase/inc/view.hxx b/sw/source/uibase/inc/view.hxx index 0eecc7d048c7..81d2a9ffe1ba 100644 --- a/sw/source/uibase/inc/view.hxx +++ b/sw/source/uibase/inc/view.hxx @@ -545,6 +545,7 @@ public: void GetState(SfxItemSet&); void StateStatusLine(SfxItemSet&); void UpdateWordCount(SfxShell*, sal_uInt16); + void ExecFormatFootnote(); // functions for drawing void SetDrawFuncPtr(SwDrawBase* pFuncPtr); diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index a7ee88e9c887..28ce00665db0 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -436,12 +436,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) } case FN_FORMAT_FOOTNOTE_DLG: { - SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - - boost::scoped_ptr<VclAbstractDialog> pDlg(pFact->CreateSwFootNoteOptionDlg(rView.GetWindow(), rView.GetWrtShell())); - OSL_ENSURE(pDlg, "Dialog creation failed!"); - pDlg->Execute(); + rView.ExecFormatFootnote(); break; } case FN_NUMBERING_OUTLINE_DLG: diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx index b13a9579c9a6..12e4ee082d8e 100644 --- a/sw/source/uibase/shells/drawsh.cxx +++ b/sw/source/uibase/shells/drawsh.cxx @@ -298,12 +298,7 @@ void SwDrawShell::Execute(SfxRequest &rReq) break; case FN_FORMAT_FOOTNOTE_DLG: { - SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - - boost::scoped_ptr<VclAbstractDialog> pDlg(pFact->CreateSwFootNoteOptionDlg(GetView().GetWindow(), GetView().GetWrtShell())); - OSL_ENSURE(pDlg, "Dialog creation failed!"); - pDlg->Execute(); + GetView().ExecFormatFootnote(); break; } case FN_NUMBERING_OUTLINE_DLG: diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 6c7b344a18ce..86e96432b728 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -376,12 +376,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) break; case FN_FORMAT_FOOTNOTE_DLG: { - SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert(pFact && "SwAbstractDialogFactory fail!"); - - boost::scoped_ptr<VclAbstractDialog> pDlg(pFact->CreateSwFootNoteOptionDlg(GetView().GetWindow(), rView.GetWrtShell())); - assert(pDlg && "Dialog creation failed!"); - pDlg->Execute(); + GetView().ExecFormatFootnote(); break; } case FN_NUMBERING_OUTLINE_DLG: diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index 020bcad4bfcb..eba9627784a4 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -237,12 +237,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) break; case FN_FORMAT_FOOTNOTE_DLG: { - SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert(pFact); - - boost::scoped_ptr<VclAbstractDialog> pDlg(pFact->CreateSwFootNoteOptionDlg(GetView().GetWindow(), GetView().GetWrtShell())); - assert(pDlg); - pDlg->Execute(); + GetView().ExecFormatFootnote(); break; } case FN_NUMBERING_OUTLINE_DLG: diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index a1c90105f836..d4bdd65c1225 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -472,12 +472,7 @@ void SwTextShell::Execute(SfxRequest &rReq) break; case FN_FORMAT_FOOTNOTE_DLG: { - SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - - boost::scoped_ptr<VclAbstractDialog> pDlg(pFact->CreateSwFootNoteOptionDlg(GetView().GetWindow(), rWrtSh)); - OSL_ENSURE(pDlg, "Dialog creation failed!"); - pDlg->Execute(); + GetView().ExecFormatFootnote(); break; } case SID_INSERTDOC: diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index 78a0b6cab55e..a821f04e3609 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -78,6 +78,7 @@ using namespace ::com::sun::star; #include <unomid.h> #include <boost/scoped_ptr.hpp> +#include "swabstdlg.hxx" SFX_IMPL_NAMED_VIEWFACTORY(SwView, "Default") { @@ -594,4 +595,14 @@ void SwView::ExecViewOptions(SfxRequest &rReq) rReq.Done(); } +void SwView::ExecFormatFootnote() +{ + SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); + OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); + + boost::scoped_ptr<VclAbstractDialog> pDlg(pFact->CreateSwFootNoteOptionDlg(GetWindow(), GetWrtShell())); + OSL_ENSURE(pDlg, "Dialog creation failed!"); + pDlg->Execute(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |