[Libreoffice-commits] core.git: include/oox oox/source sc/source sd/qa

Szymon Kłos szymon.klos at collabora.com
Sat Sep 23 15:43:49 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 c0a61832965aff202d72a2bf51556c5c6b6d594b
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 dadad8d6ca34..cebc4f41ca4d 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -211,10 +211,9 @@ public:
                  ::oox::core::XmlFilterBase* pFB, DocumentType eDocumentType );
     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 60bdc4d8c6c7..bbf0cf113f14 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -377,12 +377,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();
@@ -434,7 +428,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();
 
@@ -448,8 +442,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 b3d42048ec6d..05ea273d2612 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1935,7 +1935,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 13a58328fce4..f3da7609ae02 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -1140,7 +1140,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 9861726386e0..cd60f8dc95c2 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -112,6 +112,7 @@ public:
     void testTdf112552();
     void testTdf112557();
     void testTdf112334();
+    void testTdf112089();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -151,6 +152,7 @@ public:
     CPPUNIT_TEST(testTdf112552);
     CPPUNIT_TEST(testTdf112557);
     CPPUNIT_TEST(testTdf112334);
+    CPPUNIT_TEST(testTdf112089);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -1144,6 +1146,20 @@ void SdOOXMLExportTest2::testTdf112334()
     CPPUNIT_ASSERT_EQUAL(OUString("style.color"), 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