2
* Licensed to the Apache Software Foundation (ASF) under one or more
3
* contributor license agreements. See the NOTICE file distributed with
4
* this work for additional information regarding copyright ownership.
5
* The ASF licenses this file to You under the Apache License, Version 2.0
6
* (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
9
* http://www.apache.org/licenses/LICENSE-2.0
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
18
/* $Id: TextDecorationMaker.java 1089559 2011-04-06 18:39:15Z adelmelle $ */
20
package org.apache.fop.fo.properties;
22
import java.util.List;
24
import org.apache.fop.fo.Constants;
25
import org.apache.fop.fo.FObj;
26
import org.apache.fop.fo.PropertyList;
27
import org.apache.fop.fo.expr.NCnameProperty;
28
import org.apache.fop.fo.expr.PropertyException;
31
* Dedicated {@link org.apache.fop.fo.properties.PropertyMaker} for handling the
32
* <a href="http://www.w3.org/TR/xsl/#text-decoration"><code>text-decoration</code></a>
35
public class TextDecorationMaker extends ListProperty.Maker {
38
* Create a maker for the given property id.
39
* @param propId id of the property for which a maker should be created
41
public TextDecorationMaker(int propId) {
47
* Add validation rules for the <code>text-decoration</code> property.
50
public Property convertProperty(Property p,
51
PropertyList propertyList,
53
throws PropertyException {
55
ListProperty listProp = (ListProperty) super.convertProperty(p, propertyList, fo);
56
List lst = listProp.getList();
58
boolean under = false;
60
boolean through = false;
61
boolean blink = false;
63
for (int i = lst.size(); --i >= 0;) {
64
Property prop = (Property)lst.get(i);
65
if (prop instanceof NCnameProperty) {
66
prop = checkEnumValues(prop.getString());
70
enumValue = prop.getEnum();
73
case Constants.EN_NONE:
74
if (under | over | through | blink) {
75
throw new PropertyException("Invalid combination of values");
79
case Constants.EN_UNDERLINE:
80
case Constants.EN_NO_UNDERLINE:
81
case Constants.EN_OVERLINE:
82
case Constants.EN_NO_OVERLINE:
83
case Constants.EN_LINE_THROUGH:
84
case Constants.EN_NO_LINE_THROUGH:
85
case Constants.EN_BLINK:
86
case Constants.EN_NO_BLINK:
88
throw new PropertyException
89
("'none' specified, no additional values allowed");
92
case Constants.EN_UNDERLINE:
93
case Constants.EN_NO_UNDERLINE:
98
case Constants.EN_OVERLINE:
99
case Constants.EN_NO_OVERLINE:
104
case Constants.EN_LINE_THROUGH:
105
case Constants.EN_NO_LINE_THROUGH:
110
case Constants.EN_BLINK:
111
case Constants.EN_NO_BLINK:
117
throw new PropertyException("Invalid combination of values");
120
throw new PropertyException("Invalid value specified: " + p);