diff options
author | Eike Rathke <erack@redhat.com> | 2015-06-05 14:10:31 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-08-06 12:21:58 +0200 |
commit | d862e2564ee1f808b19d626a7e21b5b3efa933d4 (patch) | |
tree | 503c2d74fb5cc5948b0ea319969322067fa5c908 /i18npool | |
parent | f31a9365c3f80a4a88ac79b07e2e624253f33ee3 (diff) |
ensure engineering notation format is present
We could generate that in the number formatter, but as long as we don't ...
Change-Id: Icbbad4215fdf7f3a94f652c27cb2f9b04205b519
(cherry picked from commit f672c8cc0d5227ab3484e20322f20dd4ee35ed96)
Diffstat (limited to 'i18npool')
-rw-r--r-- | i18npool/source/localedata/LocaleNode.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index 8ef4149c709a..89325aeaf0ba 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -659,6 +659,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const ValueSet aFormatIndexSet; NameSet aDefaultsSet; bool bCtypeIsRef = false; + bool bHaveEngineering = false; for (sal_Int16 i = 0; i< getNumberOfChildren() ; i++, formatCount++) { @@ -805,6 +806,20 @@ void LCFormatNode::generateCode (const OFileWriter &of) const incErrorInt( "Error: [CURRENCY] replaceTo not found for formatindex=\"%d\".\n", formatindex); } break; + default: + if (aUsage == "SCIENTIFIC_NUMBER") + { + // Check for presence of ##0.00E+00 + OUString aCode( n->getValue()); + // Simple check without decimal separator (assumed to + // be one UTF-16 character). May be prefixed with + // [NatNum1] or other tags. + sal_Int32 nInt = aCode.indexOf("##0"); + sal_Int32 nDec = (nInt < 0 ? -1 : aCode.indexOf("00E+00", nInt)); + if (nInt >= 0 && nDec == nInt+4) + bHaveEngineering = true; + } + break; } if (pCtype) { @@ -947,6 +962,9 @@ void LCFormatNode::generateCode (const OFileWriter &of) const ; // nothing } } + + if (!bHaveEngineering) + incError("Engineering notation format not present, e.g. ##0.00E+00 or ##0,00E+00 for usage=\"SCIENTIFIC_NUMBER\"\n"); } of.writeAsciiString("\nstatic const sal_Int16 "); |