class BuilderContext {
/** stack of RtfContainers */
- private final Stack m_containers = new Stack();
+ private final Stack containers = new Stack();
/** stack of TableContexts */
- private final Stack m_tableContexts = new Stack();
+ private final Stack tableContexts = new Stack();
/** stack of IBuilders */
- private final Stack m_builders = new Stack();
+ private final Stack builders = new Stack();
/** Rtf options */
- IRtfOptions m_options;
+ private IRtfOptions options;
BuilderContext(IRtfOptions rtfOptions) {
- m_options = rtfOptions;
+ options = rtfOptions;
}
/** find first object of given class from top of stack s
Object getBuilder(Class builderClass,boolean required)
throws Exception
{
- final IBuilder result = (IBuilder)getObjectFromStack(m_builders,builderClass);
+ final IBuilder result = (IBuilder)getObjectFromStack(builders,builderClass);
if(result == null && required) {
throw new Exception(
"IBuilder of class '" + builderClass.getName() + "' not found on builders stack"
Object /*IBuilder*/ forWhichBuilder) throws Exception {
// TODO what to do if the desired container is not at the top of the stack?
// close top-of-stack container?
- final RtfContainer result = (RtfContainer)getObjectFromStack(m_containers,
+ final RtfContainer result = (RtfContainer)getObjectFromStack(containers,
containerClass);
if (result == null && required) {
/** push an RtfContainer on our stack */
void pushContainer(RtfContainer c) {
- m_containers.push(c);
+ containers.push(c);
}
/**
void replaceContainer(RtfContainer oldC, RtfContainer newC)
throws Exception {
// treating the Stack as a Vector allows such manipulations (yes, I hear you screaming ;-)
- final int index = m_containers.indexOf(oldC);
+ final int index = containers.indexOf(oldC);
if (index < 0) {
throw new Exception("container to replace not found:" + oldC);
}
- m_containers.setElementAt(newC, index);
+ containers.setElementAt(newC, index);
}
/** pop the topmost RtfContainer from our stack */
void popContainer() {
- m_containers.pop();
+ containers.pop();
}
/* push an IBuilder to our stack /
void pushBuilder(IBuilder b)
{
- m_builders.push(b);
+ builders.push(b);
}*/
/** pop the topmost IBuilder from our stack and return previous builder on stack
IBuilder popBuilderAndGetPreviousOne()
{
IBuilder result = null;
- m_builders.pop();
- if(!m_builders.isEmpty()) {
- result = (IBuilder)m_builders.peek();
+ builders.pop();
+ if(!builders.isEmpty()) {
+ result = (IBuilder)builders.peek();
}
return result;
}
*/
/** return the current TableContext */
TableContext getTableContext() {
- return (TableContext)m_tableContexts.peek();
+ return (TableContext)tableContexts.peek();
}
/** push a TableContext to our stack */
void pushTableContext(TableContext tc) {
- m_tableContexts.push(tc);
+ tableContexts.push(tc);
}
/** pop a TableContext from our stack */
void popTableContext() {
- m_tableContexts.pop();
+ tableContexts.pop();
}
}
\ No newline at end of file
*/
class FoUnitsConverter {
- private static final FoUnitsConverter m_instance = new FoUnitsConverter();
+ private static final FoUnitsConverter INSTANCE = new FoUnitsConverter();
/** points to twips: 1 twip is 1/20 of a point */
public static final float POINT_TO_TWIPS = 20f;
/** conversion factors keyed by xsl:fo units names */
- private static final Map m_twipFactors = new HashMap();
+ private static final Map TWIP_FACTORS = new HashMap();
static {
- m_twipFactors.put("mm", new Float(MM_TO_TWIPS));
- m_twipFactors.put("cm", new Float(CM_TO_TWIPS));
- m_twipFactors.put("pt", new Float(POINT_TO_TWIPS));
- m_twipFactors.put("in", new Float(IN_TO_TWIPS));
+ TWIP_FACTORS.put("mm", new Float(MM_TO_TWIPS));
+ TWIP_FACTORS.put("cm", new Float(CM_TO_TWIPS));
+ TWIP_FACTORS.put("pt", new Float(POINT_TO_TWIPS));
+ TWIP_FACTORS.put("in", new Float(IN_TO_TWIPS));
}
/** singleton pattern */
/** singleton pattern */
static FoUnitsConverter getInstance() {
- return m_instance;
+ return INSTANCE;
}
/** convert given value to RTF units
// find conversion factor
if (units != null && units.trim().length() > 0) {
- final Float factor = (Float)m_twipFactors.get(units.toLowerCase());
+ final Float factor = (Float)TWIP_FACTORS.get(units.toLowerCase());
if (factor == null) {
throw new FOPException("conversion factor not found for '" + units + "' units");
}
static RtfAttributes convertAttributes(PropertyList properties)
- throws FOPException{
+ throws FOPException {
RtfAttributes attrib = new RtfAttributes();
- Property prop=null;
- int iStartIndentInTwips=0;
+ Property prop = null;
+ int iStartIndentInTwips = 0;
//start-indent
if ((prop = properties.get("start-indent")) != null) {
attrib.set(RtfText.LEFT_INDENT_BODY,
(int) FoUnitsConverter.getInstance().convertToTwips(sValue));
} else {
- if(iStartIndentInTwips >= 360) {
+ if (iStartIndentInTwips >= 360) {
//if the start indent is greater than default, set to the start indent
attrib.set(RtfText.LEFT_INDENT_BODY, iStartIndentInTwips);
} else {
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem.RtfListItemLabel;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTextrun;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable;
RtfAttributes atts = TableAttributesConverter.convertRowAttributes(tr.properties,
tbl.getHeaderAttribs());
- if(tr.getParent() instanceof TableHeader) {
+ if (tr.getParent() instanceof TableHeader) {
atts.set(ITableAttributes.ATTR_HEADER);
}
public void startList(ListBlock lb) {
try {
// create an RtfList in the current list container
- final IRtfListContainer c = (IRtfListContainer)builderContext.getContainer(IRtfListContainer.class,true,this);
- final RtfList newList = c.newList(ListAttributesConverter.convertAttributes(lb.properties));
+ final IRtfListContainer c
+ = (IRtfListContainer)builderContext.getContainer(
+ IRtfListContainer.class, true, this);
+ final RtfList newList = c.newList(
+ ListAttributesConverter.convertAttributes(lb.properties));
builderContext.pushContainer(newList);
} catch (IOException ioe) {
log.error("startList: " + ioe.getMessage());
public void startListItem(ListItem li) {
// create an RtfListItem in the current RtfList
try {
- final RtfList list = (RtfList)builderContext.getContainer(RtfList.class,true,this);
+ final RtfList list = (RtfList)builderContext.getContainer(
+ RtfList.class, true, this);
builderContext.pushContainer(list.newListItem());
} catch (IOException ioe) {
log.error("startList: " + ioe.getMessage());
RtfListItem item
= (RtfListItem)builderContext.getContainer(RtfListItem.class, true, this);
- RtfListItemLabel label=item.new RtfListItemLabel(item);
+ RtfListItemLabel label = item.new RtfListItemLabel(item);
builderContext.pushContainer(label);
} catch (IOException ioe) {
log.error("startPageNumber:" + ioe.getMessage());
*/
package org.apache.fop.render.rtf;
-import java.util.ArrayList;
+import java.util.List;
import org.apache.avalon.framework.logger.ConsoleLogger;
import org.apache.avalon.framework.logger.Logger;
class TableContext implements ITableColumnsInfo {
private final Logger log = new ConsoleLogger();
- private final BuilderContext m_context;
- private final ArrayList m_colWidths = new ArrayList();
- private int m_colIndex;
+ private final BuilderContext context;
+ private final List colWidths = new java.util.ArrayList();
+ private int colIndex;
/**
* Added by Peter Herweg on 2002-06-29
* value > 0 means there is row-spanning
* Each value in the list is decreased by 1 after each finished table-row
*/
- private final ArrayList m_colRowSpanningNumber = new ArrayList();
+ private final List colRowSpanningNumber = new java.util.ArrayList();
/**
* Added by Peter Herweg on 2002-06-29
* For this purpose the attributes of a cell are stored in this array, as soon
* as a number-rows-spanned attribute has been found.
*/
- private final ArrayList m_colRowSpanningAttrs = new ArrayList();
+ private final List colRowSpanningAttrs = new java.util.ArrayList();
- private boolean m_bNextRowBelongsToHeader = false;
+ private boolean bNextRowBelongsToHeader = false;
- public void setNextRowBelongsToHeader(boolean bNextRowBelongsToHeader) {
- m_bNextRowBelongsToHeader = bNextRowBelongsToHeader;
+ public void setNextRowBelongsToHeader(boolean value) {
+ this.bNextRowBelongsToHeader = value;
}
public boolean getNextRowBelongsToHeader() {
- return m_bNextRowBelongsToHeader;
+ return bNextRowBelongsToHeader;
}
TableContext(BuilderContext ctx) {
- m_context = ctx;
+ context = ctx;
}
void setNextColumnWidth(String strWidth)
throws Exception {
- m_colWidths.add(new Float(FoUnitsConverter.getInstance().convertToTwips(strWidth)));
+ colWidths.add(new Float(FoUnitsConverter.getInstance().convertToTwips(strWidth)));
}
//Added by Peter Herweg on 2002-06-29
RtfAttributes getColumnRowSpanningAttrs() {
- return (RtfAttributes)m_colRowSpanningAttrs.get(m_colIndex);
+ return (RtfAttributes)colRowSpanningAttrs.get(colIndex);
}
//Added by Peter Herweg on 2002-06-29
Integer getColumnRowSpanningNumber() {
- return (Integer)m_colRowSpanningNumber.get(m_colIndex);
+ return (Integer)colRowSpanningNumber.get(colIndex);
}
//Added by Peter Herweg on 2002-06-29
void setCurrentColumnRowSpanning(Integer iRowSpanning, RtfAttributes attrs)
throws Exception {
- if (m_colIndex < m_colRowSpanningNumber.size()) {
- m_colRowSpanningNumber.set(m_colIndex, iRowSpanning);
- m_colRowSpanningAttrs.set(m_colIndex, attrs);
+ if (colIndex < colRowSpanningNumber.size()) {
+ colRowSpanningNumber.set(colIndex, iRowSpanning);
+ colRowSpanningAttrs.set(colIndex, attrs);
} else {
- m_colRowSpanningNumber.add(iRowSpanning);
- m_colRowSpanningAttrs.add(m_colIndex, attrs);
+ colRowSpanningNumber.add(iRowSpanning);
+ colRowSpanningAttrs.add(colIndex, attrs);
}
}
//Added by Peter Herweg on 2002-06-29
public void setNextColumnRowSpanning(Integer iRowSpanning,
RtfAttributes attrs) {
- m_colRowSpanningNumber.add(iRowSpanning);
- m_colRowSpanningAttrs.add(m_colIndex, attrs);
+ colRowSpanningNumber.add(iRowSpanning);
+ colRowSpanningAttrs.add(colIndex, attrs);
}
/**
* Added by Peter Herweg on 2002-06-29
* This function is called after each finished table-row.
- * It decreases all values in m_colRowSpanningNumber by 1. If a value
+ * It decreases all values in colRowSpanningNumber by 1. If a value
* reaches 0 row-spanning is finished, and the value won't be decreased anymore.
*/
public void decreaseRowSpannings() {
- for (int z = 0; z < m_colRowSpanningNumber.size(); ++z) {
- Integer i = (Integer)m_colRowSpanningNumber.get(z);
+ for (int z = 0; z < colRowSpanningNumber.size(); ++z) {
+ Integer i = (Integer)colRowSpanningNumber.get(z);
if (i.intValue() > 0) {
i = new Integer(i.intValue() - 1);
}
- m_colRowSpanningNumber.set(z, i);
+ colRowSpanningNumber.set(z, i);
if (i.intValue() == 0) {
- m_colRowSpanningAttrs.set(z, null);
+ colRowSpanningAttrs.set(z, null);
}
}
}
* 'number-columns-spanned' processing
*/
public void selectFirstColumn() {
- m_colIndex = 0;
+ colIndex = 0;
}
/**
* 'number-columns-spanned' processing
*/
public void selectNextColumn() {
- m_colIndex++;
+ colIndex++;
}
/**
*/
public float getColumnWidth() {
try {
- return ((Float)m_colWidths.get(m_colIndex)).floatValue();
+ return ((Float)colWidths.get(colIndex)).floatValue();
} catch (IndexOutOfBoundsException ex) {
// this code contributed by Trembicki-Guy, Ed <GuyE@DNB.com>
log.warn("fo:table-column width not defined, using " + INVALID_COLUM_WIDTH);
/** Added by Boris Poudérous on 07/22/2002 */
public int getColumnIndex() {
- return m_colIndex;
+ return colIndex;
}
/** - end - */
/** Added by Boris Poudérous on 07/22/2002 */
public int getNumberOfColumns() {
- return m_colWidths.size();
+ return colWidths.size();
}
/** - end - */
}
String ATTR_ROW_LEFT_INDENT = "trleft";
/** table row header */
- public final String ATTR_HEADER = "trhdr";
+ String ATTR_HEADER = "trhdr";
// RTF 1.6 Row and table attributes
/** table row padding, top */
protected int graphicCompressionRate = 80;
/** The image data */
- private byte[] data = null;
+ private byte[] imagedata = null;
/** The image type */
- private int type;
+ private int imagetype;
//////////////////////////////////////////////////
// @@ Construction
// getRtfFile ().getLog ().logInfo ("Writing image '" + url + "'.");
- data = null;
+ imagedata = null;
try {
final InputStream in = url.openStream();
try {
- data = IOUtil.toByteArray(url.openStream());
+ imagedata = IOUtil.toByteArray(url.openStream());
} finally {
IOUtil.shutdownStream(in);
}
+ url + "' (" + e + ")");
}
- if (data == null) {
+ if (imagedata == null) {
return;
}
// Determine image file format
String file = url.getFile ();
- type = determineImageType(data, file.substring(file.lastIndexOf(".") + 1));
+ imagetype = determineImageType(imagedata, file.substring(file.lastIndexOf(".") + 1));
- if (type >= ImageConstants.I_TO_CONVERT_BASIS) {
+ if (imagetype >= ImageConstants.I_TO_CONVERT_BASIS) {
// convert
- int to = ImageConstants.CONVERT_TO [type - ImageConstants.I_TO_CONVERT_BASIS];
+ int to = ImageConstants.CONVERT_TO[imagetype - ImageConstants.I_TO_CONVERT_BASIS];
// if (to == ImageConstants.I_JPG) {
// ByteArrayOutputStream out = null;
// //convert to jpeg
// out = new ByteArrayOutputStream();
// Encoder jpgEncoder = new Encoder(graphicCompressionRate, out);
-// jpgEncoder.encodeJPEG(data);
-// data = out.toByteArray();
+// jpgEncoder.encodeJPEG(imagedata);
+// imagedata = out.toByteArray();
// type = to;
// }
// catch (JPEGException e) {
// out.close();
// }
// } else {
- type = ImageConstants.I_NOT_SUPPORTED;
+ imagetype = ImageConstants.I_NOT_SUPPORTED;
// }
}
- if (type == ImageConstants.I_NOT_SUPPORTED) {
+ if (imagetype == ImageConstants.I_NOT_SUPPORTED) {
throw new ExternalGraphicException("The tag <fo:external-graphic> "
+ "does not support "
+ file.substring(file.lastIndexOf(".") + 1)
+ " - image type.");
}
- String rtfImageCode = ImageConstants.RTF_TAGS [type];
+ String rtfImageCode = ImageConstants.RTF_TAGS[imagetype];
// Writes the beginning of the rtf image
writeGroupMark(true);
writeControlWord("pict");
- StringBuffer buf = new StringBuffer(data.length * 3);
+ StringBuffer buf = new StringBuffer(imagedata.length * 3);
writeControlWord(rtfImageCode);
computeImageSize();
writeSizeInfo();
- for (int i = 0; i < data.length; i++) {
- int iData = data [i];
+ for (int i = 0; i < imagedata.length; i++) {
+ int iData = imagedata [i];
// Make positive byte
if (iData < 0) {
}
private void computeImageSize () {
- if (type == ImageConstants.I_PNG) {
- width = ImageUtil.getIntFromByteArray(data, 16, 4, true);
- height = ImageUtil.getIntFromByteArray(data, 20, 4, true);
- } else if (type == ImageConstants.I_JPG) {
+ if (imagetype == ImageConstants.I_PNG) {
+ width = ImageUtil.getIntFromByteArray(imagedata, 16, 4, true);
+ height = ImageUtil.getIntFromByteArray(imagedata, 20, 4, true);
+ } else if (imagetype == ImageConstants.I_JPG) {
int basis = -1;
byte ff = (byte) 0xff;
byte c0 = (byte) 0xc0;
- for (int i = 0; i < data.length; i++) {
- byte b = data[i];
+ for (int i = 0; i < imagedata.length; i++) {
+ byte b = imagedata[i];
if (b != ff) {
continue;
}
- if (i == data.length - 1) {
+ if (i == imagedata.length - 1) {
continue;
}
- b = data[i + 1];
+ b = imagedata[i + 1];
if (b != c0) {
continue;
}
}
if (basis != -1) {
- width = ImageUtil.getIntFromByteArray(data, basis + 2, 2, true);
- height = ImageUtil.getIntFromByteArray(data, basis, 2, true);
+ width = ImageUtil.getIntFromByteArray(imagedata, basis + 2, 2, true);
+ height = ImageUtil.getIntFromByteArray(imagedata, basis, 2, true);
}
- } else if (type == ImageConstants.I_EMF) {
- width = ImageUtil.getIntFromByteArray(data, 151, 4, false);
- height = ImageUtil.getIntFromByteArray(data, 155, 4, false);
+ } else if (imagetype == ImageConstants.I_EMF) {
+ width = ImageUtil.getIntFromByteArray(imagedata, 151, 4, false);
+ height = ImageUtil.getIntFromByteArray(imagedata, 155, 4, false);
}
}
/**
* Determines wheter the image is a jpeg.
*
- * @param data Image
+ * @param imagedata Image
*
* @return
* true If JPEG type\n
public RtfListTable startListTable(RtfAttributes attr)
throws IOException {
listNum++;
- if(listTable != null) {
+ if (listTable != null) {
return listTable;
} else {
- listTable = new RtfListTable(this, writer, new Integer(listNum), attr);
- listTableContainer.addChild(listTable);
+ listTable = new RtfListTable(this, writer, new Integer(listNum), attr);
+ listTableContainer.addChild(listTable);
}
return listTable;
* @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
* @author Andreas Putz a.putz@skynamics.com
*/
-public class RtfListItem
-extends RtfContainer
-implements IRtfTextrunContainer,
- IRtfListContainer,
- IRtfParagraphContainer {
+public class RtfListItem extends RtfContainer
+ implements IRtfTextrunContainer,
+ IRtfListContainer,
+ IRtfParagraphContainer {
private RtfList parentList;
private RtfParagraph paragraph;
private RtfListStyle listStyle;
- private int number=0;
+ private int number = 0;
/** special RtfParagraph that writes list item setup code before its content */
private class RtfListItemParagraph extends RtfParagraph {
}
public class RtfListItemLabel extends RtfTextrun implements IRtfTextrunContainer {
- RtfListItem rtfListItem;
+ private RtfListItem rtfListItem;
public RtfListItemLabel(RtfListItem item) throws IOException {
super(null, item.writer, null);
- rtfListItem=item;
+ rtfListItem = item;
}
public RtfTextrun getTextrun() throws IOException {
public void addString(String s) throws IOException {
final String label = s.trim();
- if(label.length() > 0 && Character.isDigit(label.charAt(0))) {
+ if (label.length() > 0 && Character.isDigit(label.charAt(0))) {
rtfListItem.setRtfListStyle(new RtfListStyleNumber());
} else {
rtfListItem.setRtfListStyle(new RtfListStyleText(label));
parentList = parent;
}
- public RtfTextrun getTextrun()
- throws IOException {
- RtfTextrun textrun=RtfTextrun.getTextrun(this, writer, null);
+ public RtfTextrun getTextrun() throws IOException {
+ RtfTextrun textrun = RtfTextrun.getTextrun(this, writer, null);
textrun.setRtfListItem(this);
return textrun;
}
getRtfListStyle().writeListPrefix(this);
writeGroupMark(false);
- writeOneAttribute(RtfListTable.LIST_NUMBER,new Integer(number));
+ writeOneAttribute(RtfListTable.LIST_NUMBER, new Integer(number));
}
/**
* @return ListSytle of the List
*/
public RtfListStyle getRtfListStyle() {
- if(listStyle==null) {
+ if (listStyle == null) {
return parentList.getRtfListStyle();
} else {
return listStyle;
private RtfListItem rtfListItem;
public void setRtfListItem(RtfListItem item) {
- rtfListItem=item;
+ rtfListItem = item;
}
public RtfListItem getRtfListItem() {
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement;
public class RtfListStyleText extends RtfListStyle {
- String text;
+ private String text;
public RtfListStyleText(String s) {
- text=s;
+ text = s;
}
/**
element.writeGroupMark(true);
String sCount;
- if(text.length()<10) {
+ if (text.length() < 10) {
sCount = "0" + String.valueOf(text.length());
} else {
sCount = String.valueOf(text.length());
import java.util.LinkedList;
import java.util.Iterator;
-import java.util.LinkedList;
import java.io.Writer;
import java.io.IOException;
//import org.apache.fop.render.rtf.rtflib.jfor.main.JForVersionInfo;
throws IOException {
super(parent, w, attrs);
- styles=new LinkedList();
+ styles = new LinkedList();
}
/**
* @param list RtfList to add
*/
public int addList(RtfList list) {
- if(lists == null) {
- lists=new LinkedList();
+ if (lists == null) {
+ lists = new LinkedList();
}
lists.add(list);
* @throws IOException for I/O problems
*/
public void writeRtfContent() throws IOException {
- if(lists!=null) {
+ if (lists != null) {
//write '\listtable'
writeGroupMark(true);
writeStarControlWordNS(LIST_TABLE);
//write '\listoveridetable'
writeGroupMark(true);
writeStarControlWordNS(LIST_OVR_TABLE);
- int z=1;
+ int z = 1;
for (Iterator it = styles.iterator(); it.hasNext();) {
final RtfListStyle style = (RtfListStyle)it.next();
writeOneAttributeNS(LIST_SPACE, new Integer(0));
writeOneAttributeNS(LIST_INDENT, attrib.getValue(LIST_INDENT));
- RtfListItem item=(RtfListItem)list.getChildren().get(0);
+ RtfListItem item = (RtfListItem)list.getChildren().get(0);
item.getRtfListStyle().writeLevelGroup(this);
writeGroupMark(false);
// The 'id' of the referenced page
private String id = null;
- /** Create an RTF page number citation as a child of given container with default attributes */
- RtfPageNumberCitation (IRtfPageNumberCitationContainer parent, Writer w, String id)
- throws IOException {
- super((RtfContainer)parent, w);
- this.id = id;
- }
+ /** Create an RTF page number citation as a child of given container with default attributes */
+ RtfPageNumberCitation (IRtfPageNumberCitationContainer parent, Writer w, String id)
+ throws IOException {
+ super((RtfContainer)parent, w);
+ this.id = id;
+ }
- /** Create an RTF page number citation as a child of given
- * paragraph, copying its attributes */
- RtfPageNumberCitation (RtfParagraph parent, Writer w, String id)
- throws IOException {
- // add the attributes ant text attributes of the parent paragraph
- super((RtfContainer)parent, w, parent.attrib);
- if (parent.getTextAttributes() != null) {
- attrib.set(parent.getTextAttributes());
- }
- this.id = id;
- }
+ /** Create an RTF page number citation as a child of given
+ * paragraph, copying its attributes */
+ RtfPageNumberCitation (RtfParagraph parent, Writer w, String id)
+ throws IOException {
+ // add the attributes ant text attributes of the parent paragraph
+ super((RtfContainer)parent, w, parent.attrib);
+ if (parent.getTextAttributes() != null) {
+ attrib.set(parent.getTextAttributes());
+ }
+ this.id = id;
+ }
- /**
- * Write the content
- * @throws IOException for I/O problems
- */
+ /**
+ * Write the content
+ * @throws IOException for I/O problems
+ */
protected void writeRtfContent() throws IOException {
// If we have a valid ID
if (isValid()) {
}
}
- /** checks that the 'ref-id' attribute exists */
- private boolean isValid() {
- if (id != null) {
- return true;
- } else {
- return false;
+ /** checks that the 'ref-id' attribute exists */
+ private boolean isValid() {
+ return (id != null);
}
- }
- /**
- * @return true if this element would generate no "useful" RTF content
- */
- public boolean isEmpty() {
- return false;
- }
-}
+ /**
+ * @return true if this element would generate no "useful" RTF content
+ */
+ public boolean isEmpty() {
+ return false;
+ }
+}
\ No newline at end of file
id = idNum;
parentRow = parent;
this.cellWidth = cellWidth;
- setCenter = setRight = false;
+ setCenter = false;
+ setRight = false;
}
final RtfTable parentTable = (RtfTable) parent;
adjustBorderProperties(parentTable);
- writeAttributes(attrib,new String[]{ITableAttributes.ATTR_HEADER});
+ writeAttributes(attrib, new String[]{ITableAttributes.ATTR_HEADER});
writeAttributes(attrib, ITableAttributes.ROW_BORDER);
writeAttributes(attrib, ITableAttributes.CELL_BORDER);
writeAttributes(attrib, BorderAttributesConverter.BORDERS);
* @return true if the row is the first in the table
*/
public boolean isFirstRow() {
- if (id == 1) {
- return true;
- } else {
- return false;
- }
+ return (id == 1);
}
/**
RtfText(IRtfTextContainer parent, Writer w, String str, RtfAttributes attr)
throws IOException {
super((RtfContainer)parent, w);
- text = str;
+ this.text = str;
this.attr = attr;
}
* @return true if the text is a tab character
*/
public boolean isTab() {
- if (text.trim().length() == 1 && text.charAt(0) == CHAR_TAB) {
- return true;
- } else {
- return false;
- }
+ return (text.trim().length() == 1 && text.charAt(0) == CHAR_TAB);
}
/**
* @return true if text is a newline character
*/
public boolean isNewLine() {
- if (text.trim().length() == 1 && text.charAt(0) == CHAR_NEW_LINE) {
- return true;
- } else {
- return false;
- }
+ return (text.trim().length() == 1 && text.charAt(0) == CHAR_NEW_LINE);
}
/**
*/
public boolean isBold(boolean isStart) {
if (isStart) {
- if (text.trim().length() == 1 && text.charAt(0) == CHAR_BOLD_START) {
- return true;
- }
+ return (text.trim().length() == 1 && text.charAt(0) == CHAR_BOLD_START);
} else {
- if (text.trim().length() == 1 && text.charAt(0) == CHAR_BOLD_END) {
- return true;
- } else {
- return false;
- }
+ return (text.trim().length() == 1 && text.charAt(0) == CHAR_BOLD_END);
}
- return false;
}
/** @return the attributes of our text */
// FOP
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfExternalGraphic;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList;
/**
* Class which contains a linear text run. It has methods to add attributes,
//may contain for example \intbl
writeAttributes(attrib, null);
- if(rtfListItem!=null) {
+ if (rtfListItem != null) {
rtfListItem.getRtfListStyle().writeParagraphPrefix(this);
}
if (!bHide) {
e.writeRtf();
- if (rtfListItem!=null && e instanceof RtfParagraphBreak) {
+ if (rtfListItem != null && e instanceof RtfParagraphBreak) {
rtfListItem.getRtfListStyle().writeParagraphPrefix(this);
}
}
}
public void setRtfListItem(RtfListItem listItem) {
- rtfListItem=listItem;
+ rtfListItem = listItem;
}
public RtfListItem getRtfListItem() {