summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2021-10-25 15:09:10 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-10-27 00:07:28 +0200
commit5862ea89fe285bf83b9a7658906ed3e0b8d86853 (patch)
tree7c6daf2cd9cace0307c0937aae85fe946e67ed18 /sc
parent3a76bba6bc2d638ce9e13179bcf03854b05b97e1 (diff)
tdf#142010 XLS import: fix bad calculation after editing
Inserting a column messed up formulas in the test document of tdf#142010. This was a regression resulted by the tdf#89281 fix for a performance regression in XLS import related to shared formulas. Revert of commit ba686b9bd2596811141e4028947334f10799c356 "tdf#89281 fix performance regression of XLS import - cleanup" and commit b18b5b7edf3d14ef5f0efe53e367f88a423088c4 "tdf#89281 fix performance regression of XLS import". Change-Id: I96636fb1d84939385efbe7054a4271ff10b88907 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124151 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 7d5703ca50d719fbd82615fb81da7949fe163ae5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124189 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/tokenarray.hxx1
-rw-r--r--sc/source/core/tool/token.cxx35
-rw-r--r--sc/source/filter/excel/excform.cxx9
3 files changed, 2 insertions, 43 deletions
diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx
index 401ecb392239..f6af4641f24a 100644
--- a/sc/inc/tokenarray.hxx
+++ b/sc/inc/tokenarray.hxx
@@ -259,7 +259,6 @@ public:
OUString CreateString( sc::TokenStringContext& rCxt, const ScAddress& rPos ) const;
void WrapReference( const ScAddress& rPos, SCCOL nMaxCol, SCROW nMaxRow );
- bool NeedsWrapReference( const ScAddress& rPos, SCCOL nMaxCol, SCROW nMaxRow ) const;
sal_Int32 GetWeight() const;
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 04355b86a8ec..d8579a8a834e 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -5238,41 +5238,6 @@ void ScTokenArray::WrapReference( const ScAddress& rPos, SCCOL nMaxCol, SCROW nM
}
}
-bool ScTokenArray::NeedsWrapReference( const ScAddress& rPos, SCCOL nMaxCol, SCROW nMaxRow ) const
-{
- FormulaToken** p = pCode.get();
- FormulaToken** pEnd = p + static_cast<size_t>(nLen);
- for (; p != pEnd; ++p)
- {
- switch ((*p)->GetType())
- {
- case svSingleRef:
- {
- formula::FormulaToken* pToken = *p;
- ScSingleRefData& rRef = *pToken->GetSingleRef();
- ScAddress aAbs = rRef.toAbs(*mxSheetLimits, rPos);
- if (aAbs.Col() > nMaxCol || aAbs.Row() > nMaxRow)
- return true;
- }
- break;
- case svDoubleRef:
- {
- formula::FormulaToken* pToken = *p;
- ScComplexRefData& rRef = *pToken->GetDoubleRef();
- ScRange aAbs = rRef.toAbs(*mxSheetLimits, rPos);
- // Entire columns/rows are sticky.
- if ( (!rRef.IsEntireCol() && (aAbs.aStart.Row() > nMaxRow || aAbs.aEnd.Row() > nMaxRow)) ||
- (!rRef.IsEntireRow() && (aAbs.aStart.Col() > nMaxCol || aAbs.aEnd.Col() > nMaxCol)))
- return true;
- }
- break;
- default:
- ;
- }
- }
- return false;
-}
-
sal_Int32 ScTokenArray::GetWeight() const
{
sal_Int32 nResult = 0;
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index f1374e2d5c12..d217c9622e06 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -121,13 +121,8 @@ void ImportExcel::Formula(
if (pSharedCode)
{
ScFormulaCell* pCell;
- if (pSharedCode->NeedsWrapReference(aScPos, EXC_MAXCOL8, EXC_MAXROW8))
- {
- pCell = new ScFormulaCell(rD, aScPos, pSharedCode->Clone());
- pCell->GetCode()->WrapReference(aScPos, EXC_MAXCOL8, EXC_MAXROW8);
- }
- else
- pCell = new ScFormulaCell(rD, aScPos, *pSharedCode);
+ pCell = new ScFormulaCell(rD, aScPos, pSharedCode->Clone());
+ pCell->GetCode()->WrapReference(aScPos, EXC_MAXCOL8, EXC_MAXROW8);
rDoc.getDoc().EnsureTable(aScPos.Tab());
rDoc.setFormulaCell(aScPos, pCell);
pCell->SetNeedNumberFormat(false);