diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx index 0289e8edaa4c..52a0deb3b10f 100644 --- a/include/svl/zformat.hxx +++ b/include/svl/zformat.hxx @@ -273,6 +273,8 @@ public: } return false; } + /** Get the count of numbers among string elements **/ + sal_uInt16 GetNumForNumberElementCount( sal_uInt16 nNumFor ) const; /** Get the scanned type of the specified subformat. */ short GetNumForInfoScannedType( sal_uInt16 nNumFor ) const diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 935176bdca5d..8da58b524b61 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -5059,6 +5059,16 @@ sal_Int32 SvNumberformat::GetQuoteEnd( const OUString& rStr, sal_Int32 nPos, return nLen; // End of String } +sal_uInt16 SvNumberformat::GetNumForNumberElementCount( sal_uInt16 nNumFor ) const +{ + if ( nNumFor < 4 ) + { + sal_uInt16 nAnz = NumFor[nNumFor].GetCount(); + return nAnz - ImpGetNumForStringElementCount( nNumFor ); + } + return 0; +} + sal_uInt16 SvNumberformat::ImpGetNumForStringElementCount( sal_uInt16 nNumFor ) const { sal_uInt16 nCnt = 0; diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index 3070831b1e40..e449133d5c75 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -1456,9 +1456,9 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt case css::util::NumberFormat::FRACTION: { sal_Int32 nInteger = nLeading; - if ( pElemStr && (*pElemStr)[0] == '?' ) + if ( rFormat.GetNumForNumberElementCount( nPart ) == 3 ) { - // If the first digit character is a question mark, + // If there is only two numbers + fraction in format string // the fraction doesn't have an integer part, and no // min-integer-digits attribute must be written. nInteger = -1;