From: Glenn Adams Date: Fri, 20 Apr 2012 21:26:43 +0000 (+0000) Subject: Bugzilla #53101: Ensure that table cell spanning works in right-to-left writing mode. X-Git-Tag: fop-1_1rc1old~43 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=46917ef59fd0ffbbcccb16d57118a92da3dc1e0d;p=xmlgraphics-fop.git Bugzilla #53101: Ensure that table cell spanning works in right-to-left writing mode. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1328515 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java b/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java index aaccbd0d3..b0ad22386 100644 --- a/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java +++ b/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java @@ -245,13 +245,14 @@ public class ColumnSetup { * the left-most column; otherwise, the first column is the left-most * column. * @param col column index (1 is first column) + * @param nrColSpan number columns spanned (for calculating offset in rtl mode) * @param context the context for percentage based calculations * @return the X offset of the requested column */ - public int getXOffset(int col, PercentBaseContext context) { + public int getXOffset(int col, int nrColSpan, PercentBaseContext context) { // TODO handle vertical WMs [GA] if ( (wmTraits != null) && (wmTraits.getColumnProgressionDirection() == Direction.RL) ) { - return getXOffsetRTL(col, context); + return getXOffsetRTL(col, nrColSpan, context); } else { return getXOffsetLTR(col, context); } @@ -262,9 +263,9 @@ public class ColumnSetup { * column; i.e., those columns whose column numbers are greater than the * specified column number. */ - private int getXOffsetRTL(int col, PercentBaseContext context) { + private int getXOffsetRTL(int col, int nrColSpan, PercentBaseContext context) { int xoffset = 0; - for (int i = col, nc = colWidths.size(); ++i < nc;) { + for (int i = (col + nrColSpan - 1), nc = colWidths.size(); ++i < nc;) { int effCol = i; if (colWidths.get(effCol) != null) { xoffset += ((Length) colWidths.get(effCol)).getValue(context); diff --git a/src/java/org/apache/fop/layoutmgr/table/RowPainter.java b/src/java/org/apache/fop/layoutmgr/table/RowPainter.java index f6c831b3f..955dafabd 100644 --- a/src/java/org/apache/fop/layoutmgr/table/RowPainter.java +++ b/src/java/org/apache/fop/layoutmgr/table/RowPainter.java @@ -468,7 +468,7 @@ class RowPainter { block.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE); block.setIPD(ipd); block.setBPD(bpd); - block.setXOffset(tclm.getXOffsetOfGridUnit(colIndex) + block.setXOffset(tclm.getXOffsetOfGridUnit(colIndex, 1) + (borderStart.getRetainedWidth() / 2)); block.setYOffset(getRowOffset(rowIndex) - (borderBefore.getRetainedWidth() / 2)); diff --git a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java index db5b4736c..f5e7500e2 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java @@ -317,16 +317,17 @@ public class TableContentLayoutManager implements PercentBaseContext { * @return the requested X offset */ protected int getXOffsetOfGridUnit(PrimaryGridUnit gu) { - return getXOffsetOfGridUnit(gu.getColIndex()); + return getXOffsetOfGridUnit(gu.getColIndex(), gu.getCell().getNumberColumnsSpanned()); } /** * Returns the X offset of the grid unit in the given column. * @param colIndex the column index (zero-based) + * @param nrColSpan number columns spanned * @return the requested X offset */ - protected int getXOffsetOfGridUnit(int colIndex) { - return startXOffset + getTableLM().getColumns().getXOffset(colIndex + 1, getTableLM()); + protected int getXOffsetOfGridUnit(int colIndex, int nrColSpan) { + return startXOffset + getTableLM().getColumns().getXOffset(colIndex + 1, nrColSpan, getTableLM()); } /** diff --git a/status.xml b/status.xml index 67e2fb973..13c5bc36f 100644 --- a/status.xml +++ b/status.xml @@ -62,6 +62,9 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> + + Ensure that table cell spanning works in right-to-left writing mode. + Ensure that table footer and header are included in bididirectional resolution. diff --git a/test/layoutengine/standard-testcases/table-column_column-progression-rl_3.xml b/test/layoutengine/standard-testcases/table-column_column-progression-rl_3.xml new file mode 100644 index 000000000..0b39606f7 --- /dev/null +++ b/test/layoutengine/standard-testcases/table-column_column-progression-rl_3.xml @@ -0,0 +1,89 @@ + + + + + +

+ This test checks table column progression with right-to-left writing mode when using multiple + column spans. See also bugzilla #53103. +

+
+ + + + + + + + + + + + + + header-R1;C1-span2 + + + header-R1;C2 + + + header-R1;C3 + + + + + + + body-R2;C1 + + + body-R2;C2 + + + body-R2;C3 + + + + + body-R3;C1-span3 + + + body-R3;C2 + + + + + + + + + + + + + + + + + + + + + + +