summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2016-12-30 15:14:18 +0100
committerJochen Nitschke <j.nitschke+logerrit@ok.de>2017-01-03 00:15:35 +0000
commit77dc03c29501234bb07170004a7b8204987bad0c (patch)
tree89ea0ab3d995782442da6be17645a6743eb63131
parent9efa11a1090ab088c64a26dacea5d6f40d7878e6 (diff)
tdf#48140 replace CellRangeAddress in xlsx import (2)
Change-Id: I91115c65671910e4208cb14ae3837ff2129af472 Reviewed-on: https://gerrit.libreoffice.org/32571 Tested-by: Jochen Nitschke <j.nitschke+logerrit@ok.de> Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
-rw-r--r--sc/source/filter/inc/defnamesbuffer.hxx1
-rw-r--r--sc/source/filter/inc/formulabase.hxx4
-rw-r--r--sc/source/filter/inc/pivotcachebuffer.hxx1
-rw-r--r--sc/source/filter/oox/defnamesbuffer.cxx9
-rw-r--r--sc/source/filter/oox/formulabase.cxx13
-rw-r--r--sc/source/filter/oox/pivotcachebuffer.cxx6
6 files changed, 28 insertions, 6 deletions
diff --git a/sc/source/filter/inc/defnamesbuffer.hxx b/sc/source/filter/inc/defnamesbuffer.hxx
index 7a2417d10845..5a6c812309d9 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 f016f2c24acf..91c67c820d1b 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 262aebacc5fa..dfb8ae8c6b8f 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 9bbaf5381ffb..b668d9855ab8 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 6247aaf3b89c..5966c083c776 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 fbdcfdda11a0..685d163044e1 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() )