summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-09-04 11:18:49 +0200
committerEike Rathke <erack@redhat.com>2017-09-04 11:19:28 +0200
commit8cb3faca4b1d1d9c68faba103c6c6117853e639e (patch)
tree40634f17f621b96b613c39c2ff65ca1f6d1060d1 /svl
parentde0993097cad2fd5819f8bea5ff53cddce7cde41 (diff)
Resolves: tdf#52510 handle trailing ';' specifying empty following subformat
Change-Id: Ic84065f11619542fe735f45e72c9303897ea5755
Diffstat (limited to 'svl')
-rw-r--r--svl/source/numbers/zformat.cxx22
1 files changed, 20 insertions, 2 deletions
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 65f06418d1df..d40c7d977f17 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -1175,8 +1175,26 @@ SvNumberformat::SvNumberformat(OUString& rString,
}
if (sBuff.getLength() == nPos)
{
- if ( nIndex == 2 && eSymbolType == BRACKET_SYMBOLTYPE_FORMAT &&
- sBuff[nPos - 1] == ';' )
+ if (nIndex < 3 && rString[rString.getLength()-1] == ';')
+ {
+ // A trailing ';' is significant and specifies the following
+ // subformat to be empty. We don't enter the scanning loop
+ // above again though.
+ // Note that the operators apply to the current last scanned
+ // subformat.
+ if (nIndex == 0 && eOp1 == NUMBERFORMAT_OP_NO)
+ {
+ eOp1 = NUMBERFORMAT_OP_GT; // undefined condition, default: > 0
+ }
+ else if (nIndex == 1 && eOp2 == NUMBERFORMAT_OP_NO)
+ {
+ eOp2 = NUMBERFORMAT_OP_LT; // undefined condition, default: < 0
+ }
+ NumFor[nIndex+1].Info().eScannedType = css::util::NumberFormat::EMPTY;
+ if (sBuff[nPos-1] != ';')
+ sBuff.insert( nPos++, ';');
+ }
+ if (nIndex == 2 && eSymbolType == BRACKET_SYMBOLTYPE_FORMAT && sBuff[nPos-1] == ';')
{
// #83510# A 4th subformat explicitly specified to be empty
// hides any text. Need the type here for HasTextFormat()