Download it now!
Bug 51514 - The "Target in document" window displays hundreds of nonsensical items in bookmarks
Summary: The "Target in document" window displays hundreds of nonsensical items in boo...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium major
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: target:3.7.0 target:3.6.2 target:3.5.7
Keywords: regression
Depends on:
Blocks:
 
Reported: 2012-06-28 03:52 UTC by narayanaras
Modified: 2012-08-26 22:49 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
bugdoc with TOC and headings to reproduce problem (10.85 KB, application/vnd.oasis.opendocument.text)
2012-08-22 21:14 UTC, Michael Stahl (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description narayanaras 2012-06-28 03:52:21 UTC
I have written a 430-page manual in Writer. 

It suffers from a peculiar problem: The "Target in document" window shows hundreds of nonsensical items in the "Bookmark" node of the tree.

Because of these extra items, it is very difficult to spot the genuine bookmarks.

A typical spurious entry looks like this:
_RefHeading_xxxxx_yyyyyyyyyy

Where-
"_RefHeading_" text (literal) is always there. 
xxxxx is a five-digit random number.
yyyyyyyyyyy is a ten-digit random number.


HISTORY:
The document used to crash very frequently in OOo (and later in LO). So I copied and pasted its chapters in separate odt file, and then created a master file to link them. At this stage, I discovered that I cannot easily insert cross-links from one chapter to another in the master. So I exported the master as a normal odt, and then broke all links to subdocuments (Edit>Links menu).

The result is a 430+ page odt file.

I am editing this file to insert hyperlinks. But there are too many spurious bookmarks, as described above.
Comment 1 narayanaras 2012-06-28 04:02:13 UTC
Forgot to add:

The spurious bookmarks appear only in the "Target in document" window: The Navigator panel shows only the genuine bookmarks.

I can share the document (5 MB).
Comment 2 narayanaras 2012-06-28 04:17:15 UTC
There is a related discussion at OOo forum:
http://www.oooforum.org/forum/viewtopic.phtml?t=125387

That means I am not the only one to see this problem.

According to this discussion, the problem is created when a document has a TOC and then if is edited+saved. 

Subsequently, the "Target in document" window starts showing such spurious entries. The number of the spurious entries goes on increasing with each save operation.
Comment 3 Rainer Bielefeld Retired 2012-06-28 05:48:37 UTC
[Reproducible] with parallel installation of Master "LOdev " 3.7.0.0.alpha0+   - WIN7 Home Premium (64bit) ENGLISH UI [Build ID: 3985521]" (tinderbox: W2008R2@16-minimal_build, pull time 2012-06-24)
Comment 4 Rainer Bielefeld Retired 2012-06-28 05:56:54 UTC
[Reproducible] with Server installation of  Master "LOdev 3.6.0alpha0+  – WIN7 Home Premium (64bit) ENGLISH UI [Build ID: 475d0c5-829fc92-39746e8-206648e-fefd87]" (2012-02-14)

Bibisect might help?

@Michael:
Please set Status to ASSIGNED and add yourself to "Assigned To" if you accept this Bug
Comment 5 narayanaras 2012-06-28 07:57:00 UTC
P.S. Apart from preventing such spurious bookmarks, there should also be a way to delete the bookmarks that have made their way into the document.
Comment 6 Michael Stahl (allotropia) 2012-08-22 20:25:55 UTC
regression in OOo 3.2, worked in OOo 3.1.

now, who was refactoring bookmarks in OOo 3.2 ?

it seems the difference that causes this is that
SwXBookmarks::getElementNames() returns CrossRefBookmarks
since CWS swrefactormarks2 df6d312ca537402463e4eb0530f22b956600fc02
while previously it did only return real bookmarks.

now how do we check for crossref there...
Comment 7 Michael Stahl (allotropia) 2012-08-22 21:14:48 UTC
Created attachment 65982 [details]
bugdoc with TOC and headings to reproduce problem

so my first question was, where the heck do we have a "Target in Document" dialog; it is in Insert->Hyperlink, then click on "Document" and then the button below "Target in document"
Comment 8 Michael Stahl (allotropia) 2012-08-22 21:16:52 UTC
fixed on master, now you only get real bookmarks
Comment 9 Björn Michaelsen 2012-08-22 22:47:54 UTC
/me trying to whistle innocently.

@mst: Did you check those awesome half-implemented fieldmarks to be working still -- IIRC that one changed some of those bookmark iterations to suddenly include 'internal' bookmarks too to work.
Comment 10 narayanaras 2012-08-23 02:36:44 UTC
Thanks for resolving that problem!

BTW is it possible to REMOVE those spurious bookmarks somehow?

If not, I have some good news for the LibreOffice/OpenOffice users: The latest beta version (1.4) of the extension "AltSearch" can remove them. 

This beta was created by the author based on my request, but it is not released as stable version yet.

Unfortunately, Altsearch is not listed in LibO's extensions. (WHY???)
It is available from OpenOffice extensions site, here: http://extensions.openoffice.org/en/project/AltSearch

Can someone from LO arrange the rest?
1. Get Tomas to release v1.4
2. Add AltSearch to http://extensions.libreoffice.org/

Thanks.
-Narayan
Comment 11 Not Assigned 2012-08-23 13:15:05 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-3-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=5ae1369a87ddc0293f6a78ef368179b6f8e43495&g=libreoffice-3-6

fdo#51514: SwXBookmarks: only consider real bookmarks:


It will be available in LibreOffice 3.6.2.
Comment 12 Michael Stahl (allotropia) 2012-08-23 14:38:41 UTC
narayanaras, the _RefHeading_ bookmarks are necessary to make cross-references work, so removing them doesn't seem like a good idea; they just shouldn't be displayed as Bookmarks in the UI anywhere.
Comment 13 narayanaras 2012-08-23 15:25:19 UTC
Ah!

Anyway this tool can remove the offending bookmarks only temporarily: If we refresh the TOC, they come back! So that's what I did, so that I can select the valid links easily. (No permanent damage done).

Thanks for the clarification. I will convey that to Tomas (the AltSearch author).
Comment 14 Not Assigned 2012-08-26 22:49:25 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-3-5":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d781d21f09542873266c97a9483fa1c6e9549889&g=libreoffice-3-5

fdo#51514: SwXBookmarks: only consider real bookmarks:


It will be available in LibreOffice 3.5.7.