[Libreoffice-commits] core.git: oox/source sw/qa

Attila Bakos (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 20 08:56:37 UTC 2020


 oox/source/vml/vmlshapecontext.cxx          |    9 +++++++--
 sw/qa/extras/ooxmlexport/data/tdf78749.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx  |   10 ++++++++++
 3 files changed, 17 insertions(+), 2 deletions(-)

New commits:
commit 9283cd9e13cd3e0dd7d6b831d930128931862a40
Author:     Attila Bakos <bakos.attilakaroly at nisz.hu>
AuthorDate: Wed Apr 8 14:50:07 2020 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Mon Apr 20 10:55:53 2020 +0200

    tdf#78749 DOCX: import VML background image
    
    of text boxes. DOCX relationship identifier
    wasn't handled earlier, only XLSX.
    
    Co-developer: Tibor Nagy
    
    Change-Id: I72f246e6f69d70d1e203087516ee93a57563f777
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91933
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index dbec50102fd1..ce8805f6621c 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -354,6 +354,10 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A
             mrTypeModel.maStrokeModel.moJoinStyle = rAttribs.getToken( XML_joinstyle );
         break;
         case VML_TOKEN( fill ):
+        {
+            // in DOCX shapes use r:id for the relationship id
+            // in XLSX they use o:relid
+            bool bHasORelId = rAttribs.hasAttribute( O_TOKEN(relid) );
             mrTypeModel.maFillModel.moFilled.assignIfUsed( lclDecodeBool( rAttribs, XML_on ) );
             mrTypeModel.maFillModel.moColor.assignIfUsed( rAttribs.getString( XML_color ) );
             mrTypeModel.maFillModel.moOpacity = lclDecodeOpacity( rAttribs, XML_opacity, 1.0 );
@@ -364,9 +368,10 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A
             mrTypeModel.maFillModel.moFocus = lclDecodePercent( rAttribs, XML_focus, 0.0 );
             mrTypeModel.maFillModel.moFocusPos = lclDecodePercentPair( rAttribs, XML_focusposition );
             mrTypeModel.maFillModel.moFocusSize = lclDecodePercentPair( rAttribs, XML_focussize );
-            mrTypeModel.maFillModel.moBitmapPath = decodeFragmentPath( rAttribs, O_TOKEN( relid ) );
+            mrTypeModel.maFillModel.moBitmapPath = decodeFragmentPath( rAttribs, bHasORelId ? O_TOKEN(relid) : R_TOKEN(id) );
             mrTypeModel.maFillModel.moRotate = lclDecodeBool( rAttribs, XML_rotate );
-        break;
+            break;
+        }
         case VML_TOKEN( imagedata ):
         {
             // shapes in docx use r:id for the relationship id
diff --git a/sw/qa/extras/ooxmlexport/data/tdf78749.docx b/sw/qa/extras/ooxmlexport/data/tdf78749.docx
new file mode 100644
index 000000000000..db498849e645
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf78749.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index ba54c33e115a..6c43dda43653 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -44,6 +44,16 @@ protected:
     }
 };
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf78749, "tdf78749.docx")
+{
+    //Shape lost the background image before, now check if it still has...
+    auto xShape = getShape(1);
+    uno::Reference<beans::XPropertySet> xShpProps(xShape, uno::UNO_QUERY);
+    OUString aPropertyVal;
+    xShpProps->getPropertyValue("FillBitmapName") >>= aPropertyVal;
+    CPPUNIT_ASSERT(!aPropertyVal.isEmpty());
+}
+
 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128207, "tdf128207.docx")
 {
     //There was the charts on each other, because their horizontal and vertical position was 0!


More information about the Libreoffice-commits mailing list