[Libreoffice-bugs] [Bug 47471] Clear Direct Formatting damages the document's styles

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Tue Apr 25 11:53:10 UTC 2017


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

Thomas Lendo <thomas.lendo at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thomas.lendo at gmail.com

--- Comment #19 from Thomas Lendo <thomas.lendo at gmail.com> ---
I can reproduce this bug with attachment 59017 and with my own test file.

Version: 5.3.2.2
Build ID: 6cd4f1ef626f15116896b1d8e1398b56da0d0ee1
CPU Threads: 8; OS Version: Windows 6.2; UI Render: default; Layout Engine:
new; 
Locale: de-DE (de_DE); Calc: CL

Steps to reproduce:
1. Create a Writer file.
2. Write some text.
3. Apply a paragraph style to the whole text (different than "Default style",
e.g. Ctrl + A and select "Text Body").
4. Select some text and do some direct PARAGRAPH formatting (e.g. open context
menu "Paragraph..." > Area > Color > select red color > OK -- applying a yellow
highlight color from the toolbar is not enough).
5. Select all text with Ctrl + A.
6. Type Ctrl + M.
7. Save the file.
8. Open the file again.

Actual result:
The text which was changed with direct formatting is assigned to "Default
style".

Expected result:
Styles shouldn't change.

My assumption:

When changing text with direct formatting, LibO creates a new style in the
content.xml (P1, P2, etc for paragraphs; T1, T2, etc. for character styles).
This new style includes the direct formatting (e.g. background color) and a
link to the parent style.
When activating the "Clear Direct Formatting" command, LibO deletes the direct
formatting. But LibO doesn't delete the new style (e.g. P1) completely AND
doesn't assign the original parent style to the text.

Example of content.xml before doing Clear Direct Formatting:

<office:automatic-styles>
 <style:style style:name="P1" style:parent-style-name="Endnote"
style:family="paragraph">
  <loext:graphic-properties draw:fill-color="#ff0000" draw:fill="solid"/>
  <style:paragraph-properties style:writing-mode="page"
fo:background-color="#ff0000"/>
 </style:style>
</office:automatic-styles>

<office:body>
 <office:text>
  <text:p text:style-name="Endnote">Ich bin ein Text.</text:p>
  <text:p text:style-name="P1">Ich bin ein Text.</text:p>
  <text:p text:style-name="Endnote">Ich bin ein Text.</text:p>
 </office:text>
</office:body>

Example of content.xml after doing Clear Direct Formatting:

<office:automatic-styles>
 <style:style style:name="P1" style:family="paragraph">
  <loext:graphic-properties draw:fill-color="#ff0000" draw:fill="solid"/>
  <style:paragraph-properties style:writing-mode="page"
fo:background-color="#ff0000"/>
 </style:style>
</office:automatic-styles>

<office:body>
 <office:text>
  <text:p text:style-name="Endnote">Ich bin ein Text.</text:p>
  <text:p>Ich bin ein Text.</text:p>
  <text:p text:style-name="Endnote">Ich bin ein Text.</text:p>
 </office:text>
</office:body>

Suggestion:

When activating the "Clear Direct Formatting" command, LibO should assign the
parent style to the paragraph (in the example above: text:style-name="Endnote"
instead of text:style-name="P1") and then LibO should delete P1 as much as it
includes direct formatting.

-- 
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/20170425/c61977e6/attachment.html>


More information about the Libreoffice-bugs mailing list