Bug 116404 - FILESAVE DOCX: Styles of new RTL document saved in .docx as LTR
Summary: FILESAVE DOCX: Styles of new RTL document saved in .docx as LTR
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:6.3.0
Keywords:
Depends on:
Blocks: DOCX RTL
  Show dependency treegraph
 
Reported: 2018-03-14 17:10 UTC by eladhen2
Modified: 2024-08-03 09:15 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description eladhen2 2018-03-14 17:10:54 UTC
Description:
In Writer, when writing a new RTL document with locale defined as Hebrew the document behaves as though it's in RTL, but checking the Default Style "Text direction" is defined as "Use superordinate object settings".  If you save the document as docx and reopen it you will find that the Default Style's "Text direction" is defined as "Left-to-right (LTR)". Applying Styles in the document now are LTR. 




Steps to Reproduce:
1. Define your locale as Hebrew in Tools > Options > Language Settings > Languages
2. Restart Libreoffice Writer.
3. Write a document using styles (heading 1, Text Body etc.). Notice that the text is RTL (as it should be in this Locale).
4. Go to Styles > Styles and formatting and right click Default Style, selecting Modify... > Alignment. Notice that Properties > Text direction is set by default to "Use superordinate object settings"
5. Save the file as a docx file.
6. Close LO writer and reopen the saved docx file.
7. Write a line and apply a style (heading 1, Text Body etc.).


Actual Results:  
The applied styles' Text direction is "Left-to-right (LTR)".

Expected Results:
*The same RTL styles from while writing the file would be applied.


Reproducible: Always


User Profile Reset: No



Additional Info:
Workaround
*You can manually go to Styles > Styles and formatting and right click Default style, selecting Modify... > Alignment > Properties > Text direction and change it to "Right-to-left (RTL)" before you save.

I'm using Version 6.0.2.1 on Linux Mint 18.3


User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0
Comment 1 Julien Nabet 2018-03-14 20:55:51 UTC
On pc Debian x86-64 with master sources updated today, I could reproduce this.
Comment 2 Xisco Faulí 2018-03-15 10:02:57 UTC
Reproduced in

Version: 5.2.0.0.alpha0+
Build ID: 3ca42d8d51174010d5e8a32b96e9b4c0b3730a53
Threads 4; Ver: 4.10; Render: default; 

Version: 4.3.0.0.alpha1+
Build ID: c15927f20d4727c3b8de68497b6949e72f9e6e9e
Comment 3 Eyal Rozenberg 2018-03-15 22:34:58 UTC
I am able to reproduce only partially:

* I do see the Heading 1 and Text Body styles of the DOCX file are defined to have LTR direction, in their style properties. However,
* I see the two paragraphs I had written using those styles still directed RTL (and right-aligned)

Also using v6.0.2.1 on GNU/Linux Mint 18.3.
Comment 4 eladhen2 2018-03-15 22:39:09 UTC
(In reply to Eyal Rozenberg from comment #3)
> I am able to reproduce only partially:
> 
> * I do see the Heading 1 and Text Body styles of the DOCX file are defined
> to have LTR direction, in their style properties. However,
> * I see the two paragraphs I had written using those styles still directed
> RTL (and right-aligned)
> 
> Also using v6.0.2.1 on GNU/Linux Mint 18.3.

That's identical to what I get. the text that's already written stays RTL, but the styles are now all LTR, and if you apply any of them the text they are applied on becomes LTR.
Comment 5 Eyal Rozenberg 2018-12-27 16:44:37 UTC
This seems to happen with Arabic as well, so changing the "Blocking" bug number.
Comment 6 Justin L 2019-01-26 13:01:08 UTC
This is an excellent, clear problem description - thanks. Also applies to .DOC.

Note that this ONLY seems to apply to completely new documents.  If saved as ODF and re-loaded, then the  export to docx saves the bidi setting. That suggests an "unset" default value is being skipped in the export process. Wrtw8styl.cxx OutputStyle identifies nPos==0 as "Normal" style, so we can force the RES_FRAMEDIR property to be ::SET here.

The identical thing is happening on import in WW8RStyle::Import().
        /*
        Word defaults to ltr not from environment like writer. Regardless of
        the page/sections rtl setting the standard style lack of rtl still
        means ltr
        */
Comment 7 Justin L 2019-01-26 16:34:18 UTC
proposed fix via these three parts:
-https://gerrit.libreoffice.org/66964 tdf#116404 filter\ww8: use bidi for default style in RTL locale
-https://gerrit.libreoffice.org/66965 tdf#116404 DOC: check locale if BiDi inherits Environment
-https://gerrit.libreoffice.org/66966 tdf#116404 RTF: check locale if BiDi inherits Environment
Comment 8 Commit Notification 2019-02-23 15:39:22 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/06742182e5306d6d06e3253981723a69a3c978ab%5E%21

tdf#116404 filter\ww8: use bidi for default style in RTL locale

It will be available in 6.3.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 9 Commit Notification 2019-02-25 04:17:23 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/ae4e0a81753dd280f6b77b5ee61cf7e9f85e5cfe%5E%21

tdf#116404 DOC: check locale if BiDi inherits Environment

It will be available in 6.3.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 10 Commit Notification 2019-02-26 19:28:02 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/aebc79b670fb60c43dd07e8e963abe019754c092%5E%21

tdf#116404 RTF: check locale if BiDi inherits Environment

It will be available in 6.3.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 11 Commit Notification 2019-03-19 18:24:05 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/daa4aef1512eb7a6b615720725a5a682b0030f8e%5E%21

try2 tdf#116404 filter\ww8: use bidi for default style in RTL locale

It will be available in 6.3.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.