From dada5958c1a5565e9d7e098c75c90f60e575ab62 Mon Sep 17 00:00:00 2001 From: Tamás Zolnai Date: Mon, 28 Aug 2017 19:15:25 +0200 Subject: Follow up changes related to DOCX form control export MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These lines are expected to be called only for DOCX format. AnchorType is a Writer specific attribute so it can be used to decide on the file format. Change-Id: Ie92f1ff801fac09cb9f658e523244ffc928690f2 Reviewed-on: https://gerrit.libreoffice.org/41655 Reviewed-by: Tamás Zolnai Tested-by: Tamás Zolnai --- filter/source/msfilter/eschesdo.cxx | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx index 5ed8d3892125..d203e7827c5b 100644 --- a/filter/source/msfilter/eschesdo.cxx +++ b/filter/source/msfilter/eschesdo.cxx @@ -420,28 +420,26 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj, } else if ( rObj.GetType() == "drawing.Control" ) { - mpEscherEx->OpenContainer( ESCHER_SpContainer ); - bool bInline = false; const Reference< XPropertySet > xPropSet(rObj.mXPropSet, UNO_QUERY); - if(xPropSet.is()) + const Reference xPropInfo = xPropSet.is() ? xPropSet->getPropertySetInfo() : Reference(); + // This code is expected to be called only for DOCX format. + if (xPropInfo.is() && xPropInfo->hasPropertyByName("AnchorType") && bOOxmlExport) { - const Reference xPropInfo = xPropSet->getPropertySetInfo(); - if (xPropInfo.is() && xPropInfo->hasPropertyByName("AnchorType")) + text::TextContentAnchorType eAnchorType; + xPropSet->getPropertyValue("AnchorType") >>= eAnchorType; + bool bInline = eAnchorType == text::TextContentAnchorType_AS_CHARACTER; + mpEscherEx->OpenContainer( ESCHER_SpContainer ); + if(bInline) { - text::TextContentAnchorType eAnchorType; - xPropSet->getPropertyValue("AnchorType") >>= eAnchorType; - bInline = eAnchorType == text::TextContentAnchorType_AS_CHARACTER; + ADD_SHAPE( ESCHER_ShpInst_PictureFrame, SHAPEFLAG_HAVESPT | SHAPEFLAG_HAVEANCHOR ); + } + else + { + ADD_SHAPE( ESCHER_ShpInst_HostControl, SHAPEFLAG_HAVESPT | SHAPEFLAG_HAVEANCHOR ); } - } - - if(bInline) - { - ADD_SHAPE( ESCHER_ShpInst_PictureFrame, SHAPEFLAG_HAVESPT | SHAPEFLAG_HAVEANCHOR ); } else - { - ADD_SHAPE( ESCHER_ShpInst_HostControl, SHAPEFLAG_HAVESPT | SHAPEFLAG_HAVEANCHOR ); - } + break; } else if ( rObj.GetType() == "drawing.Connector" ) { -- cgit