Kaydet (Commit) ab7e112b authored tarafından Eike Rathke's avatar Eike Rathke

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.

Change-Id: I16194ad59cce3d15271e7610e8ed90ac1786bcaa
üst 3bd190ae
...@@ -1417,11 +1417,15 @@ void ScInterpreter::ScConcat_MS() ...@@ -1417,11 +1417,15 @@ void ScInterpreter::ScConcat_MS()
if ( !aCell.isEmpty() ) if ( !aCell.isEmpty() )
{ {
if ( aCell.hasString() ) if ( aCell.hasString() )
aResBuf.append( aCell.getString( pDok ) ); {
svl::SharedString aSS;
GetCellString( aSS, aCell);
aResBuf.append( aSS.getString());
}
else else
{ {
if ( !aCell.hasEmptyValue() ) if ( !aCell.hasEmptyValue() )
aResBuf.append( OUString::number( aCell.getValue() ) ); aResBuf.append( OUString::number( GetCellValue( aAdr, aCell)));
} }
} }
} }
...@@ -1459,11 +1463,15 @@ void ScInterpreter::ScConcat_MS() ...@@ -1459,11 +1463,15 @@ void ScInterpreter::ScConcat_MS()
if ( !aCell.isEmpty() ) if ( !aCell.isEmpty() )
{ {
if ( aCell.hasString() ) if ( aCell.hasString() )
aResBuf.append( aCell.getString( pDok ) ); {
svl::SharedString aSS;
GetCellString( aSS, aCell);
aResBuf.append( aSS.getString());
}
else else
{ {
if ( !aCell.hasEmptyValue() ) if ( !aCell.hasEmptyValue() )
aResBuf.append( OUString::number( aCell.getValue() ) ); aResBuf.append( OUString::number( GetCellValue( aAdr, aCell)));
} }
} }
} }
...@@ -1537,11 +1545,15 @@ void ScInterpreter::ScTextJoin_MS() ...@@ -1537,11 +1545,15 @@ void ScInterpreter::ScTextJoin_MS()
if ( !aCell.isEmpty() ) if ( !aCell.isEmpty() )
{ {
if ( aCell.hasString() ) if ( aCell.hasString() )
aDelimiters.push_back( aCell.getString( pDok ) ); {
svl::SharedString aSS;
GetCellString( aSS, aCell);
aDelimiters.push_back( aSS.getString());
}
else else
{ {
if ( !aCell.hasEmptyValue() ) 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() ...@@ -1579,11 +1591,15 @@ void ScInterpreter::ScTextJoin_MS()
if ( !aCell.isEmpty() ) if ( !aCell.isEmpty() )
{ {
if ( aCell.hasString() ) if ( aCell.hasString() )
aDelimiters.push_back( aCell.getString( pDok ) ); {
svl::SharedString aSS;
GetCellString( aSS, aCell);
aDelimiters.push_back( aSS.getString());
}
else else
{ {
if ( !aCell.hasEmptyValue() ) if ( !aCell.hasEmptyValue() )
aDelimiters.push_back( OUString::number( aCell.getValue() ) ); aDelimiters.push_back( OUString::number( GetCellValue( aAdr, aCell)));
} }
} }
else else
...@@ -1682,11 +1698,15 @@ void ScInterpreter::ScTextJoin_MS() ...@@ -1682,11 +1698,15 @@ void ScInterpreter::ScTextJoin_MS()
if ( !aCell.isEmpty() ) if ( !aCell.isEmpty() )
{ {
if ( aCell.hasString() ) if ( aCell.hasString() )
aStr = aCell.getString( pDok ); {
svl::SharedString aSS;
GetCellString( aSS, aCell);
aStr = aSS.getString();
}
else else
{ {
if ( !aCell.hasEmptyValue() ) if ( !aCell.hasEmptyValue() )
aStr = OUString::number( aCell.getValue() ); aStr = OUString::number( GetCellValue( aAdr, aCell));
} }
} }
else else
...@@ -1742,11 +1762,15 @@ void ScInterpreter::ScTextJoin_MS() ...@@ -1742,11 +1762,15 @@ void ScInterpreter::ScTextJoin_MS()
if ( !aCell.isEmpty() ) if ( !aCell.isEmpty() )
{ {
if ( aCell.hasString() ) if ( aCell.hasString() )
aStr = aCell.getString( pDok ); {
svl::SharedString aSS;
GetCellString( aSS, aCell);
aStr = aSS.getString();
}
else else
{ {
if ( !aCell.hasEmptyValue() ) if ( !aCell.hasEmptyValue() )
aStr = OUString::number( aCell.getValue() ); aStr = OUString::number( GetCellValue( aAdr, aCell));
} }
} }
else else
...@@ -1941,9 +1965,9 @@ void ScInterpreter::ScSwitch_MS() ...@@ -1941,9 +1965,9 @@ void ScInterpreter::ScSwitch_MS()
ScRefCellValue aCell( *pDok, aAdr ); ScRefCellValue aCell( *pDok, aAdr );
isValue = !( aCell.hasString() || aCell.hasEmptyValue() || aCell.isEmpty() ); isValue = !( aCell.hasString() || aCell.hasEmptyValue() || aCell.isEmpty() );
if ( isValue ) if ( isValue )
fRefVal = aCell.getValue(); fRefVal = GetCellValue( aAdr, aCell);
else else
aRefStr = aCell.getString( pDok ); GetCellString( aRefStr, aCell);
} }
break; break;
case svExternalSingleRef: case svExternalSingleRef:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment