sc/source/core/tool/interpr8.cxx |   52 ++++++++++++++++++++++++++++-----------
 1 file changed, 38 insertions(+), 14 deletions(-)

New commits:
commit 32ecf73b9f26e74f72086bf43a72244c165a391c
Author: Eike Rathke <er...@redhat.com>
Date:   Mon Jun 13 18:08:46 2016 +0200

    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 <er...@redhat.com>
    Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/core/tool/interpr8.cxx b/sc/source/core/tool/interpr8.cxx
index dcf43d2..a94cd03 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:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to