summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-06-02 22:42:05 +0200
committerEike Rathke <erack@redhat.com>2017-06-02 23:07:52 +0200
commite3c73fea1a65d42744f60df3f95b047459cf01e0 (patch)
treef2eb2fd650755632875b78bc2aadc3526a2c5dd5 /sc
parent9c9109c6e09890ac6f6596cdfbe3b6e1f7cfded7 (diff)
Add parentheses only for functions and operators
Change-Id: Ifdd3b0644c54b93f32e93b9448a4364475027a00
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/parclass.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/sc/source/core/tool/parclass.cxx b/sc/source/core/tool/parclass.cxx
index f53a91895ee7..8da7305aa7cc 100644
--- a/sc/source/core/tool/parclass.cxx
+++ b/sc/source/core/tool/parclass.cxx
@@ -539,13 +539,14 @@ void ScParameterClassification::GenerateDocumentation()
if ( !xMap->getSymbol(eOp).isEmpty() )
{
OUStringBuffer aStr(xMap->getSymbol(eOp));
- aStr.append('(');
formula::FormulaByteToken aToken( eOp);
sal_uInt8 nParams = GetMinimumParameters( eOp);
// preset parameter count according to opcode value, with some
// special handling
+ bool bAddParentheses = true;
if ( eOp < SC_OPCODE_STOP_DIV )
{
+ bAddParentheses = false; // will be overridden below if parameters
switch ( eOp )
{
case ocIf:
@@ -563,7 +564,10 @@ void ScParameterClassification::GenerateDocumentation()
}
}
else if ( eOp < SC_OPCODE_STOP_ERRORS )
+ {
+ bAddParentheses = false;
aToken.SetByte(0);
+ }
else if ( eOp < SC_OPCODE_STOP_BIN_OP )
{
switch ( eOp )
@@ -592,6 +596,10 @@ void ScParameterClassification::GenerateDocumentation()
aToken.SetByte( nParams);
if ( nParams != aToken.GetParamCount() )
SAL_WARN("sc.core", "(parameter count differs, token ParamCount: " << (int)aToken.GetParamCount() << " classification: " << (int)nParams << ") ");
+ if (aToken.GetByte())
+ bAddParentheses = true;
+ if (bAddParentheses)
+ aStr.append('(');
for ( sal_uInt16 j=0; j < nParams; ++j )
{
if ( j > 0 )
@@ -625,7 +633,8 @@ void ScParameterClassification::GenerateDocumentation()
aStr.append(", ...");
if ( nParams )
aStr.append(' ');
- aStr.append(')');
+ if (bAddParentheses)
+ aStr.append(')');
switch ( eOp )
{
case ocRRI: