diff options
author | Eike Rathke <erack@redhat.com> | 2017-05-22 20:39:37 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-05-22 21:14:16 +0200 |
commit | 8b55956d6a07d1d6b62ffdf58277e6752513f4c0 (patch) | |
tree | 9f8b7dbe89c681faf63b03dc70f86798bb4650b7 /sc | |
parent | 7b3a0b7ea0f5ad2745cc7e15945150fcbc9e7c5a (diff) |
Introduce GetMatrix() from svRefList, tdf#58874
Change-Id: Id3a2500c475835c54fbf02505f852bb33e1403cc
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/inc/interpre.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/tool/interpr5.cxx | 27 |
2 files changed, 26 insertions, 2 deletions
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index 29cb26c05220..9e5de664d0dc 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -435,6 +435,7 @@ ScMatrixRef CreateMatrixFromDoubleRef( const formula::FormulaToken* pToken, inline ScTokenMatrixMap& GetTokenMatrixMap(); static ScTokenMatrixMap* CreateTokenMatrixMap(); ScMatrixRef GetMatrix(); +ScMatrixRef GetMatrix( short & rParam, size_t & rInRefList ); sc::RangeMatrix GetRangeMatrix(); void ScTableOp(); // repeated operations diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index 2b8e65bb8752..4e0ee214897c 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -323,7 +323,7 @@ ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const FormulaToken* pToken } ScTokenMatrixMap::const_iterator aIter; - if (pTokenMatrixMap && ((aIter = pTokenMatrixMap->find( pToken)) != pTokenMatrixMap->end())) + if (pToken && pTokenMatrixMap && ((aIter = pTokenMatrixMap->find( pToken)) != pTokenMatrixMap->end())) { /* XXX casting const away here is ugly; ScMatrixToken (to which the * result of this function usually is assigned) should not be forced to @@ -340,7 +340,7 @@ ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const FormulaToken* pToken pDok->FillMatrix(*pMat, nTab1, nCol1, nRow1, nCol2, nRow2); - if (pTokenMatrixMap) + if (pToken && pTokenMatrixMap) pTokenMatrixMap->insert( ScTokenMatrixMap::value_type( pToken, new ScMatrixToken( pMat))); return pMat; @@ -463,6 +463,29 @@ ScMatrixRef ScInterpreter::GetMatrix() return pMat; } +ScMatrixRef ScInterpreter::GetMatrix( short & rParam, size_t & rRefInList ) +{ + switch (GetRawStackType()) + { + case svRefList: + { + ScRange aRange( ScAddress::INITIALIZE_INVALID ); + PopDoubleRef( aRange, rParam, rRefInList); + if (nGlobalError != FormulaError::NONE) + return nullptr; + + SCCOL nCol1, nCol2; + SCROW nRow1, nRow2; + SCTAB nTab1, nTab2; + aRange.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2); + return CreateMatrixFromDoubleRef( nullptr, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2); + } + break; + default: + return GetMatrix(); + } +} + sc::RangeMatrix ScInterpreter::GetRangeMatrix() { sc::RangeMatrix aRet; |