sw/source/filter/ww8/wrtw8nds.cxx |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit c8a95925ca316c2656c81696b1e87c7d5767883d
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Sat Aug 8 15:01:49 2020 +0300
Commit:     Justin Luth <justin_l...@sil.org>
CommitDate: Wed Aug 19 19:45:25 2020 +0200

    tdf#135329 sw MS export: don't miss nextAttr fly position
    
    Step 1 - write out bypassed flies.
    This patch is Step 2 - don't bypass fly position.
    
    The SearchNext function was skipping some flies
    because it was not returning them as a stopping
    position (nextAttr). The time I noticed this happening
    was at the start of the paragraph, when there were
    zero-anchored paragraph flies which hadn't been processed
    and so they returned a non-usable minPos.
    
    With this patch, I OUGHT to have rendered Step 1's
    patch unnecessary.
    
    Change-Id: I9924dbf5424f5b0309ec944e1bb79380672220f5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100387
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_l...@sil.org>

diff --git a/sw/source/filter/ww8/wrtw8nds.cxx 
b/sw/source/filter/ww8/wrtw8nds.cxx
index b8440df9fb60..e9a830d55ce4 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -356,14 +356,17 @@ sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos )
     }
 
     // #i2916# Check to see if there are any graphics anchored to characters 
in this paragraph's text.
-    if (maFlyIter != maFlyFrames.end())
+    sal_Int32 nNextFlyPos = 0;
+    ww8::FrameIter aTmpFlyIter = maFlyIter;
+    while (aTmpFlyIter != maFlyFrames.end() && nNextFlyPos < nStartPos)
     {
-        const SwPosition &rAnchor = maFlyIter->GetPosition();
+        const SwPosition &rAnchor = aTmpFlyIter->GetPosition();
+        nNextFlyPos = rAnchor.nContent.GetIndex();
 
-        sal_Int32 nPos = rAnchor.nContent.GetIndex();
-        if (nPos >= nStartPos && nPos <= nMinPos)
-            nMinPos = nPos;
+        ++aTmpFlyIter;
     }
+    if (nNextFlyPos >= nStartPos && nNextFlyPos < nMinPos)
+        nMinPos = nNextFlyPos;
 
     //nMinPos found and not going to change at this point
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to