[Libreoffice-commits] core.git: 7 commits - chart2/qa include/oox offapi/com oox/source writerfilter/source

Markus Mohrhard markus.mohrhard at googlemail.com
Sat Apr 18 22:25:06 PDT 2015


 chart2/qa/extras/chart2export.cxx                        |   37 +++++++++++++++
 chart2/qa/extras/data/xlsx/data_label.xlsx               |binary
 include/oox/core/xmlfilterbase.hxx                       |    3 +
 include/oox/export/chartexport.hxx                       |    2 
 offapi/com/sun/star/xml/sax/XFastShapeContextHandler.idl |    4 +
 oox/source/core/xmlfilterbase.cxx                        |   21 +++-----
 oox/source/drawingml/chart/seriesconverter.cxx           |   31 +++++++-----
 oox/source/export/chartexport.cxx                        |   36 ++++++++++++++
 oox/source/shape/ShapeContextHandler.cxx                 |   13 +++++
 oox/source/shape/ShapeContextHandler.hxx                 |    7 ++
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx    |    2 
 11 files changed, 130 insertions(+), 26 deletions(-)

New commits:
commit 316f1505f1e0b1820c51913a11ae00b86a43cc13
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Apr 19 06:12:53 2015 +0200

    add test case for data label default value import, related tdf#74886
    
    Change-Id: I7792f542204f9813f3e36a49924da17f7abd14ea

diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 01b8bc1..1b4b0a3 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -18,6 +18,7 @@
 #include <com/sun/star/text/XTextDocument.hpp>
 #include <com/sun/star/text/XTextFramesSupplier.hpp>
 #include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/chart2/DataPointLabel.hpp>
 
 #include <unotools/ucbstreamhelper.hxx>
 #include <rtl/strbuf.hxx>
@@ -85,6 +86,7 @@ public:
     void testMarkerColorXLSX();
     void testRoundedCornersXLSX();
     void testAxisNumberFormatXLSX();
+    void testDataLabelDefaultValuesXLSX();
 
     CPPUNIT_TEST_SUITE(Chart2ExportTest);
     CPPUNIT_TEST(test);
@@ -135,6 +137,7 @@ public:
     CPPUNIT_TEST(testMarkerColorXLSX);
     CPPUNIT_TEST(testRoundedCornersXLSX);
     CPPUNIT_TEST(testAxisNumberFormatXLSX);
+    CPPUNIT_TEST(testDataLabelDefaultValuesXLSX);
     CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -1256,6 +1259,23 @@ void Chart2ExportTest::testAxisNumberFormatXLSX()
     assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[2]/c:numFmt", "sourceLinked", "1");
 }
 
