summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-09-04 11:18:49 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2017-09-15 21:18:58 +0200
commit8a398429cd7b8369af360def49989623176cd233 (patch)
tree724dbf22af9e1698652ed7f773df0dbf04d71923 /svl
parent09b4b50ef5bfe1b7d963ae70071d4e8ce20f361d (diff)
Resolves: tdf#52510 handle trailing ';' specifying empty following subformat
Change-Id: Ic84065f11619542fe735f45e72c9303897ea5755 (cherry picked from commit 8cb3faca4b1d1d9c68faba103c6c6117853e639e) Reviewed-on: https://gerrit.libreoffice.org/41878 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
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 734af6294825..361fe5c40571 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -1189,8 +1189,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()