summaryrefslogtreecommitdiff
path: root/sc/source/filter
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-12-30 01:16:53 +0100
committerAndras Timar <andras.timar@collabora.com>2015-01-08 15:09:42 +0100
commit247a076c1b9bbe8b4816e9fba6b60c56c06e5b11 (patch)
treed88ad86620c9248acb8a98fd8d4f02e175c3b742 /sc/source/filter
parentdd0850b08f39fa125fbd13a72359e96b5b5726c9 (diff)
relative refs wrap around in xls, fdo#84556
Change-Id: If84d468d4bd55ed55ccd517d0b078d283a1a9c38 Reviewed-on: https://gerrit.libreoffice.org/13695 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com> (cherry picked from commit 57009e242645590603b8854a81be74c1d4872fa1)
Diffstat (limited to 'sc/source/filter')
-rw-r--r--sc/source/filter/excel/excform8.cxx11
-rw-r--r--sc/source/filter/excel/impop.cxx12
2 files changed, 16 insertions, 7 deletions
diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx
index 1653ea9f1868..2fdf75eacf90 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -1409,7 +1409,16 @@ void ExcelToSc8::ExcRelToScRel8( sal_uInt16 nRow, sal_uInt16 nC, ScSingleRefData
{
// C O L
if( bColRel )
- rSRD.SetRelCol(static_cast<SCCOL>(static_cast<sal_Int8>(nC)));
+ {
+ SCCOL nRelCol = static_cast<sal_Int8>(nC);
+ sal_Int16 nDiff = aEingPos.Col() + nRelCol;
+ if ( nDiff < 0)
+ {
+ // relative column references wrap around
+ nRelCol = static_cast<sal_Int16>(256 + (int)nRelCol);
+ }
+ rSRD.SetRelCol(static_cast<SCCOL>(nRelCol));
+ }
else
rSRD.SetAbsCol(static_cast<SCCOL>(nCol));
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index ba281b863a34..18f55ff380a0 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -859,17 +859,17 @@ void ImportExcel::Shrfmla( void )
const ScTokenArray* pErgebnis;
- pFormConv->Reset();
- pFormConv->Convert( pErgebnis, maStrm, nLenExpr, true, FT_SharedFormula );
-
- OSL_ENSURE( pErgebnis, "+ImportExcel::Shrfmla(): ScTokenArray is NULL!" );
-
// The shared range in this record is erroneous more than half the time.
- // Don't ever rely on it.
+ // Don't ever rely on it. Use the one from the formula cell above.
SCCOL nCol1 = mpLastFormula->mnCol;
SCROW nRow1 = mpLastFormula->mnRow;
ScAddress aPos(nCol1, nRow1, GetCurrScTab());
+ pFormConv->Reset(aPos);
+ pFormConv->Convert( pErgebnis, maStrm, nLenExpr, true, FT_SharedFormula );
+
+ OSL_ENSURE( pErgebnis, "+ImportExcel::Shrfmla(): ScTokenArray is NULL!" );
+
pExcRoot->pShrfmlaBuff->Store(aPos, *pErgebnis);
// Create formula cell for the last formula record.