diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2016-12-31 03:53:42 +0100 |
---|---|---|
committer | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2017-01-03 00:21:00 +0000 |
commit | b144ec03020b9d717bd7ccad0e6e4c84aa3f9898 (patch) | |
tree | ca39e94087438a990f7e3b9293980637d28fe81b /sc | |
parent | c5c9b888d8d0c414a3b27619a6df9adfebf4f77f (diff) |
tdf#48140 replace CellRangeAddress in xlsx import (11)
Change-Id: I033b2ddb720942882aad5ceaa8b140546f32356d
Reviewed-on: https://gerrit.libreoffice.org/32580
Tested-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/inc/formulabuffer.hxx | 8 | ||||
-rw-r--r-- | sc/source/filter/inc/worksheethelper.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/formulabuffer.cxx | 19 | ||||
-rw-r--r-- | sc/source/filter/oox/sheetdatacontext.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/oox/worksheethelper.cxx | 2 |
5 files changed, 17 insertions, 20 deletions
diff --git a/sc/source/filter/inc/formulabuffer.hxx b/sc/source/filter/inc/formulabuffer.hxx index 1d1bc7752d0a..9b0f28cc7f12 100644 --- a/sc/source/filter/inc/formulabuffer.hxx +++ b/sc/source/filter/inc/formulabuffer.hxx @@ -16,8 +16,6 @@ #include <salhelper/thread.hxx> #include <osl/mutex.hxx> #include "workbookhelper.hxx" -#include <com/sun/star/table/CellAddress.hpp> -#include <com/sun/star/table/CellRangeAddress.hpp> #include <map> #include <vector> #include "worksheethelper.hxx" @@ -67,8 +65,8 @@ public: struct TokenRangeAddressItem { TokenAddressItem maTokenAndAddress; - css::table::CellRangeAddress maCellRangeAddress; - TokenRangeAddressItem( const TokenAddressItem& rTokenAndAddress, const css::table::CellRangeAddress& rCellRangeAddress ) : maTokenAndAddress( rTokenAndAddress ), maCellRangeAddress( rCellRangeAddress ) {} + ScRange maRange; + TokenRangeAddressItem( const TokenAddressItem& rTokenAndAddress, const ScRange& rRange ) : maTokenAndAddress( rTokenAndAddress ), maRange( rRange ) {} }; struct FormulaValue @@ -121,7 +119,7 @@ public: void setCellFormulaValue( const ScAddress& rAddress, const OUString& rValueStr, sal_Int32 nCellType ); - void setCellArrayFormula( const css::table::CellRangeAddress& rRangeAddress, + void setCellArrayFormula( const ScRange& rRangeAddress, const ScAddress& rTokenAddress, const OUString& ); diff --git a/sc/source/filter/inc/worksheethelper.hxx b/sc/source/filter/inc/worksheethelper.hxx index e0d04ceee7d2..fdd2812ed4d1 100644 --- a/sc/source/filter/inc/worksheethelper.hxx +++ b/sc/source/filter/inc/worksheethelper.hxx @@ -294,7 +294,7 @@ public: const ScAddress& rAddr, sal_Int32 nSharedId, const OUString& rCellValue, sal_Int32 nValueType ); - void setCellArrayFormula( const css::table::CellRangeAddress& rRangeAddress, const ScAddress& rTokenAddress, const OUString& ); + void setCellArrayFormula( const ScRange& rRangeAddress, const ScAddress& rTokenAddress, const OUString& rTokenStr ); void createSharedFormulaMapEntry( const ScAddress& rAddress, diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index 003d0b96769b..dd00d4502bbb 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -13,7 +13,6 @@ #include "formulacell.hxx" #include "document.hxx" #include "documentimport.hxx" -#include "convuno.hxx" #include "rangelst.hxx" #include "autonamecache.hxx" @@ -27,7 +26,6 @@ using namespace com::sun::star; using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::table; using namespace ::com::sun::star::sheet; using namespace ::com::sun::star::container; @@ -233,19 +231,16 @@ void applyArrayFormulas( ScDocumentImport& rDoc, SvNumberFormatter& rFormatter, const std::vector<FormulaBuffer::TokenRangeAddressItem>& rArrays ) { - std::vector<FormulaBuffer::TokenRangeAddressItem>::const_iterator it = rArrays.begin(), itEnd = rArrays.end(); - for (; it != itEnd; ++it) + for (const FormulaBuffer::TokenRangeAddressItem& rAddressItem : rArrays) { - const ScAddress& aPos = it->maTokenAndAddress.maCellAddress; - ScRange aRange; - ScUnoConversion::FillScRange(aRange, it->maCellRangeAddress); + const ScAddress& aPos = rAddressItem.maTokenAndAddress.maCellAddress; ScCompiler aComp(&rDoc.getDoc(), aPos); aComp.SetNumberFormatter(&rFormatter); aComp.SetGrammar(formula::FormulaGrammar::GRAM_OOXML); - std::unique_ptr<ScTokenArray> pArray(aComp.CompileString(it->maTokenAndAddress.maTokenStr)); + std::unique_ptr<ScTokenArray> pArray(aComp.CompileString(rAddressItem.maTokenAndAddress.maTokenStr)); if (pArray) - rDoc.setMatrixCells(aRange, *pArray, formula::FormulaGrammar::GRAM_OOXML); + rDoc.setMatrixCells(rAddressItem.maRange, *pArray, formula::FormulaGrammar::GRAM_OOXML); } } @@ -430,12 +425,12 @@ void FormulaBuffer::setCellFormula( SharedFormulaDesc(rAddress, nSharedId, rCellValue, nValueType)); } -void FormulaBuffer::setCellArrayFormula( const css::table::CellRangeAddress& rRangeAddress, const ScAddress& rTokenAddress, const OUString& rTokenStr ) +void FormulaBuffer::setCellArrayFormula( const ScRange& rRangeAddress, const ScAddress& rTokenAddress, const OUString& rTokenStr ) { TokenAddressItem tokenPair( rTokenStr, rTokenAddress ); - assert( rRangeAddress.Sheet >= 0 && (size_t)rRangeAddress.Sheet < maCellArrayFormulas.size() ); - maCellArrayFormulas[ rRangeAddress.Sheet ].push_back( TokenRangeAddressItem( tokenPair, rRangeAddress ) ); + assert( rRangeAddress.aStart.Tab() >= 0 && (size_t)rRangeAddress.aStart.Tab() < maCellArrayFormulas.size() ); + maCellArrayFormulas[ rRangeAddress.aStart.Tab() ].push_back( TokenRangeAddressItem( tokenPair, rRangeAddress ) ); } void FormulaBuffer::setCellFormulaValue( diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx index 9c47da50b7b4..dc679314afc7 100644 --- a/sc/source/filter/oox/sheetdatacontext.cxx +++ b/sc/source/filter/oox/sheetdatacontext.cxx @@ -173,7 +173,11 @@ void SheetDataContext::onEndElement() break; case XML_array: if( mbValidRange && maFmlaData.isValidArrayRef( maCellData.maCellAddr ) ) - setCellArrayFormula( maFmlaData.maFormulaRef, maCellData.maCellAddr, maFormulaStr ); + { + ScRange aRangeAddr( maFmlaData.maFormulaRef.StartColumn, maFmlaData.maFormulaRef.StartRow, maFmlaData.maFormulaRef.Sheet, + maFmlaData.maFormulaRef.EndColumn, maFmlaData.maFormulaRef.EndRow, maFmlaData.maFormulaRef.Sheet); + setCellArrayFormula( aRangeAddr, maCellData.maCellAddr, maFormulaStr ); + } // set cell formatting, but do not set result as cell value mrSheetData.setBlankCell( maCellData ); break; diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx index 832f97e98348..2eccb8244c3d 100644 --- a/sc/source/filter/oox/worksheethelper.cxx +++ b/sc/source/filter/oox/worksheethelper.cxx @@ -1592,7 +1592,7 @@ void WorksheetHelper::setCellFormula( getFormulaBuffer().setCellFormula(rAddr, nSharedId, rCellValue, nValueType); } -void WorksheetHelper::setCellArrayFormula( const css::table::CellRangeAddress& rRangeAddress, const ScAddress& rTokenAddress, const OUString& rTokenStr ) +void WorksheetHelper::setCellArrayFormula( const ScRange& rRangeAddress, const ScAddress& rTokenAddress, const OUString& rTokenStr ) { getFormulaBuffer().setCellArrayFormula( rRangeAddress, rTokenAddress, rTokenStr ); } |