summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--filter/source/msfilter/escherex.cxx13
-rw-r--r--filter/source/msfilter/msdffimp.cxx14
-rw-r--r--oox/source/drawingml/shape.cxx3
-rw-r--r--sc/qa/unit/data/xls/hiddenShape.xlsbin0 -> 24064 bytes
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx30
5 files changed, 53 insertions, 7 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 63464150d7be..98a961f63836 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -1223,17 +1223,20 @@ void EscherPropertyContainer::CreateShapeProperties( const css::uno::Reference<
uno::Reference< beans::XPropertySet > aXPropSet( rXShape, uno::UNO_QUERY );
if ( aXPropSet.is() )
{
- bool bVal = false;
+ bool bVisible = false;
+ bool bPrintable = false;
css::uno::Any aAny;
sal_uInt32 nShapeAttr = 0;
- if (EscherPropertyValueHelper::GetPropertyValue(aAny, aXPropSet, "Visible", true) && (aAny >>= bVal))
+ if (EscherPropertyValueHelper::GetPropertyValue(aAny, aXPropSet, "Visible", true) && (aAny >>= bVisible))
{
- if ( !bVal )
+ if ( !bVisible )
nShapeAttr |= 0x20002; // set fHidden = true
}
- if (EscherPropertyValueHelper::GetPropertyValue(aAny, aXPropSet, "Printable", true) && (aAny >>= bVal))
+ // This property (fPrint) isn't used in Excel anymore, leaving it for legacy reasons
+ // one change, based on XLSX: hidden implies not printed, let's not export the fPrint property in that case
+ if (bVisible && EscherPropertyValueHelper::GetPropertyValue(aAny, aXPropSet, "Printable", true) && (aAny >>= bPrintable))
{
- if ( !bVal )
+ if ( !bPrintable )
nShapeAttr |= 0x10000; // set fPrint = false;
}
if ( nShapeAttr )
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index c44f09a87ab1..5e175aa42837 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4857,8 +4857,18 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
if ( pRet )
{
sal_Int32 nGroupProperties( GetPropertyValue( DFF_Prop_fPrint, 0 ) );
- pRet->SetVisible( ( nGroupProperties & 2 ) == 0 );
- pRet->SetPrintable( ( nGroupProperties & 1 ) != 0 );
+ const bool bVisible = ( ( nGroupProperties & 2 ) == 0 );
+ pRet->SetVisible( bVisible );
+ // In Excel hidden means not printed
+ if ( !bVisible )
+ {
+ pRet->SetPrintable( false );
+ }
+ else
+ {
+ // This property isn't used in Excel anymore, leaving it for legacy reasons
+ pRet->SetPrintable( ( nGroupProperties & 1 ) != 0 );
+ }
}
//Import alt text as description
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 1d73cdaa38f6..92aa4ce059b9 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -855,6 +855,9 @@ Reference< XShape > const & Shape::createAndInsert(
SAL_INFO("oox.drawingml", "Shape::createAndInsert: invisible shape with id='" << msId << "'");
const OUString sVisible( "Visible" );
xSet->setPropertyValue( sVisible, Any( false ) );
+ // In Excel hidden means not printed, let's use visibility for now until that's handled separately
+ const OUString sPrintable( "Printable" );
+ xSet->setPropertyValue( sPrintable, Any( false ) );
}
ActionLockGuard const alg(mxShape);
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 8a2a2d169da3..083b9931c971 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -184,6 +184,7 @@ public:
void testSheetCondensedCharacterSpaceXLSX();
void testTextUnderlineColorXLSX();
void testSheetRunParagraphPropertyXLSX();
+ void testHiddenShapeXLS();
void testHiddenShapeXLSX();
void testHyperlinkXLSX();
void testMoveCellAnchoredShapesODS();
@@ -293,6 +294,7 @@ public:
CPPUNIT_TEST(testSheetCondensedCharacterSpaceXLSX);
CPPUNIT_TEST(testTextUnderlineColorXLSX);
CPPUNIT_TEST(testSheetRunParagraphPropertyXLSX);
+ CPPUNIT_TEST(testHiddenShapeXLS);
CPPUNIT_TEST(testHiddenShapeXLSX);
CPPUNIT_TEST(testHyperlinkXLSX);
CPPUNIT_TEST(testMoveCellAnchoredShapesODS);
@@ -3507,14 +3509,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::parseExport(*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::testHyperlinkXLSX()