Kaydet (Commit) 71c49bcf authored tarafından Michaël Lefèvre's avatar Michaël Lefèvre Kaydeden (comit) Noel Grandin

tdf#60739 code factorisation

Limit duplication for SfxRequest FN_NUMBERING_OUTLINE_DLG in sw shells

Change-Id: Ibbf58480232f3b393d13548508b7cdbc98690847
Reviewed-on: https://gerrit.libreoffice.org/14313Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 0473818b
...@@ -546,6 +546,7 @@ public: ...@@ -546,6 +546,7 @@ public:
void StateStatusLine(SfxItemSet&); void StateStatusLine(SfxItemSet&);
void UpdateWordCount(SfxShell*, sal_uInt16); void UpdateWordCount(SfxShell*, sal_uInt16);
void ExecFormatFootnote(); void ExecFormatFootnote();
void ExecNumberingOutline(SfxItemPool &);
// functions for drawing // functions for drawing
void SetDrawFuncPtr(SwDrawBase* pFuncPtr); void SetDrawFuncPtr(SwDrawBase* pFuncPtr);
......
...@@ -441,14 +441,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) ...@@ -441,14 +441,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq )
} }
case FN_NUMBERING_OUTLINE_DLG: case FN_NUMBERING_OUTLINE_DLG:
{ {
SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1); rView.ExecNumberingOutline(GetPool());
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "Dialog creation failed!");
boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
rView.GetWindow(), &aTmp, rView.GetWrtShell()));
OSL_ENSURE(pDlg, "Dialog creation failed!");
pDlg->Execute();
pDlg.reset();
rReq.Done(); rReq.Done();
} }
break; break;
......
...@@ -303,14 +303,7 @@ void SwDrawShell::Execute(SfxRequest &rReq) ...@@ -303,14 +303,7 @@ void SwDrawShell::Execute(SfxRequest &rReq)
} }
case FN_NUMBERING_OUTLINE_DLG: case FN_NUMBERING_OUTLINE_DLG:
{ {
SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1); GetView().ExecNumberingOutline(GetPool());
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "Dialog creation failed!");
boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
GetView().GetWindow(), &aTmp, GetView().GetWrtShell()));
OSL_ENSURE(pDlg, "Dialog creation failed!");
pDlg->Execute();
pDlg.reset();
rReq.Done(); rReq.Done();
} }
break; break;
......
...@@ -381,14 +381,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) ...@@ -381,14 +381,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
} }
case FN_NUMBERING_OUTLINE_DLG: case FN_NUMBERING_OUTLINE_DLG:
{ {
SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1); GetView().ExecNumberingOutline(GetPool());
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
assert(pFact && "Dialog creation failed!");
boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
GetView().GetWindow(), &aTmp, GetView().GetWrtShell()));
assert(pDlg && "Dialog creation failed!");
pDlg->Execute();
pDlg.reset();
rReq.Done(); rReq.Done();
} }
break; break;
......
...@@ -242,14 +242,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) ...@@ -242,14 +242,7 @@ void SwFrameShell::Execute(SfxRequest &rReq)
} }
case FN_NUMBERING_OUTLINE_DLG: case FN_NUMBERING_OUTLINE_DLG:
{ {
SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1); GetView().ExecNumberingOutline(GetPool());
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
assert(pFact);
boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
GetView().GetWindow(), &aTmp, GetView().GetWrtShell()));
assert(pDlg);
pDlg->Execute();
pDlg.reset();
rReq.Done(); rReq.Done();
break; break;
} }
......
...@@ -695,14 +695,7 @@ void SwTextShell::Execute(SfxRequest &rReq) ...@@ -695,14 +695,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
break; break;
case FN_NUMBERING_OUTLINE_DLG: case FN_NUMBERING_OUTLINE_DLG:
{ {
SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1); GetView().ExecNumberingOutline(GetPool());
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "Dialog creation failed!");
boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
GetView().GetWindow(), &aTmp, rWrtSh));
OSL_ENSURE(pDlg, "Dialog creation failed!");
pDlg->Execute();
pDlg.reset();
rReq.Done(); rReq.Done();
} }
break; break;
......
...@@ -79,6 +79,7 @@ using namespace ::com::sun::star; ...@@ -79,6 +79,7 @@ using namespace ::com::sun::star;
#include <unomid.h> #include <unomid.h>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include "swabstdlg.hxx" #include "swabstdlg.hxx"
#include "misc.hrc"
SFX_IMPL_NAMED_VIEWFACTORY(SwView, "Default") SFX_IMPL_NAMED_VIEWFACTORY(SwView, "Default")
{ {
...@@ -605,4 +606,16 @@ void SwView::ExecFormatFootnote() ...@@ -605,4 +606,16 @@ void SwView::ExecFormatFootnote()
pDlg->Execute(); 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<SfxAbstractTabDialog> 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment