i18npool/source/localedata/LocaleNode.cxx |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

New commits:
commit f672c8cc0d5227ab3484e20322f20dd4ee35ed96
Author: Eike Rathke <er...@redhat.com>
Date:   Fri Jun 5 14:10:31 2015 +0200

    ensure engineering notation format is present
    
    We could generate that in the number formatter, but as long as we don't ...
    
    Change-Id: Icbbad4215fdf7f3a94f652c27cb2f9b04205b519

diff --git a/i18npool/source/localedata/LocaleNode.cxx 
b/i18npool/source/localedata/LocaleNode.cxx
index d088dbe..29adfab 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 ");
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to