Kaydet (Commit) 83b43ef2 authored tarafından Miklos Vajna's avatar Miklos Vajna

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/40147Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 36f2df84
...@@ -293,7 +293,8 @@ public: ...@@ -293,7 +293,8 @@ public:
DBCONN_DBASE, DBCONN_DBASE,
DBCONN_FLAT, DBCONN_FLAT,
DBCONN_MSJET, DBCONN_MSJET,
DBCONN_MSACE DBCONN_MSACE,
DBCONN_WRITER
}; };
/// MailMergeEvent source /// MailMergeEvent source
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#define ST_PUNCTUATION (RC_DBUI_BEGIN + 14) #define ST_PUNCTUATION (RC_DBUI_BEGIN + 14)
#define ST_TEXT (RC_DBUI_BEGIN + 15) #define ST_TEXT (RC_DBUI_BEGIN + 15)
#define RA_SALUTATION (RC_DBUI_BEGIN + 16) #define RA_SALUTATION (RC_DBUI_BEGIN + 16)
#define STR_FILTER_SXW (RC_DBUI_BEGIN + 17)
#define RA_PUNCTUATION (RC_DBUI_BEGIN + 18) #define RA_PUNCTUATION (RC_DBUI_BEGIN + 18)
#define ST_TITLE_MALE (RC_DBUI_BEGIN + 19) #define ST_TITLE_MALE (RC_DBUI_BEGIN + 19)
#define ST_TITLE_FEMALE (RC_DBUI_BEGIN + 20) #define ST_TITLE_FEMALE (RC_DBUI_BEGIN + 20)
...@@ -48,6 +49,7 @@ ...@@ -48,6 +49,7 @@
#define ST_REMOVESALUTATIONFIELD (RC_DBUI_BEGIN + 23) #define ST_REMOVESALUTATIONFIELD (RC_DBUI_BEGIN + 23)
#define ST_DRAGSALUTATION (RC_DBUI_BEGIN + 24) #define ST_DRAGSALUTATION (RC_DBUI_BEGIN + 24)
#define ST_TITLE_EDIT (RC_DBUI_BEGIN + 25) #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_CONFIGUREMAIL (RC_DBUI_BEGIN + 32)
#define ST_FILTERNAME (RC_DBUI_BEGIN + 33) #define ST_FILTERNAME (RC_DBUI_BEGIN + 33)
#define ST_TYPE (RC_DBUI_BEGIN + 34) #define ST_TYPE (RC_DBUI_BEGIN + 34)
......
...@@ -60,13 +60,21 @@ String STR_FILTER_SXC ...@@ -60,13 +60,21 @@ String STR_FILTER_SXC
{ {
Text [ en-US ] = "%PRODUCTNAME Calc (*.ods;*.sxc)" ; Text [ en-US ] = "%PRODUCTNAME Calc (*.ods;*.sxc)" ;
}; };
String STR_FILTER_SXW
{
Text [ en-US ] = "%PRODUCTNAME Writer (*.odt;*.sxw)" ;
};
String STR_FILTER_DBF String STR_FILTER_DBF
{ {
Text [ en-US ] = "dBase (*.dbf)" ; Text [ en-US ] = "dBase (*.dbf)" ;
}; };
String STR_FILTER_XLS 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 String STR_FILTER_TXT
{ {
......
...@@ -2573,8 +2573,10 @@ OUString SwDBManager::LoadAndRegisterDataSource(SwDocShell* pDocShell) ...@@ -2573,8 +2573,10 @@ OUString SwDBManager::LoadAndRegisterDataSource(SwDocShell* pDocShell)
OUString sFilterAllData(SwResId(STR_FILTER_ALL_DATA)); OUString sFilterAllData(SwResId(STR_FILTER_ALL_DATA));
OUString sFilterSXB(SwResId(STR_FILTER_SXB)); OUString sFilterSXB(SwResId(STR_FILTER_SXB));
OUString sFilterSXC(SwResId(STR_FILTER_SXC)); OUString sFilterSXC(SwResId(STR_FILTER_SXC));
OUString sFilterSXW(SwResId(STR_FILTER_SXW));
OUString sFilterDBF(SwResId(STR_FILTER_DBF)); OUString sFilterDBF(SwResId(STR_FILTER_DBF));
OUString sFilterXLS(SwResId(STR_FILTER_XLS)); OUString sFilterXLS(SwResId(STR_FILTER_XLS));
OUString sFilterDOC(SwResId(STR_FILTER_DOC));
OUString sFilterTXT(SwResId(STR_FILTER_TXT)); OUString sFilterTXT(SwResId(STR_FILTER_TXT));
OUString sFilterCSV(SwResId(STR_FILTER_CSV)); OUString sFilterCSV(SwResId(STR_FILTER_CSV));
#ifdef _WIN32 #ifdef _WIN32
...@@ -2582,12 +2584,14 @@ OUString SwDBManager::LoadAndRegisterDataSource(SwDocShell* pDocShell) ...@@ -2582,12 +2584,14 @@ OUString SwDBManager::LoadAndRegisterDataSource(SwDocShell* pDocShell)
OUString sFilterACCDB(SwResId(STR_FILTER_ACCDB)); OUString sFilterACCDB(SwResId(STR_FILTER_ACCDB));
#endif #endif
xFltMgr->appendFilter( sFilterAll, "*" ); 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( sFilterSXB, "*.odb" );
xFltMgr->appendFilter( sFilterSXC, "*.ods;*.sxc" ); xFltMgr->appendFilter( sFilterSXC, "*.ods;*.sxc" );
xFltMgr->appendFilter( sFilterSXW, "*.odt;*.sxw" );
xFltMgr->appendFilter( sFilterDBF, "*.dbf" ); xFltMgr->appendFilter( sFilterDBF, "*.dbf" );
xFltMgr->appendFilter( sFilterXLS, "*.xls" ); xFltMgr->appendFilter( sFilterXLS, "*.xls;*.xlsx" );
xFltMgr->appendFilter( sFilterDOC, "*.doc;*.docx" );
xFltMgr->appendFilter( sFilterTXT, "*.txt" ); xFltMgr->appendFilter( sFilterTXT, "*.txt" );
xFltMgr->appendFilter( sFilterCSV, "*.csv" ); xFltMgr->appendFilter( sFilterCSV, "*.csv" );
#ifdef _WIN32 #ifdef _WIN32
...@@ -2628,13 +2632,21 @@ SwDBManager::DBConnURITypes SwDBManager::GetDBunoURI(const OUString &rURI, uno:: ...@@ -2628,13 +2632,21 @@ SwDBManager::DBConnURITypes SwDBManager::GetDBunoURI(const OUString &rURI, uno::
} }
else if(sExt.equalsIgnoreAsciiCase("sxc") else if(sExt.equalsIgnoreAsciiCase("sxc")
|| sExt.equalsIgnoreAsciiCase("ods") || sExt.equalsIgnoreAsciiCase("ods")
|| sExt.equalsIgnoreAsciiCase("xls")) || sExt.equalsIgnoreAsciiCase("xls")
|| sExt.equalsIgnoreAsciiCase("xlsx"))
{ {
OUString sDBURL("sdbc:calc:"); OUString sDBURL("sdbc:calc:");
sDBURL += aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE); sDBURL += aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
aURLAny <<= sDBURL; aURLAny <<= sDBURL;
type = DBCONN_CALC; 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")) else if(sExt.equalsIgnoreAsciiCase("dbf"))
{ {
aURL.removeSegment(); aURL.removeSegment();
...@@ -2701,6 +2713,7 @@ OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const ...@@ -2701,6 +2713,7 @@ OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const
switch (type) { switch (type) {
case DBCONN_UNKNOWN: case DBCONN_UNKNOWN:
case DBCONN_CALC: case DBCONN_CALC:
case DBCONN_WRITER:
break; break;
case DBCONN_ODB: case DBCONN_ODB:
bStore = false; bStore = false;
......
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