[Libreoffice-commits] core.git: sw/source

Michaël Lefèvre lefevre00 at yahoo.fr
Thu Feb 5 03:12:36 PST 2015


 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(-)

New commits:
commit 71c49bcfa0677f013684030defbf5ead21695d85
Author: Michaël Lefèvre <lefevre00 at yahoo.fr>
Date:   Tue Feb 3 22:18:17 2015 +0100

    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 <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/sw/source/uibase/inc/view.hxx b/sw/source/uibase/inc/view.hxx
index 81d2a9f..3301a19 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 28ce006..f007372 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<SfxAbstractTabDialog> 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 12e4ee0..e138418 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<SfxAbstractTabDialog> 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 86e9643..291328d 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<SfxAbstractTabDialog> 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 eba9627..eeaffff 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<SfxAbstractTabDialog> 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 d4bdd65..0d3d360 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<SfxAbstractTabDialog> 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 a821f04..1c7bf5cb 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 <unomid.h>
 #include <boost/scoped_ptr.hpp>
 #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<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: */


More information about the Libreoffice-commits mailing list