Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 225536 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/birt/report/engine/emitter/html/AttributeBuilder.java (+31 lines)
Lines 12-17 Link Here
12
package org.eclipse.birt.report.engine.emitter.html;
12
package org.eclipse.birt.report.engine.emitter.html;
13
13
14
import org.eclipse.birt.report.engine.content.IStyle;
14
import org.eclipse.birt.report.engine.content.IStyle;
15
import org.eclipse.birt.report.engine.css.engine.value.birt.BIRTConstants;
15
import org.eclipse.birt.report.engine.ir.DimensionType;
16
import org.eclipse.birt.report.engine.ir.DimensionType;
16
import org.w3c.dom.css.CSSValue;
17
import org.w3c.dom.css.CSSValue;
17
18
Lines 676-679 Link Here
676
			styleBuffer.append( "')" ); //$NON-NLS-1$
677
			styleBuffer.append( "')" ); //$NON-NLS-1$
677
		}
678
		}
678
	}
679
	}
680
681
	/**
682
	 * Builds the direction style.
683
	 * 
684
	 * @param styleBuffer
685
	 *            The <code>StringBuffer</code> to which the result is output.
686
	 * @param style
687
	 *            The style object.
688
	 * 
689
	 * @author bidi_hcg
690
	 */
691
	public static void buildBidiDirection( StringBuffer styleBuffer, 
692
			IStyle style )
693
	{
694
		if ( style != null )
695
		{
696
			String direction = style.getDirection();
697
	
698
			if ( direction != null )
699
			{
700
				if ( BIRTConstants.BIRT_RTL_VALUE.equals( direction ) )
701
					buildProperty( styleBuffer, IStyle.CSS_DIRECTION_PROPERTY,
702
							IStyle.CSS_RTL_VALUE );
703
				else if ( BIRTConstants.BIRT_LTR_VALUE.equals( direction ) )
704
					buildProperty( styleBuffer, IStyle.CSS_DIRECTION_PROPERTY,
705
							IStyle.CSS_LTR_VALUE );
706
			}
707
		}
708
	}
709
679
}
710
}
(-)src/org/eclipse/birt/report/engine/emitter/html/HTMLEmitter.java (-1 lines)
Lines 12-18 Link Here
12
package org.eclipse.birt.report.engine.emitter.html;
12
package org.eclipse.birt.report.engine.emitter.html;
13
13
14
import java.util.Stack;
14
import java.util.Stack;
15
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
16
import org.eclipse.birt.report.engine.content.ICellContent;
15
import org.eclipse.birt.report.engine.content.ICellContent;
17
import org.eclipse.birt.report.engine.content.IColumn;
16
import org.eclipse.birt.report.engine.content.IColumn;
18
import org.eclipse.birt.report.engine.content.IContainerContent;
17
import org.eclipse.birt.report.engine.content.IContainerContent;
(-)src/org/eclipse/birt/report/engine/emitter/html/HTMLReportEmitter.java (-5 / +74 lines)
Lines 60-65 Link Here
60
import org.eclipse.birt.report.engine.content.ITableContent;
60
import org.eclipse.birt.report.engine.content.ITableContent;
61
import org.eclipse.birt.report.engine.content.ITableGroupContent;
61
import org.eclipse.birt.report.engine.content.ITableGroupContent;
62
import org.eclipse.birt.report.engine.content.ITextContent;
62
import org.eclipse.birt.report.engine.content.ITextContent;
63
import org.eclipse.birt.report.engine.css.engine.value.css.CSSConstants;
63
import org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter;
64
import org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter;
64
import org.eclipse.birt.report.engine.emitter.EmitterUtil;
65
import org.eclipse.birt.report.engine.emitter.EmitterUtil;
65
import org.eclipse.birt.report.engine.emitter.IEmitterServices;
66
import org.eclipse.birt.report.engine.emitter.IEmitterServices;
Lines 361-367 Link Here
361
				actionHandler = actHandler;
362
				actionHandler = actHandler;
362
			}
363
			}
363
			pageFooterFloatFlag = htmlOption.getPageFooterFloatFlag( );
364
			pageFooterFloatFlag = htmlOption.getPageFooterFloatFlag( );
364
			htmlRtLFlag = htmlOption.getHtmlRtLFlag( );
365
			//htmlRtLFlag = htmlOption.getHtmlRtLFlag( );
366
			retrieveRtLFlag( htmlOption ); // bidi_hcg
365
			enableMetadata = htmlOption.getEnableMetadata( );
367
			enableMetadata = htmlOption.getEnableMetadata( );
366
			ouputInstanceIDs = htmlOption.getInstanceIDs( );
368
			ouputInstanceIDs = htmlOption.getInstanceIDs( );
367
			metadataEmitter = new MetadataEmitter( writer, htmlOption, idGenerator );
369
			metadataEmitter = new MetadataEmitter( writer, htmlOption, idGenerator );
