Bug 146490 - UI: Field in a header/footer (like page number) lists a single time in navigator (and only for last page)
Summary: UI: Field in a header/footer (like page number) lists a single time in naviga...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.2.5.2 release
Hardware: All All
: medium normal
Assignee: Jim Raykowski
URL:
Whiteboard: target:7.4.0
Keywords:
Depends on:
Blocks: Fields
  Show dependency treegraph
 
Reported: 2021-12-30 19:08 UTC by Telesto
Modified: 2022-04-10 12:47 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file (8.79 KB, application/vnd.oasis.opendocument.text)
2021-12-30 19:08 UTC, Telesto
Details
header footer tag for page number field (72.75 KB, image/png)
2022-01-02 22:28 UTC, Jim Raykowski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2021-12-30 19:08:18 UTC
Description:
UI: Field in a footnote (like page number) lists a single time in navigator (and only for last page)

Steps to Reproduce:
1. Open the attached file
2. Sidebar -> Navigator Deck -> Fields 
3. Select it & press Enter 

Actual Results:
It shows page 3, but navigates to page 1

Expected Results:
No clue what should happen, show the field for each page individually?
The page 3 is certainly misleading


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 1bb0e177124d5d6661b72df6c7d848fb23639652
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL
Comment 1 Telesto 2021-12-30 19:08:41 UTC
Created attachment 177212 [details]
Example file
Comment 2 Telesto 2021-12-30 19:16:27 UTC
I do think this being wrong, but of the alternative I struggle. Removing the reference to page 3 might do the trick?
Comment 3 Jim Raykowski 2022-01-02 22:28:10 UTC
Created attachment 177256 [details]
header footer tag for page number field

@Telesto, Happy New LO Year!

Think you mean fields in the footer. 

I noticed when 'Same content on left and right pages' and 'Same content on first page' settings are turned off, 'Page number - 3, 2, 1' show in the Fields category along with a grayed out 'Page number - 3'.

Perhaps add a 'Header/Footer' tag to the field listing in the Navigator such as is shown in the attached screen shot?

