Bug 112742 - FILEOPEN: DOCX - Jump to saved cursor position
Summary: FILEOPEN: DOCX - Jump to saved cursor position
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
Hardware: All All
: medium enhancement
Assignee: Not Assigned
Depends on:
Blocks: DOCX Bookmarks Saved-Cursor 112740
  Show dependency treegraph
Reported: 2017-09-29 07:50 UTC by Yousuf Philips (jay) (retired)
Modified: 2022-06-25 15:29 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:
Regression By:

sample (12.48 KB, application/wps-office.docx)
2017-09-29 07:50 UTC, Yousuf Philips (jay) (retired)

Note You need to log in before you can comment on or make changes to this bug.
Description Yousuf Philips (jay) (retired) 2017-09-29 07:50:22 UTC
Created attachment 136603 [details]

1. open attached document
2. cursor should be placed at the beginning of line 2

Relevant XML

<w:p w:rsidR="003D1584" w:rsidRDefault="003D1584">
   <w:bookmarkStart w:id="0" w:name="_GoBack" />
   <w:bookmarkEnd w:id="0" />
      <w:t>Testing 2</w:t>

Build ID: 8d2a287da3abb0576512406227d0a3acd602123e
CPU threads: 2; OS: Linux 4.4; UI render: default; VCL: gtk2; 
Locale: en-US (en_US.UTF-8); Calc: group
Comment 1 Timur 2019-12-11 11:37:32 UTC
I see in MSO 2013 that it opens DOCX on the beginning, but is offering "Pick up where you left off". Meaning that it already saves position, as explained here. LO doesn't move cursor to that position, as with .odt. Test master 6.5+.
Comment 2 Justin L 2022-06-22 16:48:27 UTC
ODT has that ability.

Cursor Position
In general, all documents open with the cursor at the start of the document.

One exception appears when the author of a Writer text document saves and reopens a document: The cursor will be at the same position where it has been when the document was saved. This only works when the name of the author was entered in Tools - Options - LibreOffice - User Data.

Press Shift+F5 to set the cursor to the last saved position.
Comment 3 Justin L 2022-06-22 19:13:24 UTC
We somehow need to call SetRestorePosition if we have the bookmark _GoBack I guess.

OK - that's easy. It is always called. Look at ZoomFactor in writerfilter's ApplySettingsTable for the place to set those variables. In ODT these are stored in settings.xml as ViewLeft and ViewTop (and IsSelectedFrame).

However, it will be INCREDIBLY hard to convert a bookmark into a LO Cursor position.

Possibly a better alternative would be to extend LO itself to ALSO look for a _GoBack bookmark when SID_RESTORE_EDITING_VIEW is called. (However, LO won't change _GoBack bookmarks at save time, so that position would never be updated by LO.)
Comment 4 Justin L 2022-06-25 02:19:14 UTC
Shift-F5 suggested implementation here: https://gerrit.libreoffice.org/c/core/+/136409/1
Comment 5 Justin L 2022-06-25 15:29:52 UTC
Does MS Word save _GoBack as a selection?
-2010: yes
-2019: no - no _GoBack saved at all.

Does MS Word prompt to jump to _GoBack
-2010: no
-2013: yes (according to comment 1)
-2019: no, but it does prompt based on some (likely) internally stored data.

Based on this inconsistency and abandonment by MS, I don't see any point in implementing this for DOCX.