sw UNO API: fix infinite loop when building portions of a bookmark range

The problem was that in case the bookmark range points to a number of
characters in a text node, where neither the start or the end is the paragraph
start and end, and in case there is an at-char anchored object at the beginning
of the paragraph, then lcl_CreatePortions() never ended.

It is assumed that the loop in lcl_CreatePortions() will end at some stage, as
every iteration moves the cursor forward. But this wasn't true in the above
situation: the first frame was anchored at char pos 0, the range was char
positions 1..7, and we failed to ignore frames which are anchored before start:
so position was constantly 1.

Fix the problem by explicitly ignoring frames before the current position, so
lcl_ExportFrames() properly returns -1 when there are no anchored objects in
the current range. Testcase is in the next commit.

Change-Id: I73662e09cd09ee7e0ea4575b1150beb40f1ccc3a
sw: Unit test for cycle in lcl_CreatePortions

Reviewed on:
	https://gerrit.libreoffice.org/13413
Conflicts:
	sw/qa/extras/uiwriter/uiwriter.cxx

Change-Id: I26a8707046d7f30381fb51c41e49f8dee4796ba7