The grayed out field seems to me to be a bug with header/footer handling of fields. We could sweep it under the carpet by not displaying fields in the header/footer that are in hidden state. What do you think? Maybe discuss in a separate ticket?
Comment 4 Jim Raykowski 2022-01-02 22:31:58 UTC
Forgot to mention that the additional Page number field shown in the screen shot is due to adding a Header and inserting a Page number field in it.
Comment 5 Heiko Tietze 2022-01-03 10:19:43 UTC
(In reply to Jim Raykowski from comment #3)
> Perhaps add a 'Header/Footer' tag to the field listing in the Navigator such
> as is shown in the attached screen shot?

Don't see a use case that requires all page numbers in the Navigator and would rather suppress repeated content. Which means to do as you suggest: show once with the info being part of header/footer.
Comment 6 Telesto 2022-01-03 10:37:59 UTC
(In reply to Jim Raykowski from comment #3)
> Created attachment 177256 [details]
> header footer tag for page number field
> 
> @Telesto, Happy New LO Year!

Thanx!

> 
> Think you mean fields in the footer. 

Sorry, yes. Not sure where my mind was while typing the bug report ..

> I noticed when 'Same content on left and right pages' and 'Same content on
> first page' settings are turned off, 'Page number - 3, 2, 1' show in the
> Fields category along with a grayed out 'Page number - 3'.
> 
> Perhaps add a 'Header/Footer' tag to the field listing in the Navigator such
> as is shown in the attached screen shot?

Surely better compared to the current situation. So +1 from me. 

> The grayed out field seems to me to be a bug with header/footer handling of
> fields. We could sweep it under the carpet by not displaying fields in the
> header/footer that are in hidden state. What do you think? Maybe discuss in
> a separate ticket?

Well I personally dislike sweeping things under the carpet. It makes tracking of bugs very hard, and simply solving an issue at the wrong level. So it's rather a 'last resort'. Which isn't the last option by definition, but also matter of cost/benefit and how much harm it can do  

I encountered the same problem in slightly different consternation at bug 146491. Where it seems - no understanding of the code - that hidden fields are written to DOCX. Which is likely wrong (polluting the file). Which makes showing hidden fields in navigator more of a feature
Comment 7 Jim Raykowski 2022-01-09 06:43:43 UTC
(In reply to Telesto from comment #6)
> I encountered the same problem in slightly different consternation at bug
> 146491. Where it seems - no understanding of the code - that hidden fields
> are written to DOCX. Which is likely wrong (polluting the file). Which makes
> showing hidden fields in navigator more of a feature
Seems the revert patch for bug 146491 only solves that particular issue.

I can still make hidden fields appear in the Navigator upon adding a Header to the example file or unchecking the 'Same content on left and right pages' option in the Page Style Header and/or Footer tab(s).

Definitely will dig through the code to try to find out why this happens and if it can be changed before throwing in the towel and doing a hack around.

Showing hidden fields may be useful when a field is in a hidden section or in folded outline content.
Comment 8 BogdanB 2022-01-21 02:25:29 UTC
Confirm with
Version: 7.3.1.0.0+ / LibreOffice Community
Build ID: 216ad305810d1d36cf5874fd9842111d426899a8
CPU threads: 4; OS: Linux 5.13; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded

Also with
Version: 7.2.5.2 / LibreOffice Community
Build ID: 499f9727c189e6ef3471021d6132d4c694f357e5
CPU threads: 4; OS: Linux 5.13; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 9 Commit Notification 2022-01-22 21:50:08 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a903d114f8d67f266e12d129333fb35c04861ae2

tdf#146490 SwNavigator: replace page number field expand field text

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Jim Raykowski 2022-01-22 22:00:56 UTC
I've marked this bug as resolved fixed. I think the problems with graying out of fields should be opened in a separate ticket.
Comment 11 BogdanB 2022-01-24 18:43:43 UTC
Verified.

Jim, thanks for solving, and Telesto for reporting.

Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: 0c3b8792b712e939d2ad524d554f96616b4844be
CPU threads: 16; OS: Linux 5.13; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 12 Jim Raykowski 2022-02-19 07:55:38 UTC
Any objections to just not including fields that are in header footers in the Fields content list? They really don't behave well.
Comment 13 Heiko Tietze 2022-02-21 07:56:49 UTC
(In reply to Jim Raykowski from comment #12)
> Any objections to just not including fields that are in header footers in
> the Fields content list? They really don't behave well.

Take it by the curb. Header/Footer are seen as special areas and might become hidden in special distraction-free views, for example.
Comment 14 Commit Notification 2022-02-24 03:34:38 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5693f0caa0bb589696ac36b9e0ca42b5e26924d0

tdf#146490 SwNavigator: don't show fields that are in header footer area

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Jim Raykowski 2022-02-24 03:36:54 UTC
(In reply to Heiko Tietze from comment #13)
> (In reply to Jim Raykowski from comment #12)
> > Any objections to just not including fields that are in header footers in
> > the Fields content list? They really don't behave well.
> 
> Take it by the curb. Header/Footer are seen as special areas and might
> become hidden in special distraction-free views, for example.
To the curb it is with much relief.
Comment 16 sdc.blanco 2022-04-10 12:47:29 UTC
(In reply to Commit Notification from comment #14)
> Affected users are encouraged to test the fix and report feedback.
Found this ticket, after noticing (in 7.4.0) that header/footer fields were missing.  

Some feedback.

1. When fields first appeared in Navigator (thanks!), didn't it show repeatedly the fields in header/footer for each page?  which was also irritating, but then it got better (thanks again!)

2. When the header/footer field was missing (in this latest version), it was noticed (and a little unsettling).  Had the field fallen out of the document? etc.

3. Point of the previous two points: at least one user actually uses (and is grateful for) this feature in Navigator, and notices what happens with it, while also having a sense that it can be improved. iow -- thanks for this feature, and thanks for being willing to consider further refinement of it.

4. A query (inspired in part by the recent Footnotes/Endnotes in Navigator, along with the mention here that Header/Footer fields are difficult):  Would it be possible/easy to make a special "Header/Footer" section in Navigator that would show "fields", "images", "objects"?

(use case:  it becomes easier and easier to use Navigator now to open editing of shapes, frames, fields, rather than selecting, right-clicking, etc in the document.  It would be convenient to have all Header/Footer things collected in one place -- where these items would NOT then appear in Fields, Images, Shapes (thereby avoiding the labelling problem that was first attempted with this ticket).