[Libreoffice-bugs] [Bug 128041] New: conditional text in header/footer fields turned static

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Wed Oct 9 08:53:17 UTC 2019


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

            Bug ID: 128041
           Summary: conditional text in header/footer fields turned static
           Product: LibreOffice
           Version: 6.2.7.1 release
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Writer
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: page74010-sf at yahoo.fr

Description:
Conditional text or hidden text/para/section is used to create variants of a
base document. The conditional blocks are included or hidden based on the value
of a variable.

In the main text flow, the condition of the field is computed using the latest
value of the variable. Thus if various "set variable" fields are used
throughout the document, the conditional block will reflect the state of the
variable known at the location of the block.

In header of footer, field values are captured at start (header) or bottom
(footer) of page, as can be seen for page number, chapter number or
user-variable. What is inserted is the running value of these variables.

When it comes to conditional block, the situation is quite different. What I
understand from my experiments is the following:

- header/footer are "translated" to some internal form when the page style is
first met and this is cached in the page style
- whenever a header/footer needs to be inserted in the final formatted output
flow (what is printed or displayed on screen), the cache is used to speed up
layout
- "simple" field insertion, like page number, is a code to fetch the variable
value and to format it

But conditional blocks seem to be interpreted when the cache entry is built,
i.e. the condition is computed with the values known at this moment and the
associated text/para/section is stored in the cached or discarded.

Later when the header/footer is inserted in the output page, the block is no
longer conditional but "static".

This behaviour makes sense for the main text flow because the block is be met
only once.

But it leads to inconsistencies in the header/footer:
- I can insert the current value of the condition variable
- I can also attempt to insert a conditional block controlled by the same
variable but it is now static, reflecting the state of the variable at the
beginning of the sequence of the pages under the current page style

The conditional block will no longer change whereas the inserted variable value
does.

This may be the result of a design decision, but it is not stated explicitly in
the documentation nor in the built-in help.

Why do I need it?

Presently, you can handle header/footer variants through the first page, odd
page, right page sub-style definitions. This takes care of the first page
having a special presentation.

I am presently facing a typographic case where the LAST page of a sequence must
be formatted differently. This is not the last page of the document (which
could be detected with the "Next page" field returning a null value).
Consequently, I added "set variable" fields in the main text flow to toggle the
state of a flag variable. I use this flag value in a footer to control
conditional insertion, but it does not work.

This special formatting can't be replaced by a page break to an ad-hoc page
style, because there should be no page break in main text flow. It is really
only a spot location, not a range, which needs to be flagged, something like a
note, but in the footer area, not in the note area. And also, it must not cause
conflicts with notes.

I asked a question on ask.libreoffice.org but didn't get a workaround
https://ask.libreoffice.org/en/question/211993/writer-headerfooter-variables-and-conditional-text/

Steps to Reproduce:
1. create a multipage document with a "set variable" field on every page, value
alternates between 0 and 1
2. in the footer, insert a "show value" field for the variable
3. in the footer, add two "hidden paragraph" fields with condition ==0 and ==1
and text telling whic value is not active

Actual Results:
Variable current value is correctly echoed
"Hidden paragraph" is the one selected by the value of the variable at the
bottom of the first page

Expected Results:
"Hidden paragraph" should follow variable value


Reproducible: Always


User Profile Reset: No



Additional Info:
Test file provided

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20191009/08627910/attachment-0001.html>


More information about the Libreoffice-bugs mailing list