Apache OpenOffice (AOO) Bugzilla – Issue 65247
Writer creates a bookmark SwXTextPosition*** when removing a paragraph before a TextTable
Last modified: 2013-02-24 21:09:17 UTC
Assume the following text-content: "This is the first paragraph<bookmark name="test"><par_break> <TextTable> This is the second paragraph</bookmark><par_break>" where <bookmark name="test">...</bookmarks> is a bookmark named "test" that has been inserted into the text using Insert->Bookmark (and markes the included content), <par_break> is a new-paragraph-charakter (shown with view->nonprinting Charakters) and <TextTable> is a simple TextTable inserted with Table->insert. The following basic-code deletes the first paragraph in which the bookmark "test" starts: Sub removeFirstPar mytext = ThisComponent.Text bookmark = ThisComponent.getBookmarks().getByName("test") range = bookmark.getAnchor() parEnum = range.createEnumeration() if(parEnum.hasMoreElements()) then par = parEnum.nextElement() mytext.removeTextContent(par) endif End Sub After running the code, the first paragraph gets removed (OK), but there is a new Bookmark "SwXTextPosition***" (*** is a generated number) created, which I didn't expect (BUG!). The mistake (only) occurs in the case of the combination of a TextParagraph followed by a TextTable surrounded by a Bookmarks that marks both elements. So the missbehaviour doesn't occur when running the macro on the following text-content-example: "This is the first paragraph<bookmark name="test"><par_break> This is the second paragraph<par_break> And this is the third paragraph</bookmark><par_break>" What I really want to do is to delete an empty paragraph before a TextTable, where the positions of the Paragraph and the Table are provided by a bookmark.
sw->tl: when the texttable is between the two paragraphs the mentioned additional bookmark appears. When there is no table in between it seems to work. But when I press "CTRL-Z" to redo the change in that case I also get the additional bookmark.
.
Created attachment 36657 [details] Bugdoc with macro that runs with SO
TL->AMA: Please take over. Thanks!
Fixed in CWS sw8u10bf03 docbm.cxx docedt.cxx
Ready for QA
Verified fix in CWs sw8u10bf03.
Checked in DEV300m22.