summaryrefslogtreecommitdiff
path: root/xmloff/source/style/xmlnumfi.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff/source/style/xmlnumfi.cxx')
-rw-r--r--xmloff/source/style/xmlnumfi.cxx32
1 files changed, 16 insertions, 16 deletions
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 618232990c96..bedd13bebcf6 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -457,7 +457,7 @@ SvXMLNumFmtEmbeddedTextContext::SvXMLNumFmtEmbeddedTextContext( SvXMLImport& rIm
{
if ( aIter.getToken() == XML_ELEMENT(NUMBER, XML_POSITION) )
{
- if (::sax::Converter::convertNumber( nAttrVal, aIter.toView(), 0 ))
+ if (::sax::Converter::convertNumber( nAttrVal, aIter.toView() ))
nTextPosition = nAttrVal;
}
else
@@ -1707,8 +1707,8 @@ void SvXMLNumFormatContext::AddNumber( const SvXMLNumberInfo& rInfo )
bool bGrouping = rInfo.bGrouping;
size_t const nEmbeddedCount = rInfo.m_EmbeddedElements.size();
- if ( nEmbeddedCount )
- bGrouping = false; // grouping and embedded characters can't be used together
+ if ( nEmbeddedCount && rInfo.m_EmbeddedElements.rbegin()->first > 0 )
+ bGrouping = false; // grouping and embedded characters in integer part can't be used together
sal_uInt32 nStdIndex = pFormatter->GetStandardIndex( nFormatLang );
OUStringBuffer aNumStr(pFormatter->GenerateFormat( nStdIndex, nFormatLang,
@@ -1746,10 +1746,21 @@ void SvXMLNumFormatContext::AddNumber( const SvXMLNumberInfo& rInfo )
}
}
+ if ( ( rInfo.bDecReplace || rInfo.nMinDecimalDigits < rInfo.nDecimals ) && nPrec ) // add decimal replacement (dashes)
+ {
+ // add dashes for explicit decimal replacement, # or ? for variable decimals
+ sal_Unicode cAdd = rInfo.bDecReplace ? '-' : ( rInfo.bDecAlign ? '?': '#' );
+
+ if ( rInfo.nMinDecimalDigits == 0 )
+ aNumStr.append( pData->GetLocaleData( nFormatLang ).getNumDecimalSep() );
+ for ( sal_uInt16 i=rInfo.nMinDecimalDigits; i<nPrec; i++)
+ aNumStr.append( cAdd );
+ }
+
if ( nEmbeddedCount )
{
// insert embedded strings into number string
- // only the integer part is supported
+ // support integer (position >=0) and decimal (position <0) part
// nZeroPos is the string position where format position 0 is inserted
sal_Int32 nZeroPos = aNumStr.indexOf( pData->GetLocaleData( nFormatLang ).getNumDecimalSep() );
@@ -1778,7 +1789,7 @@ void SvXMLNumFormatContext::AddNumber( const SvXMLNumberInfo& rInfo )
{
sal_Int32 const nFormatPos = it.first;
sal_Int32 nInsertPos = nZeroPos - nFormatPos;
- if ( nFormatPos >= 0 && nInsertPos >= 0 )
+ if ( nInsertPos >= 0 )
{
// #107805# always quote embedded strings - even space would otherwise
// be recognized as thousands separator in French.
@@ -1792,17 +1803,6 @@ void SvXMLNumFormatContext::AddNumber( const SvXMLNumberInfo& rInfo )
aFormatCode.append( aNumStr );
- if ( ( rInfo.bDecReplace || rInfo.nMinDecimalDigits < rInfo.nDecimals ) && nPrec ) // add decimal replacement (dashes)
- {
- // 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() );
- for ( sal_uInt16 i=rInfo.nMinDecimalDigits; i<nPrec; i++)
- aFormatCode.append( cAdd );
- }
-
// add extra thousands separators for display factor
if (rInfo.fDisplayFactor == 1.0 || rInfo.fDisplayFactor <= 0.0)