Apache OpenOffice (AOO) Bugzilla – Issue 13564
collapseToStart() and collapseToEnd() both set the cursor to the rightmost position
Last modified: 2013-02-24 21:08:27 UTC
Using Windows XP version 1.0.3 I entered some text in a write document such as 0123456789 Now, place the cursor between 4 and 5 and select the characters 34. Run the macro. The text "5" will be selected and printed so that I know that collapseToEnd() moves both the start and end cursor to the space between 4 and 5. The same thing happens if you use collapseToStart(). Is this a bug or am I missing something? Now, place the cursor between 2 and 3 and select the characters 34. The same behavior is noted as seen above! Conclusion: Both collapseToStart() and collapseToEnd() set the cursor to the rightmost position. Although I can use this information, to achieve my goals, it seems incorrect. Sub CollapseError Dim lSelCount&, oSelections As Object, oSel As Object Dim oText As Object, oStartCursor As Object, oEndCursor As Object Dim iWhichSelection As Integer, i% oSelections = ThisComponent.getCurrentSelection() oText = ThisComponent.Text lSelCount = oSelections.getCount() For iWhichSelection = 0 To lSelCount - 1 oSel = oSelections.getByIndex(iWhichSelection) oStartCursor = oText.CreateTextCursorByRange(oSel) If Not oStartCursor.isCollapsed() Then '?? collapse to start and end yield the same result oStartCursor.collapseToEnd() 'oStartCursor.collapseToStart() oStartCursor.goRight(1, True) MsgBox "Cursor text = " + oStartCursor.getString() i = oText.compareRegionEnds(oStartCursor, oSel) Print "Compare Ends of Cursor and Sel yields " + i i = oText.compareRegionStarts(oStartCursor, oSel) Print "Compare starts of Cursor and Sel yields " + i End If Next End Sub
This is a scripting issue
This is (most probably) no scripting but an API problem because isStartOfWord seems to return false values. But not only if the call comes from Basic.
Sorry, I copied my comment from i13565. Here isStartOfWord is not involved of course, but otherwise the comment still is correct... :-)
Already fixed in current version (644 m13) should be OK in OO 1.1 Beta2. TL->SW: Please check and close.
SW: works as expected in srx644m13 => fixed, I will recheck it when the snapshot is available on OpenOffice
SW: works as expected in OOo1.1beta2 => closed