sw/qa/extras/ooxmlexport/data/testTdf130167_spilloverHeader.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx                       |    9 
+++++++++
 writerfilter/source/dmapper/DomainMapper.cxx                     |    3 +++
 3 files changed, 12 insertions(+)

New commits:
commit 6d9d4f94e9c0a94bf88d006ba8b157b4cabaeebc
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Mon Feb 3 21:41:03 2020 +0300
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Feb 5 09:08:13 2020 +0100

    tdf#130167 writerfilter: while bDiscardHeaderFooter, ignore inlines
    
    Inline objects from unused headers/footers were being loaded
    and then ignored, with the result that they were added to the
    next text section. Similar to git log -p -w 5510f5635021
    
    An earlier commit attempted to do the same thing I think.
    git log -p -w da0c3b50c7969
    My guess is that in this case we have MULTIPLE uses of the
    same image file, so ultimately it wasn't deleted from
    DrawObjects - and therefore could still be referenced.
    
    I found this fix by randomly trying to shut stuff off.
    It seems to make sense, but shapes are not my area
    of understanding.
    
    Change-Id: I748c0e59638bb83de8461c498e1676bbae47df92
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87909
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_l...@sil.org>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/qa/extras/ooxmlexport/data/testTdf130167_spilloverHeader.docx 
b/sw/qa/extras/ooxmlexport/data/testTdf130167_spilloverHeader.docx
new file mode 100644
index 000000000000..6bcafa285f18
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/testTdf130167_spilloverHeader.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 1de85ff3ec83..d9d952bf5b4d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -144,6 +144,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf129522_removeShadowStyle, 
"tdf129522_removeShado
     CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_NONE, aShadow.Location);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf130167_spilloverHeaderShape, 
"testTdf130167_spilloverHeader.docx")
+{
+    uno::Reference<text::XTextGraphicObjectsSupplier> 
xTextGraphicObjectsSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xNameAccess(
+        xTextGraphicObjectsSupplier->getGraphicObjects(), uno::UNO_QUERY);
+    // graphics from discarded headers were being added to the text body. 
Reduced from 5 to 2 shapes overall.
+    CPPUNIT_ASSERT(xNameAccess->getCount() < 4);
+}
+
 DECLARE_OOXMLIMPORT_TEST(testTdf125038, "tdf125038.docx")
 {
     OUString aActual = getParagraph(1)->getString();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index aa8e7f02d6b0..68179bf31f82 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2236,6 +2236,9 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
     case NS_ooxml::LN_anchor_anchor: // at_character drawing
     case NS_ooxml::LN_inline_inline: // as_character drawing
     {
+        if ( m_pImpl->IsDiscardHeaderFooter() )
+            break;
+
         writerfilter::Reference<Properties>::Pointer_t pProperties = 
rSprm.getProps();
         if( pProperties.get())
         {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to