sc/source/ui/formdlg/formula.cxx |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 9c9954570519f2607cf261ff19801e4a167d607b
Author: Eike Rathke <er...@redhat.com>
Date:   Wed Jul 5 18:52:14 2017 +0200

    Display string results in the Function Wizard quoted
    
    To distinguish number strings from numeric results.
    
    Change-Id: I68e044e839b2d5d2e87835dd0002f42aa0fc8192
    (cherry picked from commit 14f562b109042ebde90261f93952b4c730e1427d)
    Reviewed-on: https://gerrit.libreoffice.org/39608
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>

diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx
index cbaf4dd74165..308b206537d0 100644
--- a/sc/source/ui/formdlg/formula.cxx
+++ b/sc/source/ui/formdlg/formula.cxx
@@ -338,13 +338,16 @@ bool ScFormulaDlg::calculateValue( const OUString& 
rStrExp, OUString& rStrResult
     {
         SvNumberFormatter& aFormatter = *(m_pDoc->GetFormatTable());
         Color* pColor;
-        if ( pFCell->IsValue() )
+        if (pFCell->IsMatrix())
+        {
+            rStrResult = pFCell->GetString().getString();
+        }
+        else if (pFCell->IsValue())
         {
             double n = pFCell->GetValue();
             sal_uLong nFormat = aFormatter.GetStandardFormat( n, 0,
                             pFCell->GetFormatType(), ScGlobal::eLnge );
-            aFormatter.GetOutputString( n, nFormat,
-                                        rStrResult, &pColor );
+            aFormatter.GetOutputString( n, nFormat, rStrResult, &pColor );
         }
         else
         {
@@ -352,6 +355,11 @@ bool ScFormulaDlg::calculateValue( const OUString& 
rStrExp, OUString& rStrResult
                             pFCell->GetFormatType(), ScGlobal::eLnge);
             aFormatter.GetOutputString( pFCell->GetString().getString(), 
nFormat,
                                         rStrResult, &pColor );
+            // Indicate it's a string, so a number string doesn't look numeric.
+            // Escape embedded quotation marks first by doubling them, as
+            // usual. Actually the result can be copy-pasted from the result
+            // box as literal into a formula expression.
+            rStrResult = "\"" + rStrResult.replaceAll( "\"", "\"\"") + "\"";
         }
 
         ScRange aTestRange;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to