Difference between revisions of "TextAlignment"
(→Proposed Solution) |
(→Proposed Solution) |
||
Line 40: | Line 40: | ||
Considering the thoughts of the previous chapter the following solution has been worked out: | Considering the thoughts of the previous chapter the following solution has been worked out: | ||
− | * Internally keep OOo's text alignment values <code>LEFT</code> and <code>RIGHT</code> with the current meaning and impact. | + | * Internally keep OOo's text alignment values <code>LEFT</code> and <code>RIGHT</code> with the current meaning and impact. The intention to keep these text alignment values is that they are only used for ODF documents which are created by former OOo versions which still have issue 105270 and for the support of the existing UNO-APIs in order not to break existing extensions, macros, etc. which are using these UNO-APIs. |
− | * | + | * Internally introduce new text alignment values <code>START</code> and <code>END</code> corresponding to ODF's <code>LEFT/START</code> and <code>RIGHT/END</code> text alignment values. Additionally, the text formatting has to be adjusted to support these new text alignment values accordingly. |
− | * Introduce a new UNO-API for the text alignment of paragraphs - com::sun::star::style:: | + | * Adjust the user interface |
− | * Introduce a new UNO-API for the text alignment of paragraphs in table cells - com::sun::star::table::CellProperties::CellTextAlign with the possible values <code>STANDARD</code>, <code>START</code>, <code>CENTER</code>, <code>END</code>, <code>BLOCK</code> and <code>REPEAT</code>. Values <code>START</code> and <code>END</code> correspond to the internally newly introduced text alignment values. The values <code>STANDARD</code>, <code>CENTER</code>, <code>BLOCK</code> and <code>REPEAT</code> are the same as the ones from the existing UNO-API com::sun::star::table::CellProperties:: | + | * Introduce a new UNO-API for the text alignment of paragraphs - com::sun::star::style::ParagraphProperties::ParaTextAlign with the possible values <code>START</code>, <code>END</code>, <code>BLOCK</code>, <code>CENTER</code> and <code>STRETCH</code>. Values <code>START</code> and <code>END</code> correspond to the internally newly introduced text alignment values. The values <code>BLOCK</code>, <code>CENTER</code> and <code>STRETCH</code> are the same as the ones from the existing UNO-API com::sun::star::style::ParagraphProperties::ParaAdjust. |
+ | * Introduce a new UNO-API for the text alignment of paragraphs in table cells - com::sun::star::table::CellProperties::CellTextAlign with the possible values <code>STANDARD</code>, <code>START</code>, <code>CENTER</code>, <code>END</code>, <code>BLOCK</code> and <code>REPEAT</code>. Values <code>START</code> and <code>END</code> correspond to the internally newly introduced text alignment values. The values <code>STANDARD</code>, <code>CENTER</code>, <code>BLOCK</code> and <code>REPEAT</code> are the same as the ones from the existing UNO-API com::sun::star::table::CellProperties::HoriJustify. | ||
* The ODF import filter has to distinguish two cases | * The ODF import filter has to distinguish two cases | ||
: Import of ODF documents which has been created by OOo versions which still have issue 105270. In this case ODF attribute <code>fo:text-align</code> is mapped using the existing UNO-APIs. This assures that such ODF documents are displayed as they are displayed in the OOo versions which still has issue 105270. We will get the following mapping: | : Import of ODF documents which has been created by OOo versions which still have issue 105270. In this case ODF attribute <code>fo:text-align</code> is mapped using the existing UNO-APIs. This assures that such ODF documents are displayed as they are displayed in the OOo versions which still has issue 105270. We will get the following mapping: | ||
Line 121: | Line 122: | ||
| right-to-left || left-to-right || <code>RIGHT</code> <br> inherited from a style || <code>END</code> | | right-to-left || left-to-right || <code>RIGHT</code> <br> inherited from a style || <code>END</code> | ||
|} | |} | ||
− | * Deprecate the existing UNO-APIs com::sun::star::style::ParagraphProperties::ParaAdjust and com::sun::star::table::CellProperties:: | + | * Deprecate the existing UNO-APIs com::sun::star::style::ParagraphProperties::ParaAdjust and com::sun::star::table::CellProperties::HoriJustify. Document that these UNO-APIs are deprecated in favor of the new ones. Assure that at these deprecated UNO-APIs text alignment values <code>LEFT</code> and <code>RIGHT</code> are returned, when the newly introduced text alignment values <code>START</code> respectively <code>END</code> are set at the internal text alignment attribute. The conversion will be documented in the UNO-API documentation and has to distinguish two cases: |
: Conversion for a certain style: | : Conversion for a certain style: | ||
::{| class="wikitable" style="text-align:center" | ::{| class="wikitable" style="text-align:center" | ||
Line 169: | Line 170: | ||
| right-to-left || left-to-right || <code>END</code> <br> inherited from a style || <code>RIGHT</code> | | right-to-left || left-to-right || <code>END</code> <br> inherited from a style || <code>RIGHT</code> | ||
|} | |} | ||
+ | * The ODF export filter will only use the newly introduced UNO-APIs. Thus, written ODF attribute <code>fo:text-align="left"/"start"</code> respectively <code>fo:text-align="right"/"end"</code> will be according to the ODF specification. |
Revision as of 14:52, 22 July 2010
Contents
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
andRIGHT/END
and everything is ok.
Unfortunately, it is not that easy :(
There is no doubt that OOo has to support ODF's LEFT/START
and RIGHT/END
for the text alignment and its corresponding meaning. But certain stuff has to be considered which will make the solution more complicate and will cost more effort. At least the following points need attention:
- OOo's format dialogs for paragraphs respectively paragraphs in table cells use terms left and right - left/top and right/bottom, if enhanced support for Asian languages has been enabled - for the text alignment. Correcting/Changing OOo's text alignment will have impact on this user interface.
- OOo's formatting toolbar uses terms left and right and corresponding visualizations of left-aligned respectively right-aligned text in its icons for the text alignment. Correcting/Changing OOo's text alignment will have impact on this user interface.
- OOo has corresponding UNO-APIs for the text alignment. These are com::sun::star::style::ParagraphProperties::ParaAdjust for paragraphs and com::sun::star::table::CellProperties::CellHoriJustify for the paragraphs in table cells. These UNO-APIs have writing direction independent text alignment values
LEFT
andRIGHT
. Applying the easy fix would be an incompatible change of these UNO-APIs and would break existing extensions, macros, etc. which are using these UNO-APIs. Supporting these UNO-APIs - at least for one or two OOo version or until a major OOo release - is important and expected by the corresponding user group. - OOo's import and export filters for foreign file formats needs to be adjusted when OOo's text alignment is corrected/changed.
- 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 last released 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.
Proposed Solution
Considering the thoughts of the previous chapter the following solution has been worked out:
- Internally keep OOo's text alignment values
LEFT
andRIGHT
with the current meaning and impact. The intention to keep these text alignment values is that they are only used for ODF documents which are created by former OOo versions which still have issue 105270 and for the support of the existing UNO-APIs in order not to break existing extensions, macros, etc. which are using these UNO-APIs. - Internally introduce new text alignment values
START
andEND
corresponding to ODF'sLEFT/START
andRIGHT/END
text alignment values. Additionally, the text formatting has to be adjusted to support these new text alignment values accordingly. - Adjust the user interface
- Introduce a new UNO-API for the text alignment of paragraphs - com::sun::star::style::ParagraphProperties::ParaTextAlign with the possible values
START
,END
,BLOCK
,CENTER
andSTRETCH
. ValuesSTART
andEND
correspond to the internally newly introduced text alignment values. The valuesBLOCK
,CENTER
andSTRETCH
are the same as the ones from the existing UNO-API com::sun::star::style::ParagraphProperties::ParaAdjust. - Introduce a new UNO-API for the text alignment of paragraphs in table cells - com::sun::star::table::CellProperties::CellTextAlign with the possible values
STANDARD
,START
,CENTER
,END
,BLOCK
andREPEAT
. ValuesSTART
andEND
correspond to the internally newly introduced text alignment values. The valuesSTANDARD
,CENTER
,BLOCK
andREPEAT
are the same as the ones from the existing UNO-API com::sun::star::table::CellProperties::HoriJustify. - The ODF import filter has to distinguish two cases
- Import of ODF documents which has been created by OOo versions which still have issue 105270. In this case ODF attribute
fo:text-align
is mapped using the existing UNO-APIs. This assures that such ODF documents are displayed as they are displayed in the OOo versions which still has issue 105270. We will get the following mapping:
fo:text-align value maps to
text alignment value"left" LEFT
"start" LEFT
"right" RIGHT
"end" RIGHT
- Import of other ODF documents. In this case the new UNO-APIs are used. We will get the following mapping:
fo:text-align value maps to
text alignment value"left" START
"start" START
"right" END
"end" END
- The new UNO-APIs have to return
START
respectivelyEND
when the internal text alignment attribute has internal text alignment valueLEFT
respectivelyRIGHT
set. For this conversion two cases need to be distinguished.
- Conversion for a certain style:
writing direction
of documenttext alignment value maps to
UNO-API text alignment valueleft-to-right LEFT
START
left-to-right RIGHT
END
right-to-left LEFT
END
right-to-left RIGHT
START
- Conversion for a certain paragraph or table cell:
writing direction
of documentwriting direction
of paragraph/table celltext alignment value maps to
UNO-API text alignment valueleft-to-right left-to-right LEFT
START
left-to-right left-to-right RIGHT
END
left-to-right right-to-left LEFT
END
left-to-right right-to-left RIGHT
START
left-to-right right-to-left LEFT
inherited from a styleEND
left-to-right right-to-left RIGHT
inherited from a styleSTART
right-to-left right-to-left LEFT
END
right-to-left right-to-left RIGHT
START
right-to-left left-to-right LEFT
START
right-to-left left-to-right RIGHT
END
right-to-left left-to-right LEFT
inherited from a styleSTART
right-to-left left-to-right RIGHT
inherited from a styleEND
- Deprecate the existing UNO-APIs com::sun::star::style::ParagraphProperties::ParaAdjust and com::sun::star::table::CellProperties::HoriJustify. Document that these UNO-APIs are deprecated in favor of the new ones. Assure that at these deprecated UNO-APIs text alignment values
LEFT
andRIGHT
are returned, when the newly introduced text alignment valuesSTART
respectivelyEND
are set at the internal text alignment attribute. The conversion will be documented in the UNO-API documentation and has to distinguish two cases:
- Conversion for a certain style:
writing direction
of documenttext alignment value maps to
UNO-API text alignment valueleft-to-right START
LEFT
left-to-right END
RIGHT
right-to-left START
RIGHT
right-to-left END
LEFT
- Conversion for a certain paragraph or table cell:
writing direction
of documentwriting direction
of paragraph/table celltext alignment value maps to
UNO-API text alignment valueleft-to-right left-to-right START
LEFT
left-to-right left-to-right END
RIGHT
left-to-right right-to-left START
RIGHT
left-to-right right-to-left END
RIGHT
left-to-right right-to-left START
inherited from a styleRIGHT
left-to-right right-to-left END
inherited from a styleLEFT
right-to-left right-to-left START
RIGHT
right-to-left right-to-left END
LEFT
right-to-left left-to-right START
LEFT
right-to-left left-to-right END
RIGHT
right-to-left left-to-right START
inherited from a styleLEFT
right-to-left left-to-right END
inherited from a styleRIGHT
- The ODF export filter will only use the newly introduced UNO-APIs. Thus, written ODF attribute
fo:text-align="left"/"start"
respectivelyfo:text-align="right"/"end"
will be according to the ODF specification.