[Libreoffice-commits] core.git: sw/CppunitTest_sw_rtfexport.mk sw/qa writerfilter/source

Vasily Melenchuk vasily.melenchuk at cib.de
Fri Feb 13 09:24:37 PST 2015


 sw/CppunitTest_sw_rtfexport.mk                 |   31 -------------------------
 sw/qa/extras/rtfimport/data/fdo49893.rtf       |   14 +++++++++++
 sw/qa/extras/rtfimport/rtfimport.cxx           |    9 +++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    6 ++++
 writerfilter/source/rtftok/rtfsdrimport.cxx    |   14 +++++------
 5 files changed, 37 insertions(+), 37 deletions(-)

New commits:
commit 2c411e4487f24968d6a62958fec85e4e3e1fda93
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
Date:   Mon Feb 2 09:43:51 2015 +0000

    tdf#49893 partial fix for blank rentangle problem in RTF
    
    * pib structure in rtf shape is processed always, if exists, not only
      for shape #75 (picture frame): it is possible for other shapes, at
      least for #1 (rectangle)
    
    * picture inside shape gets width and height from shape: this picture
      looks like pib object and should fit shape frame
    
    Conflicts:
    	sw/qa/extras/rtfimport/rtfimport.cxx
    
    Reviewed on:
    	https://gerrit.libreoffice.org/14396
    
    Change-Id: I5cf2e692940c4ddd8ab8b291ef65c0cc44c45f5d

diff --git a/sw/CppunitTest_sw_rtfexport.mk b/sw/CppunitTest_sw_rtfexport.mk
index 33f366b..48c8758 100644
--- a/sw/CppunitTest_sw_rtfexport.mk
+++ b/sw/CppunitTest_sw_rtfexport.mk
@@ -48,36 +48,7 @@ $(eval $(call gb_CppunitTest_use_api,sw_rtfexport,\
 $(eval $(call gb_CppunitTest_use_ure,sw_rtfexport))
 $(eval $(call gb_CppunitTest_use_vcl,sw_rtfexport))
 
-$(eval $(call gb_CppunitTest_use_components,sw_rtfexport,\
-	basic/util/sb \
-    comphelper/util/comphelp \
-    configmgr/source/configmgr \
-    embeddedobj/util/embobj \
-    filter/source/config/cache/filterconfig1 \
-    filter/source/storagefilterdetect/storagefd \
-    framework/util/fwk \
-    i18npool/util/i18npool \
-    linguistic/source/lng \
-    package/source/xstor/xstor \
-    package/util/package2 \
-    sax/source/expatwrap/expwrap \
-    sfx2/util/sfx \
-    starmath/util/sm \
-    svl/source/fsstor/fsstorage \
-    svtools/util/svt \
-    sw/util/msword \
-    sw/util/sw \
-    sw/util/swd \
-    toolkit/util/tk \
-    ucb/source/core/ucb1 \
-    ucb/source/ucp/file/ucpfile1 \
-    unotools/util/utl \
-    unoxml/source/service/unoxml \
-	uui/util/uui \
-    writerfilter/util/writerfilter \
-    xmloff/util/xo \
-	oox/util/oox \
-))
+$(eval $(call gb_CppunitTest_use_rdb,sw_rtfexport,services))
 
 $(eval $(call gb_CppunitTest_use_configuration,sw_rtfexport))
 
diff --git a/sw/qa/extras/rtfimport/data/fdo49893.rtf b/sw/qa/extras/rtfimport/data/fdo49893.rtf
new file mode 100755
index 0000000..05eedcb
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo49893.rtf
@@ -0,0 +1,14 @@
+{\rtf1
+{\shp{\*\shpinst\shplid1{\sp{\sn ShapeType}{\sv 75}}\shpleft0\shptop144
+\shpbottom576\shpright1296\shpbxcolumn\shpbypara\shpwr3\shpwrk0{\sp{\sn dxWrapDistLeft}{\sv 0}}{\sp{\sn dxWrapDistRight}{\sv 0}}
+{\sp{\sn dxWrapDistTop}{\sv 0}}{\sp{\sn dxWrapDistBottom}{\sv 0}}{\sp{\sn fFilled}{\sv 1}}{\sp{\sn fillType}{\sv 3}}{\sp{\sn fillType}
+{\sv 3}}{\sp{\sn fillColor}{\sv 0}}{\sp{\sn fillBackColor}{\sv 0}}{\sp{\sn fillToTop}{\sv 65536}}{\sp{\sn fillToLeft}{\sv 65536}
+}{\sp{\sn fillToRight}{\sv 0}}{\sp{\sn fillToBottom}{\sv 0}}{\sp{\sn pib}{\sv
+{\pict\pngblip
+47494638396110001000d5ff00000000ffffffc0c0c0555f00ffffaafcfcfcf6f6f6eaeaeae6e6e6e4e4e4e3e3e3c2c2c2c1c1c1bcbcbcb5b5b5b3b3b3b0b0b0adadada5a5a5a2a2a2a1a1a19f9f9f9494948a8a8a8888888686867b7b7b6c6c6c5c5c5c4e4e4e4b4b4b4747474646463d3d3d3c3c3c2e2e2e2525251b1b1b18181810101009090906060603030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000021f90401000002002c0000000010001000000684408170482c0a06c8a4728924389f506833b281302a8e6b164b18103024c52111504cca67332102e0042e9a40d9319f8300a343c1200f54e47f7e2a00001e0b0a7d0d728a010d838400261a7c0d94947784252700127e9d159f6c8411140019080ea7a9a85f842122281612b1b3b25d6b1f29291d0fbbbdbc5d5e51c34e4cc64a46c94341003b}}}
+{\sp{\sn lTxid}{\sv 1}}{\sp{\sn dxTextLeft}{\sv 91440}}{\sp{\sn dxTextRight}
+{\sv 91440}}{\sp{\sn dxTextTop}{\sv 45720}}{\sp{\sn dxTextBottom}{\sv 45720}}{\sp{\sn txflTextFlow}{\sv 0}
+}
+}
+}
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 39c1054..90ef8d3 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2256,6 +2256,15 @@ DECLARE_RTFIMPORT_TEST(testTdf88811, "tdf88811.rtf")
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), xDrawPage->getCount());
 }
 
