[Libreoffice-commits] core.git: filter/source

Tamás Zolnai tamas.zolnai at collabora.com
Mon Aug 28 20:46:20 UTC 2017


 filter/source/msfilter/eschesdo.cxx |   30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

New commits:
commit dada5958c1a5565e9d7e098c75c90f60e575ab62
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Mon Aug 28 19:15:25 2017 +0200

    Follow up changes related to DOCX form control export
    
    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 <tamas.zolnai at collabora.com>
    Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>

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<XPropertySetInfo> xPropInfo = xPropSet.is() ? xPropSet->getPropertySetInfo() : Reference<XPropertySetInfo>();
+            // This code is expected to be called only for DOCX format.
+            if (xPropInfo.is() && xPropInfo->hasPropertyByName("AnchorType") && bOOxmlExport)
             {
-                const Reference<XPropertySetInfo> 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" )
         {


More information about the Libreoffice-commits mailing list