Bug 166179 - Writer paragraph marker formatting: can't get rid of character properties
Summary: Writer paragraph marker formatting: can't get rid of character properties
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
25.8.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard: target:25.8.0 target:25.2.4
Keywords:
Depends on:
Blocks:
 
Reported: 2025-04-14 14:13 UTC by Miklos Vajna
Modified: 2025-04-23 10:35 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Minimal reproducer (14.09 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2025-04-14 14:13 UTC, Miklos Vajna
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Miklos Vajna 2025-04-14 14:13:37 UTC
Created attachment 200339 [details]
Minimal reproducer

Steps to reproduce the problem:

1) Open the attached document
2) Go to the end of the 2nd paragraph (closest to "select 2nd paragraph marker" in Word)
3) Notice that the toolbar suggests the character property "strike-through" is on.
4) Click on the enabled toolbar button

Expected result: the text in the relevant paragraph is no longer strike-through

Actual result: nothing changes for the rendered text
Comment 1 V Stuart Foote 2025-04-14 15:23:26 UTC
But I can already use the Formatting -> 'Clear Direct Formatting' menu entry, or the button entry provided on the Formatting (Styles) toolbar when the list item is selected.

So isn't this Direct Formatting? The color and the strikethrough? And it behaves as expected...

Opening the custom List Style WWNum1 to see it uses the "ListLabel 1" character style. Editing that I see there is no Font Attribute set for the character style, it can be.
Comment 2 Miklos Vajna 2025-04-15 07:23:10 UTC
This is direct formatting, but Word has no paragraph-level character properties, it only has character properties on the paragraph marker; while Writer has paragraph-level char properties, but has no paragraph marker.

To bridge the two, Michael S added RES_PARATR_LIST_AUTOFMT, which can store the char props of the paragraph marker, and this is used during rendering, but you can only clear all character properties at once, you can't just clear one of them, or set a custom value or anything. :-) So the bug is that there is no UI to edit the RES_PARATR_LIST_AUTOFMT of a paragraph.

> And it behaves as expected...

Nah, if I see "strike-through" is enabled on the toolbar and I press the button and nothing happens, that's weird, I would say.
Comment 3 V Stuart Foote 2025-04-15 12:05:19 UTC
(In reply to Miklos Vajna from comment #2)
> 
> > And it behaves as expected...
> 
> Nah, if I see "strike-through" is enabled on the toolbar and I press the
> button and nothing happens, that's weird, I would say.

Only at the last position of the paragraph's text run does the Strikethrough effect show. Add some text from there, and any additional text being entered will take the DF (color and strike through).

For that new text, toggling the Strikethrough off still leaves the DF of the red text color in place. And with selection, the DF of the text color can also be removed. 

But that leaves the List markings DF (of color and strike through) intact, isn't that expected?

The List marks and Paragraph text are different objects, seems like the ww8 filter import giving DF the list markings should not bleed over into the paragraph.
Comment 4 Commit Notification 2025-04-15 13:58:11 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5dde0947cd1eafde690bd032805be732f5ee6f02

tdf#166179 sw: fix inconsistent UI state vs command exec for the para marker

It will be available in 25.8.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 5 Miklos Vajna 2025-04-15 14:11:26 UTC
(In reply to V Stuart Foote from comment #3)
> But that leaves the List markings DF (of color and strike through) intact,
> isn't that expected?
> 
> The List marks and Paragraph text are different objects, seems like the ww8
> filter import giving DF the list markings should not bleed over into the
> paragraph.

It's an MS Word (mis)feature that some character properties on the paragraph marker formatting are also used for the number portion. The context of this bug is around that compat mode, since the reproducer document is a DOCX file.

In this case the formatting of the paragraph marker is currently represented twice in the import result (empty span at the paragraph end, and a dedicated per-paragraph RES_PARATR_LIST_AUTOFMT -- I would hope that in the long run we get rid of the empty span), and the old UI only updated the span, not the RES_PARATR_LIST_AUTOFMT, which sounds inconsistent.

The above commit fixes that, now you can selectively remove the redness or the strike-through if your cursor is at the end of the paragraph (closest to Word's "select the paragraph marker", and only that, not the entire paragraph), instead of just being able to clear all of them using Ctrl-M.

Thanks for your thoughts, though. :-) Given that I'm used to the Writer way of doing this (char props are possible at character level, list portion is described using the list level's associated paragraph style), I agree that this is weird, so it's correct that all this only happens when we're in Word compat mode.
Comment 6 Commit Notification 2025-04-23 10:35:04 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

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

tdf#166179 sw: fix inconsistent UI state vs command exec for the para marker

It will be available in 25.2.4.

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.