Issue 24289

Summary: Redundant bookmarks are generated while operating with XTextCursor
Product: App Dev Reporter: akrioukov <basileia>
Component: apiAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: issues
Version: 3.3.0 or older (OOo)   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description akrioukov 2004-01-11 13:22:36 UTC
AFAIU, each time our program operates with an XTextCursor object, OOo creates 
temporary bookmarks to remember that cusrsor's current position. Usually these 
bookmarks are deleted after the program execution, but sometimes they are not. Let's take 
the following example. Suppose we have selected some text in a document (it should be 
longer than 2 characters), and then processed it with the following macro: 
 
Sub Test 
	oSel = ThisComponent.getCurrentController ().getSelection ().getByIndex (0) 
	oText = ThisComponent.Text 
	oRange = oText.createTextCursorByRange (oSel) 
	 
	' create a text cursor inside another text range 
	oCursor = oText.createTextCursorByRange (oRange.Start) 
	oCursor.goRight (1, False) 
	oCursor.goRight (1, True) 
	 
	oRange.setString ("Replaced") 
End Sub 
 
Here we get an XTextRange object, then create a text cursor *inside* this range, and then 
just replace the string of our text range.  
 
Now simply undo the changes. Of course this restores the string we have replaced, but, 
unfortunately, not only the string. Go to the Insert->Bookmark dialog. You will see that the 
document contains a new bookmark, called "SwXTextPosition***", where *** is an arbitrary 
number. 
 
Suppose we have performed this operation several times (which is very vital situation). Now 
our document contains a growing number of redundant bookmarks, which make its xml 
structure more complex and iterating through its elements more difficult. So the problem is 
clear. I suppose each time our program deletes or modifies some text content, OOo should 
check if text which should be removed contains some autogenerated bookmarks and 
remove them first.
Comment 1 ooo 2004-01-12 11:37:51 UTC
forwarding to responsible developer
Comment 2 thomas.lange 2004-04-20 14:11:17 UTC
TL->hbrinkm: According to OS the Undo always changes the removed UNO bookmarks
to regular ones.
According to OS either restoring of UNO bookmarks cabn be omitted because there
is no need, or else it should properly restored.
Comment 3 openoffice 2004-06-21 08:32:32 UTC
setting initial target
Comment 4 Marcus 2017-05-20 11:27:33 UTC
Reset assigne to the default "issues@openoffice.apache.org".