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

Matúš Kukan matus.kukan at collabora.com
Mon Aug 11 05:25:05 PDT 2014


 oox/source/drawingml/chart/modelbase.cxx       |    3 +--
 oox/source/drawingml/chart/objectformatter.cxx |   11 ++++++++---
 oox/source/drawingml/chart/seriesconverter.cxx |    5 ++---
 3 files changed, 11 insertions(+), 8 deletions(-)

New commits:
commit 2772bb0a1997c76be47d81d67678c907b28df650
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Tue Jul 29 21:10:22 2014 +0200

    Fix some number format issues, bnc#862510
    
    Set "LinkNumberFormatToSource" to false, so that format code is not
    ignored.
    Also, do not inherit format code common for all labels, if there is
    specific format code for a data label.
    
    Change-Id: I505311d5df641d61e616e354734bd332609fa122
    (cherry picked from commit c8cc89ff802d86b1f3a69afe1b4835b7df7f70c7)
    Reviewed-on: https://gerrit.libreoffice.org/10782
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>

diff --git a/oox/source/drawingml/chart/modelbase.cxx b/oox/source/drawingml/chart/modelbase.cxx
index b349945..eadde2b 100644
--- a/oox/source/drawingml/chart/modelbase.cxx
+++ b/oox/source/drawingml/chart/modelbase.cxx
@@ -34,8 +34,7 @@ NumberFormat::NumberFormat() :
 void NumberFormat::setAttributes( const AttributeList& rAttribs )
 {
     maFormatCode = rAttribs.getString( XML_formatCode, OUString() );
-    // default is 'false', not 'true' as specified
-    mbSourceLinked = rAttribs.getBool( XML_sourceLinked, false );
+    // TODO: if XML_sourceLinked is true, <c:formatCode> should be used instead.
 }
 
 // ============================================================================
diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx
index 8e91941..a9911e7 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -1128,7 +1128,9 @@ void ObjectFormatter::convertNumberFormat( PropertySet& rPropSet, const NumberFo
                 append( OUStringToOString( rNumberFormat.maFormatCode, osl_getThreadTextEncoding() ) ).append( '\'' ).getStr() );
         }
 
-        rPropSet.setProperty(PROP_LinkNumberFormatToSource, makeAny(rNumberFormat.mbSourceLinked));
+        // Format code is ignored if "LinkNumberFormatToSource" is set to "true" :-/
+        // See AxisHelper::getExplicitNumberFormatKeyForAxis()
+        rPropSet.setProperty(PROP_LinkNumberFormatToSource, makeAny(rNumberFormat.maFormatCode.isEmpty()));
     }
 }
 
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx
index dbd3201..2cccd3a 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -234,9 +234,8 @@ void DataLabelsConverter::convertFromModel( const Reference< XDataSeries >& rxDa
     // data point label settings
     for( DataLabelsModel::DataLabelVector::iterator aIt = mrModel.maPointLabels.begin(), aEnd = mrModel.maPointLabels.end(); aIt != aEnd; ++aIt )
     {
-        (*aIt)->maNumberFormat.maFormatCode = mrModel.maNumberFormat.maFormatCode;
-        if( !mrModel.maNumberFormat.maFormatCode.isEmpty() )
-            (*aIt)->maNumberFormat.mbSourceLinked = false;
+        if ((*aIt)->maNumberFormat.maFormatCode.isEmpty())
+            (*aIt)->maNumberFormat = mrModel.maNumberFormat;
 
         DataLabelConverter aLabelConv( *this, **aIt );
         aLabelConv.convertFromModel( rxDataSeries, rTypeGroup );
commit c76daf9b5f1efc44eaf6541314f122d641c791cc
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/10781
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>

diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx
index b5b0a5b..8e91941 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -1113,9 +1113,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