[Libreoffice-commits] core.git: 3 commits - external/libmwaw sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Wed Aug 13 05:47:31 PDT 2014


 external/libmwaw/0001-MWAWDocument.cxx-remove-an-useless-debug-message.patch |   24 ++++++++++
 external/libmwaw/UnpackedTarball_libmwaw.mk                                  |    1 
 sw/qa/extras/rtfimport/data/behind-doc.rtf                                   |   19 +++++++
 sw/qa/extras/rtfimport/rtfimport.cxx                                         |    9 +++
 writerfilter/source/ooxml/model.xml                                          |    2 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx                               |   19 ++++---
 writerfilter/source/rtftok/rtfdocumentimpl.hxx                               |    2 
 7 files changed, 67 insertions(+), 9 deletions(-)

New commits:
commit 37ecf082378a94d28d90b6f7639b0815484d9e3e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Aug 13 14:39:40 2014 +0200

    RTF import: fix handling of RTF_SHPFBLWTXT
    
    Commit 6cac123a8de8357cf11d9b5f818233889d729939 (fdo#45183 import
    RTF_SHPFBLWTXT, 2012-12-27) fixed this already once in the past -- fix
    it again, this time with a testcase.
    
    Change-Id: I0cbbfb1ba4eef42b2ee32f6f77065afaad3ddc1b

diff --git a/sw/qa/extras/rtfimport/data/behind-doc.rtf b/sw/qa/extras/rtfimport/data/behind-doc.rtf
new file mode 100644
index 0000000..d9996bc
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/behind-doc.rtf
@@ -0,0 +1,19 @@
+{\rtf1
+{\shp
+{\*\shpinst\shpleft-7\shptop-7\shpright1274\shpbottom1274\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt1\shpz0\shplid1026
+{\sp
+{\sn shapeType}
+{\sv 75}
+}
+{\sp
+{\sn pib}
+{\sv
+{\pict\picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0\picw2258\pich2258\picwgoal1280\pichgoal1280\pngblip\bliptag1974568719
+{\*\blipuid 75b1870fd12614068d19954c8cfee5d1}
+47494638396110001000d5ff00000000ffffffc0c0c0555f00ffffaafcfcfcf6f6f6eaeaeae6e6e6e4e4e4e3e3e3c2c2c2c1c1c1bcbcbcb5b5b5b3b3b3b0b0b0adadada5a5a5a2a2a2a1a1a19f9f9f9494948a8a8a8888888686867b7b7b6c6c6c5c5c5c4e4e4e4b4b4b4747474646463d3d3d3c3c3c2e2e2e2525251b1b1b18181810101009090906060603030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000021f90401000002002c0000000010001000000684408170482c0a06c8a4728924389f506833b281302a8e6b164b18103024c52111504cca67332102e0042e9a40d9319f8300a343c1200f54e47f7e2a00001e0b0a7d0d728a010d838400261a7c0d94947784252700127e9d159f6c8411140019080ea7a9a85f842122281612b1b3b25d6b1f29291d0fbbbdbc5d5e51c34e4cc64a46c94341003b}
+}
+}
+}
+}
+aaa\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 2dc99ce..36b29c7 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1893,6 +1893,15 @@ DECLARE_RTFIMPORT_TEST(testFdo82106, "fdo82106.rtf")
     getParagraph(2, "before\tafter");
 }
 
+DECLARE_RTFIMPORT_TEST(testBehindDoc, "behind-doc.rtf")
+{
+    // The problem was that "behind doc" didn't result in the shape being in the background, only in being wrapped as "through".
+    uno::Reference<drawing::XShape> xShape = getShape(1);
+    CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGHT, getProperty<text::WrapTextMode>(xShape, "Surround"));
+    // This was true.
+    CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xShape, "Opaque"));
+}
+
 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 52d8993..fc0a988 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -887,20 +887,25 @@ int RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XSh
         // wrap sprm
         RTFSprms aAnchorWrapAttributes;
         RTFSprms aAnchorAttributes;
+        aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_behindDoc, RTFValue::Pointer_t(new RTFValue(m_aStates.top().aShape.bInBackground)));
         RTFSprms aAnchorSprms;
         for (RTFSprms::Iterator_t i = m_aStates.top().aCharacterAttributes.begin(); i != m_aStates.top().aCharacterAttributes.end(); ++i)
         {
             if (i->first == NS_ooxml::LN_CT_WrapSquare_wrapText)
                 aAnchorWrapAttributes.set(i->first, i->second);
         }
+        sal_Int32 nWrap = -1;
         for (RTFSprms::Iterator_t i = m_aStates.top().aCharacterSprms.begin(); i != m_aStates.top().aCharacterSprms.end(); ++i)
         {
             if (i->first == NS_ooxml::LN_EG_WrapType_wrapNone)
+            {
+                nWrap = NS_ooxml::LN_EG_WrapType_wrapNone;
                 aAnchorSprms.set(i->first, i->second);
+            }
         }
         RTFValue::Pointer_t pAnchorWrapValue(new RTFValue(aAnchorWrapAttributes));
         aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_extent, pExtentValue);
-        if (aAnchorWrapAttributes.size())
+        if (aAnchorWrapAttributes.size() && nWrap != NS_ooxml::LN_EG_WrapType_wrapNone)
             aAnchorSprms.set(NS_ooxml::LN_EG_WrapType_wrapSquare, pAnchorWrapValue);
 
         // See OOXMLFastContextHandler::positionOffset(), we can't just put offset values in an RTFValue.
