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

Miklos Vajna vmiklos at collabora.co.uk
Tue Jul 18 18:10:10 UTC 2017


 sw/inc/dbmgr.hxx                |    3 ++-
 sw/inc/dbui.hrc                 |    2 ++
 sw/source/ui/dbui/dbui.src      |   10 +++++++++-
 sw/source/uibase/dbui/dbmgr.cxx |   19 ++++++++++++++++---
 4 files changed, 29 insertions(+), 5 deletions(-)

New commits:
commit 83b43ef2223b66484e0e90e7b614886e06f955b5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Jul 18 17:57:52 2017 +0200

    sw mail merge: add support for the new 'writer' connectivity driver
    
    By mapping the .odt, .sxw, .doc and .docx extensions to sdbc:writer:. If
    we are at it, also accept xlsx next to xls.
    
    Change-Id: I8c6769b282adec1e7e8d191170e7aa9b324f2018
    Reviewed-on: https://gerrit.libreoffice.org/40147
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index 6d3357333864..4d4bd461a9ae 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -293,7 +293,8 @@ public:
         DBCONN_DBASE,
         DBCONN_FLAT,
         DBCONN_MSJET,
-        DBCONN_MSACE
+        DBCONN_MSACE,
+        DBCONN_WRITER
     };
 
     /// MailMergeEvent source
diff --git a/sw/inc/dbui.hrc b/sw/inc/dbui.hrc
index 832fc74007b7..de79b0aba00c 100644
--- a/sw/inc/dbui.hrc
+++ b/sw/inc/dbui.hrc
@@ -40,6 +40,7 @@
 #define ST_PUNCTUATION          (RC_DBUI_BEGIN + 14)
 #define ST_TEXT                 (RC_DBUI_BEGIN + 15)
 #define RA_SALUTATION           (RC_DBUI_BEGIN + 16)
+#define STR_FILTER_SXW          (RC_DBUI_BEGIN + 17)
 #define RA_PUNCTUATION          (RC_DBUI_BEGIN + 18)
 #define ST_TITLE_MALE           (RC_DBUI_BEGIN + 19)
 #define ST_TITLE_FEMALE         (RC_DBUI_BEGIN + 20)
@@ -48,6 +49,7 @@
 #define ST_REMOVESALUTATIONFIELD (RC_DBUI_BEGIN + 23)
 #define ST_DRAGSALUTATION       (RC_DBUI_BEGIN + 24)
 #define ST_TITLE_EDIT           (RC_DBUI_BEGIN + 25)
+#define STR_FILTER_DOC          (RC_DBUI_BEGIN + 26)
 #define ST_CONFIGUREMAIL        (RC_DBUI_BEGIN + 32)
 #define ST_FILTERNAME           (RC_DBUI_BEGIN + 33)
 #define ST_TYPE                 (RC_DBUI_BEGIN + 34)
diff --git a/sw/source/ui/dbui/dbui.src b/sw/source/ui/dbui/dbui.src
index cfea19f0ac0f..019177e0f337 100644
--- a/sw/source/ui/dbui/dbui.src
+++ b/sw/source/ui/dbui/dbui.src
@@ -60,13 +60,21 @@ String STR_FILTER_SXC
 {
     Text [ en-US ] = "%PRODUCTNAME Calc (*.ods;*.sxc)" ;
 };
