Bug 149480

Summary: text:page-adjust behaves wrong when page number is defined manually
Product: LibreOffice Reporter: Mike Kaganski <mikekaganski>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: normal CC: aron.budea, buzea.bogdan, rb.henschel
Priority: medium    
Version: Inherited From OOo   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=35694
https://bugs.documentfoundation.org/show_bug.cgi?id=154928
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 108746    

Description Mike Kaganski 2022-06-07 15:12:43 UTC
In a new text document:

1. Add two page breaks (so that the document has three pages);
2. Edit the last page break, to define page style (the same Default) and page number (1);
3. Add a footer to Default page style;
4. Add a Page Number field, a text " and the next is ", and another Page Number field to the footer text; the second Page Number field should have Offset set to 1.

Using of Version: 7.3.4.1 (x64) / LibreOffice Community
Build ID: 13668373362b52f6e3ebcaaecb031bd59a3ac66b
CPU threads: 12; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: en-US (ru_RU); UI: en-US
Calc: CL Jumbo

The end result is:
First page has footer text  "1 and the next is 2"
Second page has footer text "2 and the next is 3"
Third page has footer text  "1 and the next is 2"

Note the ODF description of the feature provided in bug 35694 comment 39; the current text is at [1].

Two problems here:

1. Second page must show "2 and the next is 1";
2. Third page must show  "1 and the next is " (there must be no number after "is").

Rationale:
The feature is meant to refer to previous or following pages, not to do arithmetic operations with current page number. The wording makes sure to tell about "display of page numbers of following or preceding pages", i.e., the offset is used to get to some page before or after, but the display must reflect the target page number as it is defined on that page.

This means that on page 2, the next page is the third one - and that page must be found using the offset; then that third page's number (i.e., "1") must be displayed.

On the third page, the offset must result in an absent next page, and the display must be empty, as specified by the standard.

[1] https://docs.oasis-open.org/office/OpenDocument/v1.3/OpenDocument-v1.3-part3-schema.html#attribute-text_page-adjust
Comment 1 Regina Henschel 2022-06-07 16:30:40 UTC
I agree with you. If the document has a page sequence of "1" "2" "A", then offset +1 should generate "2", "A", "".

I see the same problem in AOO.
Comment 2 BogdanB 2023-04-28 15:45:40 UTC
The same
Retested with
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 424bdeda9fea09f0b48b5551baf872656845c7c3
CPU threads: 16; OS: Linux 5.19; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded