diff options
author | Eike Rathke <erack@redhat.com> | 2016-08-10 18:33:41 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-08-19 00:15:05 +0000 |
commit | 96a8c73a44ff26e60b90fe59461af880a0c7c025 (patch) | |
tree | 398fa10370d418ae6373f0486033b4bed5e8d4f5 | |
parent | 0db37afc551e7e7be04dfb3a7efe7a1e5e327f2f (diff) |
XML number format: do not enquote space followed by minus, tdf#97837 follow-up
Which with
[$kr.-406] #.##0,00;[RED][$kr.-406] -#.##0,00
saved and reloaded gave
[$kr.-406] #.##0,00;[RED][$kr.-406]" -"#.##0,00
and thus an almost identical duplicated format with the built-in format.
Change-Id: Ie39b97576842bc29ac301d2fe64f7331f6c57fc4
(cherry picked from commit 4d993ae8f267e35f7c030861a92226c940bb46cc)
Reviewed-on: https://gerrit.libreoffice.org/28041
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
-rw-r--r-- | xmloff/source/style/xmlnumfi.cxx | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index 9ea4e74e5d3d..3120bea98a99 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -792,14 +792,16 @@ static void lcl_EnquoteIfNecessary( OUStringBuffer& rContent, const SvXMLNumForm bool bQuote = true; sal_Int32 nLength = rContent.getLength(); - if ( ( nLength == 1 && - lcl_ValidChar( rContent[0], rParent ) ) || - ( nLength == 2 && - lcl_ValidChar( rContent[0], rParent ) && - rContent[1] == ' ' ) ) + if ((nLength == 1 && lcl_ValidChar( rContent[0], rParent)) || + (nLength == 2 && + ((rContent[0] == ' ' && rContent[1] == '-') || + (rContent[1] == ' ' && lcl_ValidChar( rContent[0], rParent))))) { - // don't quote single separator characters like space or percent, - // or separator characters followed by space (used in date formats) + // Don't quote single separator characters like space or percent, + // or separator characters followed by space (used in date formats). + // Or space followed by minus (used in currency formats) that would + // lead to almost duplicated formats with built-in formats just with + // the difference of quotes. bQuote = false; } else if ( rParent.GetType() == XML_TOK_STYLES_PERCENTAGE_STYLE && nLength > 1 ) |