aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2006-01-16 09:50:28 +0000
committerJeremias Maerki <jeremias@apache.org>2006-01-16 09:50:28 +0000
commita74c0623f7d0412d41ea4653cbc94c0b09cde903 (patch)
tree58b3ea642738440093159b7babfea6d48aa10344 /src/java/org/apache
parent2bd5c4dca72282acc54745db170818dd33d17e69 (diff)
downloadxmlgraphics-fop-a74c0623f7d0412d41ea4653cbc94c0b09cde903.tar.gz
xmlgraphics-fop-a74c0623f7d0412d41ea4653cbc94c0b09cde903.zip
Code conventions please! No tab characters, spacing etc.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@369410 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r--src/java/org/apache/fop/render/rtf/TableAttributesConverter.java37
-rw-r--r--src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTable.java67
-rw-r--r--src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java97
-rw-r--r--src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java73
4 files changed, 135 insertions, 139 deletions
diff --git a/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java b/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java
index 90d1cac21..f1e4b4e86 100644
--- a/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java
+++ b/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java
@@ -29,11 +29,9 @@ import org.apache.fop.fo.flow.TableCell;
import org.apache.fop.fo.flow.TableHeader;
import org.apache.fop.fo.flow.TableRow;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
-import org.apache.fop.fo.properties.Property;
import org.apache.fop.render.rtf.BorderAttributesConverter;
import org.apache.fop.render.rtf.rtflib.rtfdoc.ITableAttributes;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfColorTable;
/**
* Contributor(s):
@@ -80,7 +78,8 @@ public class TableAttributesConverter {
static RtfAttributes convertTableAttributes(Table fobj)
throws FOPException {
FOPRtfAttributes attrib = new FOPRtfAttributes();
- attrib.setTwips(ITableAttributes.ATTR_ROW_LEFT_INDENT, fobj.getCommonMarginBlock().marginLeft);
+ attrib.setTwips(ITableAttributes.ATTR_ROW_LEFT_INDENT,
+ fobj.getCommonMarginBlock().marginLeft);
return attrib;
}
@@ -111,12 +110,12 @@ public class TableAttributesConverter {
static RtfAttributes convertCellAttributes(TableCell fobj)
throws FOPException {
- Property p;
- RtfColorTable colorTable = RtfColorTable.getInstance();
+ //Property p;
+ //RtfColorTable colorTable = RtfColorTable.getInstance();
FOPRtfAttributes attrib = new FOPRtfAttributes();
- boolean isBorderPresent = false;
+ //boolean isBorderPresent = false;
CommonBorderPaddingBackground border = fobj.getCommonBorderPaddingBackground();
// Cell background color
@@ -127,23 +126,23 @@ public class TableAttributesConverter {
CommonBorderPaddingBackground brd = null;
if (fobj.getParent() instanceof TableRow) {
- TableRow parentRow=(TableRow)fobj.getParent();
+ TableRow parentRow = (TableRow)fobj.getParent();
brd = parentRow.getCommonBorderPaddingBackground();
color = brd.backgroundColor;
} else if (fobj.getParent() instanceof TableHeader) {
- TableHeader parentHeader=(TableHeader)fobj.getParent();
+ TableHeader parentHeader = (TableHeader)fobj.getParent();
brd = parentHeader.getCommonBorderPaddingBackground();
color = brd.backgroundColor;
}
if (color == null
- && fobj.getParent()!=null
- && fobj.getParent().getParent()!=null
- && fobj.getParent().getParent().getParent() instanceof Table) {
-
- Table table = (Table)fobj.getParent().getParent().getParent();
- brd = table.getCommonBorderPaddingBackground();
- color = brd.backgroundColor;
+ && fobj.getParent() != null
+ && fobj.getParent().getParent() != null
+ && fobj.getParent().getParent().getParent() instanceof Table) {
+
+ Table table = (Table)fobj.getParent().getParent().getParent();
+ brd = table.getCommonBorderPaddingBackground();
+ color = brd.backgroundColor;
}
@@ -226,8 +225,8 @@ public class TableAttributesConverter {
RtfAttributes rtfatts)
throws FOPException {
- Property p;
- RtfColorTable colorTable = RtfColorTable.getInstance();
+ //Property p;
+ //RtfColorTable colorTable = RtfColorTable.getInstance();
RtfAttributes attrib = null;
@@ -237,8 +236,8 @@ public class TableAttributesConverter {
attrib = rtfatts;
}
- String attrValue;
- boolean isBorderPresent = false;
+ //String attrValue;
+ //boolean isBorderPresent = false;
//need to set a default width
//check for keep-together row attribute
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTable.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTable.java
index 65ac2eb49..e5a0bc122 100644
--- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTable.java
+++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTable.java
@@ -105,10 +105,10 @@ public class RtfTable extends RtfContainer {
* @throws IOException for I/O problems
*/
protected void writeRtfPrefix() throws IOException {
- if (isNestedTable()) {
- writeControlWordNS("pard");
- }
-
+ if (isNestedTable()) {
+ writeControlWordNS("pard");
+ }
+
writeGroupMark(true);
}
@@ -119,8 +119,8 @@ public class RtfTable extends RtfContainer {
protected void writeRtfSuffix() throws IOException {
writeGroupMark(false);
- if(isNestedTable()) {
- getRow().writeRowAndCellsDefintions();
+ if (isNestedTable()) {
+ getRow().writeRowAndCellsDefintions();
}
}
@@ -169,36 +169,37 @@ public class RtfTable extends RtfContainer {
return super.getRtfAttributes();
}
+ /** @return true if the the table is a nested table */
public boolean isNestedTable() {
- if (isNestedTable == null) {
- RtfElement e=this;
- while(e.parent != null) {
- if (e.parent instanceof RtfTableCell) {
- isNestedTable=new Boolean(true);
- return true;
- }
-
- e = e.parent;
- }
-
- isNestedTable=new Boolean(false);
- } else {
- return isNestedTable.booleanValue();
- }
-
- return false;
+ if (isNestedTable == null) {
+ RtfElement e = this;
+ while (e.parent != null) {
+ if (e.parent instanceof RtfTableCell) {
+ isNestedTable = Boolean.TRUE;
+ return true;
+ }
+
+ e = e.parent;
+ }
+
+ isNestedTable = Boolean.FALSE;
+ } else {
+ return isNestedTable.booleanValue();
+ }
+
+ return false;
}
public RtfTableRow getRow() {
- RtfElement e=this;
- while(e.parent != null) {
- if (e.parent instanceof RtfTableRow) {
- return (RtfTableRow) e.parent;
- }
-
- e = e.parent;
- }
-
- return null;
+ RtfElement e = this;
+ while (e.parent != null) {
+ if (e.parent instanceof RtfTableRow) {
+ return (RtfTableRow) e.parent;
+ }
+
+ e = e.parent;
+ }
+
+ return null;
}
}
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java
index 49fe9fd09..11930b0a0 100644
--- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java
+++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java
@@ -35,9 +35,9 @@ import java.util.Iterator;
*/
public class RtfTableCell
-extends RtfContainer
-implements IRtfParagraphContainer, IRtfListContainer, IRtfTableContainer,
- IRtfExternalGraphicContainer, IRtfTextrunContainer {
+ extends RtfContainer
+ implements IRtfParagraphContainer, IRtfListContainer, IRtfTableContainer,
+ IRtfExternalGraphicContainer, IRtfTextrunContainer {
private RtfParagraph paragraph;
private RtfList list;
private RtfTable table;
@@ -281,39 +281,37 @@ implements IRtfParagraphContainer, IRtfListContainer, IRtfTableContainer,
* @throws IOException for I/O problems
*/
protected void writeRtfSuffix() throws IOException {
- if (getRow().getTable().isNestedTable()) {
- //nested table
- writeControlWordNS("nestcell");
- writeGroupMark(true);
- writeControlWord("nonesttables");
- writeControlWord("par");
- writeGroupMark(false);
- } else {
- // word97 hangs if cell does not contain at least one "par" control word
- // TODO this is what causes the extra spaces in nested table of test
- // 004-spacing-in-tables.fo,
- // but if is not here we generate invalid RTF for word97
-
- if (setCenter) {
- writeControlWord("qc");
- } else if (setRight) {
- writeControlWord("qr");
- } else {
- writeControlWord("ql");
- }
-
-
-
- if (!containsText()) {
- writeControlWord("intbl");
-
- //R.Marra this create useless paragraph
- //Seem working into Word97 with the "intbl" only
- // writeControlWord("par");
- }
-
- writeControlWord("cell");
- }
+ if (getRow().getTable().isNestedTable()) {
+ //nested table
+ writeControlWordNS("nestcell");
+ writeGroupMark(true);
+ writeControlWord("nonesttables");
+ writeControlWord("par");
+ writeGroupMark(false);
+ } else {
+ // word97 hangs if cell does not contain at least one "par" control word
+ // TODO this is what causes the extra spaces in nested table of test
+ // 004-spacing-in-tables.fo,
+ // but if is not here we generate invalid RTF for word97
+
+ if (setCenter) {
+ writeControlWord("qc");
+ } else if (setRight) {
+ writeControlWord("qr");
+ } else {
+ writeControlWord("ql");
+ }
+
+ if (!containsText()) {
+ writeControlWord("intbl");
+
+ //R.Marra this create useless paragraph
+ //Seem working into Word97 with the "intbl" only
+ //writeControlWord("par");
+ }
+
+ writeControlWord("cell");
+ }
}
@@ -457,12 +455,11 @@ implements IRtfParagraphContainer, IRtfListContainer, IRtfTableContainer,
return result;
}
- public RtfTextrun getTextrun()
- throws IOException {
+ public RtfTextrun getTextrun() throws IOException {
RtfAttributes attrs = new RtfAttributes();
- if(!getRow().getTable().isNestedTable()) {
- attrs.set("intbl");
+ if (!getRow().getTable().isNestedTable()) {
+ attrs.set("intbl");
}
RtfTextrun textrun = RtfTextrun.getTextrun(this, writer, attrs);
@@ -475,15 +472,15 @@ implements IRtfParagraphContainer, IRtfListContainer, IRtfTableContainer,
}
public RtfTableRow getRow() {
- RtfElement e=this;
- while(e.parent != null) {
- if (e.parent instanceof RtfTableRow) {
- return (RtfTableRow) e.parent;
- }
-
- e = e.parent;
- }
-
- return null;
+ RtfElement e = this;
+ while (e.parent != null) {
+ if (e.parent instanceof RtfTableRow) {
+ return (RtfTableRow) e.parent;
+ }
+
+ e = e.parent;
+ }
+
+ return null;
}
}
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java
index d43cecc4a..2c6402061 100644
--- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java
+++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java
@@ -132,26 +132,26 @@ public class RtfTableRow extends RtfContainer implements ITableAttributes {
*/
protected void writeRtfContent() throws IOException {
- if (getTable().isNestedTable()) {
- //nested table
- writeControlWord("intbl");
- writeControlWord("itap2");
- } else {
- //normal (not nested) table
- writeRowAndCellsDefintions();
- }
+ if (getTable().isNestedTable()) {
+ //nested table
+ writeControlWord("intbl");
+ writeControlWord("itap2");
+ } else {
+ //normal (not nested) table
+ writeRowAndCellsDefintions();
+ }
// now children can write themselves, we have the correct RTF prefix code
super.writeRtfContent();
}
public void writeRowAndCellsDefintions() throws IOException {
-// render the row and cells definitions
+ // render the row and cells definitions
writeControlWord("trowd");
if (!getTable().isNestedTable()) {
- writeControlWord("itap0");
+ writeControlWord("itap0");
}
-
+
//check for keep-together
if (attrib != null && attrib.isSet(ITableAttributes.ROW_KEEP_TOGETHER)) {
writeControlWord(ROW_KEEP_TOGETHER);
@@ -251,22 +251,21 @@ public class RtfTableRow extends RtfContainer implements ITableAttributes {
* @throws IOException for I/O problems
*/
protected void writeRtfSuffix() throws IOException {
- if (getTable().isNestedTable()) {
- //nested table
- writeGroupMark(true);
- writeStarControlWord("nesttableprops");
- writeRowAndCellsDefintions();
- writeControlWordNS("nestrow");
- writeGroupMark(false);
-
-
- writeGroupMark(true);
- writeControlWord("nonesttables");
- writeControlWord("par");
- writeGroupMark(false);
- } else {
- writeControlWord("row");
- }
+ if (getTable().isNestedTable()) {
+ //nested table
+ writeGroupMark(true);
+ writeStarControlWord("nesttableprops");
+ writeRowAndCellsDefintions();
+ writeControlWordNS("nestrow");
+ writeGroupMark(false);
+
+ writeGroupMark(true);
+ writeControlWord("nonesttables");
+ writeControlWord("par");
+ writeGroupMark(false);
+ } else {
+ writeControlWord("row");
+ }
writeGroupMark(false);
}
@@ -322,15 +321,15 @@ public class RtfTableRow extends RtfContainer implements ITableAttributes {
}
public RtfTable getTable() {
- RtfElement e=this;
- while(e.parent != null) {
- if (e.parent instanceof RtfTable) {
- return (RtfTable) e.parent;
- }
-
- e = e.parent;
- }
-
- return null;
+ RtfElement e = this;
+ while (e.parent != null) {
+ if (e.parent instanceof RtfTable) {
+ return (RtfTable) e.parent;
+ }
+
+ e = e.parent;
+ }
+
+ return null;
}
}