Bug 161657 - [DOCX] LibreOffice shouldn't try to import the comment style from DOCX files
Summary: [DOCX] LibreOffice shouldn't try to import the comment style from DOCX files
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: difficultyMedium, easyHack, skillDesign
Depends on:
Blocks: DOCX-Comments
  Show dependency treegraph
 
Reported: 2024-06-19 14:09 UTC by Rafael Lima
Modified: 2024-07-26 07:28 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample DOCX file (12.42 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2024-06-19 14:09 UTC, Rafael Lima
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Lima 2024-06-19 14:09:23 UTC
Created attachment 194823 [details]
Sample DOCX file

LibreOffice has now support for comment styles, which is great.

However, when importing DOCX files, LO shouldn't try to "import" or "guess" the comment style from the DOCX file.

The problem occurs when we have line spacing in the DOCX file, so the comment will now have line spacing as well, which is bad because the comment box is usually small and spacing between lines is not desired.

We should either:
1) Not import line spacing attributes for comment styles of DOCX files, or...
2) When the file is DOCX, assume a default style created by LO on the fly, maybe only using the same font from the standard style in the DOCX file

Steps to reproduce:
1) Open the attached DOCX file (this was created in Word)
2) Insert a comment
3) Write a comment that has multiple lines
4) Notice the spacing between the lines

Expected results:
There should be no spacing between the lines in de default imported comment style

This is especially problematic when reading scientific papers and dissertations, in which the default style almost always uses 1.5 line spacing, and then the comments start having these 1.5 line spacings as well, which is annoying because now in every DOCX I receive, I have to fix the comment style.

System info:

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 6b2aaaa6be71b1289521bd2ffd2d4abacecabb87
CPU threads: 16; OS: Linux 6.8; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Calc: CL threaded
Comment 1 Dieter 2024-07-14 14:42:47 UTC
I confirm it with

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: ccc3996cfcbebe14e9d5f3511906cfc64ddf3452
CPU threads: 4; OS: Windows 10 X86_64 (10.0 build 19045); UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL threaded

> We should either:
> 1) Not import line spacing attributes for comment styles of DOCX files, or...
> 2) When the file is DOCX, assume a default style created by LO on the fly,
> maybe only using the same font from the standard style in the DOCX file

I think, a general decision should be taken by design-team
Comment 2 Heiko Tietze 2024-07-15 08:06:34 UTC
The comment styling is not necessarily as bad as in your sample document. And changing the style is pretty simple. I would not mess with the import filter.
(You may also use the comments sidebar soon, bug 106316.)

However, if someone changes the Default PS, the Comment PS follows. We could solve this by adding the single-line attribute so it wont be overwritten. Perhaps indentation and spacing too.
Comment 3 Eyal Rozenberg 2024-07-24 16:16:48 UTC
TBH, I've always been of two minds about "fully-styleable" comments, with paragraph styles and such. 

One extreme of how to consider comments is as something which is basically just textual, and the document viewer or editor can choose to put them anywhere, in different layouts (boxes near the page, sidebar, comment area with one line per comment etc) and the comment author should not make any assumptions regarding how they're going to look.

The other extreme is of the comment being a sort of a mini-document in a box.

I believe this contradiction or duality is reflected also in this bug:

> ... when we have line spacing in the DOCX file...

so, the thing is, we _always_ have line spacing in our comments - because they are made up of paragraphs, with paragraph styles, which include line spacing. What if it were an ODT with a comment paragraph style which included a line spacing other than the default? How do we distinguish between a "legitimate" decision to use 1.5x spacing - which we support - from an "illegitimate" decision? It's problematic to use the fact that the input file is DOCX as the criterion.
Comment 4 Heiko Tietze 2024-07-26 07:20:14 UTC
We discussed the topic in the design meeting.

To ensure the comments being readable we should define the attributes on the Comments style

* line spacing = single
* indents = all 0,
* spacing = 0
* font color = COL_AUTO
* highlight = none

Code pointer:

Attribuites need to be added at DocumentStylePoolManager::GetTextCollFromPool() in sw/source/core/doc/DocumentStylePoolManager.cxx under "case RES_POOLCOLL_COMMENT:"