diff options
author | Laurent Balland-Poirier <laurent.balland-poirier@laposte.net> | 2016-05-11 06:54:15 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-05-30 12:02:26 +0000 |
commit | 1544a26ac9f7dd60605dd21e9cbe29d490aafdce (patch) | |
tree | 708021bf17d7aef8d3e017d1eaa1321209944528 /svl | |
parent | 933a9d9245fdeceefd92fba9a5cb4db6bca92984 (diff) |
tdf#99661 Add max-denominator-value attribute to number:fraction
Add max-denominator-value attibute to <number:fraction> to comply with ODF 1.3
See https://issues.oasis-open.org/browse/OFFICE-3695
Specify loext or number according to ODF version
This value is only used to stored the number of digits in numerator.
No other values than 9, 99, 999,... are expected.
Add loext:max-numerator-digits attributes to <number:fraction>
to distinguish
??/?? and ##/## or any combination
Not saved for ODF strict
min-...-digits indicates the number of '?'
max-...-digits indicates the total number of '?' and '#'
This needs to be saved with both min-...-digits at least one
because previous versions cannot have min-...-digits of 0. See tdf#38097
Change-Id: Ibd785579aa75edc315e3bd94935a146d82bbeeef
Reviewed-on: https://gerrit.libreoffice.org/24903
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/numbers/zformat.cxx | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 0529f271979c..2f2d412ad114 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -2004,7 +2004,6 @@ void lcl_GetOutputStringScientific(double fNumber, sal_uInt16 nCharCount, nPrec, rFormatter.GetNumDecimalSep()[0], true ); } - OUString lcl_GetDenominatorString(const ImpSvNumberformatInfo &rInfo, sal_uInt16 nAnz) { sal_uInt16 i; @@ -2025,6 +2024,24 @@ OUString lcl_GetDenominatorString(const ImpSvNumberformatInfo &rInfo, sal_uInt16 return aDenominatorString.makeStringAndClear(); } +OUString lcl_GetNumeratorString(const ImpSvNumberformatInfo &rInfo, sal_uInt16 nAnz) +{ + sal_Int16 i; + OUStringBuffer aNumeratorString; + for( i = 0; i < nAnz; i++ ) + { + if( rInfo.nTypeArray[i] == NF_SYMBOLTYPE_FRAC ) + { + for( i--; i >= 0 && rInfo.nTypeArray[i] == NF_SYMBOLTYPE_DIGIT ; i-- ) + { + aNumeratorString.insert( 0, rInfo.sStrArray[i] ); + } + i = nAnz; + } + } + return aNumeratorString.makeStringAndClear(); +} + // TODO: More optimizations? void lcl_ForcedDenominator(sal_uLong &nFrac, sal_uLong &nDiv, sal_uLong nForcedDiv) { @@ -2051,6 +2068,13 @@ OUString SvNumberformat::GetDenominatorString( sal_uInt16 nNumFor ) const return lcl_GetDenominatorString( rInfo, nAnz ); } +OUString SvNumberformat::GetNumeratorString( sal_uInt16 nNumFor ) const +{ + const ImpSvNumberformatInfo& rInfo = NumFor[nNumFor].Info(); + sal_uInt16 nAnz = NumFor[nNumFor].GetCount(); + return lcl_GetNumeratorString( rInfo, nAnz ); +} + bool SvNumberformat::GetOutputString(double fNumber, sal_uInt16 nCharCount, OUString& rOutString) const { using namespace std; |