Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 225180 - [Bidi] Support text direction of report element
Summary: [Bidi] Support text direction of report element
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: 2.3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 2.3.0 RC1   Edit
Assignee: Yu Chen CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 222072 225539 225548
  Show dependency tree
 
Reported: 2008-04-01 15:00 EDT by Lina Kemmel CLA
Modified: 2008-06-22 06:23 EDT (History)
10 users (show)

See Also:


Attachments
Patch against the current trunk (51.08 KB, patch)
2008-04-02 10:13 EDT, Lina Kemmel CLA
bjorn.freeman-benson: iplog+
Lina.Kemmel: review?
Details | Diff
Complementary patch (10.08 KB, patch)
2008-04-09 12:31 EDT, Lina Kemmel CLA
bjorn.freeman-benson: iplog+
Lina.Kemmel: review?
Details | Diff
BidiAlignmentResolver patch (2.29 KB, patch)
2008-05-09 04:21 EDT, Lina Kemmel CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lina Kemmel CLA 2008-04-01 15:00:02 EDT
This bug is to introduce design element text direction property.

To improve readability of certain text-enabled items, users will be given ability to control text direction at report element level. The direction default will be driven from the global orientation (bug 225140), but it would be possible to apply text direction value mismatching that of the global orientation.
Comment 1 Lina Kemmel CLA 2008-04-02 10:13:51 EDT
Created attachment 94547 [details]
Patch against the current trunk

This attachment includes API-related and some other basic changes to support design element text direction.

The changes mostly apply to the style model and Report engine (generation phase).
Comment 2 Lina Kemmel CLA 2008-04-06 14:14:31 EDT
Comment on attachment 94547 [details]
Patch against the current trunk


More information:

The main goal of the changes is to extend the ROM Style element with a new property representing the horizontal direction of text flow, and provide API for retrieving and manipulating this property programmatically.

1. Report metadata changes aim at defining a Property element named "bidiTextDirection", and are handled in course of bug 225140.

2. Design engine:

   2.2. Public constants:
       - org.eclipse.birt.report.model.elements.interfaces.IStyleModel
         #TEXT_DIRECTION_PROP

   2.3. Getters and setters:
        - org.eclipse.birt.report.model.simpleapi.Style#getDirection
        - org.eclipse.birt.report.model.simpleapi.Style#setDirection

        - org.eclipse.birt.report.model.api.StyleHandle#getDirection
        - org.eclipse.birt.report.model.api.StyleHandle#setDirection

        - org.eclipse.birt.report.model.api.HighlightRuleHandle#getDirection
        - org.eclipse.birt.report.model.api.HighlightRuleHandle#setDirection

        - org.eclipse.birt.report.model.api.TOCHandle#getDirection
          (not settable for the time being)

   2.4. A new public method org.eclipse.birt.report.model.api.GroupPropertyHandle#isDirectionRTL - figures out whether the first property is the group is right-to-left. Meant to be consumed for presentation purposes in Eclipse-based Design tool.

3. Report engine:

   3.1. Public constants:
        3.1.1. Internal BIRT style model:
               - org.eclipse.birt.report.model.elements.interfaces.IStyleModel
                 #TEXT_DIRECTION_PROP = "bidiTextDirection"
        3.1.2. CSS-compliant style constant:
               - org.eclipse.birt.report.engine.css.engine.value.css
                 .CSSConstants#CSS_DIRECTION_PROPERTY = "direction"

   3.2. Other constants, property getters and setters:

        3.2.1. Class org.eclipse.birt.report.engine.css.dom.AbstractStyle:
               3.2.1.1. Getter:
                        - public String getDirection( )
               3.2.1.2. Setter:
                       - public String setDirection( String )

        3.2.2. Class org.eclipse.birt.report.engine.api.TOCStyle:
               3.2.2.1. Constants:
                        - public static final String DIRECTION = "direction"
                         (where the name matches that defined in the CSS-2 spec)
               3.2.2.2. Getter:
                        - public String getDirection( )
               3.2.2.3. Setter:
                        - public String setDirection( String )

        3.2.3. Class org.eclipse.birt.report.engine.script.internal.instance
               .StyleInstance:
               3.2.3.1. Getter:
                      - public String getDirection( )
               3.2.3.2. Setter:
                      - public String setDirection( String )

   3.3. Style constants definitions, a hash table and hash implementation for looking up a property name were modified to back the new keyword - "direction". Affected modules:
        - src/org/eclipse/birt/report/engine/css/engine/token.gperf
        - src/org/eclipse/birt/report/engine/css/engine/token.cpp (re-generated)
        - class org.eclipse.birt.report.engine.css.engine.PerfectHash
        - class org.eclipse.birt.report.engine.css.engine.StyleConstants
