summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/GraphicImport.cxx
diff options
context:
space:
mode:
authorAron Budea <aron.budea@collabora.com>2019-02-23 02:01:54 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-03-04 12:15:11 +0100
commit0b9e4f6085d147c43a86d107303eea9b86e7f34c (patch)
treeaa5c01125afcf8bda8ab223c2e98cedd59e416e5 /writerfilter/source/dmapper/GraphicImport.cxx
parentba676e500f39c398248b906e516843f20ecef30e (diff)
tdf#119201 Don't show/print hidden shapes in DOCX
Similar fix to b38065ea941375bf4f78f13314e84f4a875545d9 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 DOCX format (DOC shapes have no such property). Change-Id: Ifc3c36f90aa16ded1a9f31197612a5c85fde5d87 Reviewed-on: https://gerrit.libreoffice.org/68239 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter/source/dmapper/GraphicImport.cxx')
-rw-r--r--writerfilter/source/dmapper/GraphicImport.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 76b7797c161a..ea0058752f74 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -225,6 +225,7 @@ public:
bool bSizeProtected;
bool bPositionProtected;
+ bool bHidden;
sal_Int32 nShapeOptionType;
@@ -277,6 +278,7 @@ public:
,bIsGraphic(false)
,bSizeProtected(false)
,bPositionProtected(false)
+ ,bHidden(false)
,nShapeOptionType(0)
,m_rPositionOffsets(rPositionOffsets)
,m_rAligns(rAligns)
@@ -559,6 +561,9 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
//alternative text
m_pImpl->title = rValue.getString();
break;
+ case NS_ooxml::LN_CT_NonVisualDrawingProps_hidden:
+ m_pImpl->bHidden = (nIntValue == 1);
+ break;
case NS_ooxml::LN_CT_GraphicalObjectFrameLocking_noChangeAspect://90644;
//disallow aspect ratio change - ignored
break;
@@ -717,7 +722,6 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
if ( bUseShape )
m_xShape = xShape;
-
if ( m_xShape.is( ) )
{
uno::Reference< beans::XPropertySet > xShapeProps
@@ -785,6 +789,12 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
// This needs to be AT_PARAGRAPH by default and not AT_CHARACTER, otherwise shape will move when the user inserts a new paragraph.
text::TextContentAnchorType eAnchorType = text::TextContentAnchorType_AT_PARAGRAPH;
+ if (m_pImpl->bHidden)
+ {
+ xShapeProps->setPropertyValue("Visible", uno::makeAny(false));
+ xShapeProps->setPropertyValue("Printable", uno::makeAny(false));
+ }
+
// Avoid setting AnchorType for TextBoxes till SwTextBoxHelper::syncProperty() doesn't handle transition.
bool bTextBox = false;
xShapeProps->getPropertyValue("TextBox") >>= bTextBox;