+String STR_FILTER_SXW
+{
+    Text [ en-US ] = "%PRODUCTNAME Writer (*.odt;*.sxw)" ;
+};
 String STR_FILTER_DBF
 {
     Text [ en-US ] = "dBase (*.dbf)" ;
 };
 String STR_FILTER_XLS
 {
-    Text [ en-US ] = "Microsoft Excel (*.xls)" ;
+    Text [ en-US ] = "Microsoft Excel (*.xls;*.xlsx)" ;
+};
+String STR_FILTER_DOC
+{
+    Text [ en-US ] = "Microsoft Word (*.doc;*.docx)" ;
 };
 String STR_FILTER_TXT
 {
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index ffc10aa3ce1e..fc71c762dc18 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -2573,8 +2573,10 @@ OUString SwDBManager::LoadAndRegisterDataSource(SwDocShell* pDocShell)
     OUString sFilterAllData(SwResId(STR_FILTER_ALL_DATA));
     OUString sFilterSXB(SwResId(STR_FILTER_SXB));
     OUString sFilterSXC(SwResId(STR_FILTER_SXC));
+    OUString sFilterSXW(SwResId(STR_FILTER_SXW));
     OUString sFilterDBF(SwResId(STR_FILTER_DBF));
     OUString sFilterXLS(SwResId(STR_FILTER_XLS));
+    OUString sFilterDOC(SwResId(STR_FILTER_DOC));
     OUString sFilterTXT(SwResId(STR_FILTER_TXT));
     OUString sFilterCSV(SwResId(STR_FILTER_CSV));
 #ifdef _WIN32
@@ -2582,12 +2584,14 @@ OUString SwDBManager::LoadAndRegisterDataSource(SwDocShell* pDocShell)
     OUString sFilterACCDB(SwResId(STR_FILTER_ACCDB));
 #endif
     xFltMgr->appendFilter( sFilterAll, "*" );
-    xFltMgr->appendFilter( sFilterAllData, "*.ods;*.sxc;*.dbf;*.xls;*.txt;*.csv");
+    xFltMgr->appendFilter( sFilterAllData, "*.ods;*.sxc;*.odt;*.sxw;*.dbf;*.xls;*.xlsx;*.doc;*.docx;*.txt;*.csv");
 
     xFltMgr->appendFilter( sFilterSXB, "*.odb" );
     xFltMgr->appendFilter( sFilterSXC, "*.ods;*.sxc" );
+    xFltMgr->appendFilter( sFilterSXW, "*.odt;*.sxw" );
     xFltMgr->appendFilter( sFilterDBF, "*.dbf" );
-    xFltMgr->appendFilter( sFilterXLS, "*.xls" );
+    xFltMgr->appendFilter( sFilterXLS, "*.xls;*.xlsx" );
+    xFltMgr->appendFilter( sFilterDOC, "*.doc;*.docx" );
     xFltMgr->appendFilter( sFilterTXT, "*.txt" );
     xFltMgr->appendFilter( sFilterCSV, "*.csv" );
 #ifdef _WIN32
@@ -2628,13 +2632,21 @@ SwDBManager::DBConnURITypes SwDBManager::GetDBunoURI(const OUString &rURI, uno::
     }
     else if(sExt.equalsIgnoreAsciiCase("sxc")
         || sExt.equalsIgnoreAsciiCase("ods")
-            || sExt.equalsIgnoreAsciiCase("xls"))
+            || sExt.equalsIgnoreAsciiCase("xls")
+            || sExt.equalsIgnoreAsciiCase("xlsx"))
     {
         OUString sDBURL("sdbc:calc:");
         sDBURL += aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
         aURLAny <<= sDBURL;
         type = DBCONN_CALC;
     }
+    else if (sExt.equalsIgnoreAsciiCase("sxw") || sExt.equalsIgnoreAsciiCase("odt") || sExt.equalsIgnoreAsciiCase("doc") || sExt.equalsIgnoreAsciiCase("docx"))
+    {
+        OUString sDBURL("sdbc:writer:");
+        sDBURL += aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+        aURLAny <<= sDBURL;
+        type = DBCONN_WRITER;
+    }
     else if(sExt.equalsIgnoreAsciiCase("dbf"))
     {
         aURL.removeSegment();
@@ -2701,6 +2713,7 @@ OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const
     switch (type) {
     case DBCONN_UNKNOWN:
     case DBCONN_CALC:
+    case DBCONN_WRITER:
         break;
     case DBCONN_ODB:
         bStore = false;


More information about the Libreoffice-commits mailing list