+void Chart2ExportTest::testDataLabelDefaultValuesXLSX()
+{
+    load("/chart2/qa/extras/data/xlsx/", "data_label.xlsx");
+    Reference< chart2::XChartDocument> xDoc = getChartDocFromSheet(0, mxComponent);
+    Reference<chart2::XDataSeries> xSeries = getDataSeriesFromDoc(xDoc, 0);
+    Reference<beans::XPropertySet> xPropSet(xSeries, uno::UNO_QUERY_THROW);
+    uno::Any aAny = xPropSet->getPropertyValue("Label");
+    chart2::DataPointLabel aLabel;
+    CPPUNIT_ASSERT(aAny >>= aLabel);
+    CPPUNIT_ASSERT(aLabel.ShowNumber);
+
+    xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+    CPPUNIT_ASSERT(pXmlDoc);
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:showVal", "val", "1");
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLblPos", "val", "outEnd");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/data_label.xlsx b/chart2/qa/extras/data/xlsx/data_label.xlsx
new file mode 100644
index 0000000..1ccf9b6
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/data_label.xlsx differ
commit 914b4fb5a3c159bfd7cd8be2639185144f11d7ed
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Apr 19 02:59:39 2015 +0200

    import chart MSO 2007 streams correctly for docx files, tdf#82216
    
    Change-Id: Icda809faf315dac5953d38781b2b401d51f7a40a

diff --git a/include/oox/core/xmlfilterbase.hxx b/include/oox/core/xmlfilterbase.hxx
index d522fd6..9a8203e 100644
--- a/include/oox/core/xmlfilterbase.hxx
+++ b/include/oox/core/xmlfilterbase.hxx
@@ -236,6 +236,9 @@ public:
 
     bool isMSO2007Document() const;
 
+    void checkDocumentProperties(
+            com::sun::star::uno::Reference<com::sun::star::document::XDocumentProperties> xDocProps);
+
 protected:
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
         implGetInputStream( utl::MediaDescriptor& rMediaDesc ) const SAL_OVERRIDE;
diff --git a/offapi/com/sun/star/xml/sax/XFastShapeContextHandler.idl b/offapi/com/sun/star/xml/sax/XFastShapeContextHandler.idl
index de14155..a15ae8d 100644
--- a/offapi/com/sun/star/xml/sax/XFastShapeContextHandler.idl
+++ b/offapi/com/sun/star/xml/sax/XFastShapeContextHandler.idl
@@ -24,6 +24,7 @@
 #include <com/sun/star/drawing/XDrawPage.idl>
 #include <com/sun/star/frame/XModel.idl>
 #include <com/sun/star/io/XInputStream.idl>
+#include <com/sun/star/document/XDocumentProperties.idl>
 
 
 module com {  module sun {  module star {  module xml {  module sax {
@@ -43,6 +44,7 @@ interface XFastShapeContextHandler: com::sun::star::xml::sax::XFastContextHandle
     [attribute] string RelationFragmentPath;
     [attribute] long StartToken;
     [attribute] com::sun::star::awt::Point Position;
+    [attribute] com::sun::star::document::XDocumentProperties DocumentProperties;
 };
 
 
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 5597a58..4ff011a 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -223,33 +223,30 @@ XmlFilterBase::~XmlFilterBase()
     mxImpl->maFastParser.setDocumentHandler( 0 );
 }
 
-namespace {
-
-bool is2007MSODocument(Reference<XDocumentProperties> xDocProps)
+void XmlFilterBase::checkDocumentProperties(Reference<XDocumentProperties> xDocProps)
 {
+    mbMSO2007 = false;
     if (!xDocProps->getGenerator().startsWithIgnoreAsciiCase("Microsoft"))
-        return false;
+        return;
 
     uno::Reference<beans::XPropertyAccess> xUserDefProps(xDocProps->getUserDefinedProperties(), uno::UNO_QUERY);
     if (!xUserDefProps.is())
-        return false;
+        return;
 
     comphelper::SequenceAsHashMap aUserDefinedProperties(xUserDefProps->getPropertyValues());
     comphelper::SequenceAsHashMap::iterator it = aUserDefinedProperties.find("AppVersion");
     if (it == aUserDefinedProperties.end())
-        return false;
+        return;
 
     OUString aValue;
     if (!(it->second >>= aValue))
-        return false;
+        return;
 
     if (!aValue.startsWithIgnoreAsciiCase("12."))
-        return false;
+        return;
 
     SAL_WARN("oox", "a MSO 2007 document");
-    return true;
-}
-
+    mbMSO2007 = true;
 }
 
 void XmlFilterBase::importDocumentProperties()
@@ -270,7 +267,7 @@ void XmlFilterBase::importDocumentProperties()
     Reference< XDocumentPropertiesSupplier > xPropSupplier( xModel, UNO_QUERY);
     Reference< XDocumentProperties > xDocProps = xPropSupplier->getDocumentProperties();
     xImporter->importProperties( xDocumentStorage, xDocProps );
-    mbMSO2007 = is2007MSODocument(xDocProps);
+    checkDocumentProperties(xDocProps);
 }
 
 FastParser* XmlFilterBase::createParser() const
diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index e4910ad..39cc970 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -620,6 +620,19 @@ void SAL_CALL ShapeContextHandler::setPosition(const awt::Point& rPosition) thro
     maPosition = rPosition;
 }
 
+void SAL_CALL ShapeContextHandler::setDocumentProperties(const uno::Reference<document::XDocumentProperties>& xDocProps)
+    throw (css::uno::RuntimeException, std::exception)
+{
+    mxDocumentProperties = xDocProps;
+    mxFilterBase->checkDocumentProperties(mxDocumentProperties);
+}
+
+uno::Reference<document::XDocumentProperties> SAL_CALL ShapeContextHandler::getDocumentProperties()
+    throw (css::uno::RuntimeException, std::exception)
+{
+    return mxDocumentProperties;
+}
+
 OUString ShapeContextHandler::getImplementationName()
     throw (css::uno::RuntimeException, std::exception)
 {
diff --git a/oox/source/shape/ShapeContextHandler.hxx b/oox/source/shape/ShapeContextHandler.hxx
index 7697e2a..ad57ad9 100644
--- a/oox/source/shape/ShapeContextHandler.hxx
+++ b/oox/source/shape/ShapeContextHandler.hxx
@@ -30,6 +30,7 @@
 #include "oox/core/xmlfilterbase.hxx"
 #include "ShapeFilterBase.hxx"
 #include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
 
 namespace oox { namespace shape {
 
@@ -138,6 +139,11 @@ public:
     virtual css::awt::Point SAL_CALL getPosition() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     virtual void SAL_CALL setPosition(const css::awt::Point& rPosition) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
+    virtual void SAL_CALL setDocumentProperties(const css::uno::Reference<css::document::XDocumentProperties>& xDocProps)
+        throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+    virtual css::uno::Reference<css::document::XDocumentProperties> SAL_CALL getDocumentProperties()
+        throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
 private:
     ShapeContextHandler(ShapeContextHandler &) SAL_DELETED_FUNCTION;
     void operator =(ShapeContextHandler &) SAL_DELETED_FUNCTION;
@@ -159,6 +165,7 @@ private:
     css::uno::Reference<css::drawing::XShape> mxSavedShape;
     css::uno::Reference<XFastContextHandler> mxWpgContext;
     css::uno::Reference<XFastContextHandler> mxChartShapeContext;
+    css::uno::Reference<css::document::XDocumentProperties> mxDocumentProperties;
 
     core::XmlFilterRef mxFilterBase;
     drawingml::ThemePtr mpThemePtr;
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 85c5f1b..dc18eae 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1532,6 +1532,8 @@ OOXMLFastContextHandlerShape::OOXMLFastContextHandlerShape
     }
 
     mrShapeContext->setModel(getDocument()->getModel());
+    uno::Reference<document::XDocumentPropertiesSupplier> xDocSupplier(getDocument()->getModel(), uno::UNO_QUERY_THROW);
+    mrShapeContext->setDocumentProperties(xDocSupplier->getDocumentProperties());
     mrShapeContext->setDrawPage(getDocument()->getDrawPage());
     mrShapeContext->setInputStream(getDocument()->getStorageStream());
 
commit 6f969d256fdbbc0b93d7baeec089afbbea94fc0e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Apr 19 02:56:31 2015 +0200

    use correct default value for OOXML and MSO 2007, tdf#74886
    
    Change-Id: I7733e1ea08322638afe4ffda8bb535f5223cc8e1

diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx
index 7470929..d116359 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -94,7 +94,7 @@ Reference< XLabeledDataSequence > lclCreateLabeledDataSequence(
 }
 
 void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatter,
-        const DataLabelModelBase& rDataLabel, const TypeGroupConverter& rTypeGroup, bool bDataSeriesLabel )
+        const DataLabelModelBase& rDataLabel, const TypeGroupConverter& rTypeGroup, bool bDataSeriesLabel, bool bMSO2007Doc )
 {
     const TypeGroupInfo& rTypeInfo = rTypeGroup.getTypeInfo();
 
@@ -105,14 +105,17 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt
         will reset <c:showVal> for this point, unless <c:showVal> is repeated
         in the data point). The elements <c:layout>, <c:numberFormat>,
         <c:spPr>, <c:tx>, and <c:txPr> are not affected at all. */
-    bool bHasAnyElement =
-        rDataLabel.moaSeparator.has() || rDataLabel.monLabelPos.has() ||
-        rDataLabel.mobShowCatName.has() || rDataLabel.mobShowLegendKey.has() ||
-        rDataLabel.mobShowPercent.has() || rDataLabel.mobShowSerName.has() ||
-        rDataLabel.mobShowVal.has();
-
-    bool bShowValue   = !rDataLabel.mbDeleted && rDataLabel.mobShowVal.get( false );
-    bool bShowPercent = !rDataLabel.mbDeleted && rDataLabel.mobShowPercent.get( false ) && (rTypeInfo.meTypeCategory == TYPECATEGORY_PIE);
+    bool bHasAnyElement = true;
+    if (bMSO2007Doc)
+    {
+        bHasAnyElement = rDataLabel.moaSeparator.has() || rDataLabel.monLabelPos.has() ||
+            rDataLabel.mobShowCatName.has() || rDataLabel.mobShowLegendKey.has() ||
+            rDataLabel.mobShowPercent.has() || rDataLabel.mobShowSerName.has() ||
+            rDataLabel.mobShowVal.has();
+    }
+
+    bool bShowValue   = !rDataLabel.mbDeleted && rDataLabel.mobShowVal.get( !bMSO2007Doc );
+    bool bShowPercent = !rDataLabel.mbDeleted && rDataLabel.mobShowPercent.get( !bMSO2007Doc ) && (rTypeInfo.meTypeCategory == TYPECATEGORY_PIE);
     if( bShowValue &&
         !bShowPercent && rTypeInfo.meTypeCategory == TYPECATEGORY_PIE &&
         rDataLabel.maNumberFormat.maFormatCode.indexOf('%') >= 0 )
@@ -120,8 +123,8 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt
         bShowValue = false;
         bShowPercent = true;
     }
-    bool bShowCateg   = !rDataLabel.mbDeleted && rDataLabel.mobShowCatName.get( false );
-    bool bShowSymbol  = !rDataLabel.mbDeleted && rDataLabel.mobShowLegendKey.get( false );
+    bool bShowCateg   = !rDataLabel.mbDeleted && rDataLabel.mobShowCatName.get( !bMSO2007Doc );
+    bool bShowSymbol  = !rDataLabel.mbDeleted && rDataLabel.mobShowLegendKey.get( !bMSO2007Doc );
 
     // type of attached label
     if( bHasAnyElement || rDataLabel.mbDeleted )
@@ -201,8 +204,9 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat
 
     try
     {
+        bool bMSO2007Doc = getFilter().isMSO2007Document();
         PropertySet aPropSet( rxDataSeries->getDataPointByIndex( mrModel.mnIndex ) );
-        lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, false );
+        lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, false, bMSO2007Doc );
         const TypeGroupInfo& rTypeInfo = rTypeGroup.getTypeInfo();
         bool bIsPie = rTypeInfo.meTypeCategory == TYPECATEGORY_PIE;
         if( mrModel.mxLayout && !mrModel.mxLayout->mbAutoLayout && !bIsPie )
