sc/source/filter/inc/defnamesbuffer.hxx | 1 + sc/source/filter/inc/formulabase.hxx | 4 ++++ sc/source/filter/inc/pivotcachebuffer.hxx | 1 - sc/source/filter/oox/defnamesbuffer.cxx | 9 +++++++++ sc/source/filter/oox/formulabase.cxx | 13 +++++++++++++ sc/source/filter/oox/pivotcachebuffer.cxx | 6 +----- 6 files changed, 28 insertions(+), 6 deletions(-)
New commits: commit 77dc03c29501234bb07170004a7b8204987bad0c Author: Jochen Nitschke <j.nitschke+loger...@ok.de> Date: Fri Dec 30 15:14:18 2016 +0100 tdf#48140 replace CellRangeAddress in xlsx import (2) Change-Id: I91115c65671910e4208cb14ae3837ff2129af472 Reviewed-on: https://gerrit.libreoffice.org/32571 Tested-by: Jochen Nitschke <j.nitschke+loger...@ok.de> Reviewed-by: Jochen Nitschke <j.nitschke+loger...@ok.de> diff --git a/sc/source/filter/inc/defnamesbuffer.hxx b/sc/source/filter/inc/defnamesbuffer.hxx index 7a2417d..5a6c812 100644 --- a/sc/source/filter/inc/defnamesbuffer.hxx +++ b/sc/source/filter/inc/defnamesbuffer.hxx @@ -118,6 +118,7 @@ public: inline sal_Int32 getTokenIndex() const { return mnTokenIndex; } /** Tries to resolve the defined name to an absolute cell range. */ bool getAbsoluteRange( css::table::CellRangeAddress& orRange ) const; + bool getAbsoluteRange( ScRange& orRange ) const; private: typedef ::std::unique_ptr< StreamDataSequence > StreamDataSeqPtr; diff --git a/sc/source/filter/inc/formulabase.hxx b/sc/source/filter/inc/formulabase.hxx index f016f2c..91c67c8 100644 --- a/sc/source/filter/inc/formulabase.hxx +++ b/sc/source/filter/inc/formulabase.hxx @@ -697,6 +697,10 @@ public: css::table::CellRangeAddress& orRange, const ApiTokenSequence& rTokens, bool bAllowRelative ) const; + bool extractCellRange( + ScRange& orRange, + const ApiTokenSequence& rTokens, + bool bAllowRelative ) const; /** Tries to extract a cell range list from a formula token sequence. diff --git a/sc/source/filter/inc/pivotcachebuffer.hxx b/sc/source/filter/inc/pivotcachebuffer.hxx index 262aeba..dfb8ae8 100644 --- a/sc/source/filter/inc/pivotcachebuffer.hxx +++ b/sc/source/filter/inc/pivotcachebuffer.hxx @@ -20,7 +20,6 @@ #ifndef INCLUDED_SC_SOURCE_FILTER_INC_PIVOTCACHEBUFFER_HXX #define INCLUDED_SC_SOURCE_FILTER_INC_PIVOTCACHEBUFFER_HXX -#include <com/sun/star/table/CellRangeAddress.hpp> #include <com/sun/star/util/DateTime.hpp> #include <oox/helper/containerhelper.hxx> #include <oox/helper/refvector.hxx> diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx index 9bbaf53..b668d98 100644 --- a/sc/source/filter/oox/defnamesbuffer.cxx +++ b/sc/source/filter/oox/defnamesbuffer.cxx @@ -406,6 +406,15 @@ bool DefinedName::getAbsoluteRange( CellRangeAddress& orRange ) const return getFormulaParser().extractCellRange( orRange, aFTokenSeq, false ); } +bool DefinedName::getAbsoluteRange( ScRange& orRange ) const +{ + ScTokenArray* pTokenArray = mpScRangeData->GetCode(); + Sequence< FormulaToken > aFTokenSeq; + ScTokenConversion::ConvertToTokenSequence(getScDocument(), aFTokenSeq, *pTokenArray); + return getFormulaParser().extractCellRange( orRange, aFTokenSeq, false ); +} + + DefinedNamesBuffer::DefinedNamesBuffer( const WorkbookHelper& rHelper ) : WorkbookHelper( rHelper ) { diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx index 6247aaf..5966c08 100644 --- a/sc/source/filter/oox/formulabase.cxx +++ b/sc/source/filter/oox/formulabase.cxx @@ -1610,6 +1610,19 @@ bool FormulaProcessorBase::extractCellRange( CellRangeAddress& orRange, return false; } +bool FormulaProcessorBase::extractCellRange( ScRange& orRange, + const ApiTokenSequence& rTokens, bool bAllowRelative ) const +{ + ApiCellRangeList aRanges; + lclProcessRef( aRanges, extractReference( rTokens ), bAllowRelative, -1 ); + if( !aRanges.empty() ) + { + orRange = aRanges.getBaseAddress(); + return true; + } + return false; +} + void FormulaProcessorBase::extractCellRangeList( ApiCellRangeList& orRanges, const ApiTokenSequence& rTokens, bool bAllowRelative, sal_Int32 nFilterBySheet ) const { diff --git a/sc/source/filter/oox/pivotcachebuffer.cxx b/sc/source/filter/oox/pivotcachebuffer.cxx index fbdcfdd..685d163 100644 --- a/sc/source/filter/oox/pivotcachebuffer.cxx +++ b/sc/source/filter/oox/pivotcachebuffer.cxx @@ -49,7 +49,6 @@ namespace xls { using namespace ::com::sun::star::container; using namespace ::com::sun::star::sheet; -using namespace ::com::sun::star::table; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; @@ -1075,10 +1074,7 @@ void PivotCache::finalizeInternalSheetSource() // local or global defined name if( const DefinedName* pDefName = getDefinedNames().getByModelName( maSheetSrcModel.maDefName, nSheet ).get() ) { - CellRangeAddress aCellRange = CellRangeAddress( maSheetSrcModel.maRange.aStart.Tab(), - maSheetSrcModel.maRange.aStart.Col(), maSheetSrcModel.maRange.aStart.Row(), - maSheetSrcModel.maRange.aEnd.Col(), maSheetSrcModel.maRange.aEnd.Row() ); - mbValidSource = pDefName->getAbsoluteRange( aCellRange ); + mbValidSource = pDefName->getAbsoluteRange( maSheetSrcModel.maRange ); } // table else if( const Table* pTable = getTables().getTable( maSheetSrcModel.maDefName ).get() ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits