Created attachment 188905 [details] document with index entries for testing Attached is a test document with some index entries (both Alphabetical and User-defined) together with an Alphabetical Index and a User-defined Index (both of them unprotected for manual changes). 1. Place cursor in an index entry. 2. Execute .uno:IndexMarkToIndex. Actual: Nothing happens. Expected: cursor is moved to the relevant item in the index. Could not find any documentation about this .uno, maybe I have the wrong expectation? Document produced and tested with: Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 693411e60c6bbd1c2ef25490cc3902f6b2461682 CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win Locale: da-DK (da_DK); UI: en-US Calc: CL threaded
Could you copy paste what you got in your macro to execute ".uno:IndexMarkToIndex"? Indeed with: Sub Main .uno:IndexMarkToIndex End Sub I got this error: Unexpected symbol: ..
(In reply to Julien Nabet from comment #1) > Could you copy paste what you got in your macro to execute No macro. Used Tools > Customize - Toolbar tab, added the .uno to a toolbar, and executed from toolbar. But because you seem to want to use a macro -- here is one that does not give an error, and also does not seem to have any effect. Sub Main dim document as object dim dispatcher as object document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") dispatcher.executeDispatch(document, ".uno:IndexMarkToIndex", "", 0, Array()) End Sub
Thank you for the feedback. I don't know anything about TOX, I've just retrieved this part: 122 if( !pTextNd || !pTextNd->GetpSwpHints() ) (gdb) p pTextNd $3 = (SwTextNode * const) 0x561a3ae9ce60 (gdb) p pTextNd->GetpSwpHints() $4 = (SwpHints *) 0x0 (gdb) bt #0 SwDoc::GetCurTOXMark(SwPosition const&, std::__debug::vector<SwTOXMark*, std::allocator<SwTOXMark*> >&) (rPos=SwPosition (node 18, offset 6), rArr=std::__debug::vector of length 0, capacity 0) at sw/source/core/doc/doctxm.cxx:122 #1 0x00007f559220e4ef in SwCursorShell::GotoTOXMarkBase() (this=0x561a3afe4660) at sw/source/core/crsr/crstrvl.cxx:365 #2 0x00007f55939b2cf2 in SwTextShell::ExecIdx(SfxRequest const&) (this=0x561a3b2339e0, rReq=...) at sw/source/uibase/shells/textidx.cxx:170 #3 0x00007f55939b9085 in SfxStubSwTextShellExecIdx(SfxShell*, SfxRequest&) (pShell=0x561a3b2339e0, rReq=...) at workdir/SdiTarget/sw/sdi/swslots.hxx:3182 I click on different parts of a brand new doc with a Table of Index created (because I noticed that it didn't work on the attached file), clicking on IndexMarkToIndex after having put the cursor at different locations doesn't do anything. Since I'm not sure how it's supposed to work, I'll let this UNCONFIRMED. Hope this gdb part will help but as for me, I can't do more, so uncc myself.
Will ask UXEVal....if no one knows what this .uno is for, then maybe it should be hidden from the Customize dialog...and/or ... maybe comment 3 gives a code pointer for possible repairs in the function.
The command in sw/source/uibase/shells/textidx.cxx executes GotoTOXMarkBase() with the comment "jump to index of TOXMark". Not sure what this exactly means, guessing either from a ToC to the entry or vice versa. Playing around with your example document I can reliably crash the application with this command (customized the command onto the toolbar and placed the caret on any field except the indexes). Adding Bjoern since he worked on this a while ago, and Michael as the "fields expert" ;-). Version: 7.4.7.2 / LibreOffice Community Build ID: 40(Build:2) CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: kf5 (cairo+xcb) Locale: de-DE (en_US.UTF-8); UI: en-US 7.4.7-5 Calc: threaded
(In reply to Heiko Tietze from comment #5) > Playing around with your example document I can reliably crash the > application with this command (customized the command onto the toolbar > Version: 7.4.7.2 / LibreOffice Community This crash was fixed/avoided by the patch in bug 153866. You should be able to use 7.5.6, 7.6.0.2, and master without a crash.
The functionality of this .uno seems clear enough. As the name indicates (and the comments in the source code underpin), the cursor should be moved from the index mark to its index. https://opengrok.libreoffice.org/xref/core/sw/source/uibase/shells/textidx.cxx?r=0908c7c1#168 case FN_IDX_MARK_TO_IDX: /* from the index mark to the index */ { GetShell().GotoTOXMarkBase(); break; } https://opengrok.libreoffice.org/xref/core/sw/source/core/crsr/crstrvl.cxx?r=d86a6d2b&fi=GotoTOXMarkBase#360 void SwCursorShell::GotoTOXMarkBase() /// jump to index of TOXMark The GotoTOXMarkBase function was present in the initial check-in from 2000, with a use case to provide an easy way to navigate from index entries to its index (without having to use Navigator).
Here's a patch that makes the UNO perform the expected behavior as I understand it to be from the discussion in this bug report: https://gerrit.libreoffice.org/c/core/+/156687
Created attachment 190050 [details] video of my guess of the intended action of this UNO Maybe?
the term "index mark" (ToXMark) means a text attribute that is inserted via Insert->Table of Contents and Index->Index Entry... entries in an index can be created both from this text attribute, and by other ways such as outline level or styles etc. as the command is named "IndexMarkToIndex" (and the comment in the source code indicates) it should jump from a index mark text attribute to its index. but the UI label now says "Index Entry to Index", since the below commit, so one could read as in the previous comment, but that is a misunderstanding. commit 8426c38a23e5bcc4a8fc061113755de0f8dbc250 tdf#153897 "mark" to "entry" for index .unos Change-Id: I3e9b94e5e6d7073773b3d39276a7f708f34492ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151196 Tested-by: Jenkins Reviewed-by: Seth Chaiklin <sdc.blanco@youmail.dk> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu index 124b226f3f35..1c8da79c029b 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu @@ -2625,7 +2625,7 @@ </node> <node oor:name=".uno:IndexMarkToIndex" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> - <value xml:lang="en-US">Index Mark to Index</value> + <value xml:lang="en-US">Index Entry to Index</value> </prop> </node> <node oor:name=".uno:JumpToFootnoteArea" oor:op="replace">
(In reply to Jim Raykowski from comment #9) > Maybe? Have I interpreted the video correctly, that the patch jumps from an entry in the index list to heading in the index list? I would think/expect that the patch should jump from an "index entry" (in the document) to the "index list" (ideally, to the corresponding item in the index list). (It did not seem that way in the video). (In reply to Michael Stahl (allotropia) from comment #10) > as the command is named "IndexMarkToIndex" (and the comment in the source > code indicates) it should jump from a index mark text attribute to its index. I think this is what I just said here, and is also the OP. > but the UI label now says "Index Entry to Index", since the below commit, so > one could read as in the previous comment, but that is a misunderstanding. This issue was discussed in bug 153897. tl;dr summary: UI uses "Insert Index Entry" everywhere, including when an index mark is inserted. No need to introduce/use this backend technical term in the UI in this one place, when Index Entry is used everywhere else (meanwhile, no change to the backend uno commandname).
(In reply to sdc.blanco from comment #11) > (In reply to Jim Raykowski from comment #9) > > Maybe? > Have I interpreted the video correctly, that the patch jumps from an entry > in the index list to heading in the index list? Yes that is what the patch does, but as Michael has explained, this is not the correct interpretation the command. > I would think/expect that the patch should jump from an "index entry" (in > the document) to the "index list" (ideally, to the corresponding item in the > index list). (It did not seem that way in the video). Before checking back here and seeing Michael's comment, I read the help on index entries and realized my misunderstanding of the command. I agree with you on the expected behavior of the command. I'll give trying to make this work another stab now that I think I understand what it is supposed to do.
It seemed to work as expected before this commit: commit 3b9aa11d885c91a3b040cb2b103b815c75d170bc Author: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> Date: Sun Jul 5 02:20:52 2020 +0200 GotoTOXMarkBase: SwIterator no more ...