--- /dev/null
+/*
+ * Copyright 1999-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.flow;
+
+import org.xml.sax.Locator;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
+import org.apache.fop.fo.properties.CommonAccessibility;
+import org.apache.fop.fo.properties.KeepProperty;
+
+/**
+ * Class modelling the fo:list-item-body object.
+ */
+public abstract class AbstractListItemPart extends FObj {
+ // The value of properties relevant for fo:list-item-label and fo:list-item-body.
+ private CommonAccessibility commonAccessibility;
+ private String id;
+ private KeepProperty keepTogether;
+ // End of property values
+
+ /** used for FO validation */
+ private boolean blockItemFound = false;
+
+ /**
+ * @param parent FONode that is the parent of this object
+ */
+ public AbstractListItemPart(FONode parent) {
+ super(parent);
+ }
+
+ /**
+ * @see org.apache.fop.fo.FObj#bind(PropertyList)
+ */
+ public void bind(PropertyList pList) throws FOPException {
+ commonAccessibility = pList.getAccessibilityProps();
+ id = pList.get(PR_ID).getString();
+ keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep();
+ }
+
+ /**
+ * @see org.apache.fop.fo.FONode#startOfNode
+ */
+ protected void startOfNode() throws FOPException {
+ checkId(id);
+ }
+
+ /**
+ * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
+ * XSL Content Model: marker* (%block;)+
+ */
+ protected void validateChildNode(Locator loc, String nsURI, String localName)
+ throws ValidationException {
+ if (nsURI == FO_URI && localName.equals("marker")) {
+ if (blockItemFound) {
+ nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
+ }
+ } else if (!isBlockItem(nsURI, localName)) {
+ invalidChildError(loc, nsURI, localName);
+ } else {
+ blockItemFound = true;
+ }
+ }
+
+ /**
+ * @see org.apache.fop.fo.FONode#endOfNode
+ */
+ protected void endOfNode() throws FOPException {
+ if (!blockItemFound) {
+ missingChildElementError("marker* (%block;)+");
+ }
+ }
+
+ /** @return the "keep-together" property. */
+ public KeepProperty getKeepTogether() {
+ return keepTogether;
+ }
+
+ /** @return the "id" property. */
+ public String getId() {
+ return id;
+ }
+
+}
+
return breakBefore;
}
+ /** @return the "keep-with-next" property. */
+ public KeepProperty getKeepWithNext() {
+ return keepWithNext;
+ }
+
+ /** @return the "keep-with-previous" property. */
+ public KeepProperty getKeepWithPrevious() {
+ return keepWithPrevious;
+ }
+
+ /** @return the "keep-together" property. */
+ public KeepProperty getKeepTogether() {
+ return keepTogether;
+ }
+
/**
* @return the "id" property.
*/
return breakBefore;
}
+ /** @return the "keep-with-next" property. */
+ public KeepProperty getKeepWithNext() {
+ return keepWithNext;
+ }
+
+ /** @return the "keep-with-previous" property. */
+ public KeepProperty getKeepWithPrevious() {
+ return keepWithPrevious;
+ }
+
+ /** @return the "keep-together" property. */
+ public KeepProperty getKeepTogether() {
+ return keepTogether;
+ }
+
/**
- * Return the "id" property.
+ * @return the "id" property.
*/
public String getId() {
return id;
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-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.
package org.apache.fop.fo.flow;
-import org.xml.sax.Locator;
-
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.PropertyList;
-import org.apache.fop.fo.ValidationException;
-import org.apache.fop.fo.properties.CommonAccessibility;
-import org.apache.fop.fo.properties.KeepProperty;
/**
* Class modelling the fo:list-item-body object.
*/
-public class ListItemBody extends FObj {
- // The value of properties relevant for fo:list-item-body.
- private CommonAccessibility commonAccessibility;
- private String id;
- private KeepProperty keepTogether;
- // End of property values
-
- /** used for FO validation */
- private boolean blockItemFound = false;
+public class ListItemBody extends AbstractListItemPart {
/**
* @param parent FONode that is the parent of this object
super(parent);
}
- /**
- * @see org.apache.fop.fo.FObj#bind(PropertyList)
- */
- public void bind(PropertyList pList) throws FOPException {
- commonAccessibility = pList.getAccessibilityProps();
- id = pList.get(PR_ID).getString();
- keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep();
- }
-
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
protected void startOfNode() throws FOPException {
- checkId(id);
+ super.startOfNode();
getFOEventHandler().startListBody();
}
- /**
- * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
- * XSL Content Model: marker* (%block;)+
- */
- protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- if (nsURI == FO_URI && localName.equals("marker")) {
- if (blockItemFound) {
- nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
- }
- } else if (!isBlockItem(nsURI, localName)) {
- invalidChildError(loc, nsURI, localName);
- } else {
- blockItemFound = true;
- }
- }
-
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
protected void endOfNode() throws FOPException {
- if (!blockItemFound) {
- missingChildElementError("marker* (%block;)+");
- }
+ super.endOfNode();
getFOEventHandler().endListBody();
}
-
- /**
- * Return the "id" property.
- */
- public String getId() {
- return id;
- }
-
+
/**
* @see org.apache.fop.fo.FObj#getName()
*/
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-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.
package org.apache.fop.fo.flow;
-import org.xml.sax.Locator;
-
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.PropertyList;
-import org.apache.fop.fo.ValidationException;
-import org.apache.fop.fo.properties.CommonAccessibility;
-import org.apache.fop.fo.properties.KeepProperty;
/**
* Class modelling the fo:list-item-label object.
- * @todo implement validateChildNode()
*/
-public class ListItemLabel extends FObj {
- // The value of properties relevant for fo:list-item-label.
- private CommonAccessibility commonAccessibility;
- private String id;
- private KeepProperty keepTogether;
- // End of property values
-
- /** used for FO validation */
- private boolean blockItemFound = false;
+public class ListItemLabel extends AbstractListItemPart {
/**
* @param parent FONode that is the parent of this object
super(parent);
}
- /**
- * @see org.apache.fop.fo.FObj#bind(PropertyList)
- */
- public void bind(PropertyList pList) throws FOPException {
- commonAccessibility = pList.getAccessibilityProps();
- id = pList.get(PR_ID).getString();
- keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep();
- }
-
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
protected void startOfNode() throws FOPException {
- checkId(id);
+ super.startOfNode();
getFOEventHandler().startListLabel();
}
- /**
- * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
- * XSL Content Model: marker* (%block;)+
- */
- protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- if (nsURI == FO_URI && localName.equals("marker")) {
- if (blockItemFound) {
- nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
- }
- } else if (!isBlockItem(nsURI, localName)) {
- invalidChildError(loc, nsURI, localName);
- } else {
- blockItemFound = true;
- }
- }
-
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
protected void endOfNode() throws FOPException {
- if (!blockItemFound) {
- missingChildElementError("marker* (%block;)+");
- }
-
+ super.endOfNode();
getFOEventHandler().endListLabel();
}
- /**
- * Return the "id" property.
- */
- public String getId() {
- return id;
- }
-
/**
* @see org.apache.fop.fo.FObj#getName()
*/
|| !getKeepTogether().getWithinColumn().isAuto();
}
+ /**
+ * Convenience method to check if a keep-with-next constraint is specified.
+ * @return true if keep-with-next is active.
+ */
+ public boolean mustKeepWithNext() {
+ return !getKeepWithNext().getWithinPage().isAuto()
+ || !getKeepWithNext().getWithinColumn().isAuto();
+ }
+
+ /**
+ * Convenience method to check if a keep-with-previous constraint is specified.
+ * @return true if keep-with-previous is active.
+ */
+ public boolean mustKeepWithPrevious() {
+ return !getKeepWithPrevious().getWithinPage().isAuto()
+ || !getKeepWithPrevious().getWithinColumn().isAuto();
+ }
+
/**
* @return the "block-progression-dimension" property.
*/