[Libreoffice-commits] core.git: 2 commits - formula/source sc/source

Eike Rathke erack at redhat.com
Wed Jul 5 16:55:19 UTC 2017


 formula/source/ui/dlg/formula.cxx |    5 ++++-
 sc/source/ui/formdlg/formula.cxx  |   14 +++++++++++---
 2 files changed, 15 insertions(+), 4 deletions(-)

New commits:
commit 14f562b109042ebde90261f93952b4c730e1427d
Author: Eike Rathke <erack at 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

diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx
index bdd9d25e2ba0..ac8b3369fe4a 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;
commit 6865f4618b6ddcc7dd5688e64e9cdd3f3064dea7
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Jul 5 18:10:39 2017 +0200

    Make that debuggable despite AnyInput() pending
    
    Somehow opening the Function Wizard always still has a keyboard input pending
    when breaking in the debugger so the first calculateValue() call was bypassed.
    
    Change-Id: I1ad2fdf1724ae793edc7497895c8d8cead733f86

diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index ae44642e461b..7326a6e568bf 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -547,7 +547,10 @@ bool FormulaDlg_Impl::CalcValue( const OUString& rStrExp, OUString& rStrResult,
     {
         // Only calculate the value when there isn't any more keyboard input:
 
-        if ( !Application::AnyInput( VclInputFlags::KEYBOARD ) )
+        // Make this debuggable by assigning to a variable that can be changed
+        // from within the debugger.
+        bool bInput = Application::AnyInput( VclInputFlags::KEYBOARD );
+        if ( !bInput )
         {
             bResult = m_pHelper->calculateValue( rStrExp, rStrResult, bForceMatrixFormula || m_pBtnMatrix->IsChecked());
         }


More information about the Libreoffice-commits mailing list