summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorAron Budea <aron.budea@collabora.com>2018-09-03 02:42:44 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2018-09-07 14:50:40 +0200
commitb38065ea941375bf4f78f13314e84f4a875545d9 (patch)
treec1158d1ae8dd205cbbfdfe1c45a034286fc831fb /sc
parentce4245a73114800972711b789a946575b804cea3 (diff)
tdf#108691, tdf#119639 Don't print hidden objects in XLS(X)
In Excel hidden drawing objects aren't printed. When not hidden, printing is controlled by a separate 'Print object' setting. Only rely visibility setting for now, but properly: visible means also printed, hidden means not printed. Ie. import visible property also as printable, and only output visible property in XLS(X) formats. For the future, in XLSX format printability is controlled by attribute 'fPrintsWithSheet' of element 'clientData', don't know about XLS, there fUsefPrint/fPrint bits don't appear to be used anymore (see note in tdf#119639). Change-Id: I728107b30056f7bf073f2fefddece1bef1eb2e7a Reviewed-on: https://gerrit.libreoffice.org/59915 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/data/xls/hiddenShape.xlsbin0 -> 24064 bytes
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx30
2 files changed, 30 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/hiddenShape.xls b/sc/qa/unit/data/xls/hiddenShape.xls
new file mode 100644
index 000000000000..339a39c9acbf
--- /dev/null
+++ b/sc/qa/unit/data/xls/hiddenShape.xls
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 5d0f1dce5313..77f7de435ec1 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -188,6 +188,7 @@ public:
void testSheetCondensedCharacterSpaceXLSX();
void testTextUnderlineColorXLSX();
void testSheetRunParagraphPropertyXLSX();
+ void testHiddenShapeXLS();
void testHiddenShapeXLSX();
void testShapeAutofitXLSX();
void testHyperlinkXLSX();
@@ -302,6 +303,7 @@ public:
CPPUNIT_TEST(testSheetCondensedCharacterSpaceXLSX);
CPPUNIT_TEST(testTextUnderlineColorXLSX);
CPPUNIT_TEST(testSheetRunParagraphPropertyXLSX);
+ CPPUNIT_TEST(testHiddenShapeXLS);
CPPUNIT_TEST(testHiddenShapeXLSX);
CPPUNIT_TEST(testShapeAutofitXLSX);
CPPUNIT_TEST(testHyperlinkXLSX);
@@ -3576,14 +3578,42 @@ void ScExportTest::testPreserveTextWhitespace2XLSX()
xDocSh->DoClose();
}
+void ScExportTest::testHiddenShapeXLS()
+{
+ ScDocShellRef xDocSh = loadDoc("hiddenShape.", FORMAT_XLS);
+ CPPUNIT_ASSERT(xDocSh.is());
+
+ ScDocument& rDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(rDoc.GetTableCount() > 0);
+ ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
+ SdrPage* pPage = pDrawLayer->GetPage(0);
+ CPPUNIT_ASSERT(pPage);
+ SdrObject* pObj = pPage->GetObj(0);
+ CPPUNIT_ASSERT(pObj);
+ CPPUNIT_ASSERT_MESSAGE("Drawing object should not be visible.", !pObj->IsVisible());
+ CPPUNIT_ASSERT_MESSAGE("Drawing object should not be printable.", !pObj->IsPrintable());
+ xDocSh->DoClose();
+}
+
void ScExportTest::testHiddenShapeXLSX()
{
ScDocShellRef xDocSh = loadDoc("hiddenShape.", FORMAT_XLSX);
CPPUNIT_ASSERT(xDocSh.is());
+ ScDocument& rDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(rDoc.GetTableCount() > 0);
+ ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
+ SdrPage* pPage = pDrawLayer->GetPage(0);
+ CPPUNIT_ASSERT(pPage);
+ SdrObject* pObj = pPage->GetObj(0);
+ CPPUNIT_ASSERT(pObj);
+ CPPUNIT_ASSERT_MESSAGE("Drawing object should not be visible.", !pObj->IsVisible());
+ CPPUNIT_ASSERT_MESSAGE("Drawing object should not be printable.", !pObj->IsPrintable());
+
xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX);
CPPUNIT_ASSERT(pDoc);
assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:nvSpPr/xdr:cNvPr", "hidden", "1");
+ xDocSh->DoClose();
}
void ScExportTest::testShapeAutofitXLSX()