@@ -3966,6 +3971,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
             break;
         case 3:
             m_aStates.top().aShape.nWrap = com::sun::star::text::WrapTextMode_THROUGHT;
+            m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_WrapType_wrapNone, RTFValue::Pointer_t(new RTFValue()));
             break;
         case 4:
             m_aStates.top().aShape.nWrap = com::sun::star::text::WrapTextMode_PARALLEL;
@@ -4469,12 +4475,8 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
     }
     break;
     case RTF_SHPFBLWTXT:
-        if (nParam == 1)
-        {
-            // Shape is below text -> send it to the background.
-            m_aStates.top().aCharacterAttributes.erase(NS_ooxml::LN_CT_WrapSquare_wrapText);
-            m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_WrapType_wrapNone, RTFValue::Pointer_t(new RTFValue()));
-        }
+        // Shape is below text -> send it to the background.
+        m_aStates.top().aShape.bInBackground = nParam;
         break;
     case RTF_CLPADB:
     case RTF_CLPADL:
@@ -5934,7 +5936,8 @@ RTFShape::RTFShape()
       nVertOrientRelation(0),
       nHoriOrientRelationToken(0),
       nVertOrientRelationToken(0),
-      nWrap(-1)
+      nWrap(-1),
+      bInBackground(false)
 {
 }
 
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 72a3f5f..d6bdf94 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -137,6 +137,8 @@ public:
     sal_uInt32 nHoriOrientRelationToken; ///< Horizontal dmapper token for Writer pictures.
     sal_uInt32 nVertOrientRelationToken; ///< Vertical dmapper token for Writer pictures.
     int nWrap;
+    /// If shape is below text (true) or text is below shape (false).
+    bool bInBackground;
 };
 
 /// Stores the properties of a drawing object.
commit 3c491f05d566b7c327f536a94b4b78f6cb9b91de
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Aug 13 14:38:46 2014 +0200

    Remove unused default attribute
    
    Change-Id: I66e78b7815173ec9181b9449252da740c10f09ec

diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index 4763305..8baefe1 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -16744,7 +16744,7 @@
       <value tokenid="0">none</value>
     </resource>
     <resource name="CT_Underline" resource="Properties">
-      <attribute name="val" tokenid="ooxml:CT_Underline_val" default="single"/>
+      <attribute name="val" tokenid="ooxml:CT_Underline_val"/>
       <attribute name="color" tokenid="ooxml:CT_Underline_color"/>
       <attribute name="themeColor" tokenid="ooxml:CT_Underline_themeColor"/>
       <attribute name="themeTint" tokenid="ooxml:CT_Underline_themeTint"/>
commit 6b3869cf74473eb58a1b756b67f60c5263f9e7cb
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Aug 13 14:32:44 2014 +0200

    libmwaw: avoid 'MWAWDocument::isFileFormatSupported()' when opening .doc files
    
    There is only a single libmwaw switch to enable both "noopt + symbols"
    and "debug messages", and we enable that switch in debug builds.
    Backport upstream patch to avoid a debug message during type detection.
    
    Change-Id: I53440ceed90529e3db7c9d91c788c7a3b2723eb1

diff --git a/external/libmwaw/0001-MWAWDocument.cxx-remove-an-useless-debug-message.patch b/external/libmwaw/0001-MWAWDocument.cxx-remove-an-useless-debug-message.patch
new file mode 100644
index 0000000..0b33534
--- /dev/null
+++ b/external/libmwaw/0001-MWAWDocument.cxx-remove-an-useless-debug-message.patch
@@ -0,0 +1,24 @@
+From 3355f5314cd01d8c264c91014d136a58f68d03f4 Mon Sep 17 00:00:00 2001
+From: osnola <alonso at loria.fr>
+Date: Wed, 13 Aug 2014 11:00:35 +0200
+Subject: [PATCH] MWAWDocument.cxx: remove an useless debug message.
+
+---
+ src/lib/MWAWDocument.cxx | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/src/lib/MWAWDocument.cxx b/src/lib/MWAWDocument.cxx
+index 5591f70..8246bf7 100644
+--- a/src/lib/MWAWDocument.cxx
++++ b/src/lib/MWAWDocument.cxx
+@@ -109,7 +109,6 @@ MWAWDocument::Confidence MWAWDocument::isFileFormatSupported(librevenge::RVNGInp
+   }
+ 
+   try {
+-    MWAW_DEBUG_MSG(("MWAWDocument::isFileFormatSupported()\n"));
+     MWAWInputStreamPtr ip(new MWAWInputStream(input, false, true));
+     MWAWInputStreamPtr rsrc=ip->getResourceForkStream();
+     shared_ptr<MWAWRSRCParser> rsrcParser;
+-- 
+1.8.4.5
+
diff --git a/external/libmwaw/UnpackedTarball_libmwaw.mk b/external/libmwaw/UnpackedTarball_libmwaw.mk
index 27bc24d..c1b7db7 100644
--- a/external/libmwaw/UnpackedTarball_libmwaw.mk
+++ b/external/libmwaw/UnpackedTarball_libmwaw.mk
@@ -17,6 +17,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,libmwaw,\
 	external/libmwaw/0001-librevenge-stream-is-optional-don-t-depend-on-it.patch \
 	external/libmwaw/0002-librevenge-stream-is-optional-don-t-depend-on-it.patch \
 	external/libmwaw/0001-msvc2013-does-not-like-this.patch \
+	external/libmwaw/0001-MWAWDocument.cxx-remove-an-useless-debug-message.patch \
 ))
 
 # vim: set noet sw=4 ts=4:


More information about the Libreoffice-commits mailing list