Lines 480-485 Link Here
480
					// style.removeProperty( "text-align" );
482
					// style.removeProperty( "text-align" );
481
					style.setProperty( IStyle.STYLE_TEXT_ALIGN,
483
					style.setProperty( IStyle.STYLE_TEXT_ALIGN,
482
							IStyle.RIGHT_VALUE );
484
							IStyle.RIGHT_VALUE );
485
					style.setProperty( IStyle.STYLE_DIRECTION,
486
							IStyle.RIGHT_TO_LEFT_VALUE ); // bidi_hcg
483
				}
487
				}
484
			}
488
			}
485
		}
489
		}
Lines 543-548 Link Here
543
547
544
			writer.openTag( HTMLTags.TAG_DIV );
548
			writer.openTag( HTMLTags.TAG_DIV );
545
549
550
			// bidi_hcg start
551
			// RTL attribute is required at HTML or BODY level for the correct
552
			// scroll bar position.
553
			if ( htmlRtLFlag )
554
			{
555
				writer.attribute( HTMLTags.ATTR_HTML_DIR, CSSConstants
556
						.CSS_RTL_VALUE );
557
			}
558
			// bidi_hcg end
559
546
			//output the report default style
560
			//output the report default style
547
			writer.attribute( HTMLTags.ATTR_STYLE,
561
			writer.attribute( HTMLTags.ATTR_STYLE,
548
					defaultStyleBuffer.toString( ) );
562
					defaultStyleBuffer.toString( ) );
Lines 551-556 Link Here
551
565
552
		writer.startWriter( );
566
		writer.startWriter( );
553
		writer.openTag( HTMLTags.TAG_HTML );
567
		writer.openTag( HTMLTags.TAG_HTML );
568
		// bidi_hcg start
569
		if ( htmlRtLFlag )
570
		{
571
			writer.attribute( HTMLTags.ATTR_HTML_DIR, CSSConstants
572
					.CSS_RTL_VALUE );
573
		}
574
		// bidi_hcg end
554
		writer.openTag( HTMLTags.TAG_HEAD );
575
		writer.openTag( HTMLTags.TAG_HEAD );
555
		
576
		
556
		// write the title of the report in html.
577
		// write the title of the report in html.
Lines 1212-1218 Link Here
1212
		writer.attribute( "valign", "top" );
1233
		writer.attribute( "valign", "top" );
1213
		if ( htmlRtLFlag )
1234
		if ( htmlRtLFlag )
1214
		{
1235
		{
1215
			writer.attribute( HTMLTags.ATTR_HTML_DIR, "RTL" );
1236
				writer.attribute( HTMLTags.ATTR_HTML_DIR, CSSConstants
1237
						.CSS_RTL_VALUE );
1216
		}
1238
		}
1217
	}
1239
	}
1218
1240
Lines 1446-1454 Link Here
1446
				CSSValue display = style.getProperty( IStyle.STYLE_DISPLAY );
1468
				CSSValue display = style.getProperty( IStyle.STYLE_DISPLAY );
1447
				if ( null == display || IStyle.BLOCK_VALUE == display )
1469
				if ( null == display || IStyle.BLOCK_VALUE == display )
1448
				{
1470
				{
1449
					// The text-algin value must be center or right.
1471
					// The text-align value must be center or right.
1450
					CSSValue algin = style.getProperty( IStyle.STYLE_TEXT_ALIGN );
1472
					CSSValue align = style.getProperty( IStyle.STYLE_TEXT_ALIGN );
1451
					if( IStyle.CENTER_VALUE == algin || IStyle.RIGHT_VALUE == algin)
1473
1474
					// bidi_hcg start
1475
					// If alignment is inconsistent with direction we need to
1476
					// be explicit for non-center alignment (i.e. alignment
1477
					// left and dir is RTL or alignment right and dir is LTR.
1478
					if ( IStyle.CENTER_VALUE.equals( align ) )
1479
					{
1480
						return true;
1481
					}
1482
					CSSValue direction = style.getProperty( IStyle.STYLE_DIRECTION );
1483
					if ( IStyle.RIGHT_TO_LEFT_VALUE.equals(direction) )
1484
					{
1485
						if ( IStyle.LEFT_VALUE.equals( align ) )
1486
						{
1487
							return true;
1488
						}
1489
					}
1490
					else
1491
					// bidi_hcg end
1492
1493
					if( /*IStyle.CENTER_VALUE == align || */IStyle.RIGHT_VALUE == align)
1452
					{
1494
					{
1453
						return true;
1495
						return true;
1454
					}
1496
					}
Lines 2859-2864 Link Here
2859
		writer.attribute( HTMLTags.ATTR_ID, group.getBookmark( ) );
2901
		writer.attribute( HTMLTags.ATTR_ID, group.getBookmark( ) );
2860
		writer.closeTag( HTMLTags.TAG_SPAN );
2902
		writer.closeTag( HTMLTags.TAG_SPAN );
2861
	}
2903
	}
