https://bugs.documentfoundation.org/show_bug.cgi?id=167851

            Bug ID: 167851
           Summary: Writer: inconsistent field value capture for headers
                    and footers
           Product: LibreOffice
           Version: 25.2.5.2 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Writer
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 202230
  --> https://bugs.documentfoundation.org/attachment.cgi?id=202230&action=edit
Incorrect value captured for header

Showing first and last item in a page header, such as heading, is common
typographical usage.

The "first value" is the one in effect for the "object" at the very top of the
page, at left of the first character, the "last value" the one in effect at the
very bottom, at right of the last character.

The "object" is usually a variable which can easily be changed by the author.
As an example, think of sentence or verse numbering. A *Set variable* field is
inserted where this number should appear.

The header is met first in a page. Consequently, we expect fields inside the
header to show values in effect at beginning of page. Similarly, the footer is
met last and we expect fields there to show values in effect at bottom of page.

The attached sample document exhibit an undocumented behaviour of the capture
process.

When the first paragraph, eventually clipped to page break in case it spans
several pages, contains at most a single occurrence of the variable, the result
is as expected.

However, if this paragraph (or the first to contain occurrences of the
variable) has several occurrences of the same variable, the value of the _LAST_
occurrence is reported in the header. This can be explained if the full
paragraph is scanned instead of taking into account only the state at first
character.

This causes two errors:
- if only one variable occurs in the middle of the paragraph, we get this
value, which is not the value in effect at start of paragraph. We're off by one
(or worse if the variable is reset).
- if there are several variable occurrences, we get the last one, which is
obviously different from the value in effect at start of paragraph.

Assuming the same algorithm is used for the footer at bottom of page in the
last paragraph, it always returns the correct value because we expect this
latest value.

It is likely that the same algorithm is used for headings because captures are
paragraph-based: heading text is the full paragraph text; heading number comes
from the associated list style which can only be applied to a paragraph.

The case of variables is different. It should operate at character level
because you can have several variable insertion in sequence inside a single
paragraph (sentence numbering).

Meanwhile, I could not find any workaround.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to