tdf#161035 remove certain BkmType::StartEnd portions

If the index is past the index of the current portion and we
are in the "before frames" stage, remove all BkmType::StartEnd
portions.

Change-Id: Ib8fe7e9f462a62f31b96b2cedf151be5d51ebf37
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 220834c..0d4d1a4 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -604,7 +604,15 @@ static void lcl_ExportBookmark(
        const SwXBookmarkPortion_ImplSharedPtr& pPtr = *aIter;
        if ( nIndex > pPtr->getIndex() )
        {
            assert(!"Some bookmarks were not consumed earlier");
            // tdf#161035 remove certain BkmType::StartEnd portions
            // If the index is past the index of the current portion and we
            // are in the "before frames" stage, remove all BkmType::StartEnd
            // portions.
            if (pPtr->nBkmType == BkmType::StartEnd && stage == ExportBookmarkPass::before_frames)
                SAL_WARN("sw.core", "lcl_ExportBookmark: BkmType::StartEnd bookmark was not consumed earlier");
            else
                assert(!"Some bookmarks were not consumed earlier");
            aIter = rBkmArr.erase(aIter);
            continue;
        }
        if ( nIndex < pPtr->getIndex() )