diff options
author | Justin Luth <justin.luth@collabora.com> | 2020-08-08 08:53:22 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2020-08-08 18:48:47 +0200 |
commit | a5ada62f564b90cf211929baf7694f477a53a445 (patch) | |
tree | 79b3ac8229c39d1e5e456a7d5374039e731733ce /sw | |
parent | 000424566db7611f8daf807f23e75e42589a5085 (diff) |
tdf#135329 sw MS export: prevent skipping at-char anchors
This patch is step 1 - write out bypassed flies.
Step 2 - don't bypass fly positions.
The SearchNext function is skipping some flies
because it is not returning them as a stopping
position (nextAttr), and so OutFly just skipped
them since they didn't exactly match the position
it was acting on.
Generally a bad idea to just ignore a picture etc.
Perhaps this is safe enough to backport all the
way to stable. But pictures are such a mess in
general, and so fragile that I don't know what
the implications might be. Thus I am breaking
this fix down into as small pieces as I possibly
can for the benefit of regression finding/fixing.
Prior to this test, there were no unit tests that failed
assert ( nPos >= nSwPos );
Change-Id: Idad0ea9d229f107a8b55150c476f3d4a6bdef3f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100375
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf135329_lostImage.odt | bin | 0 -> 29541 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8nds.cxx | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf135329_lostImage.odt b/sw/qa/extras/ooxmlexport/data/tdf135329_lostImage.odt Binary files differnew file mode 100644 index 000000000000..234109a14158 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf135329_lostImage.odt diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index f8dc2b8e9fd8..1700318a19dc 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -237,6 +237,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf134609_gridAfter, "tdf134609_gridAfter.docx") CPPUNIT_ASSERT_MESSAGE("Top border is not an edge border", aBorder.LineWidth < 100); } +DECLARE_OOXMLEXPORT_TEST(testTdf135329_lostImage, "tdf135329_lostImage.odt") +{ + // the character-anchored image was being skipped, since searchNext didn't notice it. + uno::Reference<beans::XPropertySet> xImageProps(getShape(2), uno::UNO_QUERY_THROW); +} + DECLARE_OOXMLEXPORT_TEST(testTdf134063, "tdf134063.docx") { CPPUNIT_ASSERT_EQUAL(2, getPages()); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 85b215f790c8..82799abfd9c8 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -725,7 +725,7 @@ FlyProcessingState SwWW8AttrIter::OutFlys(sal_Int32 nSwPos) const SwPosition &rAnchor = maFlyIter->GetPosition(); const sal_Int32 nPos = rAnchor.nContent.GetIndex(); - if ( nPos != nSwPos ) + if ( nPos > nSwPos ) return FLY_NOT_PROCESSED ; // We haven't processed the fly const SdrObject* pSdrObj = maFlyIter->GetFrameFormat().FindRealSdrObject(); |