From: Karen Lease Date: Sun, 4 Mar 2001 21:23:35 +0000 (+0000) Subject: Add support for border and padding shorthand properties, color keywords in foproperti... X-Git-Tag: fop-0_18_1~67 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d169e9ec5d2643ac6ba5d304269353750f987eef;p=xmlgraphics-fop.git Add support for border and padding shorthand properties, color keywords in foproperties file, new Constants iface git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194121 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/codegen/colorkw.xml b/src/codegen/colorkw.xml new file mode 100644 index 000000000..2fc7be623 --- /dev/null +++ b/src/codegen/colorkw.xml @@ -0,0 +1,149 @@ + +#f0f8ff +#faebd7 +#00ffff +#7fffd4 +#f0ffff +#f5f5dc +#ffe4c4 +#000000 +#ffebcd +#0000ff +#8a2be2 +#a52a2a +#deb887 +#5f9ea0 +#7fff00 +#d2691e +#ff7f50 +#6495ed +#fff8dc +#dc143c +#00ffff +#00008b +#008b8b +#b8860b +#a9a9a9 +#006400 +#a9a9a9 +#bdb76b +#8b008b +#556b2f +#ff8c00 +#9932cc +#8b0000 +#e9967a +#8fbc8f +#483d8b +#2f4f4f +#2f4f4f +#00ced1 +#9400d3 +#ff1493 +#00bfff +#696969 +#696969 +#1e90ff +#b22222 +#fffaf0 +#228b22 +#ff00ff +#dcdcdc +#ffb6c1 +#ffa07a +#20b2aa +#87cefa +#778899 +#778899 +#b0c4de +#ffffe0 +#00ff00 +#32cd32 +#faf0e6 +#ff00ff +#800000 +#66cdaa +#0000cd +#ba55d3 +#9370db +#3cb371 +#7b68ee +#00fa9a +#48d1cc +#c71585 +#191970 +#f5fffa +#ffe4e1 +#ffe4b5 +#ffdead +#000080 +#fdf5e6 +#808000 +#6b8e23 +#ffa500 +#ff4500 +#da70d6 +#eee8aa +#98fb98 +#afeeee +#db7093 +#ffefd5 +#ffdab9 +#cd853f +#ffc0cb +#dda0dd +#b0e0e6 +#800080 +#ff0000 +#bc8f8f +#4169e1 +#8b4513 +#fa8072 +#f8f8ff +#ffd700 +#daa520 +#808080 +#808080 +#008000 +#adff2f +#f0fff0 +#ff69b4 +#cd5c5c +#4b0082 +#fffff0 +#f0e68c +#e6e6fa +#fff0f5 +#7cfc00 +#fffacd +#add8e6 +#f08080 +#e0ffff +#fafad2 +#d3d3d3 +#90ee90 +#d3d3d3 +#f4a460 +#2e8b57 +#fff5ee +#a0522d +#c0c0c0 +#87ceeb +#6a5acd +#708090 +#708090 +#fffafa +#00ff7f +#4682b4 +#d2b48c +#008080 +#d8bfd8 +#ff6347 +#40e0d0 +#ee82ee +#f5deb3 +#ffffff +#f5f5f5 +#ffff00 +#9acd32 + diff --git a/src/codegen/enumgen.xsl b/src/codegen/enumgen.xsl index e86a5fc27..80c8db4fd 100644 --- a/src/codegen/enumgen.xsl +++ b/src/codegen/enumgen.xsl @@ -41,7 +41,7 @@ package org.apache.fop.fo.properties; extends .Enums { - public final static int = ; + public final static int = Constants.; @@ -58,7 +58,7 @@ package org.apache.fop.fo.properties; public interface { - public final static int = ; + public final static int = Constants.; } diff --git a/src/codegen/foproperties.xml b/src/codegen/foproperties.xml index ad03a9477..ae190d94c 100644 --- a/src/codegen/foproperties.xml +++ b/src/codegen/foproperties.xml @@ -1,12 +1,15 @@ - + generic-color GenericColor ColorType + + generic-boolean @@ -83,6 +86,7 @@ Length false 0pt + padding @@ -93,18 +97,18 @@ border-cond-width-template GenericCondBorderWidth - 0.5pt - 1pt - 2pt + 0.5pt + 1pt + 2pt false CondLength length Length - 0.5pt - 1pt - 2pt + 0.5pt + 1pt + 2pt medium @@ -122,11 +126,12 @@ border-width-template GenericBorderWidth Length - 0.5pt - 1pt - 2pt + 0.5pt + 1pt + 2pt false 0pt + border-width border-style-template @@ -146,6 +151,7 @@ outset none + border-style break-template @@ -450,7 +456,7 @@ true Length normal - 1.2em + 1.2em new PercentLength(numval.doubleValue(), getPercentBase(fo,propertyList)) @@ -498,13 +504,16 @@ false GenericColor transparent + + + new ColorType(nameval) padding false - Length - 0pt + List + BoxPropShorthandParser padding-before @@ -682,6 +691,9 @@ border--color + border-top + border-color + border border-top-style @@ -689,6 +701,9 @@ border--style + border-top + border-style + border border-top-width @@ -696,6 +711,9 @@ border--width + border-top + border-width + border border-bottom-color @@ -705,6 +723,9 @@ border--color black + border-bottom + border-color + border border-bottom-style @@ -712,6 +733,9 @@ border--style + border-bottom + border-style + border border-bottom-width @@ -719,6 +743,9 @@ border--width + border-bottom + border-width + border border-left-color @@ -728,6 +755,9 @@ border--color + border-left + border-color + border border-left-style @@ -735,6 +765,9 @@ border--style + border-left + border-style + border border-left-width @@ -742,6 +775,9 @@ border--width + border-left + border-width + border border-right-color @@ -751,6 +787,9 @@ border--color + border-right + border-color + border border-right-style @@ -758,6 +797,9 @@ border--style + border-right + border-style + border border-right-width @@ -765,46 +807,57 @@ border--width + border-right + border-width + border border-color false - GenericColor - black + List + BoxPropShorthandParser border-style - GenericBorderStyle + false + List + BoxPropShorthandParser border-width false - Length - 0pt + List + BoxPropShorthandParser border-top false - String - normal + List + GenericShorthandParser border-bottom false - String - normal + List + GenericShorthandParser border-left false - String - normal + List + GenericShorthandParser border-right false - String - normal + List + GenericShorthandParser + + + border + false + List + GenericShorthandParser position @@ -980,7 +1033,7 @@ true Length use-font-metrics - 0pt + 0pt diff --git a/src/codegen/properties.xsl b/src/codegen/properties.xsl index aae85444d..95893abd6 100644 --- a/src/codegen/properties.xsl +++ b/src/codegen/properties.xsl @@ -8,6 +8,10 @@ + +Do + + @@ -49,13 +53,26 @@ - protected String checkValueKeywords(String value) { + // Initialize hashtable of keywords + static Hashtable s_htKeywords; + static { + s_htKeywords = new Hashtable(); + s_htKeywords.put("", ""); + + } + protected String checkValueKeywords(String keyword) { + + String value = (String)s_htKeywords.get(keyword); + if (value == null) { + return super.checkValueKeywords(keyword); + } + else return value; } @@ -91,7 +108,7 @@ - = + = p.get(); if ( != null) { return new ( @@ -194,6 +211,7 @@ package org.apache.fop.fo.properties; +import java.util.Hashtable; import org.apache.fop.datatypes.*; import org.apache.fop.fo.*; import org.apache.fop.apps.FOPException; @@ -206,7 +224,7 @@ public class extends public interface Enums { - int = ; + int = Constants.; @@ -216,7 +234,7 @@ public class extends { - int = ; + int = Constants.; } @@ -231,7 +249,7 @@ public class extends + Enums @@ -257,7 +275,7 @@ public class extends - static private class SP_Maker + static private class SP_Maker extends implements . { SP_Maker(String sPropName) { @@ -330,8 +348,8 @@ public class extends val = baseProp.get(); return val.getComponent(subpropName); } - - + + public Property make(PropertyList propertyList) throws FOPException { return makeCompound(propertyList, propertyList.getParentFObj()); @@ -462,11 +480,11 @@ public class extends if (propertyList.getExplicit(sbExpr.toString()) != null) return true; - + return false; } - + public Property compute(PropertyList propertyList) throws FOPException { FObj parentFO = propertyList.getParentFObj(); StringBuffer sbExpr=new StringBuffer(); @@ -474,20 +492,20 @@ public class extends // Make sure the property is set before calculating it! - if (propertyList.getExplicit(sbExpr.toString()) == null) return p; + if (propertyList.getExplicitOrShorthand(sbExpr.toString()) == null) return p; sbExpr.setLength(0); p= make(propertyList, sbExpr.toString(), propertyList.getParentFObj()); - p= propertyList.getExplicit(sbExpr.toString()); + p= propertyList.getExplicitOrShorthand(sbExpr.toString()); if (p != null) { p = convertProperty(p, propertyList, parentFO ); } else p= makeCompound(propertyList, parentFO); - + Property subprop; sbExpr.setLength(0); @@ -497,7 +515,7 @@ public class extends - subprop= propertyList.getExplicit(sbExpr.toString()); + subprop= propertyList.getExplicitOrShorthand(sbExpr.toString()); setSubprop(p, "", subprop); @@ -506,7 +524,29 @@ public class extends + + + public Property getShorthand(PropertyList propertyList) { + Property p = null; + ListProperty listprop; + + + if (p == null) { + listprop = (ListProperty)propertyList.getExplicit(""); + if (listprop != null) { + // Get a parser for the shorthand to set the individual properties + + ShorthandParser shparser = new (listprop); + p = shparser.getValueForProperty(getPropName(), this, propertyList); + } + } + + return p; + } + + + } @@ -536,7 +576,7 @@ public class extends diff --git a/src/codegen/propinc.xsl b/src/codegen/propinc.xsl index 87f62e60a..f83945b3d 100644 --- a/src/codegen/propinc.xsl +++ b/src/codegen/propinc.xsl @@ -2,6 +2,7 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > +