summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-07-05 18:52:14 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2017-07-06 15:21:00 +0200
commit9c9954570519f2607cf261ff19801e4a167d607b (patch)
tree9d2772a19439e0d53590a4917dd8ad65c3951378
parentbba6e442b0d8a4adae1b4e64a7fa7246130e300e (diff)
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 <ci@libreoffice.org> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--sc/source/ui/formdlg/formula.cxx14
1 files changed, 11 insertions, 3 deletions
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;