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

PriyankaGaikwad priyanka.gaikwad at synerzip.com
Fri May 15 05:00:57 PDT 2015


 oox/source/export/shapes.cxx          |    6 ++++++
 sc/qa/unit/data/xlsx/hiddenShape.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx |   12 ++++++++++++
 3 files changed, 18 insertions(+)

New commits:
commit ccf91b9f823c28f2cb08784e4be4157bad40837e
Author: PriyankaGaikwad <priyanka.gaikwad at synerzip.com>
Date:   Thu May 7 16:19:38 2015 +0530

    tdf#74932 FILESAVE: Shapes appear when saving a .XLSX file with filter
    
    Problem Description
    If the attribute hidden is set and then after exporting it to .xlsx, the shape does not remain hidden.
    
    XML Difference
    Original :
    <xdr:cNvPr id="2" name="Rectangle 1" hidden="1"/>
    
    Roundtrip :
    <xdr:cNvPr id="0" name="CustomShape 1"></xdr:cNvPr>
    
    Change-Id: I2e87a484ea984b56415891fd157995cb49453f76
    Reviewed-on: https://gerrit.libreoffice.org/15662
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 87c0190..76d57fd 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -419,10 +419,16 @@ ShapeExport& ShapeExport::WriteCustomShape( Reference< XShape > xShape )
     // non visual shape properties
     if (GetDocumentType() != DOCUMENT_DOCX)
     {
+        bool isVisible = true ;
+        if( GETA (Visible))
+        {
+            mAny >>= isVisible;
+        }
         pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
         pFS->startElementNS( mnXmlNamespace, XML_cNvPr,
                 XML_id, I32S( GetNewShapeID( xShape ) ),
                 XML_name, IDS( CustomShape ),
+                XML_hidden, isVisible ? NULL : "1",
                 FSEND );
 
         if( GETA( URL ) )
diff --git a/sc/qa/unit/data/xlsx/hiddenShape.xlsx b/sc/qa/unit/data/xlsx/hiddenShape.xlsx
new file mode 100644
index 0000000..3f38909
Binary files /dev/null and b/sc/qa/unit/data/xlsx/hiddenShape.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index d42e29e..60b4b5c 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -143,6 +143,7 @@ public:
     void testSheetCondensedCharacterSpace();
     void testTextUnderlineColor();
     void testSheetRunParagraphProperty();
+    void testHiddenShape();
 
     CPPUNIT_TEST_SUITE(ScExportTest);
     CPPUNIT_TEST(test);
@@ -196,6 +197,7 @@ public:
     CPPUNIT_TEST(testSheetCondensedCharacterSpace);
     CPPUNIT_TEST(testTextUnderlineColor);
     CPPUNIT_TEST(testSheetRunParagraphProperty);
+    CPPUNIT_TEST(testHiddenShape);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -2630,6 +2632,16 @@ void ScExportTest::testSheetRunParagraphProperty()
     xDocSh->DoClose();
 }
 
+void ScExportTest::testHiddenShape()
+{
+    ScDocShellRef xDocSh = loadDoc("hiddenShape.", XLSX);
+    CPPUNIT_ASSERT(xDocSh.Is());
+
+    xmlDocPtr pDoc = XPathHelper::parseExport(&(*xDocSh), m_xSFactory, "xl/drawings/drawing1.xml", XLSX);
+    CPPUNIT_ASSERT(pDoc);
+    assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:nvSpPr/xdr:cNvPr", "hidden", "1");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list