@@ -247,8 +251,9 @@ void DataLabelsConverter::convertFromModel( const Reference< XDataSeries >& rxDa
 {
     if( !mrModel.mbDeleted )
     {
+        bool bMSO2007Doc = getFilter().isMSO2007Document();
         PropertySet aPropSet( rxDataSeries );
-        lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, true );
+        lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, true, bMSO2007Doc );
 
         if (mrModel.mxShapeProp)
             // Import baseline border properties for these data labels.
commit f1a7a2c1b11737e31b7852ef12d25ad0339f2a74
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Apr 19 02:19:00 2015 +0200

    fix indentation
    
    Change-Id: I1d7fa501959758d17440edcec146724cba97535f

diff --git a/offapi/com/sun/star/xml/sax/XFastShapeContextHandler.idl b/offapi/com/sun/star/xml/sax/XFastShapeContextHandler.idl
index 5ec7c88..de14155 100644
--- a/offapi/com/sun/star/xml/sax/XFastShapeContextHandler.idl
+++ b/offapi/com/sun/star/xml/sax/XFastShapeContextHandler.idl
@@ -43,7 +43,7 @@ interface XFastShapeContextHandler: com::sun::star::xml::sax::XFastContextHandle
     [attribute] string RelationFragmentPath;
     [attribute] long StartToken;
     [attribute] com::sun::star::awt::Point Position;
-  };
+};
 
 
 }; }; }; }; };
