diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-07-17 08:02:54 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-07-24 20:11:01 +0200 |
commit | c478d1b3cc371d3b9e8147ff57347f99d25c565e (patch) | |
tree | 9aa2ad1d22c7dac30e8fbb50a71eab5079ef5ddc /sw/source/uibase | |
parent | 4a822b85d2c2e32422cfe001a37b5057651f3ecf (diff) |
Implement mail merge data source from Writer tables
This is a combination of 17 commits:
connectivity: add initial writer backend
Similar to the calc one. As a first step the Driver and the Connection
interfaces are implemented, though the later has some stubs.
(cherry picked from commit 69068f2228147ca0d252762612edbcab0713cdfa)
connectivity writer driver: initial DatabaseMetaData implementation
With this the list of tables is visible in Data Sources.
(cherry picked from commit d7ac239793905564d2754edc52611930b6ba2cdc)
connectivity writer driver: add Catalog implementation
But leave OWriterCatalog::refreshTables() as a stub for now.
(cherry picked from commit 6fb3e3a9c1dd1aec8a1ba90fea51e32048e609bf)
connectivity writer driver: add Tables implementation
But leave OWriterTables::createObject() as a stub for now.
(cherry picked from commit 60020f61339e5836f5a481909c1183af2734f569)
connectivity writer driver: add Table implementation
Gets rid of the stub warnings in OWriterTables::createObject().
(cherry picked from commit bec2da98c74dc4c02561641862de15e5d2630fa2)
connectivity writer driver: add Columns implementation
Gets rid of the stub warnings in OWriterTable::refreshColumns().
(cherry picked from commit a11ddfdcf3f5021cbeb0f065694d875bb748dc76)
connectivity writer driver: add PreparedStatement implementation
Gets rid of the stub warnings in OWriterConnection::prepareStatement().
(cherry picked from commit ac3c24bec925dd53f07b2827dab0d71c0dbaedee)
Conflicts:
connectivity/source/drivers/writer/WConnection.cxx
connectivity writer driver: add ResultSet implementation
Now column headers and table data show up on the UI.
(cherry picked from commit a93c89894feb663df37609c95d4db523120c0bc1)
connectivity writer driver: add Statement implementation
Gets rid of the OWriterConnection::createStatement() stub warning. This
is the last interface which was not supported by the writer driver, as
far as I see.
(cherry picked from commit cad0d8df38cf390d0615668ce2ab7c8f7ee42cde)
connectivity writer driver: mention Writer in display name
It was just "Document" to be consistent with Calc's "Spreadsheet", but
it's confusing as we have a Text driver as well.
(cherry picked from commit 5445de1432fd65fb3ef613d1dafd2bbb9b99b265)
dbaccess: introduce DATASOURCE_TYPE::DST_WRITER
By mostly reusing the spreadsheet code. This way the UI allows creating
a data source where the backend is a Writer document (containing at
least one Writer table).
(cherry picked from commit 36f2df84fcfc21038b4d20df38a9e5addfcbde3f)
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.
(cherry picked from commit 83b43ef2223b66484e0e90e7b614886e06f955b5)
Conflicts:
sw/inc/dbui.hrc
sw/source/uibase/dbui/dbmgr.cxx
sw mailmerge: add writer data source testcase
Fails with commit 83b43ef2223b66484e0e90e7b614886e06f955b5 (sw mail
merge: add support for the new 'writer' connectivity driver, 2017-07-18)
reverted.
(cherry picked from commit d9b0108e3af7244179bcc7b07db9d0826c3ac8a6)
connectivity: merge OCalcResultSet and OWriterResultSet
Into a single OComponentResultSet, as both of them just provide data
source functionality based on a file loaded into an LO component, so
they can share code.
(cherry picked from commit e473d49acc127ece76eb31cb3610e3950f35d9d9)
Conflicts:
connectivity/source/drivers/component/CResultSet.cxx
connectivity/source/drivers/writer/WResultSet.cxx
connectivity/source/inc/writer/WResultSet.hxx
connectivity: merge OCalcStatement and OWriterStatement
Into a single OComponentStatement, as both of them just provide statement
functionality based on a file loaded into an LO component, so they can share
code.
(cherry picked from commit 4073bc15d1aa1b46b2e0953d6316f2ab6a23dc87)
connectivity: merge OCalcPreparedStatement and OWriterPreparedStatement
Into a single OComponentPreparedStatement, as both of them just provide
prepared statement functionality based on a file loaded into an LO
component, so they can share code.
(cherry picked from commit 196ee66d4aab62678a8cfb762379909bdda16051)
connectivity: merge OCalcColumns and OWriterColumns
Turns out createObject() only needs the base class OFileTable, and then
these can be shared.
(cherry picked from commit d3d9292a0fb414e6721b2f3b12b7e283caed946d)
Change-Id: I6e8a83155dbbbc3d85794e190c2e710d01902017
Reviewed-on: https://gerrit.libreoffice.org/40231
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/dbui/dbmgr.cxx | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 991b6127c251..876f4c22166a 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -2581,8 +2581,10 @@ OUString SwDBManager::LoadAndRegisterDataSource(SwDocShell* pDocShell) OUString sFilterAllData(SW_RES(STR_FILTER_ALL_DATA)); OUString sFilterSXB(SW_RES(STR_FILTER_SXB)); OUString sFilterSXC(SW_RES(STR_FILTER_SXC)); + OUString sFilterSXW(SW_RES(STR_FILTER_SXW)); OUString sFilterDBF(SW_RES(STR_FILTER_DBF)); OUString sFilterXLS(SW_RES(STR_FILTER_XLS)); + OUString sFilterDOC(SW_RES(STR_FILTER_DOC)); OUString sFilterTXT(SW_RES(STR_FILTER_TXT)); OUString sFilterCSV(SW_RES(STR_FILTER_CSV)); #ifdef _WIN32 @@ -2590,12 +2592,14 @@ OUString SwDBManager::LoadAndRegisterDataSource(SwDocShell* pDocShell) OUString sFilterACCDB(SW_RES(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 @@ -2636,13 +2640,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::NO_DECODE); 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::NO_DECODE); + aURLAny <<= sDBURL; + type = DBCONN_WRITER; + } else if(sExt.equalsIgnoreAsciiCase("dbf")) { aURL.removeSegment(); @@ -2709,6 +2721,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; |