diff options
author | Adrian Cumiskey <acumiskey@apache.org> | 2008-07-22 17:25:27 +0000 |
---|---|---|
committer | Adrian Cumiskey <acumiskey@apache.org> | 2008-07-22 17:25:27 +0000 |
commit | 94e331eebc93ac99f100576f82af034c394741c2 (patch) | |
tree | 106514941e1745670a14a9a44e57fd3ecfd16abf /src/java/org/apache/fop/render/afp/modca | |
parent | 6b7d549d6915c9a1028928afa55c45e73123472f (diff) | |
download | xmlgraphics-fop-94e331eebc93ac99f100576f82af034c394741c2.tar.gz xmlgraphics-fop-94e331eebc93ac99f100576f82af034c394741c2.zip |
* Removed unused goca accessor methods from AFPState.
* Created LineDataInfo class, this simplifies all the parameter passing on line creation.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@678812 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/afp/modca')
4 files changed, 37 insertions, 102 deletions
diff --git a/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java b/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java index e9966af57..3105f88b1 100644 --- a/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java +++ b/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java @@ -29,7 +29,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.fop.render.afp.AFPFontAttributes; -import org.apache.fop.render.afp.AFPTextDataInfo; +import org.apache.fop.render.afp.LineDataInfo; +import org.apache.fop.render.afp.TextDataInfo; import org.apache.fop.render.afp.DataObjectInfo; import org.apache.fop.render.afp.ExternalResourceGroupManager; import org.apache.fop.render.afp.ObjectAreaInfo; @@ -390,7 +391,7 @@ public class AFPDataStream extends AbstractResourceGroupContainer { * @param textDataInfo * the afp text data */ - public void createText(AFPTextDataInfo textDataInfo) { + public void createText(TextDataInfo textDataInfo) { textDataInfo.setOrientation(orientation); getCurrentPage().createText(textDataInfo); } @@ -537,22 +538,11 @@ public class AFPDataStream extends AbstractResourceGroupContainer { /** * Method to create a line on the current page. * - * @param x1 - * the first x coordinate of the line - * @param y1 - * the first y coordinate of the line - * @param x2 - * the second x coordinate of the line - * @param y2 - * the second y coordinate of the line - * @param thickness - * the thickness of the line - * @param col - * The text color. + * @param lineDataInfo the line data information. */ - public void createLine(int x1, int y1, int x2, int y2, int thickness, - Color col) { - getCurrentPage().createLine(x1, y1, x2, y2, thickness, orientation, col); + public void createLine(LineDataInfo lineDataInfo) { + lineDataInfo.setOrientation(orientation); + getCurrentPage().createLine(lineDataInfo); } /** diff --git a/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java b/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java index 8e6314adb..540e74c33 100644 --- a/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java +++ b/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java @@ -25,7 +25,8 @@ import java.io.OutputStream; import java.util.Iterator; import java.util.List; -import org.apache.fop.render.afp.AFPTextDataInfo; +import org.apache.fop.render.afp.LineDataInfo; +import org.apache.fop.render.afp.TextDataInfo; import org.apache.fop.render.afp.DataObjectCache; import org.apache.fop.render.afp.ResourceInfo; import org.apache.fop.render.afp.fonts.AFPFont; @@ -169,25 +170,11 @@ public abstract class AbstractPageObject extends AbstractNamedAFPObject { /** * Helper method to create a line on the current page, this method delegates * to the presentation text object in order to construct the line. - * - * @param x1 - * the first x coordinate of the line - * @param y1 - * the first y coordinate of the line - * @param x2 - * the second x coordinate of the line - * @param y2 - * the second y coordinate of the line - * @param thickness - * the thickness of the line - * @param lineRotation - * the rotation of the line - * @param col - * The text color. + * + * @param lineDataInfo the line data information. */ - public void createLine(int x1, int y1, int x2, int y2, int thickness, - int lineRotation, Color col) { - getPresentationTextObject().createLineData(x1, y1, x2, y2, thickness, lineRotation, col); + public void createLine(LineDataInfo lineDataInfo) { + getPresentationTextObject().createLineData(lineDataInfo); } /** @@ -197,7 +184,7 @@ public abstract class AbstractPageObject extends AbstractNamedAFPObject { * @param textDataInfo * the afp text data */ - public void createText(AFPTextDataInfo textDataInfo) { + public void createText(TextDataInfo textDataInfo) { getPresentationTextObject().createTextData(textDataInfo); } diff --git a/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java b/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java index 44e1e008a..1d3643a61 100644 --- a/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java +++ b/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java @@ -24,7 +24,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; -import org.apache.fop.render.afp.AFPTextDataInfo; +import org.apache.fop.render.afp.LineDataInfo; +import org.apache.fop.render.afp.TextDataInfo; import org.apache.fop.render.afp.tools.BinaryUtils; /** @@ -271,7 +272,7 @@ public class PresentationTextData extends AbstractAFPObject { * @throws MaximumSizeExceededException * thrown if the maximum number of text data is exceeded */ - public void createTextData(AFPTextDataInfo textDataInfo) + public void createTextData(TextDataInfo textDataInfo) throws MaximumSizeExceededException { ByteArrayOutputStream afpdata = new ByteArrayOutputStream(); @@ -357,28 +358,22 @@ public class PresentationTextData extends AbstractAFPObject { * Drawing of lines using the starting and ending coordinates, thickness and * colour arguments. * - * @param x1 - * The starting X coordinate. - * @param y1 - * The starting Y coordinate. - * @param x2 - * The ending X coordinate. - * @param y2 - * The ending Y coordinate. - * @param thickness - * The line thickness. - * @param orientation - * The orientation of the text data. - * @param col - * The text color. + * @param lineDataInfo the line data information. * @throws MaximumSizeExceededException * thrown if the maximum number of line data has been exceeded */ - public void createLineData(int x1, int y1, int x2, int y2, int thickness, - int orientation, Color col) throws MaximumSizeExceededException { + public void createLineData(LineDataInfo lineDataInfo) throws MaximumSizeExceededException { ByteArrayOutputStream afpdata = new ByteArrayOutputStream(); + int thickness = lineDataInfo.getThickness(); + int orientation = lineDataInfo.getOrientation(); + int x1 = lineDataInfo.getX1(); + int y1 = lineDataInfo.getY1(); + int x2 = lineDataInfo.getX2(); + int y2 = lineDataInfo.getY2(); + Color col = lineDataInfo.getColor(); + if (currentOrientation != orientation) { setTextOrientation(orientation, afpdata); currentOrientation = orientation; @@ -407,9 +402,9 @@ public class PresentationTextData extends AbstractAFPObject { return; } - int s = afpdata.size(); + int dataSize = afpdata.size(); - if (baos.size() + s > MAX_SIZE) { + if (baos.size() + dataSize > MAX_SIZE) { currentXCoordinate = -1; currentYCoordinate = -1; throw new MaximumSizeExceededException(); @@ -533,9 +528,7 @@ public class PresentationTextData extends AbstractAFPObject { }, 0, 5); } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public void write(OutputStream os) throws IOException { byte[] data = baos.toByteArray(); byte[] size = BinaryUtils.convert(data.length - 1, 2); diff --git a/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java b/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java index 88e29851f..5828b7171 100644 --- a/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java +++ b/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java @@ -24,7 +24,8 @@ import java.io.IOException; import java.io.OutputStream; import java.util.List; -import org.apache.fop.render.afp.AFPTextDataInfo; +import org.apache.fop.render.afp.LineDataInfo; +import org.apache.fop.render.afp.TextDataInfo; /** * The Presentation Text object is the data object used in document processing @@ -81,7 +82,7 @@ public class PresentationTextObject extends AbstractNamedAFPObject { * @param textDataInfo * The afp text data */ - public void createTextData(AFPTextDataInfo textDataInfo) { + public void createTextData(TextDataInfo textDataInfo) { if (currentPresentationTextData == null) { startPresentationTextData(); } @@ -94,56 +95,20 @@ public class PresentationTextObject extends AbstractNamedAFPObject { } /** - * Drawing of lines using the starting and ending coordinates, thickness. - * - * @param x1 - * The first x coordinate of the line. - * @param y1 - * The first y coordinate of the line. - * @param x2 - * The second x coordinate of the line. - * @param y2 - * The second y coordinate of the line. - * @param thickness - * The thickness of the line. - * @param col - * The text color. - */ - public void createLineData(int x1, int y1, int x2, int y2, int thickness, Color col) { - // Default orientation - createLineData(x1, y1, x2, y2, thickness, 0, col); - } - - /** * Drawing of lines using the starting and ending coordinates, thickness and * orientation arguments. * - * @param x1 - * The first x coordinate of the line. - * @param y1 - * The first y coordinate of the line. - * @param x2 - * The second x coordinate of the line. - * @param y2 - * The second y coordinate of the line. - * @param thickness - * The thickness of the line. - * @param orientation - * The orientation of the line. - * @param col - * The text color. + * @param lineDataInfo the line data information. */ - public void createLineData(int x1, int y1, int x2, int y2, int thickness, - int orientation, Color col) { + public void createLineData(LineDataInfo lineDataInfo) { if (currentPresentationTextData == null) { startPresentationTextData(); } try { - currentPresentationTextData.createLineData(x1, y1, x2, y2, - thickness, orientation, col); + currentPresentationTextData.createLineData(lineDataInfo); } catch (MaximumSizeExceededException msee) { endPresentationTextData(); - createLineData(x1, y1, x2, y2, thickness, orientation, col); + createLineData(lineDataInfo); } } |