commit eb2d47a9e1ee3a2a657d62cce318be209e934b56
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Apr 18 18:44:02 2015 +0200

    add test for axis number format export to XLSX
    
    Change-Id: I379ee890d184e3c79851bb1ea2f8b9b4de65e44c

diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index e13870c..01b8bc1 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -84,6 +84,7 @@ public:
     void testDispBlanksAsXLSX();
     void testMarkerColorXLSX();
     void testRoundedCornersXLSX();
+    void testAxisNumberFormatXLSX();
 
     CPPUNIT_TEST_SUITE(Chart2ExportTest);
     CPPUNIT_TEST(test);
@@ -133,6 +134,7 @@ public:
     CPPUNIT_TEST(testDispBlanksAsXLSX);
     CPPUNIT_TEST(testMarkerColorXLSX);
     CPPUNIT_TEST(testRoundedCornersXLSX);
+    CPPUNIT_TEST(testAxisNumberFormatXLSX);
     CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -1241,6 +1243,19 @@ void Chart2ExportTest::testRoundedCornersXLSX()
     assertXPath(pXmlDoc, "/c:chartSpace/c:roundedCorners", "val", "0");
 }
 
+void Chart2ExportTest::testAxisNumberFormatXLSX()
+{
+    load("/chart2/qa/extras/data/ods/", "axis_number_format.ods");
+    xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+    CPPUNIT_ASSERT(pXmlDoc);
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx", 2);
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[1]/c:numFmt", "formatCode", "0.00E+000");
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[1]/c:numFmt", "sourceLinked", "0");
+
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[2]/c:numFmt", "formatCode", "[$$-409]#,##0;-[$$-409]#,##0");
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[2]/c:numFmt", "sourceLinked", "1");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit fb745ece0be4e1042c940bae2df8420296fea1ee
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Apr 18 18:27:23 2015 +0200

    export axis number format to OOXML
    
    Change-Id: I1dcea725686f8224bda03913d0b0da9f743a5fb7

diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx
index ddc6087..8ac7fe6 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -181,6 +181,8 @@ private:
     void exportMissingValueTreatment(com::sun::star::uno::Reference<
             com::sun::star::beans::XPropertySet> xPropSet);
 
+    OUString getNumberFormatCode(sal_Int32 nKey) const;
+
 public:
 
     ChartExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX );
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 05f7518..92340a4 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2379,6 +2379,24 @@ void ChartExport::_exportAxis(
     if( xAxisTitle.is() )
         exportTitle( xAxisTitle );
 
+    bool bLinkedNumFmt = true;
+    if (GetProperty(xAxisProp, "LinkNumberFormatToSource"))
+        mAny >>= bLinkedNumFmt;
+
+    OUString aNumberFormatString("General");
+    if (GetProperty(xAxisProp, "NumberFormat"))
+    {
+        sal_Int32 nKey = 0;
+        mAny >>= nKey;
+        aNumberFormatString = getNumberFormatCode(nKey);
+    }
+
+    OString sNumberFormatString = OUStringToOString(aNumberFormatString, RTL_TEXTENCODING_UTF8);
+    pFS->singleElement(FSNS(XML_c, XML_numFmt),
+            XML_formatCode, sNumberFormatString.getStr(),
+            XML_sourceLinked, bLinkedNumFmt ? "1" : "0",
+            FSEND);
+
     // majorTickMark
     sal_Int32 nValue = 0;
     if(GetProperty( xAxisProp, "Marks" ) )
@@ -3382,6 +3400,21 @@ bool ChartExport::isDeep3dChart()
     return isDeep;
 }
 
