diff options
author | Laurent Balland-Poirier <laurent.balland-poirier@laposte.net> | 2015-03-22 22:01:53 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2015-04-27 23:24:30 +0000 |
commit | 38992b419a4655eba9b85d337edbb208fd2fff95 (patch) | |
tree | 5cbab5180769e0fc3ed069d32238cb7bb18a91fd /xmloff/source/style/xmlnumfe.cxx | |
parent | ac885af343aa4f4536cf029655826b12fd9c4340 (diff) |
tdf#90133 Extend ODF: exponent sign of scientific format
Scientific Format without sign in exponent, such as 0.00E0,
are managed by LibO, and can be saved in XLS format
This commit allows to save in ODF
Change-Id: Ia0c4589e2af942543ea296f970d163bc1d1d6f05
Reviewed-on: https://gerrit.libreoffice.org/14955
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'xmloff/source/style/xmlnumfe.cxx')
-rw-r--r-- | xmloff/source/style/xmlnumfe.cxx | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index 91c78e45e486..2c0bab4f7352 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -634,7 +634,7 @@ void SvXMLNumFmtExport::WriteNumberElement_Impl( void SvXMLNumFmtExport::WriteScientificElement_Impl( sal_Int32 nDecimals, sal_Int32 nInteger, - bool bGrouping, sal_Int32 nExp, sal_Int32 nExpInterval ) + bool bGrouping, sal_Int32 nExp, sal_Int32 nExpInterval, bool bExpSign ) { FinishTextElement_Impl(); @@ -679,6 +679,16 @@ void SvXMLNumFmtExport::WriteScientificElement_Impl( } } + // exponent sign + if ( bExpSign ) + { + rExport.AddAttribute( XML_NAMESPACE_LO_EXT, XML_EXPONENT_SIGN, XML_TRUE ); + } + else + { + rExport.AddAttribute( XML_NAMESPACE_LO_EXT, XML_EXPONENT_SIGN, XML_FALSE ); + } + SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, XML_SCIENTIFIC_NUMBER, true, false ); @@ -1162,6 +1172,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt bool bExpFound = false; bool bCurrFound = false; bool bInInteger = true; + bool bExpSign = true; sal_Int32 nExpDigits = 0; sal_Int32 nIntegerSymbols = 0; // for embedded-text, including "#" sal_Int32 nTrailingThousands = 0; // thousands-separators after all digits @@ -1204,6 +1215,8 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt case NF_SYMBOLTYPE_EXP: bExpFound = true; // following digits are exponent digits bInInteger = false; + if ( pElemStr && pElemStr->getLength() == 1 ) + bExpSign = false; // for 0.00E0 break; case NF_SYMBOLTYPE_CURRENCY: bCurrFound = true; @@ -1415,7 +1428,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt // #i43959# for scientific numbers, count all integer symbols ("0" and "#") // as integer digits: use nIntegerSymbols instead of nLeading // nIntegerSymbols represents exponent interval (for engineering notation) - WriteScientificElement_Impl( nPrecision, nLeading, bThousand, nExpDigits, nIntegerSymbols ); + WriteScientificElement_Impl( nPrecision, nLeading, bThousand, nExpDigits, nIntegerSymbols, bExpSign ); bAnyContent = true; break; case css::util::NumberFormat::FRACTION: |