Kaydet (Commit) ccf91b9f authored tarafından PriyankaGaikwad's avatar PriyankaGaikwad Kaydeden (comit) Caolán McNamara

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/15662Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 1ab97fe7
...@@ -419,10 +419,16 @@ ShapeExport& ShapeExport::WriteCustomShape( Reference< XShape > xShape ) ...@@ -419,10 +419,16 @@ ShapeExport& ShapeExport::WriteCustomShape( Reference< XShape > xShape )
// non visual shape properties // non visual shape properties
if (GetDocumentType() != DOCUMENT_DOCX) if (GetDocumentType() != DOCUMENT_DOCX)
{ {
bool isVisible = true ;
if( GETA (Visible))
{
mAny >>= isVisible;
}
pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND ); pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
pFS->startElementNS( mnXmlNamespace, XML_cNvPr, pFS->startElementNS( mnXmlNamespace, XML_cNvPr,
XML_id, I32S( GetNewShapeID( xShape ) ), XML_id, I32S( GetNewShapeID( xShape ) ),
XML_name, IDS( CustomShape ), XML_name, IDS( CustomShape ),
XML_hidden, isVisible ? NULL : "1",
FSEND ); FSEND );
if( GETA( URL ) ) if( GETA( URL ) )
......
...@@ -143,6 +143,7 @@ public: ...@@ -143,6 +143,7 @@ public:
void testSheetCondensedCharacterSpace(); void testSheetCondensedCharacterSpace();
void testTextUnderlineColor(); void testTextUnderlineColor();
void testSheetRunParagraphProperty(); void testSheetRunParagraphProperty();
void testHiddenShape();
CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test); CPPUNIT_TEST(test);
...@@ -196,6 +197,7 @@ public: ...@@ -196,6 +197,7 @@ public:
CPPUNIT_TEST(testSheetCondensedCharacterSpace); CPPUNIT_TEST(testSheetCondensedCharacterSpace);
CPPUNIT_TEST(testTextUnderlineColor); CPPUNIT_TEST(testTextUnderlineColor);
CPPUNIT_TEST(testSheetRunParagraphProperty); CPPUNIT_TEST(testSheetRunParagraphProperty);
CPPUNIT_TEST(testHiddenShape);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
...@@ -2630,6 +2632,16 @@ void ScExportTest::testSheetRunParagraphProperty() ...@@ -2630,6 +2632,16 @@ void ScExportTest::testSheetRunParagraphProperty()
xDocSh->DoClose(); 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_TEST_SUITE_REGISTRATION(ScExportTest);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment