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

Mark Hung marklh9 at gmail.com
Sat Nov 19 17:27:38 UTC 2016


 include/oox/export/shapes.hxx      |   12 +++++++-----
 oox/source/export/shapes.cxx       |   18 ++++++++++--------
 sd/qa/unit/data/odp/tdf92076.odp   |binary
 sd/qa/unit/export-tests-ooxml2.cxx |   11 +++++++++++
 4 files changed, 28 insertions(+), 13 deletions(-)

New commits:
commit afc37372c1e1e8a865a4ad91a4b998e861ad9f02
Author: Mark Hung <marklh9 at gmail.com>
Date:   Sat Nov 19 10:56:40 2016 +0800

    tdf#92076 oox - export PolyPolygonShape and PolyLineShape.
    
    1. Export PolyPolygonShape and PolyLineShape.
    2. Rename WriteBezierShape to WritePolyPolygonShape because
    ClosedBezierShape, OpenBezierShape, PolyPolygonShape,and
    PolyLineShape share the function and all use
    EscherPropertyContainer::GetPolyPolygon to get PolyPolygon
    structure and use WritePolyPolygon to write xml tags.
    
    Change-Id: I9ffdc26cf1f6fe8ea3b91b7b218d67f9e5585617
    Reviewed-on: https://gerrit.libreoffice.org/30972
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mark Hung <marklh9 at gmail.com>

diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx
index d6ae615..fad3664 100644
--- a/include/oox/export/shapes.hxx
+++ b/include/oox/export/shapes.hxx
@@ -134,9 +134,9 @@ public:
     static bool         NonEmptyText( const css::uno::Reference< css::uno::XInterface >& xIface );
 
     ShapeExport&
-                        WriteBezierShape( const css::uno::Reference< css::drawing::XShape >& xShape, bool bClosed );
+                        WritePolyPolygonShape( const css::uno::Reference< css::drawing::XShape >& xShape, bool bClosed );
     ShapeExport&
-                        WriteClosedBezierShape( const css::uno::Reference< css::drawing::XShape >& xShape );
+                        WriteClosedPolyPolygonShape( const css::uno::Reference< css::drawing::XShape >& xShape );
     ShapeExport&
                         WriteConnectorShape( const css::uno::Reference< css::drawing::XShape >& xShape );
     ShapeExport&
@@ -154,7 +154,7 @@ public:
     virtual ShapeExport&
                         WriteNonVisualProperties( const css::uno::Reference< css::drawing::XShape >& xShape );
     ShapeExport&
-                        WriteOpenBezierShape( const css::uno::Reference< css::drawing::XShape >& xShape );
+                        WriteOpenPolyPolygonShape( const css::uno::Reference< css::drawing::XShape >& xShape );
     ShapeExport&
                         WriteRectangleShape( const css::uno::Reference< css::drawing::XShape >& xShape );
 
@@ -171,12 +171,14 @@ public:
      *
      * <table>
      *   <tr><th>Shape Type</th><th>Method</th></tr>
-     *   <tr><td><tt>com.sun.star.drawing.ClosedBezierShape</tt></td>    <td>ShapeExport::WriteClosedBezierShape</td></tr>
+     *   <tr><td><tt>com.sun.star.drawing.ClosedBezierShape</tt></td>    <td>ShapeExport::WriteClosedPolyPolygonShape</td></tr>
      *   <tr><td><tt>com.sun.star.drawing.CustomShape</tt></td>          <td>ShapeExport::WriteCustomShape</td></tr>
      *   <tr><td><tt>com.sun.star.drawing.EllipseShape</tt></td>         <td>ShapeExport::WriteEllipseShape</td></tr>
      *   <tr><td><tt>com.sun.star.drawing.GraphicObjectShape</tt></td>   <td>ShapeExport::WriteGraphicObjectShape</td></tr>
      *   <tr><td><tt>com.sun.star.drawing.LineShape</tt></td>            <td>ShapeExport::WriteLineShape</td></tr>
-     *   <tr><td><tt>com.sun.star.drawing.OpenBezierShape</tt></td>      <td>ShapeExport::WriteOpenBezierShape</td></tr>
+     *   <tr><td><tt>com.sun.star.drawing.OpenBezierShape</tt></td>      <td>ShapeExport::WriteOpenPolyPolygonShape</td></tr>
+     *   <tr><td><tt>com.sun.star.drawing.PolyPolygonShape</tt></td>      <td>ShapeExport::WriteClosedPolyPolygonShape</td></tr>
+     *   <tr><td><tt>com.sun.star.drawing.PolyLineShape</tt></td>      <td>ShapeExport::WriteOpenPolyPolygonShape</td></tr>
      *   <tr><td><tt>com.sun.star.drawing.RectangleShape</tt></td>       <td>ShapeExport::WriteRectangleShape</td></tr>
      *   <tr><td><tt>com.sun.star.drawing.TableShape</tt></td>           <td>ShapeExport::WriteTableShape</td></tr>
      *   <tr><td><tt>com.sun.star.drawing.TextShape</tt></td>            <td>ShapeExport::WriteTextShape</td></tr>
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index c9d693c..820cb4c 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -428,9 +428,9 @@ bool ShapeExport::NonEmptyText( const Reference< XInterface >& xIface )
     return false;
 }
 