2904
2905
	/**
2906
	 * Figures out the RTL rendering option.
2907
	 *
2908
	 * @param htmlOption
2909
	 * @author bidi_hcg
2910
	 */
2911
	private void retrieveRtLFlag( HTMLRenderOption htmlOption )
2912
	{
2913
		// If htmlOption has RTL_FLAG option set (likely adopted from an URL
2914
		// parameter), honor this option, otherwise obtain direction from
2915
		// the report design.
2916
		Object bidiFlag = htmlOption.getOption( IRenderOption.RTL_FLAG );
2917
		if ( Boolean.TRUE.equals( bidiFlag ) )
2918
		{
2919
			htmlRtLFlag = true;
2920
		}
2921
		else if ( bidiFlag == null && report != null)
2922
		{
2923
			ReportDesignHandle handle = report.getDesign( ).getReportDesign( );
2924
			if ( handle != null )
2925
			{
2926
				htmlRtLFlag = handle.isDirectionRTL( );
2927
				htmlOption.setHtmlRtLFlag( htmlRtLFlag ); // not necessary though
2928
			}
2929
		}
2930
	}
2862
}
2931
}
2863
2932
2864
class IDGenerator
2933
class IDGenerator
(-)src/org/eclipse/birt/report/engine/emitter/html/HTMLPerformanceOptimize.java (+16 lines)
Lines 52-57 Link Here
52
		AttributeBuilder.buildVisual( styleBuffer, style );
52
		AttributeBuilder.buildVisual( styleBuffer, style );
53
		AttributeBuilder.buildTextDecoration( styleBuffer, style );
53
		AttributeBuilder.buildTextDecoration( styleBuffer, style );
54
		
54
		
55
		// bidi_hcg start
56
		// Build direction.
57
		AttributeBuilder.buildBidiDirection( styleBuffer, style );
58
		// bidi_hcg end
59
55
		// Build the textAlign
60
		// Build the textAlign
56
		String value = style.getTextAlign( );
61
		String value = style.getTextAlign( );
57
		if ( null != value )
62
		if ( null != value )
Lines 441-446 Link Here
441
				styleBuffer );
446
				styleBuffer );
442
447
443
		
448
		
449
		// bidi_hcg start
450
		// Build direction.
451
		AttributeBuilder.buildBidiDirection( styleBuffer, text
452
				.getComputedStyle( ) );
453
		// bidi_hcg end
454
444
		// build the text-align
455
		// build the text-align
445
		String textAlign = style.getTextAlign( );
456
		String textAlign = style.getTextAlign( );
446
		if ( textAlign != null )
457
		if ( textAlign != null )
Lines 482-487 Link Here
482
				HTMLEmitterUtil.DISPLAY_INLINE_BLOCK,
493
				HTMLEmitterUtil.DISPLAY_INLINE_BLOCK,
483
				styleBuffer );
494
				styleBuffer );
484
		
495
		
496
		// bidi_hcg start
497
		// Build direction.
498
		AttributeBuilder.buildBidiDirection( styleBuffer, foreign.getComputedStyle( ) );
499
		// bidi_hcg end
500
485
		// build the text-align
501
		// build the text-align
486
		String textAlign = style.getTextAlign( );
502
		String textAlign = style.getTextAlign( );
487
		if ( textAlign != null )
503
		if ( textAlign != null )
(-)src/org/eclipse/birt/report/engine/emitter/html/HTMLVisionOptimize.java (+11 lines)
Lines 474-479 Link Here
474
		if( null != textComputedStyle )
474
		if( null != textComputedStyle )
475
		{
475
		{
476
			AttributeBuilder.buildTextDecoration( styleBuffer, textComputedStyle );
476
			AttributeBuilder.buildTextDecoration( styleBuffer, textComputedStyle );
477
478
			// bidi_hcg start
479
			// Build direction.
480
			AttributeBuilder
481
					.buildBidiDirection( styleBuffer, textComputedStyle );
482
			// bidi_hcg end
477
		}
483
		}
478
		
484
		
479
		// build the text-align
485
		// build the text-align
Lines 534-539 Link Here
534
		AttributeBuilder.buildText( styleBuffer, style );
540
		AttributeBuilder.buildText( styleBuffer, style );
535
		AttributeBuilder.buildVisual( styleBuffer, style );
541
		AttributeBuilder.buildVisual( styleBuffer, style );
536
		
542
		
543
		// bidi_hcg start
544
		// Build direction.
545
		AttributeBuilder.buildBidiDirection( styleBuffer, textComputedStyle );
546
		// bidi_hcg end
547
537
		// build the text-align
548
		// build the text-align
538
		String textAlign = style.getTextAlign( );
549
		String textAlign = style.getTextAlign( );
539
		if ( textAlign != null )
550
		if ( textAlign != null )

Return to bug 225536