diff options
author | Eike Rathke <erack@redhat.com> | 2015-06-05 14:10:31 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2015-06-05 14:11:38 +0200 |
commit | f672c8cc0d5227ab3484e20322f20dd4ee35ed96 (patch) | |
tree | fcd73d7c167abc942ffdc676c8505a54a1ce0dff /i18npool | |
parent | 0aed9cbb6c6e8e048a90fed61f44efbe09efac4f (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
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 d088dbe2b0d8..29adfabcea6d 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_Int32 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 "); |