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

Kohei Yoshida kohei.yoshida at gmail.com
Mon Dec 18 02:37:29 UTC 2017


 sc/inc/documentimport.hxx              |    2 ++
 sc/source/core/data/documentimport.cxx |   19 +++++++++++++++++++
 sc/source/filter/orcus/interface.cxx   |    3 ++-
 3 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit c576d6490410a1e1d01078473982b920a29f8b91
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Dec 8 22:21:58 2017 -0500

    Handle merged cells.
    
    Change-Id: Iaa7194d4226300e495982bb1f90f72c31d748955
    Reviewed-on: https://gerrit.libreoffice.org/46660
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>

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):


More information about the Libreoffice-commits mailing list