+OUString ChartExport::getNumberFormatCode(sal_Int32 nKey) const
+{
+    uno::Reference<util::XNumberFormatsSupplier> xNumberFormatsSupplier(mxChartModel, uno::UNO_QUERY_THROW);
+    uno::Reference<util::XNumberFormats> xNumberFormats = xNumberFormatsSupplier->getNumberFormats();
+    uno::Reference<beans::XPropertySet> xNumberFormat = xNumberFormats->getByKey(nKey);
+
+    if (!xNumberFormat.is())
+        return OUString();
+
+    uno::Any aAny = xNumberFormat->getPropertyValue("FormatString");
+    OUString aValue;
+    aAny >>= aValue;
+    return aValue;
+}
+
 }// drawingml
 }// oox
 
commit 7bb87abc0cc7bf17af62117b65e18bc007573e6e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Apr 18 11:33:10 2015 +0200

    fix upDown bar export to OOXML
    
    We should not really export it as this leads to wrong import into MSO.
    
    Change-Id: I94897eef040af0785acb3c7615ce6f5b5a96f055

diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 4014393..e13870c 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -601,10 +601,12 @@ void Chart2ExportTest::testAreaChartLoad()
 
 void Chart2ExportTest::testUpDownBars()
 {
+    /*
     load("/chart2/qa/extras/data/docx/", "UpDownBars.docx");
     xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text");
     CPPUNIT_ASSERT(pXmlDoc);
     assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:upDownBars");
+    */
 }
 
 void Chart2ExportTest::testDoughnutChart()
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 63d7765..05f7518 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1608,6 +1608,9 @@ void ChartExport::exportHiLowLines()
 
 void ChartExport::exportUpDownBars( Reference< chart2::XChartType > xChartType)
 {
+    if(xChartType->getChartType() != "com.sun.star.chart2.CandleStickChartType")
+        return;
+
     FSHelperPtr pFS = GetFS();
     // export the chart property
     Reference< ::com::sun::star::chart::XStatisticDisplay > xChartPropProvider( mxDiagram, uno::UNO_QUERY );


More information about the Libreoffice-commits mailing list