diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2017-12-08 22:21:58 -0500 |
---|---|---|
committer | Kohei Yoshida <libreoffice@kohei.us> | 2017-12-18 03:31:52 +0100 |
commit | c576d6490410a1e1d01078473982b920a29f8b91 (patch) | |
tree | fa9dfd7537cf01dd7ff61a3498d00d5012f3d02b | |
parent | 7d4eeddda861dcd5a60689aca73f658bf6e6b528 (diff) |
Handle merged cells.
Change-Id: Iaa7194d4226300e495982bb1f90f72c31d748955
Reviewed-on: https://gerrit.libreoffice.org/46660
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
-rw-r--r-- | sc/inc/documentimport.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/documentimport.cxx | 19 | ||||
-rw-r--r-- | sc/source/filter/orcus/interface.cxx | 3 |
3 files changed, 23 insertions, 1 deletions
diff --git a/sc/inc/documentimport.hxx b/sc/inc/documentimport.hxx index 03f415c381cc..b4c35e1f99b5 100644 --- a/sc/inc/documentimport.hxx +++ b/sc/inc/documentimport.hxx @@ -114,6 +114,8 @@ public: void setRowsVisible(SCTAB nTab, SCROW nRowStart, SCROW nRowEnd, bool bVisible); + void setMergedCells(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); + void finalize(); private: diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx index c41e134558bf..ddfcf8b10a94 100644 --- a/sc/source/core/data/documentimport.cxx +++ b/sc/source/core/data/documentimport.cxx @@ -512,6 +512,25 @@ void ScDocumentImport::setRowsVisible(SCTAB nTab, SCROW nRowStart, SCROW nRowEnd } } +void ScDocumentImport::setMergedCells(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) +{ + ScTable* pTab = mpImpl->mrDoc.FetchTable(nTab); + if (!pTab) + return; + + ScMergeAttr aAttr(nCol2-nCol1+1, nRow2-nRow1+1); + pTab->ApplyAttr(nCol1, nRow1, aAttr); + + if (nCol1 < nCol2) + pTab->ApplyFlags(nCol1+1, nRow1, nCol2, nRow2, ScMF::Hor); + + if (nRow1 < nRow2) + pTab->ApplyFlags(nCol1, nRow1+1, nCol1, nRow2, ScMF::Ver); + + if (nCol1 < nCol2 && nRow1 < nRow2) + pTab->ApplyFlags(nCol1+1, nRow1+1, nCol2, nRow2, ScMF::Hor | ScMF::Ver); +} + namespace { class CellStoreInitializer diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index eff9570e66c3..ec93824093a2 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -307,8 +307,9 @@ void ScOrcusSheetProperties::set_row_hidden(os::row_t row, bool hidden) mrDoc.getDoc().SetRowHidden(row, row, mnTab, hidden); } -void ScOrcusSheetProperties::set_merge_cell_range(const orcus::spreadsheet::range_t& /*range*/) +void ScOrcusSheetProperties::set_merge_cell_range(const orcus::spreadsheet::range_t& range) { + mrDoc.setMergedCells(mnTab, range.first.column, range.first.row, range.last.column, range.last.row); } ScOrcusConditionalFormat::ScOrcusConditionalFormat(SCTAB nTab, ScDocument& rDoc): |