Comment 3 Zhiqiang Qian CLA 2008-04-08 01:18:02 EDT
I suggest we use the name "direction" for the new style property. This is consistent with the CSS name. Actually the proposed api already use get/setDirection(). And maybe the same for report design, just use "direction" or "orientation".
Comment 4 Lina Kemmel CLA 2008-04-08 12:16:03 EDT
These names were used initially, but changed later, mainly for the following reason. Since BIRT is aimed at a broad range of users, including those not really familiar with bi-directionality or CSS spec in general, the PMC board recommended to use more indicative names in the UI.

Another reason for not using the CSS-compliant name for direction was that functionalities behind the CSS "direction" and the BIRT "bidiTextDirection" are not equal. The former is supposed to act as "layout orientation", affecting both graphical and textual elements of the UI component. The latter only implies the order of characters in a text paragraph. These behave similarly to |WS_EX_LAYOUTRTL| and |WS_EX_RTLREADING| MS Window styles respectively
(http://msdn2.microsoft.com/en-us/library/ms632680.aspx).

(In the future, we would like to support also the CSS-compliant direction style, actually referred to in bug 223357.)
Comment 5 Lina Kemmel CLA 2008-04-09 12:31:14 EDT
Created attachment 95391 [details]
Complementary patch

Complementary patch that relocates some changes from bug 225140 here, with support for both orientation and direction.
Also includes changes to write Bidi properties into report XML file (ModuleWriter).

This patch should not conflict with the previous one.
Comment 6 Wenbin He CLA 2008-04-16 17:42:28 EDT
please wait for the result of the bidi contribution IP review. You can find the detail at https://dev.eclipse.org/ipzilla/show_bug.cgi?id=2260
Comment 7 Lina Kemmel CLA 2008-04-28 12:58:50 EDT
The IP review is complete, and this submission is now approved.
Comment 8 Rick Lu CLA 2008-05-08 04:56:27 EDT
Patched on Model codes. Since also contains Engine patch, reassign to Engine
team.

Some APIs are different from patch for the Model API naming schema:

StyleHandle.getTextDirection/setTextDirection
HighlightRuleHandle.getTextDirection/setTextDirection
TocHandle.getTextDirection/setTextDirection


Bidi choice constants:

DesignChoiceConstants.BIDI_DIRECTION_RTL
DesignChoiceConstants.BIDI_DIRECTION_LTR
Comment 9 Jun Ouyang CLA 2008-05-09 02:01:19 EDT
Lina, class org.eclipse.birt.report.engine.util.BidiAlignmentResolver is missed in the patch.
Comment 10 Lina Kemmel CLA 2008-05-09 04:21:06 EDT
Created attachment 99429 [details]
BidiAlignmentResolver patch

BidiAlignmentResolver was included in attachment #96624 [details]. I add it also here, with minor modifications.
Comment 11 Yu Chen CLA 2008-05-11 22:40:49 EDT
Fixed.
Comment 12 Lina Kemmel CLA 2008-05-12 12:14:31 EDT
(In reply to comment #8)
> Bidi choice constants:
> 
> DesignChoiceConstants.BIDI_DIRECTION_RTL
> DesignChoiceConstants.BIDI_DIRECTION_LTR
> 

Rick, will the direction choice constants "rtl" and "ltr" be used uniformly, replacing all occurrences of "Right To Left" and "Left To Right"?
Thanks.
Comment 13 Rick Lu CLA 2008-05-13 02:38:15 EDT
(In reply to comment #12)
> (In reply to comment #8)
> > Bidi choice constants:
> > 
> > DesignChoiceConstants.BIDI_DIRECTION_RTL
> > DesignChoiceConstants.BIDI_DIRECTION_LTR
> > 
> 
> Rick, will the direction choice constants "rtl" and "ltr" be used uniformly,
> replacing all occurrences of "Right To Left" and "Left To Right"?
> Thanks.
> 

Yes, since in CSS, "rtl"/"ltr" is standard option for direction. BIRT mimics it. The design file and constants uses them instead of "Right To Left"/"Left To Right".
Comment 14 Lina Kemmel CLA 2008-05-13 08:57:41 EDT
Okay, sounds great.

Thanks to All for integrating the changes!
Comment 15 Bjorn Freeman-Benson CLA 2008-06-18 16:04:45 EDT
Comment on attachment 94547 [details]
Patch against the current trunk

per Ganymede IP log
Comment 16 Bjorn Freeman-Benson CLA 2008-06-18 16:04:54 EDT
Comment on attachment 99429 [details]
BidiAlignmentResolver patch

per Ganymede IP log
Comment 17 Bjorn Freeman-Benson CLA 2008-06-18 16:05:02 EDT
Comment on attachment 95391 [details]
Complementary patch

per Ganymede IP log
Comment 18 Lina Kemmel CLA 2008-06-22 06:23:16 EDT
Verified. Closing.