summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <jluth@mail.com>2020-02-03 21:41:03 +0300
committerMiklos Vajna <vmiklos@collabora.com>2020-02-05 09:08:13 +0100
commit6d9d4f94e9c0a94bf88d006ba8b157b4cabaeebc (patch)
tree48a5ee8b2ded5e1a1cf6e3af4045cc42b6e80dd8
parentbd978e93fa0422384ace346665f532b2a714f423 (diff)
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_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sw/qa/extras/ooxmlexport/data/testTdf130167_spilloverHeader.docxbin0 -> 47532 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport14.cxx9
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx3
3 files changed, 12 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/testTdf130167_spilloverHeader.docx
Binary files 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())
{