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

Michaël Lefèvre lefevre00 at yahoo.fr
Tue Jan 27 22:22:38 PST 2015


 include/sfx2/shell.hxx               |    1 +
 sfx2/source/control/shell.cxx        |   14 ++++++++++++++
 sw/source/uibase/shells/annotsh.cxx  |   11 +----------
 sw/source/uibase/shells/drawsh.cxx   |   13 +------------
 sw/source/uibase/shells/drwtxtex.cxx |   10 +---------
 sw/source/uibase/shells/frmsh.cxx    |   12 +-----------
 sw/source/uibase/shells/textsh1.cxx  |   12 +-----------
 7 files changed, 20 insertions(+), 53 deletions(-)

New commits:
commit d57cd80479fac60a2486c74257a8840e36935e20
Author: Michaël Lefèvre <lefevre00 at yahoo.fr>
Date:   Mon Jan 26 14:46:36 2015 +0100

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

diff --git a/include/sfx2/shell.hxx b/include/sfx2/shell.hxx
index b833ce1..6af0a02 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 e6b40a6..445780d 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 b41a607..dea94dd 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 1b98e7b..056d7ce 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 eb1b039..f310062 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 cc6a8c8..6fdce9f 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 970fad9..30af928 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:


More information about the Libreoffice-commits mailing list