[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - include/oox oox/source sc/source sd/qa

Szymon Kłos szymon.klos at collabora.com
Tue Sep 26 10:30:37 UTC 2017


 include/oox/export/chartexport.hxx  |    3 +--
 oox/source/export/chartexport.cxx   |   10 +---------
 oox/source/export/shapes.cxx        |    2 +-
 sc/source/filter/excel/xeescher.cxx |    3 ++-
 sd/qa/unit/data/pptx/tdf112089.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |   16 ++++++++++++++++
 6 files changed, 21 insertions(+), 13 deletions(-)

New commits:
commit 38c924c55e5b4fe35c53e3b0ec6c07f4dad80320
Author: Szymon Kłos <szymon.klos at collabora.com>
Date:   Wed Sep 20 16:29:54 2017 +0200

    tdf#112089 add charts to the ShapeMap
    
    Charts weren't added to the collection what resulted
    in missing ids during export (target field).
    
    Change-Id: Ie96a4e33a52c5448342a3c3dcec0d8e8b244e270
    Reviewed-on: https://gerrit.libreoffice.org/42552
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx
index 528dc84473f5..74016281745a 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -210,10 +210,9 @@ public:
     ChartExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, css::uno::Reference< css::frame::XModel >& xModel, ::oox::core::XmlFilterBase* pFB = nullptr, DocumentType eDocumentType = DOCUMENT_PPTX );
     virtual ~ChartExport() {}
 
-    sal_Int32           GetChartID( );
     const css::uno::Reference< css::frame::XModel >& getModel(){ return mxChartModel; }
 
-    void WriteChartObj( const css::uno::Reference< css::drawing::XShape >& xShape, sal_Int32 nChartCount );
+    void WriteChartObj( const css::uno::Reference< css::drawing::XShape >& xShape, sal_Int32 nID, sal_Int32 nChartCount );
 
     void ExportContent();
     void InitRangeSegmentationProperties(
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 41faecacdbdb..b1e9368d7c7a 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -452,12 +452,6 @@ ChartExport::ChartExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, Reference< f
 {
 }
 
-sal_Int32 ChartExport::GetChartID( )
-{
-    sal_Int32 nID = GetFB()->GetUniqueId();
-    return nID;
-}
-
 sal_Int32 ChartExport::getChartType( )
 {
     OUString sChartType = mxDiagram->getDiagramType();
@@ -509,7 +503,7 @@ OUString ChartExport::parseFormula( const OUString& rRange )
     return aResult;
 }
 
-void ChartExport::WriteChartObj( const Reference< XShape >& xShape, sal_Int32 nChartCount )
+void ChartExport::WriteChartObj( const Reference< XShape >& xShape, sal_Int32 nID, sal_Int32 nChartCount )
 {
     FSHelperPtr pFS = GetFS();
 
@@ -523,8 +517,6 @@ void ChartExport::WriteChartObj( const Reference< XShape >& xShape, sal_Int32 nC
     if (xNamed.is())
         sName = xNamed->getName();
 
-    sal_Int32 nID = GetChartID();
-
     pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
                           XML_id,     I32S( nID ),
                           XML_name,   USS( sName ),
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index c9661684535e..871873c968b1 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1941,7 +1941,7 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const Reference< XShape >& xShape )
         Reference< XModel > xModel( xChartDoc, UNO_QUERY );
         ChartExport aChartExport( mnXmlNamespace, GetFS(), xModel, GetFB(), GetDocumentType() );
         static sal_Int32 nChartCount = 0;
-        aChartExport.WriteChartObj( xShape, ++nChartCount );
+        aChartExport.WriteChartObj( xShape, GetNewShapeID( xShape ), ++nChartCount );
         return *this;
     }
 
diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx
index e0eb7775549b..ac175ca9b135 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -1137,7 +1137,8 @@ void XclExpChartObj::SaveXml( XclExpXmlStream& rStrm )
         ChartExport aChartExport(XML_xdr, pDrawing, xModel, &rStrm, drawingml::DOCUMENT_XLSX);
         static sal_Int32 nChartCount = 0;
         nChartCount++;
-        aChartExport.WriteChartObj( mxShape, nChartCount );
+        sal_Int32 nID = rStrm.GetUniqueId();
+        aChartExport.WriteChartObj( mxShape, nID, nChartCount );
         // TODO: get the correcto chart number
     }
 
diff --git a/sd/qa/unit/data/pptx/tdf112089.pptx b/sd/qa/unit/data/pptx/tdf112089.pptx
new file mode 100755
index 000000000000..d0cafcd91c72
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf112089.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index dd723a68c3fb..7ed12af08b67 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -111,6 +111,7 @@ public:
     void testTdf112557();
     void testTdf112088();
     void testTdf112333();
+    void testTdf112089();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -145,6 +146,7 @@ public:
     CPPUNIT_TEST(testTdf112557);
     CPPUNIT_TEST(testTdf112088);
     CPPUNIT_TEST(testTdf112333);
+    CPPUNIT_TEST(testTdf112089);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -930,6 +932,20 @@ void SdOOXMLExportTest2::testTdf112333()
     CPPUNIT_ASSERT_EQUAL(OUString("fillcolor"), sAttributeName);
 }
 
+void SdOOXMLExportTest2::testTdf112089()
+{
+    ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf112089.pptx"), PPTX);
+    utl::TempFile tempFile;
+    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+    xDocShRef->DoClose();
+
+    xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
+
+    OUString sID = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:cNvPr", "id");
+    OUString sTarget = getXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt", "spid");
+    CPPUNIT_ASSERT_EQUAL(sID, sTarget);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list