if (bidiLevel >= 0) {
if ((this.bidiLevel < 0) || (bidiLevel < this.bidiLevel)) {
this.bidiLevel = bidiLevel;
- if (parent != null) {
+ if ((parent != null) && !isBidiPropagationBoundary()) {
FObj foParent = (FObj) parent;
int parentBidiLevel = foParent.getBidiLevel();
if ((parentBidiLevel < 0) || (bidiLevel < parentBidiLevel)) {
return level;
}
}
+ if (isBidiInheritanceBoundary()) {
+ break;
+ }
}
return -1;
}
+ protected boolean isBidiBoundary(boolean propagate) {
+ return false;
+ }
+
+ private boolean isBidiInheritanceBoundary() {
+ return isBidiBoundary(false);
+ }
+
+ private boolean isBidiPropagationBoundary() {
+ return isBidiBoundary(true);
+ }
+
/**
* Add a new extension attachment to this FObj.
* (see org.apache.fop.fo.FONode for details)
referenceOrientation = pList.get(PR_REFERENCE_ORIENTATION).getNumeric();
span = pList.get(PR_SPAN).getEnum();
writingModeTraits = new WritingModeTraits(
- WritingMode.valueOf(pList.get(PR_WRITING_MODE).getEnum()));
+ WritingMode.valueOf(pList.get(PR_WRITING_MODE).getEnum()),
+ pList.getExplicit(PR_WRITING_MODE) != null);
disableColumnBalancing = pList.get(PR_X_DISABLE_COLUMN_BALANCING).getEnum();
}
return writingModeTraits.getWritingMode();
}
+ /**
+ * Obtain writing mode explicit indicator.
+ * @return the writing mode explicit indicator
+ */
+ public boolean getExplicitWritingMode() {
+ return writingModeTraits.getExplicitWritingMode();
+ }
+
/** {@inheritDoc} */
public String getLocalName() {
return "block-container";
public int getNameId() {
return FO_BLOCK_CONTAINER;
}
-}
+ @Override
+ protected boolean isBidiBoundary(boolean propagate) {
+ return getExplicitWritingMode();
+ }
+
+}
overflow = pList.get(PR_OVERFLOW).getEnum();
referenceOrientation = pList.get(PR_REFERENCE_ORIENTATION).getNumeric();
writingModeTraits = new WritingModeTraits(
- WritingMode.valueOf(pList.get(PR_WRITING_MODE).getEnum()));
+ WritingMode.valueOf(pList.get(PR_WRITING_MODE).getEnum()),
+ pList.getExplicit(PR_WRITING_MODE) != null);
}
/**
return writingModeTraits.getWritingMode();
}
+ /**
+ * Obtain writing mode explicit indicator.
+ * @return the writing mode explicit indicator
+ */
+ public boolean getExplicitWritingMode() {
+ return writingModeTraits.getExplicitWritingMode();
+ }
+
/** {@inheritDoc} */
public String getLocalName() {
return "inline-container";
return false;
}
+ @Override
+ protected boolean isBidiBoundary(boolean propagate) {
+ return getExplicitWritingMode();
+ }
+
}
tableOmitFooterAtBreak = pList.get(PR_TABLE_OMIT_FOOTER_AT_BREAK).getEnum();
tableOmitHeaderAtBreak = pList.get(PR_TABLE_OMIT_HEADER_AT_BREAK).getEnum();
writingModeTraits = new WritingModeTraits(
- WritingMode.valueOf(pList.get(PR_WRITING_MODE).getEnum()));
+ WritingMode.valueOf(pList.get(PR_WRITING_MODE).getEnum()),
+ pList.getExplicit(PR_WRITING_MODE) != null);
//Bind extension properties
widowContentLimit = pList.get(PR_X_WIDOW_CONTENT_LIMIT).getLength();
return writingModeTraits.getWritingMode();
}
+ /** {@inheritDoc} */
+ public boolean getExplicitWritingMode() {
+ return writingModeTraits.getExplicitWritingMode();
+ }
+
/** @return the "fox:widow-content-limit" extension FO trait */
public Length getWidowContentLimit() {
return widowContentLimit;
return ranges;
}
+ @Override
+ protected boolean isBidiBoundary(boolean propagate) {
+ return getExplicitWritingMode();
+ }
+
}
masterReference = pList.get(PR_MASTER_REFERENCE).getString();
referenceOrientation = pList.get(PR_REFERENCE_ORIENTATION).getNumeric();
writingModeTraits = new WritingModeTraits(
- WritingMode.valueOf(pList.get(PR_WRITING_MODE).getEnum()));
+ WritingMode.valueOf(pList.get(PR_WRITING_MODE).getEnum()),
+ pList.getExplicit(PR_WRITING_MODE) != null);
if (masterReference == null || masterReference.equals("")) {
missingPropertyError("master-reference");
}
}
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean getExplicitWritingMode() {
+ if (writingModeTraits != null) {
+ return writingModeTraits.getExplicitWritingMode();
+ } else {
+ return false;
+ }
+ }
@Override
protected Stack collectDelimitedTextRanges(Stack ranges, DelimitedTextRange currentRange) {
return ranges;
}
+ @Override
+ protected boolean isBidiBoundary(boolean propagate) {
+ return true;
+ }
+
/**
* Releases a page-sequence's children after the page-sequence has been fully processed.
*/
curBlockArea.setIPD(super.getContentAreaIPD());
- curBlockArea.setBidiLevel(getBlockFO().getBidiLevel());
+ curBlockArea.setBidiLevel(getBlockFO().getBidiLevelRecursive());
TraitSetter.addBreaks(curBlockArea,
getBlockFO().getBreakBefore(), getBlockFO().getBreakAfter());
int contentIPD = referenceIPD - getIPIndents();
curBlockArea.setIPD(contentIPD);
+ curBlockArea.setBidiLevel(getListBlockFO().getBidiLevel());
+
setCurrentArea(curBlockArea);
}
return curBlockArea;
//TODO: Check - itemIPD never set?
curBlockArea.setIPD(itemIPD);
//curBlockArea.setHeight();
+ curBlockArea.setBidiLevel(getPartFO().getBidiLevel());
TraitSetter.setProducerID(curBlockArea, getPartFO().getId());
int contentIPD = referenceIPD - getIPIndents();
curBlockArea.setIPD(contentIPD);
+ curBlockArea.setBidiLevel(fo.getBidiLevel());
+
setCurrentArea(curBlockArea);
}
return curBlockArea;
Area parentArea = parentLayoutManager.getParentArea(curBlockArea);
int referenceIPD = parentArea.getIPD();
curBlockArea.setIPD(referenceIPD);
+ curBlockArea.setBidiLevel(getTableAndCaptionFO().getBidiLevel());
// Get reference IPD from parentArea
setCurrentArea(curBlockArea); // ??? for generic operations
}
Area parentArea = parentLayoutManager.getParentArea(curBlockArea);
int referenceIPD = parentArea.getIPD();
curBlockArea.setIPD(referenceIPD);
+ curBlockArea.setBidiLevel(getTableCaptionFO().getBidiLevel());
// Get reference IPD from parentArea
setCurrentArea(curBlockArea); // ??? for generic operations
}
Block[][] blocks = new Block[getTableCell().getNumberRowsSpanned()][getTableCell()
.getNumberColumnsSpanned()];
GridUnit[] gridUnits = (GridUnit[]) primaryGridUnit.getRows().get(startRow);
+ int level = getTableCell().getBidiLevelRecursive();
for (int x = 0; x < getTableCell().getNumberColumnsSpanned(); x++) {
GridUnit gu = gridUnits[x];
BorderInfo border = gu.getBorderBefore(borderBeforeWhich);
int borderWidth = border.getRetainedWidth() / 2;
if (borderWidth > 0) {
- addBorder(blocks, startRow, x, Trait.BORDER_BEFORE, border, firstOnPage);
+ addBorder(blocks, startRow, x, Trait.BORDER_BEFORE, border,
+ firstOnPage, level);
adjustYOffset(blocks[startRow][x], -borderWidth);
adjustBPD(blocks[startRow][x], -borderWidth);
}
BorderInfo border = gu.getBorderAfter(borderAfterWhich);
int borderWidth = border.getRetainedWidth() / 2;
if (borderWidth > 0) {
- addBorder(blocks, endRow, x, Trait.BORDER_AFTER, border, lastOnPage);
+ addBorder(blocks, endRow, x, Trait.BORDER_AFTER, border,
+ lastOnPage, level);
adjustBPD(blocks[endRow][x], -borderWidth);
}
}
BorderInfo border = gridUnits[0].getBorderStart();
int borderWidth = border.getRetainedWidth() / 2;
if (borderWidth > 0) {
- addBorder(blocks, y, 0, Trait.BORDER_START, border, inFirstColumn);
+ addBorder(blocks, y, 0, Trait.BORDER_START, border,
+ inFirstColumn, level);
adjustXOffset(blocks[y][0], borderWidth);
adjustIPD(blocks[y][0], -borderWidth);
}
borderWidth = border.getRetainedWidth() / 2;
if (borderWidth > 0) {
addBorder(blocks, y, gridUnits.length - 1, Trait.BORDER_END, border,
- inLastColumn);
+ inLastColumn, level);
adjustIPD(blocks[y][gridUnits.length - 1], -borderWidth);
}
}
if (getTableCell().getDisplayAlign() == EN_CENTER) {
Block space = new Block();
space.setBPD((cellBPD - usedBPD) / 2);
+ space.setBidiLevel(getTableCell().getBidiLevelRecursive());
curBlockArea.addBlock(space);
} else if (getTableCell().getDisplayAlign() == EN_AFTER) {
Block space = new Block();
space.setBPD(cellBPD - usedBPD);
+ space.setBidiLevel(getTableCell().getBidiLevelRecursive());
curBlockArea.addBlock(space);
}
}
}
private void addBorder(Block[][] blocks, int i, int j, Integer side, BorderInfo border,
- boolean outer) {
+ boolean outer, int level) {
if (blocks[i][j] == null) {
blocks[i][j] = new Block();
blocks[i][j].addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
blocks[i][j].setPositioning(Block.ABSOLUTE);
+ blocks[i][j].setBidiLevel(level);
}
blocks[i][j].addTrait(side, BorderProps.makeRectangular(border.getStyle(),
border.getRetainedWidth(), border.getColor(),
block.setBPD(bpd);
block.setXOffset(xoffset + startIndent - paddingStart);
block.setYOffset(yoffset + borderBeforeWidth);
+ block.setBidiLevel(getTableCell().getBidiLevelRecursive());
return block;
}
curBlockArea.setXOffset(xoffset + startIndent);
curBlockArea.setYOffset(yoffset);
curBlockArea.setIPD(cellIPD);
+ curBlockArea.setBidiLevel(getTableCell().getBidiLevelRecursive());
/*Area parentArea =*/ parentLayoutManager.getParentArea(curBlockArea);
// Get reference IPD from parentArea
}
public StructureTreeElement startNode(String name, Attributes attributes, StructureTreeElement parent) {
- PDFStructElem parentElem = parent == null ? ancestors.getFirst() : (PDFStructElem) parent;
+ PDFStructElem parentElem;
+ if ((parent != null) && (parent instanceof PDFStructElem)) {
+ parentElem = (PDFStructElem) parent;
+ } else {
+ parentElem = ancestors.getFirst();
+ }
PDFStructElem structElem = createStructureElement(name, parentElem, attributes,
pdfFactory, eventBroadcaster);
ancestors.addFirst(structElem);
builderContext.pushContainer(newRow);
builderContext.getTableContext().selectFirstColumn();
}
- } catch (Exception ex) {
- throw new RtfException(ex.getMessage());
+ } catch (org.apache.fop.apps.FOPException e) {
+ throw new RtfException(e.getMessage());
+ } catch (java.io.IOException e) {
+ throw new RtfException(e.getMessage());
}
}
}
} else {
/* This should never happen unless a placeholder is not catered for
* in the RTFHandler.endContainer method. */
- LOG.warn("Unhandled RTF structure tag mismatch detected between " +
- aClass.getSimpleName() + " and "+object.getClass().getSimpleName());
+ LOG.warn("Unhandled RTF structure tag mismatch detected between "
+ + aClass.getSimpleName() + " and " + object.getClass().getSimpleName());
}
}
* Assign writing mode traits from this trait to the specified
* writing mode traits setter.
* @param wms a writing mode traits setter
+ * @param explicit true if writing mode property explicitly specified
*/
- public void assignWritingModeTraits(WritingModeTraitsSetter wms) {
+ public void assignWritingModeTraits(WritingModeTraitsSetter wms, boolean explicit) {
Direction inlineProgressionDirection;
Direction blockProgressionDirection;
Direction columnProgressionDirection;
wms.setColumnProgressionDirection(columnProgressionDirection);
wms.setRowProgressionDirection(rowProgressionDirection);
wms.setShiftDirection(shiftDirection);
- wms.setWritingMode(this);
+ wms.setWritingMode(this, explicit);
}
/**
private Direction rowProgressionDirection;
private Direction shiftDirection;
private WritingMode writingMode;
+ private boolean explicit;
/**
* Default writing mode traits constructor.
*/
public WritingModeTraits() {
- this (WritingMode.LR_TB);
+ this (WritingMode.LR_TB, false);
}
/**
* Construct writing mode traits using the specified writing mode.
* @param writingMode a writing mode traits object
*/
- public WritingModeTraits(WritingMode writingMode) {
- assignWritingModeTraits(writingMode);
+ public WritingModeTraits(WritingMode writingMode, boolean explicit) {
+ assignWritingModeTraits(writingMode, explicit);
}
/**
return writingMode;
}
+ /**
+ * @return the "explicit-writing-mode" trait.
+ */
+ public boolean getExplicitWritingMode() {
+ return explicit;
+ }
+
/**
* @param writingMode the "writing-mode" trait.
*/
- public void setWritingMode(WritingMode writingMode) {
+ public void setWritingMode(WritingMode writingMode, boolean explicit) {
this.writingMode = writingMode;
+ this.explicit = explicit;
}
/**
* @param writingMode the "writing-mode" trait.
*/
- public void assignWritingModeTraits(WritingMode writingMode) {
- writingMode.assignWritingModeTraits(this);
+ public void assignWritingModeTraits(WritingMode writingMode, boolean explicit) {
+ writingMode.assignWritingModeTraits(this, explicit);
}
/**
*/
WritingMode getWritingMode();
+ /**
+ * @return the "explicit-writing-mode" trait
+ */
+ boolean getExplicitWritingMode();
+
}
* Set value of writing-mode trait.
* @param writingMode the "writing-mode" trait
*/
- void setWritingMode(WritingMode writingMode);
+ void setWritingMode(WritingMode writingMode, boolean explicit);
/**
* Collectivelly assign values to all writing mode traits based upon a specific
* writing mode.
* @param writingMode the "writing-mode" trait
+ * @param explicit true if writing mode explicitly specified
*/
- void assignWritingModeTraits(WritingMode writingMode);
+ void assignWritingModeTraits(WritingMode writingMode, boolean explicit);
}
documents. Example: the fix of marks layering will be such a case when it's done.
-->
<release version="FOP Trunk" date="TBD">
+ <action context="Layout" dev="GA" type="fix" fixes-bug="FOP-2310">
+ Fix misplaced table cell border in WM RTL context.
+ </action>
<action context="Renderers" dev="GA" type="add" fixes-bug="FOP-2298">
Enable support for PDF page transitions.
</action>