From fe787cb67a97a51dd6d13d2f1cfcd2b970c12d60 Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Sat, 24 Jul 2004 05:12:50 +0000 Subject: [PATCH] Moved most frame-relative fields and methods to BlockReferenceArea. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197822 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/area/Area.java | 63 ++++++++++---------------- 1 file changed, 24 insertions(+), 39 deletions(-) diff --git a/src/java/org/apache/fop/area/Area.java b/src/java/org/apache/fop/area/Area.java index 32faff73d..23f62af34 100644 --- a/src/java/org/apache/fop/area/Area.java +++ b/src/java/org/apache/fop/area/Area.java @@ -129,20 +129,6 @@ public class Area extends AreaNode implements Cloneable { * differ from the writing mode of the generating FO if this is a * reference-area. */ protected int frameWritingMode; - /** True if the writing-mode of the frames of this area is - * horizontal. May differ from contentIsHorizontal if this is a - * reference-area. */ - protected boolean frameIsHorizontal = true; - /** True if the the writing-mode of the frames of this area is - * left-to-right. May differ from contentIsHorizontal if this is a - * reference-area. */ - protected boolean frameLeftToRight = true; - /** The rotation trait for the framing rectangles of this area */ - protected int frameRotation; - /** Rotation from content to frame. One of 0, 90, 180, 270. */ - protected int rotateToFrame; - /** Rotation from frame to content. One of 0, 90, 180, 270. */ - protected int rotateToContent; protected void setup() { try { @@ -150,26 +136,14 @@ public class Area extends AreaNode implements Cloneable { contentIsHorizontal = WritingMode.isHorizontal(contentWritingMode); contentLeftToRight = WritingMode.isLeftToRight(contentWritingMode); contentRotation = generatedBy.getRefOrientation(); - frameWritingMode = - ((FONode)generatedBy.getParent()).getWritingMode(); - frameIsHorizontal = WritingMode.isHorizontal(frameWritingMode); - frameLeftToRight = WritingMode.isLeftToRight(frameWritingMode); - frameRotation = - ((FONode)generatedBy.getParent()).getRefOrientation(); + frameWritingMode = contentWritingMode; } catch (PropertyException e) { throw new RuntimeException(e.getMessage()); } - rotateToFrame = frameRotation - contentRotation; - if (rotateToFrame == 0) { - rotateToContent = 0; - } else { - if (rotateToFrame < 0) { - rotateToContent = -rotateToFrame; - rotateToFrame +=360; - } else { - rotateToContent = 360 - rotateToFrame; - } - } + setupFrames(); + } + + protected void setupFrames() { content = new ContentRectangle(this); padding = content.getPadding(); borders = padding.getBorders(); @@ -470,12 +444,16 @@ public class Area extends AreaNode implements Cloneable { * @return the writing-mode of the framing rectangles */ public int getFrameWritingMode() { - return frameWritingMode; + return contentWritingMode; } /** * Gets the reference-orientation applying to the contents of this * area, expressed as a normalized angle; one of 0, 90, 180 or 270. + * TODO - should this simply be 0. Should reference-orientation on + * all non-reference areas be set to 0; i.e. not rotated with respect + * to the ancestor reference-area? + * BEWARE - this is set to 0 * @return the reference-orientation */ public int getContentRotation() { @@ -483,7 +461,7 @@ public class Area extends AreaNode implements Cloneable { } public int getRotationToFrame() { - return rotateToFrame; + return 0; } /** @@ -493,11 +471,11 @@ public class Area extends AreaNode implements Cloneable { * @return the parent's reference-orientation */ public int getFrameRotation() { - return frameRotation; + return contentRotation; } public int getRotationToContent() { - return rotateToContent; + return 0; } /** @@ -514,19 +492,26 @@ public class Area extends AreaNode implements Cloneable { /** * Gets the width of this AreaGeometry as seen from any - * enclosing frame + * enclosing frame. For all + * AreaGeometrys except ContentRectangles, + * the relative dimensions are the same for frame and contents; i.e. + * height is height and width is width. * @return the frame-view width */ protected double getFrameRelativeWidth() { - return getFrameRelativeDimensions().getWidth(); + return getWidth(); } + /** * Gets the height of this AreaGeometry as seen from any - * enclosing frame + * enclosing frame. For all AreaGeometrys except + * ContentRectangles, the relative dimensions are the + * same for frame and contents; i.e. height is height and width is + * width. * @return the frame-view height */ protected double getFrameRelativeHeight() { - return getFrameRelativeDimensions().getHeight(); + return getHeight(); } /** * Gets the block-progression-dimension of the area -- 2.39.5