+DECLARE_RTFIMPORT_TEST(testFdo49893, "fdo49893.rtf")
+{
+    // Image from shape was not loaded, invalid size of image after load
+    uno::Reference<drawing::XShape> xShape(getShape(2), uno::UNO_QUERY);
+    CPPUNIT_ASSERT(xShape.is());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(432)), xShape->getSize().Height);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(1296)), xShape->getSize().Width);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 73287ce..c3f5f76 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -890,6 +890,12 @@ RTFError RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing
         nXExt = (((long)m_aStates.top().aPicture.nScaleX) * (nXExt - (m_aStates.top().aPicture.nCropL + m_aStates.top().aPicture.nCropR))) / 100L;
     if (m_aStates.top().aPicture.nScaleY != 100)
         nYExt = (((long)m_aStates.top().aPicture.nScaleY) * (nYExt - (m_aStates.top().aPicture.nCropT + m_aStates.top().aPicture.nCropB))) / 100L;
+    if (m_aStates.top().bInShape)
+    {
+        // Picture in shape: it looks like pib picture, so we will stretch the picture to shape size (tdf#49893)
+        nXExt = m_aStates.top().aShape.nRight - m_aStates.top().aShape.nLeft;
+        nYExt = m_aStates.top().aShape.nBottom - m_aStates.top().aShape.nTop;
+    }
     auto pXExtValue = std::make_shared<RTFValue>(oox::drawingml::convertHmmToEmu(nXExt));
     auto pYExtValue = std::make_shared<RTFValue>(oox::drawingml::convertHmmToEmu(nYExt));
     aExtentAttributes.set(NS_ooxml::LN_CT_PositiveSize2D_cx, pXExtValue);
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 8a03254..2c278c4 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -779,21 +779,21 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
     if (m_aParents.size() && m_aParents.top().is() && !m_bTextFrame)
         m_aParents.top()->add(xShape);
 
+    if (bPib)
+    {
+        m_rImport.resolvePict(false, xShape);
+    }
+
     if (nType == ESCHER_ShpInst_PictureFrame) // picture frame
     {
         assert(!m_bTextFrame);
-        if (bPib)
-        {
-            m_rImport.resolvePict(false, xShape);
-        }
-        else // ??? not sure if the early return should be removed on else?
+        if (!bPib) // ??? not sure if the early return should be removed on else?
         {
             m_xShape = xShape; // store it for later resolvePict call
         }
-        return;
     }
 
-    if (bCustom && xShape.is())
+    if (bCustom && xShape.is() && !bPib)
     {
         uno::Reference<drawing::XEnhancedCustomShapeDefaulter> xDefaulter(xShape, uno::UNO_QUERY);
         xDefaulter->createCustomShapeDefaults(OUString::number(nType));


More information about the Libreoffice-commits mailing list