summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-06-13 18:08:46 +0200
committerEike Rathke <erack@redhat.com>2016-06-14 08:03:23 +0000
commit32ecf73b9f26e74f72086bf43a72244c165a391c (patch)
tree20ec78a161f08130c373cfb6aa3077ebf4e698b4
parent0f9a51344863344082c71005e054094e78bb31aa (diff)
fix obtaining ScRefCellValue results, tdf#97831 follow-up
ScRefCellValue in interpreter context has to be used with GetCellValue() and GetCellString(), using raw ScRefCellValue getString() and getValue() is not enough. This also changes behavior with referenced empty cells that sc/qa/unit/data/functions/fods/Functions_Excel_2016.fods tests for, but I assume that tested our implementation, not what Excel does in these cases. Needs checking. (cherry picked from commit ab7e112bcf2ecd09ea129ef81177df8036110cb6) Conflicts: sc/qa/unit/data/functions/fods/Functions_Excel_2016.fods Change-Id: I16194ad59cce3d15271e7610e8ed90ac1786bcaa Reviewed-on: https://gerrit.libreoffice.org/26241 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/source/core/tool/interpr8.cxx52
1 files changed, 38 insertions, 14 deletions
diff --git a/sc/source/core/tool/interpr8.cxx b/sc/source/core/tool/interpr8.cxx
index dcf43d297088..a94cd032ed02 100644
--- a/sc/source/core/tool/interpr8.cxx
+++ b/sc/source/core/tool/interpr8.cxx
@@ -1417,11 +1417,15 @@ void ScInterpreter::ScConcat_MS()
if ( !aCell.isEmpty() )
{
if ( aCell.hasString() )
- aResBuf.append( aCell.getString( pDok ) );
+ {
+ svl::SharedString aSS;
+ GetCellString( aSS, aCell);
+ aResBuf.append( aSS.getString());
+ }
else
{
if ( !aCell.hasEmptyValue() )
- aResBuf.append( OUString::number( aCell.getValue() ) );
+ aResBuf.append( OUString::number( GetCellValue( aAdr, aCell)));
}
}
}
@@ -1459,11 +1463,15 @@ void ScInterpreter::ScConcat_MS()
if ( !aCell.isEmpty() )
{
if ( aCell.hasString() )
- aResBuf.append( aCell.getString( pDok ) );
+ {
+ svl::SharedString aSS;
+ GetCellString( aSS, aCell);
+ aResBuf.append( aSS.getString());
+ }
else
{
if ( !aCell.hasEmptyValue() )
- aResBuf.append( OUString::number( aCell.getValue() ) );
+ aResBuf.append( OUString::number( GetCellValue( aAdr, aCell)));
}
}
}
@@ -1537,11 +1545,15 @@ void ScInterpreter::ScTextJoin_MS()
if ( !aCell.isEmpty() )
{
if ( aCell.hasString() )
- aDelimiters.push_back( aCell.getString( pDok ) );
+ {
+ svl::SharedString aSS;
+ GetCellString( aSS, aCell);
+ aDelimiters.push_back( aSS.getString());
+ }
else
{
if ( !aCell.hasEmptyValue() )
- aDelimiters.push_back( OUString::number( aCell.getValue() ) );
+ aDelimiters.push_back( OUString::number( GetCellValue( aAdr, aCell)));
}
}
}
@@ -1579,11 +1591,15 @@ void ScInterpreter::ScTextJoin_MS()
if ( !aCell.isEmpty() )
{
if ( aCell.hasString() )
- aDelimiters.push_back( aCell.getString( pDok ) );
+ {
+ svl::SharedString aSS;
+ GetCellString( aSS, aCell);
+ aDelimiters.push_back( aSS.getString());
+ }
else
{
if ( !aCell.hasEmptyValue() )
- aDelimiters.push_back( OUString::number( aCell.getValue() ) );
+ aDelimiters.push_back( OUString::number( GetCellValue( aAdr, aCell)));
}
}
else
@@ -1682,11 +1698,15 @@ void ScInterpreter::ScTextJoin_MS()
if ( !aCell.isEmpty() )
{
if ( aCell.hasString() )
- aStr = aCell.getString( pDok );
+ {
+ svl::SharedString aSS;
+ GetCellString( aSS, aCell);
+ aStr = aSS.getString();
+ }
else
{
if ( !aCell.hasEmptyValue() )
- aStr = OUString::number( aCell.getValue() );
+ aStr = OUString::number( GetCellValue( aAdr, aCell));
}
}
else
@@ -1742,11 +1762,15 @@ void ScInterpreter::ScTextJoin_MS()
if ( !aCell.isEmpty() )
{
if ( aCell.hasString() )
- aStr = aCell.getString( pDok );
+ {
+ svl::SharedString aSS;
+ GetCellString( aSS, aCell);
+ aStr = aSS.getString();
+ }
else
{
if ( !aCell.hasEmptyValue() )
- aStr = OUString::number( aCell.getValue() );
+ aStr = OUString::number( GetCellValue( aAdr, aCell));
}
}
else
@@ -1941,9 +1965,9 @@ void ScInterpreter::ScSwitch_MS()
ScRefCellValue aCell( *pDok, aAdr );
isValue = !( aCell.hasString() || aCell.hasEmptyValue() || aCell.isEmpty() );
if ( isValue )
- fRefVal = aCell.getValue();
+ fRefVal = GetCellValue( aAdr, aCell);
else
- aRefStr = aCell.getString( pDok );
+ GetCellString( aRefStr, aCell);
}
break;
case svExternalSingleRef: