Difference between revisions of "TextAlignment"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Solution)
Line 5: Line 5:
 
= Issue 105270 - see [http://qa.openoffice.org/issues/show_bug.cgi?id=105270 here] =
 
= Issue 105270 - see [http://qa.openoffice.org/issues/show_bug.cgi?id=105270 here] =
  
The following is about how to solve issue 105270 for OpenOffice.org.
+
The following is about how to solve Issue 105270 for OpenOffice.org.
  
 
== Text Alignment - OpenOffice.org vs. OpenDocument ==
 
== Text Alignment - OpenOffice.org vs. OpenDocument ==
Line 13: Line 13:
 
In OpenDocument (ODF) which relies on XSL - http://www.w3.org/TR/xsl/#text-align - the text alignment attribute values <code>LEFT</code> and <code>RIGHT</code> are mapped to <code>START</code> and <code>END</code> respectively and are dependent on the writing direction of the paragraph.
 
In OpenDocument (ODF) which relies on XSL - http://www.w3.org/TR/xsl/#text-align - the text alignment attribute values <code>LEFT</code> and <code>RIGHT</code> are mapped to <code>START</code> and <code>END</code> respectively and are dependent on the writing direction of the paragraph.
  
This is the root cause of issue 105270.
+
This is the root cause of the defect described with issue 105270.
 
The text alignment of a paragraph whose writing direction is right-to-left and which is text-aligned at the right border is stored by OOo by ODF attribute <code>fo:text-align="END"</code>.
 
The text alignment of a paragraph whose writing direction is right-to-left and which is text-aligned at the right border is stored by OOo by ODF attribute <code>fo:text-align="END"</code>.
 
<code>fo:text-align="END"</code> is interpreted by OOo as internal text alignment attribute value <code>RIGHT</code> in order to align the paragraph at the right border.
 
<code>fo:text-align="END"</code> is interpreted by OOo as internal text alignment attribute value <code>RIGHT</code> in order to align the paragraph at the right border.
Line 20: Line 20:
 
For a right-to-left paragraph this is the left border.
 
For a right-to-left paragraph this is the left border.
  
== Solution ==
+
The defect of issue 105270 is serious one regarding OOo's ODF support for documents which contain paragraphs whose writing direction is right-to-left. It causes also interoperability problems when exchanging such documents with other ODF supporting application, especially ODF supporting office productivity applications.
 +
 
 +
== Easy Fix - but not sufficient ==
  
 
It looks like as this issue is easy to fix:
 
It looks like as this issue is easy to fix:
* Just change OOo's interpretation of <code>LEFT/START</code> and <code>RIGHT/END</code> and everything is ok.
+
* ''easy fix'': Just change OOo's interpretation of <code>LEFT/START</code> and <code>RIGHT/END</code> and everything is ok.
  
Unfortunately, it is not that easy :(
+
Unfortunately, it is not that easy :( - the reasons are:
* OOo has corresponding UNO-APIs for the text alignment, namely com::sun::star::style::ParagraphProperties for paragraph and com::sun::star::table::CellProperties for the paragraphs in table cells.
+
* OOo has corresponding UNO-APIs for the text alignment, namely com::sun::star::style::ParagraphProperties for paragraphs and com::sun::star::table::CellProperties for the paragraphs in table cells. These UNO-APIs have writing direction independent text alignment values <code>LEFT</code> and <code>RIGHT</code>. Applying the ''easy fix'' would be a incompatible change of these UNO-APIs and would break existing extensions, macros, etc. which are using these UNO-APIs.
These UNO-APIs have writing direction independent text alignment values <code>LEFT</code> and <code>RIGHT</code>.
+
* In order to fulfill the user expectations regarding the handling of ODF documents created by former OOo versions in a new OOo version existing ODF documents created by OOo versions which still have issue 105270 need to be "corrected" when handled by OOo versions in which issue 105270 has been fixed.
 +
* ODF documents containing paragraphs whose writing direction is right-to-left and created by OOo versions in which issue 105270 has been fixed will be displayed incorrect in OOo versions which still have issue 105370. This is the nature of the defect described in issue 105270. But, it does not correspond to the user expectations regarding the handling of ODF documents created by newer OOo versions in a former OOo version. This problem already exists when handling such ODF documents which are created by other ODF supporting applications. There is nothing to do to solve this problem, except updating to the up-to-date OOo version. When preparing the OOo version in which issue 105270 will be fixed, this problem should be clearly communicated. At least the release notes should contain corresponding communication about the solution of issue 105270 and its impact.

Revision as of 09:01, 22 July 2010

WORK IN PROGRESS

Issue 105270 - see here

The following is about how to solve Issue 105270 for OpenOffice.org.

Text Alignment - OpenOffice.org vs. OpenDocument

In OpenOffice.org (OOo) the text alignment attribute values LEFT and RIGHT are treated independent from the writing direction of the paragraph.

In OpenDocument (ODF) which relies on XSL - http://www.w3.org/TR/xsl/#text-align - the text alignment attribute values LEFT and RIGHT are mapped to START and END respectively and are dependent on the writing direction of the paragraph.

This is the root cause of the defect described with issue 105270. The text alignment of a paragraph whose writing direction is right-to-left and which is text-aligned at the right border is stored by OOo by ODF attribute fo:text-align="END". fo:text-align="END" is interpreted by OOo as internal text alignment attribute value RIGHT in order to align the paragraph at the right border. But, this is not correct. According to ODF the text alignment attribute value END means that the paragraph is text-aligned at the end-edge in the writing direction. For a right-to-left paragraph this is the left border.

The defect of issue 105270 is serious one regarding OOo's ODF support for documents which contain paragraphs whose writing direction is right-to-left. It causes also interoperability problems when exchanging such documents with other ODF supporting application, especially ODF supporting office productivity applications.

Easy Fix - but not sufficient

It looks like as this issue is easy to fix:

  • easy fix: Just change OOo's interpretation of LEFT/START and RIGHT/END and everything is ok.

Unfortunately, it is not that easy :( - the reasons are:

  • OOo has corresponding UNO-APIs for the text alignment, namely com::sun::star::style::ParagraphProperties for paragraphs and com::sun::star::table::CellProperties for the paragraphs in table cells. These UNO-APIs have writing direction independent text alignment values LEFT and RIGHT. Applying the easy fix would be a incompatible change of these UNO-APIs and would break existing extensions, macros, etc. which are using these UNO-APIs.
  • In order to fulfill the user expectations regarding the handling of ODF documents created by former OOo versions in a new OOo version existing ODF documents created by OOo versions which still have issue 105270 need to be "corrected" when handled by OOo versions in which issue 105270 has been fixed.
  • ODF documents containing paragraphs whose writing direction is right-to-left and created by OOo versions in which issue 105270 has been fixed will be displayed incorrect in OOo versions which still have issue 105370. This is the nature of the defect described in issue 105270. But, it does not correspond to the user expectations regarding the handling of ODF documents created by newer OOo versions in a former OOo version. This problem already exists when handling such ODF documents which are created by other ODF supporting applications. There is nothing to do to solve this problem, except updating to the up-to-date OOo version. When preparing the OOo version in which issue 105270 will be fixed, this problem should be clearly communicated. At least the release notes should contain corresponding communication about the solution of issue 105270 and its impact.
Personal tools