is RES_PARATR_LIST_AUTOFMT really necessary?
Michael Stahl
mst at libreoffice.org
Mon Sep 30 13:43:36 UTC 2024
Writer never had a concept of a "paragraph marker", but in Word there is
a character in the text at the end of the paragraph that can be selected
and formatted by the user; this presents an obvious interop problem.
RES_PARATR_LIST_AUTOFMT was added 5 years ago to store the formatting of
the paragraph marker in Word formats (e.g. \par in RTF or the w:rPr
child of w:pPr in DOCX).
this was added initially just to round-trip and to apply it to list
numbering, which Word also does, hence the name.
an additional complication is that Word allows applying a character
format to the paragraph marker, which is currently implemented as a
RES_TXTATR_CHARFMT item in the RES_PARATR_LIST_AUTOFMT's item set.
so for the paragraph marker we currently determine the formatting thus:
1. RES_PARATR_LIST_AUTOFMT items
2. RES_PARATR_LIST_AUTOFMT RES_TXTATR_CHARFMT items
3. node items
4. node para style items
(where "currently" means since 2 days ago, and "the formatting" means
line height, nothing else, in particular not the pilcrow symbol which is
painted in a very odd manner in a completely different function and
doesn't really exist in the SwLineLayout...)
but it looks like in Word formats there isn't really a "paragraph
formatting" that is different from the "paragraph marker formatting", or
at least none that i can find - except for the paragraph style.
so i've been asking myself, can't we just do away with
RES_PARATR_LIST_AUTOFMT and use the node's item set instead?
statically, this would mean to replace RES_PARATR_LIST_AUTOFMT in the
node item set with an item equivalent to RES_TXTATR_CHARFMT; the other
items that can be contained in RES_PARATR_LIST_AUTOFMT are already
available in the node item set; the node item set would then be used
only for the paragraph marker formatting, not for the entire paragraph
as it currently is.
but there are problems: because currently there is no practical
difference between putting an item into the node's item set vs. putting
it as a RES_TXTATR_AUTOFMT attribute from 0 to the end of the node,
there is code that converts between these 2 representations, e.g.,
SwTextNode::FormatToTextAttr() and it's called automatically in some
situations, which would then change the formatting; this needs to be
tracked down and checked.
the status quo also has problems, probably there are a bunch of actions
that should set or clear RES_PARATR_LIST_AUTOFMT but where it remains
untouched.
also, there is no UI currently that allows the user to change
RES_PARATR_LIST_AUTOFMT; if the node's item set were used, it's also
unclear how to present that in the UI - this is solved in Word by having
this magic character, but that doesn't look like a good solution for Writer.
of course, there are the existing ODF documents and for those the
previous semantics of the node item set would need to be preserved
somehow...
so, i'm not sure what the best solution here would look like.
More information about the LibreOffice
mailing list