[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - oox/source

Matúš Kukan matus.kukan at collabora.com
Sun Aug 10 23:32:59 PDT 2014


 oox/source/drawingml/chart/objectformatter.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 5387fc2f3935c685e58c0c98b1e9444b80a7015b
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Tue Jul 29 07:53:22 2014 +0200

    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 at redhat.com>
    Tested-by: David Tardon <dtardon at redhat.com>

diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx
index d406ce9..54b41cc 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 );
         }


More information about the Libreoffice-commits mailing list