diff options
author | Laurent Balland-Poirier <laurent.balland-poirier@laposte.net> | 2015-12-30 23:32:15 +0100 |
---|---|---|
committer | jan iversen <jani@documentfoundation.org> | 2016-01-11 13:21:43 +0000 |
commit | 3ee66e306cf0ca9c2b56de26c28e8130d7b72f64 (patch) | |
tree | 2874d829b407bf120061462fc8362ed797bc415e /xmloff/source/style/xmlnumfi.cxx | |
parent | 3ba1b60c97b342c13593d37ccf2b97a919808dfc (diff) |
tdf#40517 Export/Import in ODF decimal replacement with space
Number format such as "0.???" is saved in ODF with number:decimal-replacement=" "
Change-Id: I0dd19b5ea126f380bcf17a3ccc5d8c355119e23b
Reviewed-on: https://gerrit.libreoffice.org/21021
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
Diffstat (limited to 'xmloff/source/style/xmlnumfi.cxx')
-rw-r--r-- | xmloff/source/style/xmlnumfi.cxx | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index b4a79ea63cb4..8200fd0dcbfb 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -102,6 +102,7 @@ struct SvXMLNumberInfo bool bGrouping; bool bDecReplace; bool bExpSign; + bool bDecAlign; double fDisplayFactor; std::map<sal_Int32, OUString> m_EmbeddedElements; @@ -109,7 +110,7 @@ struct SvXMLNumberInfo { nDecimals = nInteger = nExpDigits = nExpInterval = nNumerDigits = nDenomDigits = nFracDenominator = nMinDecimalDigits = -1; - bGrouping = bDecReplace = false; + bGrouping = bDecReplace = bDecAlign = false; bExpSign = true; fDisplayFactor = 1.0; } @@ -940,10 +941,16 @@ SvXMLNumFmtElementContext::SvXMLNumFmtElementContext( SvXMLImport& rImport, aNumInfo.fDisplayFactor = fAttrDouble; break; case XML_TOK_ELEM_ATTR_DECIMAL_REPLACEMENT: - if ( !sValue.isEmpty() ) - aNumInfo.bDecReplace = true; // only a default string is supported + if ( sValue == " " ) + { + aNumInfo.bDecAlign = true; // space replacement for "?" + bVarDecimals = true; + } else - bVarDecimals = true; // empty replacement string: variable decimals + if ( sValue.isEmpty() ) + bVarDecimals = true; // empty replacement string: variable decimals + else // all other strings + aNumInfo.bDecReplace = true; // decimal replacement with dashes break; case XML_TOK_ELEM_ATTR_MIN_EXPONENT_DIGITS: if (::sax::Converter::convertNumber( nAttrVal, sValue, 0 )) @@ -1876,8 +1883,8 @@ void SvXMLNumFormatContext::AddNumber( const SvXMLNumberInfo& rInfo ) if ( ( rInfo.bDecReplace || rInfo.nMinDecimalDigits < rInfo.nDecimals ) && nPrec ) // add decimal replacement (dashes) { - // add dashes for explicit decimal replacement, # for variable decimals - sal_Unicode cAdd = rInfo.bDecReplace ? '-' : '#'; + // add dashes for explicit decimal replacement, # or ? for variable decimals + sal_Unicode cAdd = rInfo.bDecReplace ? '-' : ( rInfo.bDecAlign ? '?': '#' ); if ( rInfo.nMinDecimalDigits == 0 ) aFormatCode.append( pData->GetLocaleData( nFormatLang ).getNumDecimalSep() ); |