summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-07-11 02:52:42 +0200
committerEike Rathke <erack@redhat.com>2015-07-11 03:08:40 +0200
commitdad6be8af0e670a56d3d399a1b0a35859bd7b093 (patch)
tree1069d0c4670fd3c1db07297d8185427a1416580f /svl
parent934e35c62525a7541e6a5b2d05b557a6fcc35abb (diff)
write trailing text subformat also to Excel .xls and .xlsx, tdf#92457
... without generating 0;;;@ from 0;@ that has different semantics. Introduce css::util::NumberFormat::EMPTY to properly flag empty subformats and distinguish from UNDEFINED, everything else would be an ugly hack. SvNumberformat::GetMappedFormatstring() now correctly supports the trailing text subformat, so exports using it should get that automatically. Change-Id: If9a1bcc5ec5dfcf46688035e2b1428ab4747a68d
Diffstat (limited to 'svl')
-rw-r--r--svl/source/numbers/zformat.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index c6450347997e..03c2078b770e 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -893,7 +893,8 @@ SvNumberformat::SvNumberformat(OUString& rString,
}
if (sStr.isEmpty())
{
- // empty sub format
+ // Empty sub format.
+ NumFor[nIndex].Info().eScannedType = css::util::NumberFormat::EMPTY;
}
else
{
@@ -2202,7 +2203,7 @@ bool SvNumberformat::GetOutputString(double fNumber,
*ppColor = NumFor[nIx].GetColor();
const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
const sal_uInt16 nAnz = NumFor[nIx].GetCount();
- if (nAnz == 0 && rInfo.eScannedType == css::util::NumberFormat::UNDEFINED)
+ if (nAnz == 0 && rInfo.eScannedType == css::util::NumberFormat::EMPTY)
{
return false; // Empty => nothing
}
@@ -4722,7 +4723,7 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
eOp1 == NUMBERFORMAT_OP_GE && fLimit1 == 0.0 &&
eOp2 == NUMBERFORMAT_OP_NO && fLimit2 == 0.0 );
// with 3 or more subformats [>0];[<0];[=0] is implied if no condition specified,
- // note that subformats may be empty (;;;) and NumFor[2].GetnAnz()>0 is not checked.
+ // note that subformats may be empty (;;;) and NumFor[2].GetCount()>0 is not checked.
bDefault[2] = ( !bDefault[0] && !bDefault[1] &&
eOp1 == NUMBERFORMAT_OP_GT && fLimit1 == 0.0 &&
eOp2 == NUMBERFORMAT_OP_LT && fLimit2 == 0.0 );
@@ -4762,7 +4763,7 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
int nSub = 0; // subformats delimited so far
for ( int n=0; n<4; n++ )
{
- if ( n > 0 )
+ if ( n > 0 && NumFor[n].Info().eScannedType != css::util::NumberFormat::UNDEFINED )
{
nSem++;
}