[FOray-commit] SF.net SVN: foray:[12607] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2022-02-21 21:36:27
|
Revision: 12607
http://sourceforge.net/p/foray/code/12607
Author: victormote
Date: 2022-02-21 21:36:25 +0000 (Mon, 21 Feb 2022)
Log Message:
-----------
Conform to aXSL change: Remove BlockDiscrete interface.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractListItemContent.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockContainerRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineContainerArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalFlowRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionOuterRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableCellRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/link/LinkFactory.java
trunk/foray/foray-content/src/main/java/org/foray/content/ContentTree4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoContainerComplex.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block4a.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java
Removed Paths:
-------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockDiscrete4a.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractListItemContent.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractListItemContent.java 2022-02-18 22:43:38 UTC (rev 12606)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractListItemContent.java 2022-02-21 21:36:25 UTC (rev 12607)
@@ -32,7 +32,6 @@
import org.axsl.area.factory.BlockLevelAreaFactory;
import org.axsl.fotree.fo.Block;
import org.axsl.fotree.fo.BlockContainer;
-import org.axsl.fotree.fo.BlockDiscrete;
import org.axsl.fotree.fo.ListBlock;
import org.axsl.fotree.fo.Marker;
import org.axsl.fotree.fo.RetrieveMarker;
@@ -110,13 +109,6 @@
}
@Override
- public NormalBlockArea4a makeNormalBlockArea(final BlockDiscrete blockDiscrete) {
- final NormalBlockArea4a nbArea = NormalBlockArea4a.makeNormalBlockArea(blockDiscrete, this);
- this.children.add(nbArea);
- return nbArea;
- }
-
- @Override
public BlockContainerRa makeBlockContainerArea(final BlockContainer blockContainer) {
final BlockContainerRa newBcArea = BlockContainerRa.makeBlockContainerArea(blockContainer, this);
this.children.add(newBcArea);
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockContainerRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockContainerRa.java 2022-02-18 22:43:38 UTC (rev 12606)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockContainerRa.java 2022-02-21 21:36:25 UTC (rev 12607)
@@ -34,7 +34,6 @@
import org.axsl.fotree.FoContext;
import org.axsl.fotree.fo.Block;
import org.axsl.fotree.fo.BlockContainer;
-import org.axsl.fotree.fo.BlockDiscrete;
import org.axsl.fotree.fo.ListBlock;
import org.axsl.fotree.fo.Marker;
import org.axsl.fotree.fo.RetrieveMarker;
@@ -228,13 +227,6 @@
}
@Override
- public NormalBlockArea4a makeNormalBlockArea(final BlockDiscrete blockDiscrete) {
- final NormalBlockArea4a nbArea = NormalBlockArea4a.makeNormalBlockArea(blockDiscrete, this);
- this.children.add(nbArea);
- return nbArea;
- }
-
- @Override
public BlockContainerRa makeBlockContainerArea(final BlockContainer blockContainer) {
final BlockContainerRa newBcArea = BlockContainerRa.makeBlockContainerArea(blockContainer, this);
this.children.add(newBcArea);
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineContainerArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineContainerArea.java 2022-02-18 22:43:38 UTC (rev 12606)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineContainerArea.java 2022-02-21 21:36:25 UTC (rev 12607)
@@ -33,7 +33,6 @@
import org.axsl.area.AreaTreeException;
import org.axsl.fotree.fo.Block;
import org.axsl.fotree.fo.BlockContainer;
-import org.axsl.fotree.fo.BlockDiscrete;
import org.axsl.fotree.fo.Inline;
import org.axsl.fotree.fo.InlineContainer;
import org.axsl.fotree.fo.ListBlock;
@@ -248,13 +247,6 @@
}
@Override
- public NormalBlockArea4a makeNormalBlockArea(final BlockDiscrete blockDiscrete) {
- final NormalBlockArea4a nbArea = NormalBlockArea4a.makeNormalBlockArea(blockDiscrete, this);
- this.children.add(nbArea);
- return nbArea;
- }
-
- @Override
public BlockContainerRa makeBlockContainerArea(final BlockContainer blockContainer) {
final BlockContainerRa newBcArea
= BlockContainerRa.makeBlockContainerArea(blockContainer, this);
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2022-02-18 22:43:38 UTC (rev 12606)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2022-02-21 21:36:25 UTC (rev 12607)
@@ -37,7 +37,6 @@
import org.axsl.fotree.Fo;
import org.axsl.fotree.fo.Block;
import org.axsl.fotree.fo.BlockContainer;
-import org.axsl.fotree.fo.BlockDiscrete;
import org.axsl.fotree.fo.ListBlock;
import org.axsl.fotree.fo.Marker;
import org.axsl.fotree.fo.RetrieveMarker;
@@ -99,23 +98,6 @@
return newBlockArea;
}
- /**
- * Factory method that creates a new {@link NormalBlockArea4a}.
- * @param generatedBy The FO node generating this area.
- * @param parentArea The parent area.
- * @return The new instance.
- */
- static NormalBlockArea4a makeNormalBlockArea(final BlockDiscrete generatedBy, final AreaNode4a parentArea) {
- final NormalBlockArea4a newBlockArea = new NormalBlockArea4a(parentArea);
- final Link<NormalBlockAreaGenerator> linkage = newBlockArea.getLink((NormalBlockAreaGenerator) generatedBy);
- newBlockArea.foLink = linkage;
- newBlockArea.registerLink(generatedBy);
- final int initialPD = newBlockArea.computeInitialPD();
- newBlockArea.setProgressionDimension(initialPD);
- newBlockArea.initializeAnteriorSpace();
- return newBlockArea;
- }
-
@Override
public LineArea4a makeLineArea(final boolean allowOverflow) throws AreaTreeException {
/* The size of the next line does not need to consider the half-leading that follows the line.
@@ -156,7 +138,7 @@
if (fo instanceof Block) {
nbArea = bcFactory.makeNormalBlockArea((Block) fo);
} else {
- nbArea = bcFactory.makeNormalBlockArea((BlockDiscrete) fo);
+ throw new IllegalStateException();
}
return (NormalBlockArea4a) nbArea;
}
@@ -292,14 +274,6 @@
}
@Override
- public NormalBlockArea4a makeNormalBlockArea(final BlockDiscrete blockDiscrete) {
- final Block containingBlock = blockDiscrete.getParent();
- final NormalBlockArea4a nbArea = NormalBlockArea4a.makeNormalBlockArea(containingBlock, this);
- this.children.add(nbArea);
- return nbArea;
- }
-
- @Override
public BlockContainerRa makeBlockContainerArea(final BlockContainer blockContainer) {
final BlockContainerRa newBcArea
= BlockContainerRa.makeBlockContainerArea(blockContainer, this);
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalFlowRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalFlowRa4a.java 2022-02-18 22:43:38 UTC (rev 12606)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalFlowRa4a.java 2022-02-21 21:36:25 UTC (rev 12607)
@@ -35,7 +35,6 @@
import org.axsl.fotree.Fo;
import org.axsl.fotree.fo.Block;
import org.axsl.fotree.fo.BlockContainer;
-import org.axsl.fotree.fo.BlockDiscrete;
import org.axsl.fotree.fo.ListBlock;
import org.axsl.fotree.fo.Marker;
import org.axsl.fotree.fo.RegionBody;
@@ -219,13 +218,6 @@
}
@Override
- public NormalBlockArea4a makeNormalBlockArea(final BlockDiscrete blockDiscrete) {
- final NormalBlockArea4a nbArea = NormalBlockArea4a.makeNormalBlockArea(blockDiscrete, this);
- this.children.add(nbArea);
- return nbArea;
- }
-
- @Override
public BlockContainerRa makeBlockContainerArea(final BlockContainer blockContainer) {
final BlockContainerRa newBcArea
= BlockContainerRa.makeBlockContainerArea(blockContainer, this);
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionOuterRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionOuterRa4a.java 2022-02-18 22:43:38 UTC (rev 12606)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionOuterRa4a.java 2022-02-21 21:36:25 UTC (rev 12607)
@@ -35,7 +35,6 @@
import org.axsl.area.RegionOuterRa;
import org.axsl.fotree.fo.Block;
import org.axsl.fotree.fo.BlockContainer;
-import org.axsl.fotree.fo.BlockDiscrete;
import org.axsl.fotree.fo.ListBlock;
import org.axsl.fotree.fo.Marker;
import org.axsl.fotree.fo.Region;
@@ -204,13 +203,6 @@
}
@Override
- public NormalBlockArea4a makeNormalBlockArea(final BlockDiscrete blockDiscrete) {
- final NormalBlockArea4a nbArea = NormalBlockArea4a.makeNormalBlockArea(blockDiscrete, this);
- this.children.add(nbArea);
- return nbArea;
- }
-
- @Override
public BlockContainerRa makeBlockContainerArea(final BlockContainer blockContainer) {
final BlockContainerRa newBcArea = BlockContainerRa.makeBlockContainerArea(blockContainer, this);
this.children.add(newBcArea);
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TableCellRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TableCellRa.java 2022-02-18 22:43:38 UTC (rev 12606)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TableCellRa.java 2022-02-21 21:36:25 UTC (rev 12607)
@@ -33,7 +33,6 @@
import org.axsl.area.AreaTreeException;
import org.axsl.fotree.fo.Block;
import org.axsl.fotree.fo.BlockContainer;
-import org.axsl.fotree.fo.BlockDiscrete;
import org.axsl.fotree.fo.GraftingPoint;
import org.axsl.fotree.fo.ListBlock;
import org.axsl.fotree.fo.Marker;
@@ -408,13 +407,6 @@
}
@Override
- public NormalBlockArea4a makeNormalBlockArea(final BlockDiscrete blockDiscrete) {
- final NormalBlockArea4a nbArea = NormalBlockArea4a.makeNormalBlockArea(blockDiscrete, this);
- this.children.add(nbArea);
- return nbArea;
- }
-
- @Override
public BlockContainerRa makeBlockContainerArea(final BlockContainer blockContainer) {
final BlockContainerRa newBcArea
= BlockContainerRa.makeBlockContainerArea(blockContainer, this);
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/link/LinkFactory.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/link/LinkFactory.java 2022-02-18 22:43:38 UTC (rev 12606)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/link/LinkFactory.java 2022-02-21 21:36:25 UTC (rev 12607)
@@ -33,7 +33,6 @@
import org.axsl.fotree.fo.BidiOverride;
import org.axsl.fotree.fo.Block;
import org.axsl.fotree.fo.BlockContainer;
-import org.axsl.fotree.fo.BlockDiscrete;
import org.axsl.fotree.fo.Bookmark;
import org.axsl.fotree.fo.BookmarkTitle;
import org.axsl.fotree.fo.BookmarkTree;
@@ -118,11 +117,6 @@
}
@Override
- public NormalLink<BlockDiscrete> visit(final BlockDiscrete host) {
- return new NormalLink<BlockDiscrete>(host);
- }
-
- @Override
public NormalLink<Bookmark> visit(final Bookmark host) {
return new NormalLink<Bookmark>(host);
}
Modified: trunk/foray/foray-content/src/main/java/org/foray/content/ContentTree4a.java
===================================================================
--- trunk/foray/foray-content/src/main/java/org/foray/content/ContentTree4a.java 2022-02-18 22:43:38 UTC (rev 12606)
+++ trunk/foray/foray-content/src/main/java/org/foray/content/ContentTree4a.java 2022-02-21 21:36:25 UTC (rev 12607)
@@ -38,7 +38,6 @@
import org.axsl.fotree.Fo;
import org.axsl.fotree.fo.BasicLink;
import org.axsl.fotree.fo.Block;
-import org.axsl.fotree.fo.BlockDiscrete;
import org.axsl.fotree.fo.ExternalGraphic;
import org.axsl.fotree.fo.FoTextWords;
import org.axsl.fotree.fo.Footnote;
@@ -67,7 +66,7 @@
private List<Content4a> children = new ArrayList<Content4a>();
/**
- * Constructor that creates a content tree from the content of a {@link BlockDiscrete}.
+ * Constructor.
* @param nba The block whose content should be wrapped in a content tree.
*/
public ContentTree4a(final NormalBlockArea nba) {
@@ -94,10 +93,6 @@
* @param context The area-tree context for {@code fo} and descendants.
*/
private void processChild(final Fo fo, final Area context) {
- if (fo instanceof BlockDiscrete) {
- processChildren(fo, context);
- return;
- }
if (fo instanceof FoTextWords) {
final FoTextWords foTextWords = (FoTextWords) fo;
final TextTokensContent4a tokensContent = new TextTokensContent4a(foTextWords, null);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoContainerComplex.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoContainerComplex.java 2022-02-18 22:43:38 UTC (rev 12606)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoContainerComplex.java 2022-02-21 21:36:25 UTC (rev 12607)
@@ -28,8 +28,6 @@
package org.foray.fotree;
-import org.foray.fotree.fo.obj.BlockDiscrete4a;
-
import org.axsl.fotree.FoTreeException;
import java.util.ArrayList;
@@ -54,9 +52,7 @@
*/
public abstract class FoContainerComplex extends FoObj {
- /**
- * The children of this object. Each child of a "complex container" should be either 1) A {@link BlockDiscrete4a}
- * instance, i.e. a container for text and inline objects, or 2) A block-level object. */
+ /** The children of this object. */
private List<FoObj> children = new ArrayList<FoObj>();
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block4a.java 2022-02-18 22:43:38 UTC (rev 12606)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block4a.java 2022-02-21 21:36:25 UTC (rev 12607)
@@ -173,81 +173,6 @@
}
@Override
- public void addChild(final FoObj fobj) throws FoTreeException {
- /* TODO: The following code block should be removed when the BlockDiscrete logic is working properly. */
- if ("block".equals(getName())) {
- super.addChild(fobj);
- return;
- }
- if (fobj.isAlwaysBlockContent()) {
- getChildren().add(fobj);
- return;
- }
- if (fobj instanceof FoText4a) {
- final FoText4a text = (FoText4a) fobj;
- /* If we are still in a place where an fo:marker can be added (i.e. at the beginning of the block), and
- * this text is all whitespace, it is not really part of the BlockDiscrete content.
- * Place it directly into the block content so that fo:marker objects can be added if needed. */
- if (text.isAllWhiteSpace()
- && canAddMarkers()) {
- getChildren().add(fobj);
- } else {
- addBlockDiscreteContent(fobj);
- }
- return;
- }
- if (fobj.isAlwaysInlineContent()) {
- addBlockDiscreteContent(fobj);
- return;
- }
- if (fobj instanceof Marker4a) {
- if (canAddMarkers()) {
- getChildren().add(fobj);
- } else {
- throwExceptionContentModelViolation();
- }
- return;
- }
- if (fobj instanceof Footnote4a) {
- addBlockDiscreteContent(fobj);
- return;
- }
- if (fobj.isNeutralContainer()
- || fobj.isOutOfLineAnyContent()
- || fobj.isOutOfLineInlineContent()) {
- /* If it is capable of containing block-level elements, but does not, it can be a child. */
- if (! fobj.hasDescendantBlocks()) {
- addBlockDiscreteContent(fobj);
- } else {
- getChildren().add(fobj);
- }
- return;
- }
- throwException("Unable to handle this kind of mixed content.");
- }
-
- /**
- * Adds the object to a child instance of {@link BlockDiscrete4a} instead of directly as a child of this block,
- * first creating the {@link BlockDiscrete4a} if needed.
- * @param fobj The object to be added.
- * @throws FoTreeException For errors adding the child.
- */
- private void addBlockDiscreteContent(final FoObj fobj) throws FoTreeException {
- final FoObj lastChild = this.getLastChild();
- BlockDiscrete4a discrete = null;
- if (lastChild == null) {
- discrete = new BlockDiscrete4a(this);
- getChildren().add(discrete);
- } else if (lastChild instanceof BlockDiscrete4a) {
- discrete = (BlockDiscrete4a) lastChild;
- } else {
- discrete = new BlockDiscrete4a(this);
- getChildren().add(discrete);
- }
- discrete.addChild(fobj);
- }
-
- @Override
public KpUserAgent getParaContext() {
return this;
}
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockDiscrete4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockDiscrete4a.java 2022-02-18 22:43:38 UTC (rev 12606)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockDiscrete4a.java 2022-02-21 21:36:25 UTC (rev 12607)
@@ -1,292 +0,0 @@
-/*
- * Copyright 2021 The FOray Project.
- * http://www.foray.org
- *
- * 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.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.fotree.fo.obj;
-
-import org.foray.common.kp.KpLeafIterator4a;
-import org.foray.fotree.FoContainerComplex;
-import org.foray.fotree.FoContainerInline;
-import org.foray.fotree.FoObj;
-import org.foray.fotree.Namespace;
-import org.foray.fotree.PropertyList;
-
-import org.axsl.font.FontUse;
-import org.axsl.fotree.FoContext;
-import org.axsl.fotree.FoTreeException;
-import org.axsl.fotree.FoVisitor;
-import org.axsl.fotree.fo.BlockDiscrete;
-import org.axsl.kp.KpBranch;
-import org.axsl.kp.KpContext;
-import org.axsl.kp.KpLeaf;
-import org.axsl.kp.KpLeafIterator;
-import org.axsl.kp.KpNode;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A container for only text and inline items.
- * This is a pass-thru pseudo-element that is always a child of a {@link FoContainerComplex} and that has no inline
- * (%block;) descendants.
- * (It can have out-of-line descendants, such as those that are children of fo:footnote or fo:float).
- * In other words, it is content that can be laid out as a discrete paragraph, uninterrupted by other blocks.
- */
-public class BlockDiscrete4a extends FoContainerInline implements BlockDiscrete {
-
- /** The parent of this node. */
- private Block4a parent;
-
- /** The children of this object. */
- private List<FoObj> children = new ArrayList<FoObj>();
-
- /**
- * Constructor.
- * @param parent The parent FoObj.
- */
- public BlockDiscrete4a(final Block4a parent) {
- super(parent);
- this.parent = parent;
- }
-
- @Override
- public <T> T acceptVisitor(final FoVisitor<T> visitor) {
- return visitor.visit(this);
- }
-
- @Override
- public boolean isValid() {
- return true;
- }
-
- @Override
- public FontUse getPrimaryFont(final FoContext context) {
- return this.parent.getPrimaryFont(context);
- }
-
- @Override
- public Block4a getParent() {
- return this.parent;
- }
-
- @Override
- public List<? extends FoObj> getChildren() {
- return this.children;
- }
-
- @Override
- protected void validateAncestry() throws FoTreeException {
- }
-
- @Override
- protected void validateProperties() throws FoTreeException {
- }
-
- @Override
- protected void setup() throws FoTreeException {
- }
-
- @Override
- protected void validateDescendants() throws FoTreeException {
- }
-
- @Override
- protected void end() throws FoTreeException {
- }
-
- @Override
- public void addChild(final FoObj fobj) throws FoTreeException {
- if (fobj.canBeInlineContent()
- || fobj.isPcdataContent()) {
- if (! fobj.hasDescendantBlocks()) {
- this.children.add(fobj);
- return;
- }
- }
- if (fobj instanceof Footnote4a
- || fobj instanceof Float4a) {
- this.children.add(fobj);
- return;
- }
- throw new IllegalStateException("Cannot add item to " + this.getClass().getName() + ", "
- + fobj.getContextMessage());
- }
-
- @Override
- public Namespace getNamespace() {
- return this.parent.getNamespace();
- }
-
- @Override
- public boolean isAlwaysBlockContent() {
- return true;
- }
-
- @Override
- public boolean isPcdataContent() {
- return false;
- }
-
- @Override
- public String getName() {
- return "block-discrete-(pseudo)";
- }
-
- @Override
- public PropertyList getPropertyList() {
- return this.parent.getPropertyList();
- }
-
- @Override
- public boolean isInFlow() {
- return true;
- }
-
- @Override
- public boolean canHaveMarkerChildren() {
- return false;
- }
-
- @Override
- public boolean canHavePcdataChildren() {
- return false;
- }
-
- @Override
- public boolean canHaveInlineChildren() {
- return false;
- }
-
- @Override
- public boolean canHaveBlockChildren() {
- return false;
- }
-
- @Override
- public boolean isPseudoObject() {
- return true;
- }
-
- @Override
- public int qtyKpNodes() {
- int count = 0;
- for (int index = 0; index < this.children.size(); index ++) {
- final FoObj child = this.children.get(index);
- if (child instanceof KpNode) {
- count ++;
- }
- }
- return count;
- }
-
- @Override
- public KpNode kpNodeAt(final int nodeIndex) {
- int count = 0;
- for (int index = 0; index < this.children.size(); index ++) {
- final FoObj child = this.children.get(index);
- if (child instanceof KpNode) {
- if (nodeIndex == count) {
- return (KpNode) child;
- }
- count ++;
- }
- }
- throw new IndexOutOfBoundsException();
- }
-
- @Override
- public int qtyKpLeaves() {
- int count = 0;
- for (int nodeIndex = 0; nodeIndex < qtyKpNodes(); nodeIndex ++) {
- final KpNode node = kpNodeAt(nodeIndex);
- final KpBranch branch = KpNode.Type.asBranch(node);
- if (branch == null) {
- count ++;
- } else {
- count += branch.qtyKpLeaves();
- }
- }
- return count;
- }
-
- @Override
- public KpLeaf kpLeafAt(final int leafIndex) {
- if (leafIndex < 0) {
- throw new IndexOutOfBoundsException();
- }
- int totalLength = 0;
- for (int nodeIndex = 0; nodeIndex < qtyKpNodes(); nodeIndex ++) {
- final KpNode node = kpNodeAt(nodeIndex);
- final KpBranch branch = KpNode.Type.asBranch(node);
- if (branch == null) {
- /* Node is a leaf. */
- if (leafIndex == totalLength) {
- return (KpLeaf) node;
- } else {
- totalLength ++;
- }
- } else {
- /* Node is a branch. */
- final int currentLength = branch.qtyKpLeaves();
- totalLength += currentLength;
- if (totalLength > leafIndex) {
- final int currentIndex = leafIndex - (totalLength - currentLength);
- return branch.kpLeafAt(currentIndex);
- }
- }
- }
- throw new IndexOutOfBoundsException();
- }
-
- @Override
- public KpLeafIterator leafIterator() {
- return new KpLeafIterator4a(this);
- }
-
- @Override
- public Type getKpNodeType() {
- return KpNode.Type.BRANCH;
- }
-
- @Override
- public int qtyKpLeavesStrict() {
- /* TODO: Support this. */
- throw new UnsupportedOperationException();
- }
-
- @Override
- public CharSequence getText() {
- /* TODO: Support this. */
- throw new UnsupportedOperationException();
- }
-
- @Override
- public KpContext getKpContext() {
- return null;
- }
-
-}
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java 2022-02-18 22:43:38 UTC (rev 12606)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java 2022-02-21 21:36:25 UTC (rev 12607)
@@ -28,50 +28,50 @@
package org.foray.pioneer;
-import org.foray.common.kp.KpLeafIterator4a;
-import org.foray.content.Content4a;
-import org.foray.content.ContentTree4a;
-
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
-import org.axsl.area.LineArea;
-import org.axsl.area.NormalBlockArea;
import org.axsl.area.factory.BlockLevelAreaFactory;
-import org.axsl.fotree.fo.BlockDiscrete;
-import org.axsl.kp.KpResult;
-import org.axsl.kp.KpUserAgent;
-import org.axsl.linebreak.LineBreaker;
+import org.axsl.fotree.Fo;
/**
- * Pioneer Layout for {@link BlockDiscrete}.
+ * Pioneer Layout for BlockDiscrete.
*/
public class BlockDiscretePnr extends FoObjPnr {
+ /* TODO: Remove this class after the logic has been moved to a more appropriate place. */
- /** The real FONode which this proxy represents. */
- private BlockDiscrete blockDiscrete;
+// /** The real FONode which this proxy represents. */
+// private BlockDiscrete blockDiscrete;
+//
+// /** The content tree for this block. */
+// private ContentTree4a contentTree;
+//
+// /** The results of line-breaking for {@link #node}. */
+// private KpResult result;
+//
+// /** Index to the next line in {@link #result} to be placed on a line. */
+// private int nextResultLine = 0;
- /** The content tree for this block. */
- private ContentTree4a contentTree;
-
- /** The results of line-breaking for {@link #node}. */
- private KpResult result;
-
- /** Index to the next line in {@link #result} to be placed on a line. */
- private int nextResultLine = 0;
-
/**
* Constructor.
* @param realFObj The FO Tree object which is being laid out.
* @param layout The ancestor layout system.
*/
- public BlockDiscretePnr(final BlockDiscrete realFObj, final PioneerLayoutStrategy layout) {
+ public BlockDiscretePnr(final Fo realFObj, final PioneerLayoutStrategy layout) {
super(realFObj, layout);
- this.blockDiscrete = realFObj;
}
+// public BlockDiscretePnr(final BlockDiscrete realFObj, final PioneerLayoutStrategy layout) {
+// super(realFObj, layout);
+// this.blockDiscrete = realFObj;
+// }
+//
+// @Override
+// public BlockDiscrete getFONode() {
+// return this.blockDiscrete;
+// }
@Override
- public BlockDiscrete getFONode() {
- return this.blockDiscrete;
+ public Fo getFONode() {
+ return null;
}
@Override
@@ -81,41 +81,41 @@
areaNode = areaNode.ancestorBlockLevelAreaFactory();
}
- final BlockLevelAreaFactory bcArea = (BlockLevelAreaFactory) areaNode;
- final NormalBlockArea normalBlockArea = bcArea.makeNormalBlockArea(this.blockDiscrete);
+// final BlockLevelAreaFactory bcArea = (BlockLevelAreaFactory) areaNode;
+// final NormalBlockArea normalBlockArea = bcArea.makeNormalBlockArea(this.blockDiscrete);
+//
+// if (this.result == null) {
+// final LineBreaker lb = getLayout().getLineBreaker();
+// final KpUserAgent paraContext = this.blockDiscrete.ancestorBlock(normalBlockArea).getParaContext();
+// this.contentTree = new ContentTree4a(normalBlockArea);
+// this.result = lb.breakIntoLines(contentTree, paraContext, normalBlockArea);
+// }
- if (this.result == null) {
- final LineBreaker lb = getLayout().getLineBreaker();
- final KpUserAgent paraContext = this.blockDiscrete.ancestorBlock(normalBlockArea).getParaContext();
- this.contentTree = new ContentTree4a(normalBlockArea);
- this.result = lb.breakIntoLines(contentTree, paraContext, normalBlockArea);
- }
-
/* Run a leaf iterator alongside the iteration of the line-break results, so that we can conveniently retrieve
* the branch indexes. */
- final KpLeafIterator4a iterator = new KpLeafIterator4a(contentTree);
- for (int lineIndex = this.nextResultLine; lineIndex < result.getQtyLines(); lineIndex ++) {
- final LineArea lineArea = normalBlockArea.makeLineArea(false);
- if (lineArea == null) {
- /* Unable to create another line on the current page. */
- this.nextResultLine = lineIndex;
- if (lineIndex == 0) {
- return Status.AREA_FULL_NONE;
- } else {
- return Status.AREA_FULL_SOME;
- }
- }
+// final KpLeafIterator4a iterator = new KpLeafIterator4a(contentTree);
+// for (int lineIndex = this.nextResultLine; lineIndex < result.getQtyLines(); lineIndex ++) {
+// final LineArea lineArea = normalBlockArea.makeLineArea(false);
+// if (lineArea == null) {
+// /* Unable to create another line on the current page. */
+// this.nextResultLine = lineIndex;
+// if (lineIndex == 0) {
+// return Status.AREA_FULL_NONE;
+// } else {
+// return Status.AREA_FULL_SOME;
+// }
+// }
+//
+// int leafIndex = lineIndex < 1 ? 0 : result.getBreakPosition(lineIndex - 1);
+// final int endLeafIndex = result.getBreakPosition(lineIndex);
+// while (leafIndex < endLeafIndex) {
+// iterator.advanceToLeaf(leafIndex);
+// final int contentIndex = iterator.branchIndexAt(0);
+// final Content4a content = this.contentTree.contentAt(contentIndex);
+// leafIndex = content.addToLine(lineArea, iterator, endLeafIndex);
+// }
+// }
- int leafIndex = lineIndex < 1 ? 0 : result.getBreakPosition(lineIndex - 1);
- final int endLeafIndex = result.getBreakPosition(lineIndex);
- while (leafIndex < endLeafIndex) {
- iterator.advanceToLeaf(leafIndex);
- final int contentIndex = iterator.branchIndexAt(0);
- final Content4a content = this.contentTree.contentAt(contentIndex);
- leafIndex = content.addToLine(lineArea, iterator, endLeafIndex);
- }
- }
-
return Status.OK;
}
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java 2022-02-18 22:43:38 UTC (rev 12606)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java 2022-02-21 21:36:25 UTC (rev 12607)
@@ -53,7 +53,6 @@
import org.axsl.fotree.fo.BidiOverride;
import org.axsl.fotree.fo.Block;
import org.axsl.fotree.fo.BlockContainer;
-import org.axsl.fotree.fo.BlockDiscrete;
import org.axsl.fotree.fo.Bookmark;
import org.axsl.fotree.fo.BookmarkTitle;
import org.axsl.fotree.fo.BookmarkTree;
@@ -429,11 +428,6 @@
}
@Override
- public BlockDiscretePnr visit(final BlockDiscrete node) {
- return new BlockDiscretePnr(node, this);
- }
-
- @Override
public BlockContainerPnr visit(final BlockContainer node) {
return new BlockContainerPnr(node, this);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|