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

Kohei Yoshida kohei.yoshida at collabora.com
Wed Sep 25 13:52:54 PDT 2013


 sc/source/core/data/documentimport.cxx |    4 ++++
 sc/source/filter/excel/impop.cxx       |   18 ++++++------------
 2 files changed, 10 insertions(+), 12 deletions(-)

New commits:
commit 1bde610add5ff77043a58110d6bc5830990d99d5
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Sep 25 22:52:56 2013 +0200

    Use ScDocumentImport to set matrix formula cells from xls.
    
    Change-Id: I3462dffea93c151ccf85eb51cda9511757b72fb2

diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index d3dd4db..9998e83 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -243,6 +243,10 @@ void ScDocumentImport::setMatrixCells(
     pBlockPos->miCellPos =
         rCells.set(pBlockPos->miCellPos, rBasePos.Row(), pCell);
 
+    // Matrix formulas currently need re-calculation on import.
+    pCell->SetMatColsRows(
+        rRange.aEnd.Col()-rRange.aStart.Col()+1, rRange.aEnd.Row()-rRange.aStart.Row()+1, true);
+
     // Set the reference cells.
     ScSingleRefData aRefData;
     aRefData.InitFlags();
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 4239a5e..b855bc2 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -560,12 +560,9 @@ void ImportExcel::Array25( void )
 
         OSL_ENSURE( pErgebnis, "*ImportExcel::Array25(): ScTokenArray is NULL!" );
 
-        ScMarkData          aMarkData;
-        aMarkData.SelectOneTable( GetCurrScTab() );
-        pD->InsertMatrixFormula( static_cast<SCCOL>(nFirstCol),
-                static_cast<SCROW>(nFirstRow), static_cast<SCCOL>(nLastCol),
-                static_cast<SCROW>(nLastRow), aMarkData, EMPTY_STRING,
-                pErgebnis );
+        ScDocumentImport& rDoc = GetDocImport();
+        ScRange aArrayRange(nFirstCol, nFirstRow, GetCurrScTab(), nLastCol, nLastRow, GetCurrScTab());
+        rDoc.setMatrixCells(aArrayRange, *pErgebnis, formula::FormulaGrammar::GRAM_ENGLISH_XL_A1);
     }
 }
 
@@ -1072,12 +1069,9 @@ void ImportExcel::Array34( void )
 
         OSL_ENSURE( pErgebnis, "+ImportExcel::Array34(): ScTokenArray is NULL!" );
 
-        ScMarkData          aMarkData;
-        aMarkData.SelectOneTable( GetCurrScTab() );
-        pD->InsertMatrixFormula( static_cast<SCCOL>(nFirstCol),
-                static_cast<SCROW>(nFirstRow), static_cast<SCCOL>(nLastCol),
-                static_cast<SCROW>(nLastRow), aMarkData, EMPTY_STRING,
-                pErgebnis);
+        ScDocumentImport& rDoc = GetDocImport();
+        ScRange aArrayRange(nFirstCol, nFirstRow, GetCurrScTab(), nLastCol, nLastRow, GetCurrScTab());
+        rDoc.setMatrixCells(aArrayRange, *pErgebnis, formula::FormulaGrammar::GRAM_ENGLISH_XL_A1);
     }
 }
 


More information about the Libreoffice-commits mailing list