summaryrefslogtreecommitdiff
path: root/filter
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 /filter
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 'filter')
-rw-r--r--filter/source/msfilter/escherex.cxx13
-rw-r--r--filter/source/msfilter/msdffimp.cxx14
2 files changed, 20 insertions, 7 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 6bd7638a8cc9..b5951b441f9c 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -1255,17 +1255,20 @@ void EscherPropertyContainer::CreateShapeProperties( const uno::Reference<drawin
uno::Reference< beans::XPropertySet > aXPropSet( rXShape, uno::UNO_QUERY );
if ( aXPropSet.is() )
{
- bool bVal = false;
+ bool bVisible = false;
+ bool bPrintable = false;
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 9084e1b42638..0938905edb52 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4864,8 +4864,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