tdf#31449 Correctly test if fraction has no integer part
Test if fraction format has no integer part is modified to take into account all cases: ??/?? or ##/## and do not detect false positive like ? ??/?? Change-Id: Ia8677a5ad496e5df56ce6bf1290323555e46ba0a Reviewed-on: https://gerrit.libreoffice.org/24540 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
This commit is contained in:
parent
bf95f4f0ce
commit
3beb146b34
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user