You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ad...@apache.org on 2005/12/30 01:25:36 UTC

svn commit: r359945 - in /xmlgraphics/fop/trunk: ./ src/documentation/content/xdocs/ src/java/org/apache/fop/fo/ src/java/org/apache/fop/fo/properties/ test/fotree/testcases/

Author: adelmelle
Date: Thu Dec 29 16:25:28 2005
New Revision: 359945

URL: http://svn.apache.org/viewcvs?rev=359945&view=rev
Log:
Added support for the white-space shorthand

Added:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/WhiteSpaceShorthandParser.java   (with props)
    xmlgraphics/fop/trunk/test/fotree/testcases/white-space_shorthand-expansion.fo   (with props)
Modified:
    xmlgraphics/fop/trunk/src/documentation/content/xdocs/compliance.ihtml
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java
    xmlgraphics/fop/trunk/status.xml

Modified: xmlgraphics/fop/trunk/src/documentation/content/xdocs/compliance.ihtml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/documentation/content/xdocs/compliance.ihtml?rev=359945&r1=359944&r2=359945&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/documentation/content/xdocs/compliance.ihtml (original)
+++ xmlgraphics/fop/trunk/src/documentation/content/xdocs/compliance.ihtml Thu Dec 29 16:25:28 2005
@@ -6821,8 +6821,8 @@
       <td class="no">
         no
       </td>
-      <td class="no">
-        no
+      <td class="yes">
+        yes
       </td>
       <td align="center">
         &nbsp;

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java?rev=359945&r1=359944&r2=359945&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java Thu Dec 29 16:25:28 2005
@@ -59,6 +59,7 @@
 import org.apache.fop.fo.properties.TextDecorationProperty;
 import org.apache.fop.fo.properties.ToBeImplementedProperty;
 import org.apache.fop.fo.properties.VerticalAlignShorthandParser;
+import org.apache.fop.fo.properties.WhiteSpaceShorthandParser;
 
 /**
  * This class creates and returns an array of Property.Maker instances
@@ -1643,6 +1644,7 @@
         m.addEnum("treat-as-space", getEnumProperty(EN_TREAT_AS_SPACE, "TREAT_AS_SPACE"));
         m.addEnum("treat-as-zero-width-space", getEnumProperty(EN_TREAT_AS_ZERO_WIDTH_SPACE, "TREAT_AS_ZERO_WIDTH_SPACE"));
         m.setDefault("treat-as-space");
+        m.addShorthand(s_generics[PR_WHITE_SPACE]);
         addPropertyMaker("linefeed-treatment", m);
 
         // white-space-treatment
@@ -1654,6 +1656,7 @@
         m.addEnum("ignore-if-after-linefeed", getEnumProperty(EN_IGNORE_IF_AFTER_LINEFEED, "IGNORE_IF_AFTER_LINEFEED"));
         m.addEnum("ignore-if-surrounding-linefeed", getEnumProperty(EN_IGNORE_IF_SURROUNDING_LINEFEED, "IGNORE_IF_SURROUNDING_LINEFEED"));
         m.setDefault("ignore-if-surrounding-linefeed");
+        m.addShorthand(s_generics[PR_WHITE_SPACE]);
         addPropertyMaker("white-space-treatment", m);
 
         // text-align TODO: make it a StringProperty with enums.
@@ -1713,6 +1716,7 @@
         m.useGeneric(genericBoolean);
         m.setInherited(true);
         m.setDefault("true");
+        m.addShorthand(s_generics[PR_WHITE_SPACE]);
         addPropertyMaker("white-space-collapse", m);
 
         // wrap-option
@@ -1721,6 +1725,7 @@
         m.addEnum("wrap", getEnumProperty(EN_WRAP, "WRAP"));
         m.addEnum("no-wrap", getEnumProperty(EN_NO_WRAP, "NO_WRAP"));
         m.setDefault("wrap");
+        m.addShorthand(s_generics[PR_WHITE_SPACE]);
         addPropertyMaker("wrap-option", m);
     }
 
@@ -2763,6 +2768,16 @@
         m.setDefault("baseline");
         addPropertyMaker("vertical-align", m);
 
+        // white-space
+        m = new EnumProperty.Maker(PR_WHITE_SPACE);
+        m.setInherited(true);
+        m.addEnum("normal", getEnumProperty(EN_NORMAL, "NORMAL"));
+        m.addEnum("pre", getEnumProperty(EN_PRE, "PRE"));
+        m.addEnum("no-wrap", getEnumProperty(EN_NO_WRAP, "NO_WRAP"));
+        m.setDefault("normal");
+        m.setDatatypeParser(new WhiteSpaceShorthandParser());
+        addPropertyMaker("white-space", m);
+        
         // xml:lang
         m  = new ToBeImplementedProperty.Maker(PR_XML_LANG);
         m.setInherited(true);

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/WhiteSpaceShorthandParser.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/WhiteSpaceShorthandParser.java?rev=359945&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/WhiteSpaceShorthandParser.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/WhiteSpaceShorthandParser.java Thu Dec 29 16:25:28 2005
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.fo.properties;
+
+import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
+
+/**
+ * Shorthand parser for the white-space property;
+ * Sets the values for white-space-treament, linefeed-treatment,
+ * white-space-collapse and wrap-option
+ *
+ */
+public class WhiteSpaceShorthandParser implements ShorthandParser {
+
+    /**
+     * @see org.apache.fop.fo.properties.ShorthandParser#getValueForProperty()
+     */
+    public Property getValueForProperty(int propId, Property property,
+            PropertyMaker maker, PropertyList propertyList)
+            throws PropertyException {
+        switch (property.getEnum()) {
+        case Constants.EN_PRE:
+            switch (propId) {
+            case Constants.PR_LINEFEED_TREATMENT:
+            case Constants.PR_WHITE_SPACE_TREATMENT:
+                return new EnumProperty(Constants.EN_PRESERVE, "PRESERVE");
+            case Constants.PR_WHITE_SPACE_COLLAPSE:
+                return new EnumProperty(Constants.EN_FALSE, "FALSE");
+            case Constants.PR_WRAP_OPTION:
+                return new EnumProperty(Constants.EN_NO_WRAP, "NO_WRAP");
+            default:
+                //nop
+            }
+        case Constants.EN_NO_WRAP:
+            if (propId == Constants.PR_WRAP_OPTION) {
+                return new EnumProperty(Constants.EN_NO_WRAP, "NO_WRAP");
+            }
+        case Constants.EN_NORMAL:
+        default:
+            //nop
+        }
+        return null;
+    }
+
+}

Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/WhiteSpaceShorthandParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/WhiteSpaceShorthandParser.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/trunk/status.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/status.xml?rev=359945&r1=359944&r2=359945&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Thu Dec 29 16:25:28 2005
@@ -28,6 +28,9 @@
   <changes>
     <release version="FOP Trunk">
       <action context="Code" dev="AD" type="enhancement">
