[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - sc/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Mon Dec 29 16:24:10 PST 2014
sc/source/filter/excel/excform8.cxx | 11 ++++++++++-
sc/source/filter/excel/impop.cxx | 12 ++++++------
2 files changed, 16 insertions(+), 7 deletions(-)
New commits:
commit 4fca914f7413dc65d8cb8b1c5206df0ace6ab773
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Tue Dec 30 01:16:53 2014 +0100
relative refs wrap around in xls, fdo#84556
Change-Id: If84d468d4bd55ed55ccd517d0b078d283a1a9c38
diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx
index d283616..a413037 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -1412,7 +1412,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 312da25..ddb1058 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -864,17 +864,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.
More information about the Libreoffice-commits
mailing list