-ShapeExport& ShapeExport::WriteBezierShape( const Reference< XShape >& xShape, bool bClosed )
+ShapeExport& ShapeExport::WritePolyPolygonShape( const Reference< XShape >& xShape, bool bClosed )
 {
-    SAL_INFO("oox.shape", "write open bezier shape");
+    SAL_INFO("oox.shape", "write polypolygon shape");
 
     FSHelperPtr pFS = GetFS();
     pFS->startElementNS( mnXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_sp : XML_wsp), FSEND );
@@ -481,14 +481,14 @@ ShapeExport& ShapeExport::WriteBezierShape( const Reference< XShape >& xShape, b
     return *this;
 }
 
-ShapeExport& ShapeExport::WriteClosedBezierShape( const Reference< XShape >& xShape )
+ShapeExport& ShapeExport::WriteClosedPolyPolygonShape( const Reference< XShape >& xShape )
 {
-    return WriteBezierShape( xShape, true );
+    return WritePolyPolygonShape( xShape, true );
 }
 
-ShapeExport& ShapeExport::WriteOpenBezierShape( const Reference< XShape >& xShape )
+ShapeExport& ShapeExport::WriteOpenPolyPolygonShape( const Reference< XShape >& xShape )
 {
-    return WriteBezierShape( xShape, false );
+    return WritePolyPolygonShape( xShape, false );
 }
 
 ShapeExport& ShapeExport::WriteGroupShape(const uno::Reference<drawing::XShape>& xShape)
@@ -1388,13 +1388,15 @@ static const NameToConvertMapType& lcl_GetConverters(DocumentType eDocumentType)
         return shape_converters;
     }
 
-    shape_converters[ "com.sun.star.drawing.ClosedBezierShape" ]        = &ShapeExport::WriteClosedBezierShape;
+    shape_converters[ "com.sun.star.drawing.ClosedBezierShape" ]        = &ShapeExport::WriteClosedPolyPolygonShape;
     shape_converters[ "com.sun.star.drawing.ConnectorShape" ]           = &ShapeExport::WriteConnectorShape;
     shape_converters[ "com.sun.star.drawing.CustomShape" ]              = &ShapeExport::WriteCustomShape;
     shape_converters[ "com.sun.star.drawing.EllipseShape" ]             = &ShapeExport::WriteEllipseShape;
     shape_converters[ "com.sun.star.drawing.GraphicObjectShape" ]       = &ShapeExport::WriteGraphicObjectShape;
     shape_converters[ "com.sun.star.drawing.LineShape" ]                = &ShapeExport::WriteLineShape;
-    shape_converters[ "com.sun.star.drawing.OpenBezierShape" ]          = &ShapeExport::WriteOpenBezierShape;
+    shape_converters[ "com.sun.star.drawing.OpenBezierShape" ]          = &ShapeExport::WriteOpenPolyPolygonShape;
+    shape_converters[ "com.sun.star.drawing.PolyPolygonShape" ]          = &ShapeExport::WriteClosedPolyPolygonShape;
+    shape_converters[ "com.sun.star.drawing.PolyLineShape" ]          = &ShapeExport::WriteClosedPolyPolygonShape;
     shape_converters[ "com.sun.star.drawing.RectangleShape" ]           = &ShapeExport::WriteRectangleShape;
     shape_converters[ "com.sun.star.drawing.OLE2Shape" ]                = &ShapeExport::WriteOLE2Shape;
     shape_converters[ "com.sun.star.drawing.TableShape" ]               = &ShapeExport::WriteTableShape;
diff --git a/sd/qa/unit/data/odp/tdf92076.odp b/sd/qa/unit/data/odp/tdf92076.odp
new file mode 100755
index 0000000..ab0a20b
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf92076.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 03cff30..26e5685 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -101,6 +101,7 @@ public:
     void testExtFileField();
     void testAuthorField();
     void testTdf99224();
+    void testTdf92076();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -125,6 +126,7 @@ public:
     CPPUNIT_TEST(testExtFileField);
     CPPUNIT_TEST(testAuthorField);
     CPPUNIT_TEST(testTdf99224);
+    CPPUNIT_TEST(testTdf92076);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -736,6 +738,15 @@ void SdOOXMLExportTest2::testTdf99224()
     xShell->DoClose();
 }
 
+void SdOOXMLExportTest2::testTdf92076()
+{
+    sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf92076.odp"), ODP);
+    xShell = saveAndReload(xShell.get(), PPTX);
+    uno::Reference<drawing::XDrawPage> xPage = getPage(0, xShell);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xPage->getCount());
+    xShell->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list