+        Added feature: support for white-space shorthand
+      </action>
+      <action context="Code" dev="AD" type="enhancement">
         Added feature: support for page-break-* shorthands
       </action>
       <action context="Code" dev="MM" type="fix" fixes-bug="38053">

Added: xmlgraphics/fop/trunk/test/fotree/testcases/white-space_shorthand-expansion.fo
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/fotree/testcases/white-space_shorthand-expansion.fo?rev=359945&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/test/fotree/testcases/white-space_shorthand-expansion.fo (added)
+++ xmlgraphics/fop/trunk/test/fotree/testcases/white-space_shorthand-expansion.fo Thu Dec 29 16:25:28 2005
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2005 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- $Id$ -->
+  <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:test="http://xmlgraphics.apache.org/fop/test">
+    <fo:layout-master-set>
+      <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
+        <fo:region-body/>
+      </fo:simple-page-master>
+    </fo:layout-master-set>
+    <fo:page-sequence master-reference="normal">
+      <fo:flow flow-name="xsl-region-body">
+        <fo:block white-space="normal">
+          <test:assert property="linefeed-treatment" expected="TREAT_AS_SPACE" />
+          <test:assert property="white-space-treatment" expected="IGNORE_IF_SURROUNDING_LINEFEED" />
+          <test:assert property="white-space-collapse" expected="TRUE" />
+          <test:assert property="wrap-option" expected="WRAP" />
+          Block 1: testing white-space="normal"
+        </fo:block>
+        <fo:block white-space="pre">
+          <test:assert property="linefeed-treatment" expected="PRESERVE" />
+          <test:assert property="white-space-treatment" expected="PRESERVE" />
+          <test:assert property="white-space-collapse" expected="FALSE" />
+          <test:assert property="wrap-option" expected="NO_WRAP" />
+          Block 2: testing white-space="pre"
+        </fo:block>
+        <fo:block white-space="no-wrap">
+          <test:assert property="linefeed-treatment" expected="TREAT_AS_SPACE" />
+          <test:assert property="white-space-treatment" expected="IGNORE_IF_SURROUNDING_LINEFEED" />
+          <test:assert property="white-space-collapse" expected="TRUE" />
+          <test:assert property="wrap-option" expected="NO_WRAP" />
+          Block 3: testing white-space="no-wrap"
+        </fo:block>
+      </fo:flow>
+    </fo:page-sequence>
+  </fo:root>
+

Propchange: xmlgraphics/fop/trunk/test/fotree/testcases/white-space_shorthand-expansion.fo
------------------------------------------------------------------------------
    svn:keywords = Id



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org