01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
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.
16: */
17:
18: /* $Id: Wrapper.java 554094 2007-07-07 00:04:25Z adelmelle $ */
19:
20: package org.apache.fop.fo.flow;
21:
22: // Java
23: import org.apache.fop.apps.FOPException;
24: import org.apache.fop.fo.FONode;
25: import org.apache.fop.fo.FObjMixed;
26: import org.apache.fop.fo.PropertyList;
27: import org.apache.fop.fo.ValidationException;
28: import org.xml.sax.Locator;
29:
30: /**
31: * Implementation for fo:wrapper formatting object.
32: * The wrapper object serves as
33: * a property holder for its child node objects.
34: */
35: public class Wrapper extends FObjMixed {
36: // The value of properties relevant for fo:wrapper.
37: // End of property values
38:
39: // used for FO validation
40: private boolean blockOrInlineItemFound = false;
41:
42: /**
43: * @param parent FONode that is the parent of this object
44: */
45: public Wrapper(FONode parent) {
46: super (parent);
47: }
48:
49: /**
50: * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
51: * XSL Content Model: marker* (#PCDATA|%inline;|%block;)*
52: * Additionally (unimplemented): "An fo:wrapper that is a child of an
53: * fo:multi-properties is only permitted to have children that would
54: * be permitted in place of the fo:multi-properties."
55: */
56: protected void validateChildNode(Locator loc, String nsURI,
57: String localName) throws ValidationException {
58: if (FO_URI.equals(nsURI) && localName.equals("marker")) {
59: if (blockOrInlineItemFound) {
60: nodesOutOfOrderError(loc, "fo:marker",
61: "(#PCDATA|%inline;|%block;)");
62: }
63: } else if (isBlockOrInlineItem(nsURI, localName)) {
64: blockOrInlineItemFound = true;
65: } else {
66: invalidChildError(loc, nsURI, localName);
67: }
68: }
69:
70: /** @see org.apache.fop.fo.FONode#getLocalName() */
71: public String getLocalName() {
72: return "wrapper";
73: }
74:
75: /**
76: * @see org.apache.fop.fo.FObj#getNameId()
77: */
78: public int getNameId() {
79: return FO_WRAPPER;
80: }
81: }
|