summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorLaurent Balland-Poirier <laurent.balland-poirier@laposte.net>2016-07-06 00:10:38 +0200
committerEike Rathke <erack@redhat.com>2016-07-15 19:34:45 +0000
commitd32dab699f6584a13eb10fc1eb2801423ef52fb2 (patch)
treec47aa88941438b6a7b7450c7cb801740d19d6268 /xmloff
parent7e70b938618a49c4130502421d6909a2a3871579 (diff)
tdf#100755 Allow '0' for denominator symbol
Fraction number format Accept '0' in numerator and denominator format: 0 0/0 Represent integer 3 as: 3 0/1 Load and save format to Excel As it cannot (yet) be saved in ODF, replace 0 by ? during save to ODF Change-Id: I4721a751431d3f9b903b369d199146ddfb76b43d Reviewed-on: https://gerrit.libreoffice.org/27062 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/style/xmlnumfe.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index 3fd0d5cd84e1..70ac9958abc6 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -731,13 +731,14 @@ void SvXMLNumFmtExport::WriteFractionElement_Impl(
{
FinishTextElement_Impl();
sal_Int32 nMaxNumeratorDigits = aNumeratorString.getLength();
- sal_Int32 nMinNumeratorDigits = aNumeratorString.indexOf('?');
+ // As '0' cannot (yet) be saved in extended ODF, replace them by '?'
+ sal_Int32 nMinNumeratorDigits = aNumeratorString.replaceAll("0","?").indexOf('?');
if ( nMinNumeratorDigits >= 0 )
nMinNumeratorDigits = nMaxNumeratorDigits - nMinNumeratorDigits;
else
nMinNumeratorDigits = 0;
sal_Int32 nMaxDenominatorDigits = aDenominatorString.getLength();
- sal_Int32 nMinDenominatorDigits = aDenominatorString.indexOf('?');
+ sal_Int32 nMinDenominatorDigits = aDenominatorString.replaceAll("0","?").indexOf('?');
if ( nMinDenominatorDigits >= 0 )
nMinDenominatorDigits = nMaxDenominatorDigits - nMinDenominatorDigits;
else