From a699c1f06248949f7c86ff4fcbba209ab4ca8e0d Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Tue, 28 Jul 2009 12:53:58 +0000 Subject: Bugzilla #47311: Preparations in PDF library for bleed, trim and crop boxes. Submitted by: Peter Coppens Page view area changed from Rectangle2D to Rectangle where possible. Submitted by: Vincent Hennebert (Patch in Bugzilla only partially applied. Changes discussed with the properties not included, yet) git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@798511 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/area/AreaTreeParser.java | 9 ++++----- src/java/org/apache/fop/area/PageViewport.java | 13 ++++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'src/java/org/apache/fop/area') diff --git a/src/java/org/apache/fop/area/AreaTreeParser.java b/src/java/org/apache/fop/area/AreaTreeParser.java index ec47d2083..aae9b5017 100644 --- a/src/java/org/apache/fop/area/AreaTreeParser.java +++ b/src/java/org/apache/fop/area/AreaTreeParser.java @@ -20,6 +20,7 @@ package org.apache.fop.area; import java.awt.Color; +import java.awt.Rectangle; import java.awt.geom.Rectangle2D; import java.io.FileNotFoundException; import java.io.IOException; @@ -38,9 +39,10 @@ import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TransformerHandler; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; - import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.Locator; @@ -48,9 +50,6 @@ import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; import org.xml.sax.helpers.DefaultHandler; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import org.apache.xmlgraphics.image.loader.ImageException; import org.apache.xmlgraphics.image.loader.ImageInfo; import org.apache.xmlgraphics.image.loader.ImageManager; @@ -403,7 +402,7 @@ public class AreaTreeParser { if (currentPageViewport != null) { throw new IllegalStateException("currentPageViewport must be null"); } - Rectangle2D viewArea = XMLUtil.getAttributeAsRectangle2D(attributes, "bounds"); + Rectangle viewArea = XMLUtil.getAttributeAsRectangle(attributes, "bounds"); int pageNumber = XMLUtil.getAttributeAsInt(attributes, "nr", -1); String key = attributes.getValue("key"); String pageNumberString = attributes.getValue("formatted-nr"); diff --git a/src/java/org/apache/fop/area/PageViewport.java b/src/java/org/apache/fop/area/PageViewport.java index 321ca4c03..63740386e 100644 --- a/src/java/org/apache/fop/area/PageViewport.java +++ b/src/java/org/apache/fop/area/PageViewport.java @@ -20,7 +20,6 @@ package org.apache.fop.area; import java.awt.Rectangle; -import java.awt.geom.Rectangle2D; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; @@ -48,7 +47,7 @@ import org.apache.fop.fo.pagination.SimplePageMaster; public class PageViewport extends AreaTreeObject implements Resolvable, Cloneable { private Page page; - private Rectangle2D viewArea; + private Rectangle viewArea; private String simplePageMasterName; /** @@ -100,6 +99,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl public PageViewport(SimplePageMaster spm, int pageNumber, String pageStr, boolean blank) { this.simplePageMasterName = spm.getMasterName(); setExtensionAttachments(spm.getExtensionAttachments()); + setForeignAttributes(spm.getForeignAttributes()); this.blank = blank; int pageWidth = spm.getPageWidth().getValue(); int pageHeight = spm.getPageHeight().getValue(); @@ -118,11 +118,14 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl if (original.extensionAttachments != null) { setExtensionAttachments(original.extensionAttachments); } + if (original.foreignAttributes != null) { + setForeignAttributes(original.foreignAttributes); + } this.pageIndex = original.pageIndex; this.pageNumber = original.pageNumber; this.pageNumberString = original.pageNumberString; this.page = (Page)original.page.clone(); - this.viewArea = (Rectangle2D)original.viewArea.clone(); + this.viewArea = new Rectangle(original.viewArea); this.simplePageMasterName = original.simplePageMasterName; this.blank = original.blank; } @@ -135,7 +138,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl * @param simplePageMasterName name of the original simple-page-master that generated this page * @param blank true if this is a blank page */ - public PageViewport(Rectangle2D viewArea, int pageNumber, String pageStr, + public PageViewport(Rectangle viewArea, int pageNumber, String pageStr, String simplePageMasterName, boolean blank) { this.viewArea = viewArea; this.pageNumber = pageNumber; @@ -161,7 +164,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl * Get the view area rectangle of this viewport. * @return the rectangle for this viewport */ - public Rectangle2D getViewArea() { + public Rectangle getViewArea() { return viewArea; } -- cgit v1.2.3