summaryrefslogtreecommitdiff
path: root/oox/source/drawingml/chart
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-07-29 07:53:22 +0200
committerDavid Tardon <dtardon@redhat.com>2014-08-11 06:32:40 +0000
commit5387fc2f3935c685e58c0c98b1e9444b80a7015b (patch)
tree7a6c521ae44aa769a5e4d40b3ecf30f00c047b7a /oox/source/drawingml/chart
parent9799a623161f43a0ca0c7a4806416ce466b558a6 (diff)
bnc#862510: PPTX import: Properly show data labels in percent format.
Usually, "General" is "0.00" number format, but in this case, when we want to show percent value, MSO writes that instead of "0%". Change-Id: I748719765f58e66f9f3fb43c2b527c6823ef6fa1 (cherry picked from commit 5f47e319428a703ea53ce49d166e7628aaa60789) Reviewed-on: https://gerrit.libreoffice.org/10779 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'oox/source/drawingml/chart')
-rw-r--r--oox/source/drawingml/chart/objectformatter.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx
index d406ce924621..54b41ccfd3dc 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -1135,9 +1135,12 @@ void ObjectFormatter::convertNumberFormat( PropertySet& rPropSet, const NumberFo
sal_Int32 nPropId = bPercentFormat ? PROP_PercentageNumberFormat : PROP_NumberFormat;
try
{
- sal_Int32 nIndex = rNumberFormat.maFormatCode.equalsIgnoreAsciiCase("general") ?
+ bool bGeneral = rNumberFormat.maFormatCode.equalsIgnoreAsciiCase("general");
+ sal_Int32 nIndex = bGeneral && !bPercentFormat ?
mxData->mxNumTypes->getStandardIndex( mxData->maFromLocale ) :
- mxData->mxNumFmts->addNewConverted( rNumberFormat.maFormatCode, mxData->maEnUsLocale, mxData->maFromLocale );
+ mxData->mxNumFmts->addNewConverted(
+ bGeneral ? OUString("0%") : rNumberFormat.maFormatCode,
+ mxData->maEnUsLocale, mxData->maFromLocale );
if( nIndex >= 0 )
rPropSet.setProperty( nPropId, nIndex );
}