package org.apache.fop.area;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* @author pbw
protected CoordTransformer transformer = new CoordTransformer();
/**
- * @param parent
- * @param index
- * @param areaSync
- * @throws IndexOutOfBoundsException
+ * @param pageSeq through which this area was generated
+ * @param generatedBy the given <code>FONode</code> generated this
+ * @param parent area of this
+ * @param sync object on which operations in this are synchronized
*/
- public AbstractReferenceArea(Node parent, int index, Object areaSync)
- throws IndexOutOfBoundsException {
- super(parent, index, areaSync);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param parent
- * @param areaSync
- * @throws IndexOutOfBoundsException
- */
- public AbstractReferenceArea(Node parent, Object areaSync)
- throws IndexOutOfBoundsException {
- super(parent, areaSync);
+ public AbstractReferenceArea(
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(pageSeq, generatedBy, parent, sync);
// TODO Auto-generated constructor stub
}
* @param transformer to position this reference area
*/
public void setCoordTransformer(CoordTransformer transformer) {
- this.transformer = transformer;
+ synchronized (sync) {
+ this.transformer = transformer;
+ }
}
/**
* @return the current transformer to position this reference area
*/
public CoordTransformer getCoordTransformer() {
- return this.transformer;
+ synchronized (sync) {
+ return this.transformer;
+ }
}
/**
--- /dev/null
+/*
+ *
+ * Copyright 2004 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.
+ *
+ * Created on 27/02/2004
+ * $Id$
+ */
+package org.apache.fop.area;
+
+import java.awt.geom.Rectangle2D;
+
+import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
+
+/**
+ * @author pbw
+ * @version $Revision$ $Name$
+ */
+public class AbstractViewport
+extends Area
+implements Viewport {
+
+ /** The viewport rectange */
+ protected Rectangle2D viewArea = null;
+
+ /** Does the viewport rectange clip the reference-area? */
+ protected boolean clip = true;
+
+ /** The reference-area of the viewport/reference pair */
+ protected ReferenceArea refArea;
+
+ /**
+ * @param pageSeq
+ * @param generatedBy
+ * @param parent
+ * @param sync
+ */
+ public AbstractViewport(FoPageSequence pageSeq, FONode generatedBy,
+ Node parent, Object sync) {
+ super(pageSeq, generatedBy, parent, sync);
+ }
+ /**
+ * @param pageSeq
+ * @param generatedBy
+ */
+ public AbstractViewport(FoPageSequence pageSeq, FONode generatedBy) {
+ super(pageSeq, generatedBy);
+ }
+ /**
+ * @param pageSeq
+ * @param generatedBy
+ * @param viewArea the viewport rectangle
+ * @param parent
+ * @param sync
+ */
+ public AbstractViewport(
+ Rectangle2D viewArea,
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(pageSeq, generatedBy, parent, sync);
+ this.viewArea = viewArea;
+ }
+ /**
+ * @param pageSeq
+ * @param generatedBy
+ * @param viewArea the viewport rectangle
+ */
+ public AbstractViewport(
+ Rectangle2D viewArea,
+ FoPageSequence pageSeq,
+ FONode generatedBy) {
+ super(pageSeq, generatedBy);
+ this.viewArea = viewArea;
+ }
+ /* (non-Javadoc)
+ * @see org.apache.fop.area.Viewport#getViewArea()
+ */
+ public Rectangle2D getViewArea() {
+ synchronized (sync) {
+ return viewArea;
+ }
+ }
+ /* (non-Javadoc)
+ * @see org.apache.fop.area.Viewport#setViewArea(java.awt.geom.Rectangle2D)
+ */
+ public void setViewArea(Rectangle2D viewArea) {
+ synchronized (sync) {
+ this.viewArea = viewArea;
+ }
+ }
+ /* (non-Javadoc)
+ * @see org.apache.fop.area.Viewport#setReferenceArea(org.apache.fop.area.ReferenceArea)
+ */
+ public void setReferenceArea(ReferenceArea ref) {
+ synchronized (sync) {
+ refArea = ref;
+ }
+ }
+ /* (non-Javadoc)
+ * @see org.apache.fop.area.Viewport#getReferenceArea()
+ */
+ public ReferenceArea getReferenceArea() {
+ synchronized (sync) {
+ return refArea;
+ }
+ }
+ /* (non-Javadoc)
+ * @see org.apache.fop.area.Viewport#setClip(boolean)
+ */
+ public void setClip(boolean clip) {
+ synchronized (sync) {
+ this.clip = clip;
+ }
+ }
+ /* (non-Javadoc)
+ * @see org.apache.fop.area.Viewport#getClip()
+ */
+ public boolean getClip() {
+ synchronized (sync) {
+ return clip;
+ }
+ }
+
+}
import org.apache.fop.datastructs.Node;
import org.apache.fop.datastructs.SyncedNode;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* @author pbw
*/
public class Area extends SyncedNode implements Cloneable {
+ /** The page-sequence which generated this area. */
+ protected FoPageSequence pageSeq = null;
+ /** The FO node that generated this node. */
+ protected FONode generatedBy = null;
/** Current inline progression dimension. May be unknown. */
protected Integer iPDim = null;
/** Maximum required inline progression dimension. May be unknown. */
protected Integer bPDimMin = null;
/**
+ * @param pageSeq through which this area was generated
+ * @param generatedBy the given <code>FONode</code> generated this
* @param parent <code>Node</code> of this
* @param index of this in children of parent
+ * @param sync the object on which this area is synchronized
* @throws IndexOutOfBoundsException
*/
- public Area(Node parent, int index, Object areaSync)
+ public Area(
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ int index,
+ Object sync)
throws IndexOutOfBoundsException {
- super(parent, index, areaSync);
- // TODO Auto-generated constructor stub
+ super(parent, index, sync);
+ this.pageSeq = pageSeq;
+ this.generatedBy = generatedBy;
}
/**
+ * @param pageSeq through which this area was generated
+ * @param generatedBy the given <code>FONode</code> generated this
* @param parent <code>Node</code> of this
+ * @param sync the object on which this area is synchronized
* @throws IndexOutOfBoundsException
*/
- public Area(Node parent, Object areaSync)
- throws IndexOutOfBoundsException {
- super(parent, areaSync);
- // TODO Auto-generated constructor stub
+ public Area(
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(parent, sync);
+ this.pageSeq = pageSeq;
+ this.generatedBy = generatedBy;
}
/**
* Construct an <code>Area</code> which is the root of a tree, and is
* synchronized on itself
+ * @param pageSeq through which this area was generated
+ * @param generatedBy the given <code>FONode</code> generated this
*/
- public Area() {
+ public Area(
+ FoPageSequence pageSeq,
+ FONode generatedBy) {
super();
+ this.pageSeq = pageSeq;
+ this.generatedBy = generatedBy;
+ }
+
+ /**
+ * @return the generatedBy
+ */
+ public FONode getGeneratedBy() {
+ synchronized (sync) {
+ return generatedBy;
+ }
+ }
+ /**
+ * @param generatedBy to set
+ */
+ public void setGeneratedBy(FONode generatedBy) {
+ synchronized (sync) {
+ this.generatedBy = generatedBy;
+ }
}
/**
* @return the bPDim
*/
public Integer getBPDim() {
- return bPDim;
+ synchronized (sync) {
+ return bPDim;
+ }
}
/**
* @param dim to set
*/
public void setBPDim(Integer dim) {
- bPDim = dim;
+ synchronized (sync) {
+ bPDim = dim;
+ }
}
/**
* @return the bPDimMax
*/
public Integer getBPDimMax() {
- return bPDimMax;
+ synchronized (sync) {
+ return bPDimMax;
+ }
}
/**
* @param dimMax to set
*/
public void setBPDimMax(Integer dimMax) {
- bPDimMax = dimMax;
+ synchronized (sync) {
+ bPDimMax = dimMax;
+ }
}
/**
* @return the bPDimMin
*/
public Integer getBPDimMin() {
- return bPDimMin;
+ synchronized (sync) {
+ return bPDimMin;
+ }
}
/**
* @param dimMin to set
*/
public void setBPDimMin(Integer dimMin) {
- bPDimMin = dimMin;
+ synchronized (sync) {
+ bPDimMin = dimMin;
+ }
}
/**
* @return the iPDim
*/
public Integer getIPDim() {
- return iPDim;
+ synchronized (sync) {
+ return iPDim;
+ }
}
/**
* @param dim to set
*/
public void setIPDim(Integer dim) {
- iPDim = dim;
+ synchronized (sync) {
+ iPDim = dim;
+ }
}
/**
* @return the iPDimMax
*/
public Integer getIPDimMax() {
- return iPDimMax;
+ synchronized(sync) {
+ return iPDimMax;
+ }
}
/**
* @param dimMax to set
*/
public void setIPDimMax(Integer dimMax) {
- iPDimMax = dimMax;
+ synchronized (sync) {
+ iPDimMax = dimMax;
+ }
}
/**
* @return the iPDimMin
*/
public Integer getIPDimMin() {
- return iPDimMin;
+ synchronized (sync) {
+ return iPDimMin;
+ }
}
/**
* @param dimMin to set
*/
public void setIPDimMin(Integer dimMin) {
- iPDimMin = dimMin;
+ synchronized (sync) {
+ iPDimMin = dimMin;
+ }
}
}
package org.apache.fop.area;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* @author pbw
implements ReferenceArea {
/**
+ * @param pageSeq through which this area was generated
* @param parent
- * @param index
* @param areaSync
* @throws IndexOutOfBoundsException
*/
- public BeforeFloatRefArea(Node parent, int index, Object areaSync)
- throws IndexOutOfBoundsException {
- super(parent, index, areaSync);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param parent
- * @param areaSync
- * @throws IndexOutOfBoundsException
- */
- public BeforeFloatRefArea(Node parent, Object areaSync)
- throws IndexOutOfBoundsException {
- super(parent, areaSync);
- // TODO Auto-generated constructor stub
+ public BeforeFloatRefArea(
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object areaSync) {
+ super(pageSeq, generatedBy, parent, areaSync);
}
}
package org.apache.fop.area;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* @author pbw
/**
* @param parent of this node
- * @param index of this in children of parent
- * @throws IndexOutOfBoundsException
*/
- public BlockArea(Node parent, int index, Object areaSync)
- throws IndexOutOfBoundsException {
- super(parent, index, areaSync);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param parent of this node
- * @throws IndexOutOfBoundsException
- */
- public BlockArea(Node parent, Object areaSync)
- throws IndexOutOfBoundsException {
- super(parent, areaSync);
+ public BlockArea(
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(pageSeq, generatedBy, parent, sync);
// TODO Auto-generated constructor stub
}
package org.apache.fop.area;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* @author pbw
/**
* @param parent
- * @param index
- * @throws IndexOutOfBoundsException
*/
- public BlockContainer(Node parent, int index, Object areaSync)
- throws IndexOutOfBoundsException {
- super(parent, index, areaSync);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param parent
- * @throws IndexOutOfBoundsException
- */
- public BlockContainer(Node parent, Object areaSync)
- throws IndexOutOfBoundsException {
- super(parent, areaSync);
+ public BlockContainer(
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object areaSync) {
+ super(pageSeq, generatedBy, parent, areaSync);
// TODO Auto-generated constructor stub
}
package org.apache.fop.area;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* @author pbw
/**
* @param parent
- * @param index
* @param areaSync
* @throws IndexOutOfBoundsException
*/
- public FootnoteRefArea(Node parent, int index, Object areaSync)
+ public FootnoteRefArea(
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object areaSync)
throws IndexOutOfBoundsException {
- super(parent, index, areaSync);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param parent
- * @param areaSync
- * @throws IndexOutOfBoundsException
- */
- public FootnoteRefArea(Node parent, Object areaSync)
- throws IndexOutOfBoundsException {
- super(parent, areaSync);
- // TODO Auto-generated constructor stub
+ super(pageSeq, generatedBy, parent, areaSync);
}
}
import java.util.List;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* The main body reference area.
extends AbstractReferenceArea
implements ReferenceArea {
private List spanAreas = new java.util.ArrayList();
- private int columnGap;
- private int width;
/**
* @param parent
* @param areaSync
* @throws IndexOutOfBoundsException
*/
- public MainReferenceArea(Node parent, Object areaSync)
- throws IndexOutOfBoundsException {
- super(parent, areaSync);
- // TODO Auto-generated constructor stub
+ public MainReferenceArea(
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object areaSync) {
+ super(pageSeq, generatedBy, parent, areaSync);
}
/**
return spanAreas;
}
- /**
- * Get the column gap in millipoints.
- *
- * @return the column gap in millioints
- */
- public int getColumnGap() {
- return columnGap;
- }
-
- /**
- * Get the width of this reference area.
- *
- * @return the width
- */
- public int getWidth() {
- return width;
- }
-
}
--- /dev/null
+/*
+ *
+ * Copyright 2004 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.
+ *
+ * Created on 28/02/2004
+ * $Id$
+ */
+package org.apache.fop.area;
+
+import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
+
+/**
+ * @author pbw
+ * @version $Revision$ $Name$
+ */
+public class NormalFlowRefArea extends AbstractReferenceArea
+ implements
+ ReferenceArea {
+ /**
+ * @param pageSeq
+ * @param generatedBy
+ * @param parent
+ * @param sync
+ */
+ public NormalFlowRefArea(FoPageSequence pageSeq, FONode generatedBy,
+ Node parent, Object sync) {
+ super(pageSeq, generatedBy, parent, sync);
+ // TODO Auto-generated constructor stub
+ }
+}
/*
- * $Id$
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modifica-
- * tion, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
+ * Copyright 1999-2004 The Apache Software Foundation.
*
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
+ * 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
*
- * 3. The end-user documentation included with the redistribution, if any, must
- * include the following acknowledgment: "This product includes software
- * developed by the Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself, if
- * and wherever such third-party acknowledgments normally appear.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 4. The names "FOP" and "Apache Software Foundation" must not be used to
- * endorse or promote products derived from this software without prior
- * written permission. For written permission, please contact
- * apache@apache.org.
+ * 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.
*
- * 5. Products derived from this software may not be called "Apache", nor may
- * "Apache" appear in their name, without prior written permission of the
- * Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * ============================================================================
- *
- * This software consists of voluntary contributions made by many individuals
- * on behalf of the Apache Software Foundation and was originally created by
- * James Tauber <jtauber@jtauber.com>. For more information on the Apache
- * Software Foundation, please see <http://www.apache.org/>.
+ * $Id$
*/
package org.apache.fop.area;
import java.util.Map;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* The page.
* memory if there are forward references.
* The page is cloneable so the page master can make copies of
* the top level page and regions.
+ *
+ * @author The Apache XML-FOP sub-project
+ * @author pbw
+ * @version $Revision$ $Name$
*/
public class PageRefArea
extends AbstractReferenceArea
// temporary map of unresolved objects used when serializing the page
private Map unresolved = null;
- public PageRefArea(Node parent, Object sync) {
- super(parent, sync);
+ public PageRefArea(
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(pageSeq, generatedBy, parent, sync);
}
/**
package org.apache.fop.area;
import java.awt.geom.Rectangle2D;
+import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.Iterator;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
import org.apache.fop.fo.properties.RetrievePosition;
/**
* The page reference area is then rendered inside the PageRefArea object
*/
public class PageViewport
-extends Area
-implements Viewport, Resolveable, Cloneable {
+extends AbstractViewport
+implements Viewport, Resolveable {
+ /** Unique ID for this page. 0 is an invalid ID. */
private long pageId = 0;
- private PageRefArea pageRefArea;
- private Rectangle2D viewArea;
- private boolean clip = false;
+ /** The formatted page number */
private String pageNumber = null;
// list of id references and the rectangle on the page
* @param p the page reference area for the contents of this page
* @param bounds the dimensions of the viewport
*/
- public PageViewport(long pageId, PageRefArea p, Rectangle2D bounds) {
- super();
+ public PageViewport(
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ long pageId,
+ Rectangle2D bounds,
+ PageRefArea p) {
+ super(bounds, pageSeq, generatedBy);
this.pageId = pageId;
- pageRefArea = p;
- viewArea = bounds;
+ refArea = p;
}
/**
* @param bounds the dimensions of the viewport
*/
public PageViewport(
- Node parent, Object sync, long pageId,
- PageRefArea p, Rectangle2D bounds) {
- super(parent, sync);
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ long pageId,
+ Rectangle2D bounds,
+ PageRefArea p,
+ Node parent,
+ Object sync) {
+ super(bounds, pageSeq, generatedBy, parent, sync);
this.pageId = pageId;
- pageRefArea = p;
- viewArea = bounds;
+ refArea = p;
}
/**
* @param sync
* @param pageId
*/
- public PageViewport(Node parent, Object sync, long pageId) {
- super(parent, sync);
+ public PageViewport(
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ long pageId,
+ Node parent,
+ Object sync) {
+ super(pageSeq, generatedBy, parent, sync);
this.pageId = pageId;
- pageRefArea = null;
+ refArea = null;
viewArea = null;
}
-
+
/**
- * Set if this viewport should clip.
- * @param c true if this viewport should clip
+ * @return the pageId
*/
- public void setClip(boolean c) {
- clip = c;
+ public long getPageId() {
+ synchronized (sync) {
+ return pageId;
+ }
}
/**
- * Get the view area rectangle of this viewport.
- * @return the rectangle for this viewport
+ * @param pageId to set
*/
- public Rectangle2D getViewArea() {
- return viewArea;
+ public void setPageId(long pageId) {
+ synchronized (sync) {
+ this.pageId = pageId;
+ }
}
-
+
/**
* Get the page reference area with the contents.
* @return the page reference area
*/
public PageRefArea getPageRefArea() {
- return pageRefArea;
+ synchronized (sync) {
+ return (PageRefArea)getReferenceArea();
+ }
}
/**
* @param num the string representing the page number
*/
public void setPageNumber(String num) {
- pageNumber = num;
+ synchronized (sync) {
+ pageNumber = num;
+ }
}
/**
* @return the string that represents this page
*/
public String getPageNumber() {
- return pageNumber;
+ synchronized (sync) {
+ return pageNumber;
+ }
}
/**
* @param res the resolver of the reference
*/
public void addUnresolvedID(String id, Resolveable res) {
- if (unresolved == null) {
- unresolved = new HashMap();
- }
- List list = (List)unresolved.get(id);
- if (list == null) {
- list = new ArrayList();
- unresolved.put(id, list);
+ synchronized (sync) {
+ if (unresolved == null) {
+ unresolved = new HashMap();
+ }
+ List list = (List)unresolved.get(id);
+ if (list == null) {
+ list = new ArrayList();
+ unresolved.put(id, list);
+ }
+ list.add(res);
}
- list.add(res);
}
/**
* @return true if the page is resolved and can be rendered
*/
public boolean isResolved() {
- return unresolved == null;
+ synchronized (sync) {
+ return unresolved == null;
+ }
}
/**
* may be null if not found
*/
public void resolve(String id, List pages) {
- if (pageRefArea == null) {
- if (pendingResolved == null) {
- pendingResolved = new HashMap();
- }
- pendingResolved.put(id, pages);
- } else {
- if (unresolved != null) {
- List todo = (List)unresolved.get(id);
- if (todo != null) {
- for (int count = 0; count < todo.size(); count++) {
- Resolveable res = (Resolveable)todo.get(count);
- res.resolve(id, pages);
+ synchronized (sync) {
+ if (refArea == null) {
+ if (pendingResolved == null) {
+ pendingResolved = new HashMap();
+ }
+ pendingResolved.put(id, pages);
+ } else {
+ if (unresolved != null) {
+ List todo = (List)unresolved.get(id);
+ if (todo != null) {
+ for (int count = 0; count < todo.size(); count++) {
+ Resolveable res = (Resolveable)todo.get(count);
+ res.resolve(id, pages);
+ }
}
}
}
- }
- if (unresolved != null) {
- unresolved.remove(id);
- if (unresolved.isEmpty()) {
- unresolved = null;
+ if (unresolved != null) {
+ unresolved.remove(id);
+ if (unresolved.isEmpty()) {
+ unresolved = null;
+ }
}
}
}
* @param isfirst isfirst or islast flag
*/
public void addMarkers(Map marks, boolean start, boolean isfirst) {
- if (start) {
- if (isfirst) {
- if (markerFirstStart == null) {
- markerFirstStart = new HashMap();
- }
- if (markerFirstAny == null) {
- markerFirstAny = new HashMap();
- }
- // only put in new values, leave current
- for (Iterator iter = marks.keySet().iterator(); iter.hasNext();) {
- Object key = iter.next();
- if (!markerFirstStart.containsKey(key)) {
- markerFirstStart.put(key, marks.get(key));
+ synchronized (sync) {
+ if (start) {
+ if (isfirst) {
+ if (markerFirstStart == null) {
+ markerFirstStart = new HashMap();
}
- if (!markerFirstAny.containsKey(key)) {
- markerFirstAny.put(key, marks.get(key));
+ if (markerFirstAny == null) {
+ markerFirstAny = new HashMap();
+ }
+ // only put in new values, leave current
+ for (
+ Iterator iter = marks.keySet().iterator();
+ iter.hasNext();
+ ) {
+ Object key = iter.next();
+ if (!markerFirstStart.containsKey(key)) {
+ markerFirstStart.put(key, marks.get(key));
+ }
+ if (!markerFirstAny.containsKey(key)) {
+ markerFirstAny.put(key, marks.get(key));
+ }
+ }
+ if (markerLastStart == null) {
+ markerLastStart = new HashMap();
+ }
+ // replace all
+ markerLastStart.putAll(marks);
+
+ } else {
+ if (markerFirstAny == null) {
+ markerFirstAny = new HashMap();
+ }
+ // only put in new values, leave current
+ for (Iterator iter = marks.keySet().iterator(); iter.hasNext();) {
+ Object key = iter.next();
+ if (!markerFirstAny.containsKey(key)) {
+ markerFirstAny.put(key, marks.get(key));
+ }
}
}
- if (markerLastStart == null) {
- markerLastStart = new HashMap();
- }
- // replace all
- markerLastStart.putAll(marks);
-
} else {
- if (markerFirstAny == null) {
- markerFirstAny = new HashMap();
- }
- // only put in new values, leave current
- for (Iterator iter = marks.keySet().iterator(); iter.hasNext();) {
- Object key = iter.next();
- if (!markerFirstAny.containsKey(key)) {
- markerFirstAny.put(key, marks.get(key));
+ if (!isfirst) {
+ if (markerLastEnd == null) {
+ markerLastEnd = new HashMap();
}
+ // replace all
+ markerLastEnd.putAll(marks);
}
- }
- } else {
- if (!isfirst) {
- if (markerLastEnd == null) {
- markerLastEnd = new HashMap();
+ if (markerLastAny == null) {
+ markerLastAny = new HashMap();
}
// replace all
- markerLastEnd.putAll(marks);
- }
- if (markerLastAny == null) {
- markerLastAny = new HashMap();
+ markerLastAny.putAll(marks);
}
- // replace all
- markerLastAny.putAll(marks);
}
}
* @return Object the marker found or null
*/
public Object getMarker(String name, int pos) {
- Object mark = null;
- switch (pos) {
- case RetrievePosition.FIRST_STARTING_WITHIN_PAGE:
- if (markerFirstStart != null) {
- mark = markerFirstStart.get(name);
- }
+ synchronized (sync) {
+ Object mark = null;
+ switch (pos) {
+ case RetrievePosition.FIRST_STARTING_WITHIN_PAGE:
+ if (markerFirstStart != null) {
+ mark = markerFirstStart.get(name);
+ }
if (mark == null && markerFirstAny != null) {
mark = markerFirstAny.get(name);
}
- break;
- case RetrievePosition.FIRST_INCLUDING_CARRYOVER:
- if (markerFirstAny != null) {
- mark = markerFirstAny.get(name);
- }
- break;
- case RetrievePosition.LAST_STARTING_WITHIN_PAGE:
- if (markerLastStart != null) {
- mark = markerLastStart.get(name);
- }
+ break;
+ case RetrievePosition.FIRST_INCLUDING_CARRYOVER:
+ if (markerFirstAny != null) {
+ mark = markerFirstAny.get(name);
+ }
+ break;
+ case RetrievePosition.LAST_STARTING_WITHIN_PAGE:
+ if (markerLastStart != null) {
+ mark = markerLastStart.get(name);
+ }
if (mark == null && markerLastAny != null) {
mark = markerLastAny.get(name);
}
- break;
- case RetrievePosition.LAST_ENDING_WITHIN_PAGE:
- if (markerLastEnd != null) {
- mark = markerLastEnd.get(name);
- }
+ break;
+ case RetrievePosition.LAST_ENDING_WITHIN_PAGE:
+ if (markerLastEnd != null) {
+ mark = markerLastEnd.get(name);
+ }
if (mark == null && markerLastAny != null) {
mark = markerLastAny.get(name);
}
- break;
+ break;
+ }
+ return mark;
}
- return mark;
}
/**
* The map of unresolved references are set on the pageRefArea so that
* the resolvers can be properly serialized and reloaded.
* @param out the object output stream to write the contents
- * @throws Exception if there is a problem saving the pageRefArea
*/
- public void savePage(ObjectOutputStream out) throws Exception {
+ public void savePage(ObjectOutputStream out) {
// set the unresolved references so they are serialized
- pageRefArea.setUnresolvedReferences(unresolved);
- out.writeObject(pageRefArea);
- pageRefArea = null;
+ synchronized (sync) {
+ ((PageRefArea)refArea).setUnresolvedReferences(unresolved);
+ try {
+ out.writeObject(refArea);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ refArea = null;
+ }
}
/**
* @throws Exception if there is an error loading the pageRefArea
*/
public void loadPage(ObjectInputStream in) throws Exception {
- pageRefArea = (PageRefArea) in.readObject();
- unresolved = pageRefArea.getUnresolvedReferences();
- if (unresolved != null && pendingResolved != null) {
- for (Iterator iter = pendingResolved.keySet().iterator();
- iter.hasNext();) {
- String id = (String) iter.next();
- resolve(id, (List)pendingResolved.get(id));
+ synchronized (sync) {
+ PageRefArea pageRefArea = (PageRefArea) in.readObject();
+ refArea = pageRefArea;
+ unresolved = pageRefArea.getUnresolvedReferences();
+ if (unresolved != null && pendingResolved != null) {
+ for (Iterator iter = pendingResolved.keySet().iterator();
+ iter.hasNext();) {
+ String id = (String) iter.next();
+ resolve(id, (List)pendingResolved.get(id));
+ }
+ pendingResolved = null;
}
- pendingResolved = null;
}
}
* @return a copy of this page and associated viewports
*/
public Object clone() {
- PageViewport pv;
- try {
- pv = (PageViewport)(super.clone());
- } catch (CloneNotSupportedException e) {
- throw new RuntimeException(e);
+ synchronized (sync) {
+ PageViewport pv;
+ try {
+ pv = (PageViewport)(super.clone());
+ } catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e);
+ }
+ pageId = 0; // N.B. This invalidates the page id
+ pv.refArea = (PageRefArea)(refArea.clone());
+ return pv;
}
- pageId = 0; // N.B. This invalidates the page id
- pv.pageRefArea = (PageRefArea)pageRefArea.clone();
- return pv;
}
/**
* it holds id and marker information and is used as a key.
*/
public void clear() {
- pageRefArea = null;
+ synchronized (sync) {
+ refArea = null;
+ }
}
/**
* @see java.lang.Object#toString()
*/
public String toString() {
- StringBuffer sb = new StringBuffer(64);
- sb.append("PageViewport: page=");
- sb.append(getPageNumber());
- return sb.toString();
+ synchronized (sync) {
+ StringBuffer sb = new StringBuffer(64);
+ sb.append("PageViewport: page=");
+ sb.append(getPageNumber());
+ return sb.toString();
+ }
}
}
* @return the current transformer to position this reference area.
*/
public CoordTransformer getCoordTransformer();
+
+ public Object clone();
}
package org.apache.fop.area;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* @author pbw
* @param parent
* @param sync
*/
- public RegionAfterRefArea(Node parent, Object sync) {
- super(parent, sync);
+ public RegionAfterRefArea(
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(pageSeq, generatedBy, parent, sync);
// TODO Auto-generated constructor stub
}
import java.awt.geom.Rectangle2D;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* @author pbw
* @param sync
* @param viewArea
*/
- public RegionAfterVport(Node parent, Object sync, Rectangle2D viewArea) {
- super(parent, sync, viewArea);
- // TODO Auto-generated constructor stub
+ public RegionAfterVport(
+ Rectangle2D viewArea,
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(viewArea, pageSeq, generatedBy, parent, sync);
}
}
package org.apache.fop.area;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* @author pbw
* @param parent
* @param sync
*/
- public RegionBeforeRefArea(Node parent, Object sync) {
- super(parent, sync);
- // TODO Auto-generated constructor stub
+ public RegionBeforeRefArea(
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(pageSeq, generatedBy, parent, sync);
}
}
import java.awt.geom.Rectangle2D;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* @author pbw
* @param sync
* @param viewArea
*/
- public RegionBeforeVport(Node parent, Object sync, Rectangle2D viewArea) {
- super(parent, sync, viewArea);
+ public RegionBeforeVport(
+ Rectangle2D viewArea,
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(viewArea, pageSeq, generatedBy, parent, sync);
// TODO Auto-generated constructor stub
}
package org.apache.fop.area;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* The body region area.
* Create a new body region area.
* This sets the region reference area class to BODY.
*/
- public RegionBodyRefArea(Node parent, Object sync) {
- super(parent, sync);
+ public RegionBodyRefArea(
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(pageSeq, generatedBy, parent, sync);
+ }
+
+ /**
+ * Create a new body region area.
+ * This sets the region reference area class to BODY.
+ */
+ public RegionBodyRefArea(
+ int columnCount,
+ int columnGap,
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(pageSeq, generatedBy, parent, sync);
+ this.columnCount = columnCount;
+ this.columnGap = columnGap;
}
/**
* @param colCount the number of columns
*/
public void setColumnCount(int colCount) {
- this.columnCount = colCount;
+ synchronized (sync) {
+ this.columnCount = colCount;
+ }
}
/**
* @return the number of columns
*/
public int getColumnCount() {
- return this.columnCount;
+ synchronized (sync) {
+ return this.columnCount;
+ }
}
/**
* @param colGap the column gap in millipoints
*/
public void setColumnGap(int colGap) {
- this.columnGap = colGap;
+ synchronized (sync) {
+ this.columnGap = colGap;
+ }
}
+ /**
+ * @return the columnGap
+ */
+ public int getColumnGap() {
+ synchronized (sync) {
+ return columnGap;
+ }
+ }
/**
* Set the before float area.
*
* @param mr the main reference area
*/
public void setMainReference(MainReferenceArea mr) {
- mainReference = mr;
+ synchronized (sync) {
+ mainReference = mr;
+ }
}
/**
* @return the main reference area
*/
public MainReferenceArea getMainReference() {
- return mainReference;
+ synchronized (sync) {
+ return mainReference;
+ }
}
/**
* @return a shallow copy of this object
*/
public Object clone() {
- RegionBodyRefArea br = (RegionBodyRefArea)(super.clone());
- br.columnGap = columnGap;
- br.columnCount = columnCount;
- //br.beforeFloat = beforeFloat;
- br.mainReference = mainReference;
- //br.footnote = footnote;
- return br;
+ synchronized (sync) {
+ RegionBodyRefArea br = (RegionBodyRefArea)(super.clone());
+ br.columnGap = columnGap;
+ br.columnCount = columnCount;
+ //br.beforeFloat = beforeFloat;
+ br.mainReference = mainReference;
+ //br.footnote = footnote;
+ return br;
+ }
}
}
import java.awt.geom.Rectangle2D;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* @author pbw
* @param sync
* @param viewArea
*/
- public RegionBodyVport(Node parent, Object sync, Rectangle2D viewArea) {
- super(parent, sync, viewArea);
- // TODO Auto-generated constructor stub
+ public RegionBodyVport(
+ Rectangle2D viewArea,
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(viewArea, pageSeq, generatedBy, parent, sync);
}
}
package org.apache.fop.area;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* @author pbw
* @version $Revision$ $Name$
*/
-public class RegionEndRefArea extends RegionRefArea implements ReferenceArea {
+public class RegionEndRefArea
+extends RegionRefArea
+implements ReferenceArea {
/**
* @param parent
* @param sync
*/
- public RegionEndRefArea(Node parent, Object sync) {
- super(parent, sync);
- // TODO Auto-generated constructor stub
+ public RegionEndRefArea(
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(pageSeq, generatedBy, parent, sync);
}
}
import java.awt.geom.Rectangle2D;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* @author pbw
* @param sync
* @param viewArea
*/
- public RegionEndVport(Node parent, Object sync, Rectangle2D viewArea) {
- super(parent, sync, viewArea);
- // TODO Auto-generated constructor stub
+ public RegionEndVport(
+ Rectangle2D viewArea,
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(viewArea, pageSeq, generatedBy, parent, sync);
}
}
import java.util.List;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* This is an abstract reference area for the page regions - currently
/**
* Create a new region reference area.
*/
- public RegionRefArea(Node parent, Object sync) {
- super(parent, sync);
+ public RegionRefArea(
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(pageSeq, generatedBy, parent, sync);
}
/**
package org.apache.fop.area;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* @author pbw
* @param parent
* @param sync
*/
- public RegionStartRefArea(Node parent, Object sync) {
- super(parent, sync);
+ public RegionStartRefArea(
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(pageSeq, generatedBy, parent, sync);
// TODO Auto-generated constructor stub
}
import java.awt.geom.Rectangle2D;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* @author pbw
* @param sync
* @param viewArea
*/
- public RegionStartVport(Node parent, Object sync, Rectangle2D viewArea) {
- super(parent, sync, viewArea);
- // TODO Auto-generated constructor stub
+ public RegionStartVport(
+ Rectangle2D viewArea,
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(viewArea, pageSeq, generatedBy, parent, sync);
}
}
/*
+ * Copyright 1999-2004 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: RegionViewport.java,v 1.9 2003/03/05 15:19:31 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modifica-
- * tion, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any, must
- * include the following acknowledgment: "This product includes software
- * developed by the Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself, if
- * and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "FOP" and "Apache Software Foundation" must not be used to
- * endorse or promote products derived from this software without prior
- * written permission. For written permission, please contact
- * apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache", nor may
- * "Apache" appear in their name, without prior written permission of the
- * Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * ============================================================================
- *
- * This software consists of voluntary contributions made by many individuals
- * on behalf of the Apache Software Foundation and was originally created by
- * James Tauber <jtauber@jtauber.com>. For more information on the Apache
- * Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.fop.area;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* Region Viewport reference area.
* This area is the viewport for a region and contains a region area.
*/
-public class RegionViewport extends Area implements Viewport, Cloneable {
+public class RegionViewport
+extends AbstractViewport
+implements Viewport, Cloneable {
// this rectangle is relative to the page
- private RegionRefArea region;
- private Rectangle2D viewArea;
- private boolean clip = false;
/**
* Create a new region viewport.
*
* @param viewArea the view area of this viewport
*/
- public RegionViewport(Node parent, Object sync, Rectangle2D viewArea) {
- super(parent, sync);
- this.viewArea = viewArea;
+ public RegionViewport(
+ Rectangle2D viewArea,
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(viewArea, pageSeq, generatedBy, parent, sync);
}
/**
- * Set the region for this region viewport.
+ * Set the region-regerence-area for this region viewport.
*
- * @param reg the child region inside this viewport
+ * @param regRef the child region inside this viewport
*/
- public void setRegion(RegionRefArea reg) {
- region = reg;
+ public void setRegion(RegionRefArea regRef) {
+ setReferenceArea(regRef);
}
/**
* @return the child region inside this viewport
*/
public RegionRefArea getRegion() {
- return region;
- }
-
- /**
- * Set the clipping for this region viewport.
- *
- * @param c the clipping value
- */
- public void setClip(boolean c) {
- clip = c;
- }
-
- /**
- * Get the view area of this viewport.
- *
- * @return the viewport rectangle area
- */
- public Rectangle2D getViewArea() {
- return viewArea;
+ return (RegionRefArea)(getReferenceArea());
}
/**
out.writeFloat((float) viewArea.getHeight());
out.writeBoolean(clip);
//out.writeObject(props);
- out.writeObject(region);
+ out.writeObject(refArea);
}
private void readObject(java.io.ObjectInputStream in)
* @return a new copy of this region viewport
*/
public Object clone() {
- RegionViewport rv =
- new RegionViewport(parent, sync, (Rectangle2D)viewArea.clone());
- rv.region = (RegionRefArea)region.clone();
-// if (props != null) {
-// rv.props = (HashMap)props.clone();
-// }
- return rv;
+ synchronized (sync) {
+ RegionViewport rv;
+ try {
+ rv = (RegionViewport)(super.clone());
+ } catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e);
+ }
+ rv.viewArea = (Rectangle2D)(viewArea.clone());
+ rv.refArea = (PageRefArea)(refArea.clone());
+ return rv;
+ }
}
+
}
import java.io.Serializable;
import java.util.List;
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datastructs.Node;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.FoPageSequence;
/**
* The span reference areas are children of the main-reference-area
public class Span
extends AbstractReferenceArea
implements ReferenceArea, Serializable {
- // the list of flow reference areas in this span area
+ // the list of normal-flow-reference-areas in this span area
private List flowAreas;
- private Integer cols;
+ private NormalFlowRefArea currentFlowArea = null;
+
+ /**
+ * Number of columns in this span. Derived from the <code>span</code>
+ * property on the fo:flow and the column-count prooperty on the
+ * region-body-reference-area. Defaults to 1.
+ */
+ private int columnCount = 1;
/**
- * Create a span area with the number of columns for this span area.
- *
- * @param cols the number of columns in the span
+ * Create a span area with the number of columns for .
+ * Span-reference-areas are children of main-reference-areas.
*/
- public Span(Node parent, Object sync, Integer cols) {
- super(parent, sync);
- this.cols = cols;
+ public Span(
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(pageSeq, generatedBy, parent, sync);
}
/**
- * Get the column count for this span area.
- *
- * @return the number of columns in this span area
+ * Create a span area with the number of columns for .
+ * Span-reference-areas are children of main-reference-areas.
*/
- public Integer getColumnCount() {
- return cols;
+ public Span(
+ int columnCount,
+ FoPageSequence pageSeq,
+ FONode generatedBy,
+ Node parent,
+ Object sync) {
+ super(pageSeq, generatedBy, parent, sync);
+ this.columnCount = columnCount;
}
+ /**
+ * @return the column count
+ */
+ public int getColumnCount() {
+ synchronized (sync) {
+ return columnCount;
+ }
+ }
+ /**
+ * Set spanning condition, only if no main-reference-area exists
+ */
+ public void setColumnCount(int columnCount) throws FOPException {
+ if (flowAreas == null) {
+ this.columnCount = columnCount;
+ }
+ else {
+ throw new FOPException("normal-flow-reference-areas exist");
+ }
+ }
+
+ public boolean activeFlowRefAreas() {
+ if (flowAreas == null && currentFlowArea == null) {
+ return false;
+ }
+ return true;
+ }
}
*/
package org.apache.fop.area;
+import java.awt.geom.Rectangle2D;
+
/**
* @author pbw
* @version $Revision$ $Name$
*/
-public interface Viewport {
+public interface Viewport extends Cloneable {
+
+ /**
+ * @return the view area rectangle for this viewport
+ */
+ public abstract Rectangle2D getViewArea();
+
+ /**
+ * @param viewArea to set
+ */
+ public abstract void setViewArea(Rectangle2D viewArea);
+
+ /**
+ * Sets the reference-area of this viewport/reference pair
+ * @param ref
+ */
+ public abstract void setReferenceArea(ReferenceArea ref);
+
+ /**
+ * @return the reference-area of this viewport/reference pair
+ */
+ public abstract ReferenceArea getReferenceArea();
+ /**
+ * @param clip does this viewport clip its reference area?
+ */
+ public abstract void setClip(boolean clip);
+
+ /**
+ * @return whether this viewport clips its reference area
+ */
+ public abstract boolean getClip();
}
--- /dev/null
+/*
+ *
+ * Copyright 2004 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.
+ *
+ * Created on 27/02/2004
+ * $Id$
+ */
+package org.apache.fop.area;
+import java.awt.geom.Rectangle2D;
+/**
+ * @author pbw
+ * @version $Revision$ $Name$
+ */
+public interface ViewportI {
+ /**
+ * Set if this viewport should clip.
+ * @param c true if this viewport should clip
+ */
+ public abstract void setClip(boolean c);
+ /**
+ * Get the view area rectangle of this viewport.
+ * @return the rectangle for this viewport
+ * TODO Thread safety
+ */
+ public abstract Rectangle2D getViewArea();
+ /**
+ * @param viewArea to set
+ */
+ public abstract void setViewArea(Rectangle2D viewArea);
+ /**
+ * Get the page reference area with the contents.
+ * @return the page reference area
+ * TODO Thread safety
+ */
+ public abstract PageRefArea getPageRefArea();
+}
\ No newline at end of file