From 6ecac6589ba387551db8cd4437d8b5dc3f3fe8ec Mon Sep 17 00:00:00 2001 From: Steve Coffman Date: Fri, 3 Nov 2000 19:51:16 +0000 Subject: [PATCH] Corinna Hischke's fix to allow right, left, top, bottom borders to differ from one another. Colors are always black though. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193744 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/fo/StandardPropertyListMapping.java | 4 +- src/org/apache/fop/fo/flow/Block.java | 69 ++++++++++++++++--- .../apache/fop/fo/flow/BlockContainer.java | 69 ++++++++++++++++--- src/org/apache/fop/fo/flow/TableCell.java | 69 ++++++++++++++++--- src/org/apache/fop/fo/flow/TableColumn.java | 69 ++++++++++++++++--- src/org/apache/fop/fo/flow/TableRow.java | 66 +++++++++++++++--- 6 files changed, 299 insertions(+), 47 deletions(-) diff --git a/src/org/apache/fop/fo/StandardPropertyListMapping.java b/src/org/apache/fop/fo/StandardPropertyListMapping.java index f7866f1bd..547309c43 100644 --- a/src/org/apache/fop/fo/StandardPropertyListMapping.java +++ b/src/org/apache/fop/fo/StandardPropertyListMapping.java @@ -130,13 +130,13 @@ public class StandardPropertyListMapping implements PropertyListMapping { propertyTable.put("border-right-style",BorderRightStyle.maker()); propertyTable.put("border-right-width",BorderRightWidth.maker()); propertyTable.put("border-start-color",BorderStartColor.maker()); - propertyTable.put("border-start-color",BorderStartColor.maker()); + propertyTable.put("border-start-style",BorderStartStyle.maker()); propertyTable.put("border-start-width",BorderStartWidth.maker()); propertyTable.put("border-style",BorderStyle.maker()); propertyTable.put("border-top",BorderTop.maker()); propertyTable.put("border-top-color",BorderTopColor.maker()); propertyTable.put("border-top-style",BorderTopStyle.maker()); - propertyTable.put("border-top-style",BorderTopStyle.maker()); + propertyTable.put("border-top-width",BorderTopWidth.maker()); propertyTable.put("border-width",BorderWidth.maker()); propertyTable.put("bottom",Bottom.maker()); propertyTable.put("height",Height.maker()); diff --git a/src/org/apache/fop/fo/flow/Block.java b/src/org/apache/fop/fo/flow/Block.java index 2fd245f90..9533fddfd 100644 --- a/src/org/apache/fop/fo/flow/Block.java +++ b/src/org/apache/fop/fo/flow/Block.java @@ -92,9 +92,18 @@ public class Block extends FObjMixed { String id; - ColorType borderColor; - int borderWidth; - int borderStyle; + ColorType borderTopColor; + int borderTopWidth; + int borderTopStyle; + ColorType borderBottomColor; + int borderBottomWidth; + int borderBottomStyle; + ColorType borderLeftColor; + int borderLeftWidth; + int borderLeftStyle; + ColorType borderRightColor; + int borderRightWidth; + int borderRightStyle; BlockArea blockArea; @@ -163,12 +172,51 @@ public class Block extends FObjMixed { this.paddingRight = this.properties.get("padding-right").getLength().mvalue(); } - this.borderColor = + this.borderTopColor = this.properties.get("border-color").getColorType(); - this.borderWidth = + this.borderBottomColor = this.borderTopColor; + this.borderLeftColor = this.borderTopColor; + this.borderRightColor = this.borderTopColor; + if (this.borderTopColor == null) { + this.borderTopColor = + this.properties.get("border-top-color").getColorType(); + this.borderBottomColor = + this.properties.get("border-bottom-color").getColorType(); + this.borderLeftColor = + this.properties.get("border-left-color").getColorType(); + this.borderRightColor = + this.properties.get("border-right-color").getColorType(); + } + this.borderTopWidth = this.properties.get("border-width").getLength().mvalue(); - this.borderStyle = + this.borderBottomWidth = this.borderTopWidth; + this.borderLeftWidth = this.borderTopWidth; + this.borderRightWidth = this.borderTopWidth; + if (this.borderTopWidth == 0) { + this.borderTopWidth = + this.properties.get("border-top-width").getLength().mvalue(); + this.borderBottomWidth = + this.properties.get("border-bottom-width").getLength().mvalue(); + this.borderLeftWidth = + this.properties.get("border-left-width").getLength().mvalue(); + this.borderRightWidth = + this.properties.get("border-right-width").getLength().mvalue(); + } + this.borderTopStyle = this.properties.get("border-style").getEnum(); + this.borderBottomStyle = this.borderTopStyle; + this.borderLeftStyle = this.borderTopStyle; + this.borderRightStyle = this.borderTopStyle; + if (this.borderTopStyle == 0) { + this.borderTopStyle = + this.properties.get("border-top-style").getEnum(); + this.borderBottomStyle = + this.properties.get("border-bottom-style").getEnum(); + this.borderLeftStyle = + this.properties.get("border-left-style").getEnum(); + this.borderRightStyle = + this.properties.get("border-right-style").getEnum(); + } this.id = this.properties.get("id").getString(); @@ -226,9 +274,12 @@ public class Block extends FObjMixed { blockArea.setBackgroundColor(backgroundColor); blockArea.setPadding(paddingTop, paddingLeft, paddingBottom, paddingRight); - blockArea.setBorderStyle(borderStyle, borderStyle, borderStyle, borderStyle); - blockArea.setBorderWidth(borderWidth, borderWidth, borderWidth, borderWidth); - blockArea.setBorderColor(borderColor, borderColor, borderColor, borderColor); + blockArea.setBorderStyle(borderTopStyle, borderLeftStyle, + borderBottomStyle, borderRightStyle); + blockArea.setBorderWidth(borderTopWidth, borderLeftWidth, + borderBottomWidth, borderRightWidth); + blockArea.setBorderColor(borderTopColor, borderLeftColor, + borderBottomColor, borderRightColor); blockArea.start(); blockArea.setAbsoluteHeight(area.getAbsoluteHeight()); diff --git a/src/org/apache/fop/fo/flow/BlockContainer.java b/src/org/apache/fop/fo/flow/BlockContainer.java index 848acc2dd..a38e7ddc4 100644 --- a/src/org/apache/fop/fo/flow/BlockContainer.java +++ b/src/org/apache/fop/fo/flow/BlockContainer.java @@ -80,9 +80,18 @@ public class BlockContainer extends FObj { int width; int height; - ColorType borderColor; - int borderWidth; - int borderStyle; + ColorType borderTopColor; + int borderTopWidth; + int borderTopStyle; + ColorType borderBottomColor; + int borderBottomWidth; + int borderBottomStyle; + ColorType borderLeftColor; + int borderLeftWidth; + int borderLeftStyle; + ColorType borderRightColor; + int borderRightWidth; + int borderRightStyle; AreaContainer areaContainer; @@ -153,12 +162,51 @@ public class BlockContainer extends FObj { this.height = this.properties.get("height").getLength().mvalue(); - this.borderColor = + this.borderTopColor = this.properties.get("border-color").getColorType(); - this.borderWidth = + this.borderBottomColor = this.borderTopColor; + this.borderLeftColor = this.borderTopColor; + this.borderRightColor = this.borderTopColor; + if (this.borderTopColor == null) { + this.borderTopColor = + this.properties.get("border-top-color").getColorType(); + this.borderBottomColor = + this.properties.get("border-bottom-color").getColorType(); + this.borderLeftColor = + this.properties.get("border-left-color").getColorType(); + this.borderRightColor = + this.properties.get("border-right-color").getColorType(); + } + this.borderTopWidth = this.properties.get("border-width").getLength().mvalue(); - this.borderStyle = + this.borderBottomWidth = this.borderTopWidth; + this.borderLeftWidth = this.borderTopWidth; + this.borderRightWidth = this.borderTopWidth; + if (this.borderTopWidth == 0) { + this.borderTopWidth = + this.properties.get("border-top-width").getLength().mvalue(); + this.borderBottomWidth = + this.properties.get("border-bottom-width").getLength().mvalue(); + this.borderLeftWidth = + this.properties.get("border-left-width").getLength().mvalue(); + this.borderRightWidth = + this.properties.get("border-right-width").getLength().mvalue(); + } + this.borderTopStyle = this.properties.get("border-style").getEnum(); + this.borderBottomStyle = this.borderTopStyle; + this.borderLeftStyle = this.borderTopStyle; + this.borderRightStyle = this.borderTopStyle; + if (this.borderTopStyle == 0) { + this.borderTopStyle = + this.properties.get("border-top-style").getEnum(); + this.borderBottomStyle = + this.properties.get("border-bottom-style").getEnum(); + this.borderLeftStyle = + this.properties.get("border-left-style").getEnum(); + this.borderRightStyle = + this.properties.get("border-right-style").getEnum(); + } // initialize id String id = this.properties.get("id").getString(); @@ -180,9 +228,12 @@ public class BlockContainer extends FObj { areaContainer.setBackgroundColor(backgroundColor); areaContainer.setPadding(paddingTop, paddingLeft, paddingBottom, paddingRight); - areaContainer.setBorderStyle(borderStyle, borderStyle, borderStyle, borderStyle); - areaContainer.setBorderWidth(borderWidth, borderWidth, borderWidth, borderWidth); - areaContainer.setBorderColor(borderColor, borderColor, borderColor, borderColor); + areaContainer.setBorderStyle(borderTopStyle, borderLeftStyle, + borderBottomStyle, borderRightStyle); + areaContainer.setBorderWidth(borderTopWidth, borderLeftWidth, + borderBottomWidth, borderRightWidth); + areaContainer.setBorderColor(borderTopColor, borderLeftColor, + borderBottomColor, borderRightColor); areaContainer.start(); areaContainer.setAbsoluteHeight(area.getAbsoluteHeight()); diff --git a/src/org/apache/fop/fo/flow/TableCell.java b/src/org/apache/fop/fo/flow/TableCell.java index 24eec8ebe..16aba1704 100644 --- a/src/org/apache/fop/fo/flow/TableCell.java +++ b/src/org/apache/fop/fo/flow/TableCell.java @@ -75,9 +75,18 @@ public class TableCell extends FObj { ColorType backgroundColor; FontState fs; - ColorType borderColor; - int borderWidth; - int borderStyle; + ColorType borderTopColor; + int borderTopWidth; + int borderTopStyle; + ColorType borderBottomColor; + int borderBottomWidth; + int borderBottomStyle; + ColorType borderLeftColor; + int borderLeftWidth; + int borderLeftStyle; + ColorType borderRightColor; + int borderRightWidth; + int borderRightStyle; int paddingTop; int paddingBottom; int paddingLeft; @@ -121,12 +130,51 @@ public class TableCell extends FObj { this.fs = new FontState(area.getFontInfo(), fontFamily, fontStyle, fontWeight, fontSize); - this.borderColor = + this.borderTopColor = this.properties.get("border-color").getColorType(); - this.borderWidth = + this.borderBottomColor = this.borderTopColor; + this.borderLeftColor = this.borderTopColor; + this.borderRightColor = this.borderTopColor; + if (this.borderTopColor == null) { + this.borderTopColor = + this.properties.get("border-top-color").getColorType(); + this.borderBottomColor = + this.properties.get("border-bottom-color").getColorType(); + this.borderLeftColor = + this.properties.get("border-left-color").getColorType(); + this.borderRightColor = + this.properties.get("border-right-color").getColorType(); + } + this.borderTopWidth = this.properties.get("border-width").getLength().mvalue(); - this.borderStyle = + this.borderBottomWidth = this.borderTopWidth; + this.borderLeftWidth = this.borderTopWidth; + this.borderRightWidth = this.borderTopWidth; + if (this.borderTopWidth == 0) { + this.borderTopWidth = + this.properties.get("border-top-width").getLength().mvalue(); + this.borderBottomWidth = + this.properties.get("border-bottom-width").getLength().mvalue(); + this.borderLeftWidth = + this.properties.get("border-left-width").getLength().mvalue(); + this.borderRightWidth = + this.properties.get("border-right-width").getLength().mvalue(); + } + this.borderTopStyle = this.properties.get("border-style").getEnum(); + this.borderBottomStyle = this.borderTopStyle; + this.borderLeftStyle = this.borderTopStyle; + this.borderRightStyle = this.borderTopStyle; + if (this.borderTopStyle == 0) { + this.borderTopStyle = + this.properties.get("border-top-style").getEnum(); + this.borderBottomStyle = + this.properties.get("border-bottom-style").getEnum(); + this.borderLeftStyle = + this.properties.get("border-left-style").getEnum(); + this.borderRightStyle = + this.properties.get("border-right-style").getEnum(); + } this.paddingTop = this.properties.get("padding").getLength().mvalue(); this.paddingLeft = this.paddingTop; @@ -183,9 +231,12 @@ public class TableCell extends FObj { areaContainer.setPadding(paddingTop, paddingLeft, paddingBottom, paddingRight); areaContainer.setBackgroundColor(backgroundColor); - areaContainer.setBorderStyle(borderStyle, borderStyle, borderStyle, borderStyle); - areaContainer.setBorderWidth(borderWidth, borderWidth, borderWidth, borderWidth); - areaContainer.setBorderColor(borderColor, borderColor, borderColor, borderColor); + areaContainer.setBorderStyle(borderTopStyle, borderLeftStyle, + borderBottomStyle, borderRightStyle); + areaContainer.setBorderWidth(borderTopWidth, borderLeftWidth, + borderBottomWidth, borderRightWidth); + areaContainer.setBorderColor(borderTopColor, borderLeftColor, + borderBottomColor, borderRightColor); areaContainer.start(); areaContainer.setAbsoluteHeight(area.getAbsoluteHeight()); diff --git a/src/org/apache/fop/fo/flow/TableColumn.java b/src/org/apache/fop/fo/flow/TableColumn.java index 2efa937cb..64398c22a 100644 --- a/src/org/apache/fop/fo/flow/TableColumn.java +++ b/src/org/apache/fop/fo/flow/TableColumn.java @@ -62,9 +62,18 @@ public class TableColumn extends FObj { FontState fs; ColorType backgroundColor; - ColorType borderColor; - int borderWidth; - int borderStyle; + ColorType borderTopColor; + int borderTopWidth; + int borderTopStyle; + ColorType borderBottomColor; + int borderBottomWidth; + int borderBottomStyle; + ColorType borderLeftColor; + int borderLeftWidth; + int borderLeftStyle; + ColorType borderRightColor; + int borderRightWidth; + int borderRightStyle; int columnWidth; int columnOffset; @@ -113,12 +122,51 @@ public class TableColumn extends FObj { fontStyle, fontWeight, fontSize); this.backgroundColor = this.properties.get("background-color").getColorType(); - this.borderColor = + this.borderTopColor = this.properties.get("border-color").getColorType(); - this.borderWidth = + this.borderBottomColor = this.borderTopColor; + this.borderLeftColor = this.borderTopColor; + this.borderRightColor = this.borderTopColor; + if (this.borderTopColor == null) { + this.borderTopColor = + this.properties.get("border-top-color").getColorType(); + this.borderBottomColor = + this.properties.get("border-bottom-color").getColorType(); + this.borderLeftColor = + this.properties.get("border-left-color").getColorType(); + this.borderRightColor = + this.properties.get("border-right-color").getColorType(); + } + this.borderTopWidth = this.properties.get("border-width").getLength().mvalue(); - this.borderStyle = + this.borderBottomWidth = this.borderTopWidth; + this.borderLeftWidth = this.borderTopWidth; + this.borderRightWidth = this.borderTopWidth; + if (this.borderTopWidth == 0) { + this.borderTopWidth = + this.properties.get("border-top-width").getLength().mvalue(); + this.borderBottomWidth = + this.properties.get("border-bottom-width").getLength().mvalue(); + this.borderLeftWidth = + this.properties.get("border-left-width").getLength().mvalue(); + this.borderRightWidth = + this.properties.get("border-right-width").getLength().mvalue(); + } + this.borderTopStyle = this.properties.get("border-style").getEnum(); + this.borderBottomStyle = this.borderTopStyle; + this.borderLeftStyle = this.borderTopStyle; + this.borderRightStyle = this.borderTopStyle; + if (this.borderTopStyle == 0) { + this.borderTopStyle = + this.properties.get("border-top-style").getEnum(); + this.borderBottomStyle = + this.properties.get("border-bottom-style").getEnum(); + this.borderLeftStyle = + this.properties.get("border-left-style").getEnum(); + this.borderRightStyle = + this.properties.get("border-right-style").getEnum(); + } this.columnWidth = this.properties.get("column-width").getLength().mvalue(); @@ -132,9 +180,12 @@ public class TableColumn extends FObj { area.getHeight(), Position.RELATIVE); areaContainer.setPage(area.getPage()); areaContainer.setBackgroundColor(backgroundColor); - areaContainer.setBorderStyle(borderStyle, borderStyle, borderStyle, borderStyle); - areaContainer.setBorderWidth(borderWidth, borderWidth, borderWidth, borderWidth); - areaContainer.setBorderColor(borderColor, borderColor, borderColor, borderColor); + areaContainer.setBorderStyle(borderTopStyle, borderLeftStyle, + borderBottomStyle, borderRightStyle); + areaContainer.setBorderWidth(borderTopWidth, borderLeftWidth, + borderBottomWidth, borderRightWidth); + areaContainer.setBorderColor(borderTopColor, borderLeftColor, + borderBottomColor, borderRightColor); areaContainer.setHeight(area.getHeight()); area.addChild(areaContainer); diff --git a/src/org/apache/fop/fo/flow/TableRow.java b/src/org/apache/fop/fo/flow/TableRow.java index 764cda7e6..7ee6edb6f 100644 --- a/src/org/apache/fop/fo/flow/TableRow.java +++ b/src/org/apache/fop/fo/flow/TableRow.java @@ -81,9 +81,18 @@ public class TableRow extends FObj { ColorType backgroundColor; String id; - ColorType borderColor; - int borderWidth; - int borderStyle; + ColorType borderTopColor; + int borderTopWidth; + int borderTopStyle; + ColorType borderBottomColor; + int borderBottomWidth; + int borderBottomStyle; + ColorType borderLeftColor; + int borderLeftWidth; + int borderLeftStyle; + ColorType borderRightColor; + int borderRightWidth; + int borderRightStyle; int widthOfCellsSoFar = 0; int largestCellHeight = 0; @@ -124,12 +133,51 @@ public class TableRow extends FObj { this.properties.get("space-after.optimum").getLength().mvalue(); this.backgroundColor = this.properties.get("background-color").getColorType(); - this.borderColor = + this.borderTopColor = this.properties.get("border-color").getColorType(); - this.borderWidth = + this.borderBottomColor = this.borderTopColor; + this.borderLeftColor = this.borderTopColor; + this.borderRightColor = this.borderTopColor; + if (this.borderTopColor == null) { + this.borderTopColor = + this.properties.get("border-top-color").getColorType(); + this.borderBottomColor = + this.properties.get("border-bottom-color").getColorType(); + this.borderLeftColor = + this.properties.get("border-left-color").getColorType(); + this.borderRightColor = + this.properties.get("border-right-color").getColorType(); + } + this.borderTopWidth = this.properties.get("border-width").getLength().mvalue(); - this.borderStyle = + this.borderBottomWidth = this.borderTopWidth; + this.borderLeftWidth = this.borderTopWidth; + this.borderRightWidth = this.borderTopWidth; + if (this.borderTopWidth == 0) { + this.borderTopWidth = + this.properties.get("border-top-width").getLength().mvalue(); + this.borderBottomWidth = + this.properties.get("border-bottom-width").getLength().mvalue(); + this.borderLeftWidth = + this.properties.get("border-left-width").getLength().mvalue(); + this.borderRightWidth = + this.properties.get("border-right-width").getLength().mvalue(); + } + this.borderTopStyle = this.properties.get("border-style").getEnum(); + this.borderBottomStyle = this.borderTopStyle; + this.borderLeftStyle = this.borderTopStyle; + this.borderRightStyle = this.borderTopStyle; + if (this.borderTopStyle == 0) { + this.borderTopStyle = + this.properties.get("border-top-style").getEnum(); + this.borderBottomStyle = + this.properties.get("border-bottom-style").getEnum(); + this.borderLeftStyle = + this.properties.get("border-left-style").getEnum(); + this.borderRightStyle = + this.properties.get("border-right-style").getEnum(); + } this.id= this.properties.get("id").getString(); @@ -158,9 +206,9 @@ public class TableRow extends FObj { area.spaceLeft(), Position.RELATIVE); areaContainer.setPage(area.getPage()); areaContainer.setBackgroundColor(backgroundColor); - areaContainer.setBorderStyle(borderStyle, borderStyle, borderStyle, borderStyle); - areaContainer.setBorderWidth(borderWidth, borderWidth, borderWidth, borderWidth); - areaContainer.setBorderColor(borderColor, borderColor, borderColor, borderColor); + areaContainer.setBorderStyle(borderTopStyle, borderLeftStyle, borderBottomStyle, borderRightStyle); + areaContainer.setBorderWidth(borderTopWidth, borderLeftWidth, borderBottomWidth, borderRightWidth); + areaContainer.setBorderColor(borderTopColor, borderLeftColor, borderBottomColor, borderRightColor); areaContainer.start(); areaContainer.setAbsoluteHeight(area.getAbsoluteHeight()); -- 2.39.5