Difference between revisions of "TextAlignment"
From Apache OpenOffice Wiki
(→Format Paragraph Style Dialog, Tab pane "Alignment") |
(→Proposed Solution) |
||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Proposed Solution == | == Proposed Solution == | ||
Line 43: | Line 5: | ||
* 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. | * 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. | ||
* Adjustment of the user interface. | * Adjustment of the user interface. | ||
− | ** | + | ** Keep the terms ''left'' and ''right'' for the text alignment: |
− | + | *** Format dialogs for paragraphs, table cells and styles have to be made aware of the writing direction of the to be formatted object/objects or of the document. By this it can be assured that the text alignment values <code>START</code> and <code>END</code> are mapped to the right terms ''left'', ''right'', ''left/top'' and ''right/bottom'' and vice versa. | |
− | + | *** This has the drawback that for certain use cases the writing direction of the to be formatted objects is ambiguous. To be deterministic in all use cases the following solutions are implemented: | |
− | + | **** In text documents the writing direction of the paragraph in which the cursor is in is taken. | |
− | + | **** In drawing objects and in table cells of Calc sheets OOo does not support different writing directions for its paragraphs table cells -> no drawbacks here. | |
+ | **** For two or more table cells with different writing directions in a Calc sheet the sheet's default writing direction is taken. | ||
** Formatting Toolbar buttons "Align left" and "Align right": Keep the actual terms and its visualization in its icons in order to visual reflect the behavior of these buttons. Internally, the correct text alignment values <code>START</code> respectively <code>END</code> need to be applied at the paragraph/table cell in order to corresponding the visualized behavior. E.g., if toolbar button "Align left" is clicked and the cursor is placed in a paragraph with right-to-left writing direction text alignment value <code>END</code> needs to be applied. | ** Formatting Toolbar buttons "Align left" and "Align right": Keep the actual terms and its visualization in its icons in order to visual reflect the behavior of these buttons. Internally, the correct text alignment values <code>START</code> respectively <code>END</code> need to be applied at the paragraph/table cell in order to corresponding the visualized behavior. E.g., if toolbar button "Align left" is clicked and the cursor is placed in a paragraph with right-to-left writing direction text alignment value <code>END</code> needs to be applied. | ||
** Formatting Toolbar buttons "Left-to-Right" and "Right-to-Left" (visible, if enhanced support for complex text layout (CTL) has been enabled): Internally, the actual behavior of these functions are that the writing direction is set to <code>left-to-right</code> respectively <code>right-to-left</code> and the text alignment is set to <code>LEFT</code> respectively <code>RIGHT</code>. The setting of the text alignment needs to be adjusted to <code>START</code> for both functions. | ** Formatting Toolbar buttons "Left-to-Right" and "Right-to-Left" (visible, if enhanced support for complex text layout (CTL) has been enabled): Internally, the actual behavior of these functions are that the writing direction is set to <code>left-to-right</code> respectively <code>right-to-left</code> and the text alignment is set to <code>LEFT</code> respectively <code>RIGHT</code>. The setting of the text alignment needs to be adjusted to <code>START</code> for both functions. |
Revision as of 10:11, 11 January 2011
Contents
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. - Adjustment of the user interface.
- Keep the terms left and right for the text alignment:
- Format dialogs for paragraphs, table cells and styles have to be made aware of the writing direction of the to be formatted object/objects or of the document. By this it can be assured that the text alignment values
START
andEND
are mapped to the right terms left, right, left/top and right/bottom and vice versa. - This has the drawback that for certain use cases the writing direction of the to be formatted objects is ambiguous. To be deterministic in all use cases the following solutions are implemented:
- In text documents the writing direction of the paragraph in which the cursor is in is taken.
- In drawing objects and in table cells of Calc sheets OOo does not support different writing directions for its paragraphs table cells -> no drawbacks here.
- For two or more table cells with different writing directions in a Calc sheet the sheet's default writing direction is taken.
- Format dialogs for paragraphs, table cells and styles have to be made aware of the writing direction of the to be formatted object/objects or of the document. By this it can be assured that the text alignment values
- Formatting Toolbar buttons "Align left" and "Align right": Keep the actual terms and its visualization in its icons in order to visual reflect the behavior of these buttons. Internally, the correct text alignment values
START
respectivelyEND
need to be applied at the paragraph/table cell in order to corresponding the visualized behavior. E.g., if toolbar button "Align left" is clicked and the cursor is placed in a paragraph with right-to-left writing direction text alignment valueEND
needs to be applied. - Formatting Toolbar buttons "Left-to-Right" and "Right-to-Left" (visible, if enhanced support for complex text layout (CTL) has been enabled): Internally, the actual behavior of these functions are that the writing direction is set to
left-to-right
respectivelyright-to-left
and the text alignment is set toLEFT
respectivelyRIGHT
. The setting of the text alignment needs to be adjusted toSTART
for both functions.
- Keep the terms left and right for the text alignment:
- 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 have 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 text alignment attribute has text alignment valueLEFT
respectivelyRIGHT
set. For this conversion two cases need to be distinguished.
- Conversion for a certain style:
text alignment value writing direction
of the style(*1)
maps to
UNO-API text alignment valueLEFT
left-to-right START
RIGHT
left-to-right END
LEFT
right-to-left END
RIGHT
right-to-left START
- Conversion for a certain paragraph or table cell:
text alignment value writing direction
of paragraph/table cellwriting direction
of style(*1)
maps to
UNO-API text alignment valueLEFT
left-to-right left-to-right OR
right-to-leftSTART
LEFT
inherited from a styleleft-to-right right-to-left START
RIGHT
left-to-right left-to-right OR
right-to-leftEND
RIGHT
inherited from a styleleft-to-right right-to-left END
LEFT
right-to-left left-to-right OR
right-to-leftEND
LEFT
inherited from a styleright-to-left left-to-right END
RIGHT
right-to-left left-to-right OR
right-to-leftSTART
RIGHT
inherited from a styleright-to-left left-to-right START
-
(*1)
If the style has no writing direction set and does not inherit a writing direction from its parent style, the writing direction of the document is taken.
- 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
andEND
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:
text alignment value writing direction
of style(*2)
maps to
UNO-API text alignment valueSTART
left-to-right LEFT
END
left-to-right RIGHT
START
right-to-left RIGHT
END
right-to-left LEFT
- Conversion for a certain paragraph or table cell:
text alignment value writing direction
of paragraph/table cellwriting direction
of style(*2)
maps to
UNO-API text alignment valueSTART
left-to-right left-to-right OR
right-to-leftLEFT
START
inherited from a styleleft-to-right right-to-left LEFT
END
left-to-right left-to-right OR
right-to-leftRIGHT
END
inherited from a styleleft-to-right right-to-left RIGHT
START
right-to-left left-to-right OR
right-to-leftRIGHT
START
inherited from a styleright-to-left left-to-right RIGHT
END
right-to-left left-to-right OR
right-to-leftLEFT
END
inherited from a styleright-to-left left-to-right LEFT
-
(*2)
If the style has no writing direction set and does not inherit a writing direction from its parent style, the writing direction of the document is taken.
- 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. - Each export and import filter for foreign file formats needs to be reviewed and adjusted according to the above given conversions. In order to keep the current behavior of these filters in the first step they can rely on the existing text alignment values. In a follow-up task considering that in a future version the deprecated UNO-APIs will be removed and considering the foreign file format's text alignment definition further adjustments to the export and import filters can be made.
- Import filters can continue to use the existing internal APIs or the existing UNO-APIs to set the text alignment values.
- Export filters can also use the existing internal APIs or the existing, but deprecated UNO-APIs to retrieve the text alignment values. In the case that the existing internal APIs are used the new text alignment values
START
andEND
need to be converted as given above for the existing, but deprecated UNO-APIs.
Test cases for the proposed solution
Format Paragraph Dialog, Tab pane "Alignment"
- Test functionality of setting alignment and text direction
- for one paragraph
- no hard-set attribute values
- hard-set attribute values equal to the default ones
- hard-set attribute values different to the default ones
- for two or more paragraphs with the same alignment/text direction attribute values
- for two or more paragraphs with different alignment/text direction attribute values
- for one paragraph
Format Paragraph Style Dialog, Tab pane "Alignment"
- [need to be filled...]