You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2007/12/27 11:47:33 UTC
svn commit: r607034 [2/2] - in
/xmlgraphics/fop/branches/Temp_ImagePackageRedesign: ./
src/documentation/content/xdocs/trunk/ src/java/org/apache/fop/apps/
src/java/org/apache/fop/area/ src/java/org/apache/fop/fo/
src/java/org/apache/fop/fo/extensions/...
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java?rev=607034&r1=607033&r2=607034&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java Thu Dec 27 02:47:12 2007
@@ -21,61 +21,26 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.fop.datatypes.Numeric;
import org.apache.fop.area.AreaTreeHandler;
-import org.apache.fop.area.AreaTreeModel;
-import org.apache.fop.area.IDTracker;
-import org.apache.fop.area.PageViewport;
import org.apache.fop.area.LineArea;
-import org.apache.fop.area.Resolvable;
-
-import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.flow.Marker;
-import org.apache.fop.fo.flow.RetrieveMarker;
-
import org.apache.fop.fo.pagination.PageSequence;
import org.apache.fop.fo.pagination.PageSequenceMaster;
import org.apache.fop.fo.pagination.SideRegion;
import org.apache.fop.fo.pagination.StaticContent;
import org.apache.fop.layoutmgr.inline.ContentLayoutManager;
-import java.util.List;
-
/**
* LayoutManager for a PageSequence. This class is instantiated by
* area.AreaTreeHandler for each fo:page-sequence found in the
* input document.
*/
-public class PageSequenceLayoutManager extends AbstractLayoutManager {
+public class PageSequenceLayoutManager extends AbstractPageSequenceLayoutManager {
private static Log log = LogFactory.getLog(PageSequenceLayoutManager.class);
- /**
- * AreaTreeHandler which activates the PSLM and controls
- * the rendering of its pages.
- */
- private AreaTreeHandler areaTreeHandler;
-
- /**
- * fo:page-sequence formatting object being
- * processed by this class
- */
- private PageSequence pageSeq;
-
private PageProvider pageProvider;
- private IDTracker idTracker;
-
- /**
- * Current page with page-viewport-area being filled by
- * the PSLM.
- */
- private Page curPage;
-
- private int startPageNum = 0;
- private int currentPageNum = 0;
-
/**
* Constructor
*
@@ -83,20 +48,10 @@
* @param pseq fo:page-sequence to process
*/
public PageSequenceLayoutManager(AreaTreeHandler ath, PageSequence pseq) {
- super(pseq);
- this.areaTreeHandler = ath;
- this.idTracker = ath.getIDTracker();
- this.pageSeq = pseq;
+ super(ath, pseq);
this.pageProvider = new PageProvider(ath, pseq);
}
- /**
- * @return the LayoutManagerMaker object associated to the areaTreeHandler
- */
- public LayoutManagerMaker getLayoutManagerMaker() {
- return areaTreeHandler.getLayoutManagerMaker();
- }
-
/** @return the PageProvider applicable to this page-sequence. */
public PageProvider getPageProvider() {
return this.pageProvider;
@@ -106,25 +61,27 @@
* @return the PageSequence being managed by this layout manager
*/
protected PageSequence getPageSequence() {
- return pageSeq;
+ return (PageSequence)pageSeq;
}
/**
- * Activate the layout of this page sequence.
- * PageViewports corresponding to each page generated by this
- * page sequence will be created and sent to the AreaTreeModel
- * for rendering.
+ * Provides access to this object
+ * @return this PageSequenceLayoutManager instance
*/
+ public PageSequenceLayoutManager getPSLM() {
+ return this;
+ }
+
+ /** {@inheritDoc} */
public void activateLayout() {
- startPageNum = pageSeq.getStartingPageNumber();
- currentPageNum = startPageNum - 1;
+ initialize();
LineArea title = null;
- if (pageSeq.getTitleFO() != null) {
+ if (getPageSequence().getTitleFO() != null) {
try {
ContentLayoutManager clm = getLayoutManagerMaker().
- makeContentLayoutManager(this, pageSeq.getTitleFO());
+ makeContentLayoutManager(this, getPageSequence().getTitleFO());
title = (LineArea) clm.getParentArea(null);
} catch (IllegalStateException e) {
// empty title; do nothing
@@ -145,9 +102,7 @@
finishPage();
}
- /**
- * Finished the page-sequence and notifies everyone about it.
- */
+ /** {@inheritDoc} */
public void finishPageSequence() {
if (pageSeq.hasId()) {
idTracker.signalIDProcessed(pageSeq.getId());
@@ -157,11 +112,11 @@
(currentPageNum - startPageNum) + 1);
areaTreeHandler.notifyPageSequenceFinished(pageSeq,
(currentPageNum - startPageNum) + 1);
- pageSeq.releasePageSequence();
+ getPageSequence().releasePageSequence();
// If this sequence has a page sequence master so we must reset
// it in preparation for the next sequence
- String masterReference = pageSeq.getMasterReference();
+ String masterReference = getPageSequence().getMasterReference();
PageSequenceMaster pageSeqMaster
= pageSeq.getRoot().getLayoutMasterSet().getPageSequenceMaster(masterReference);
if (pageSeqMaster != null) {
@@ -173,229 +128,18 @@
}
}
- /**
- * Provides access to the current page.
- * @return the current Page
- */
- public Page getCurrentPage() {
- return curPage;
- }
-
- /**
- * Provides access for setting the current page.
- * @param currentPage the new current Page
- */
- protected void setCurrentPage(Page currentPage) {
- this.curPage = currentPage;
- }
-
- /**
- * Provides access to the current page number
- * @return the current page number
- */
- protected int getCurrentPageNum() {
- return currentPageNum;
- }
-
- /**
- * Provides access to the current page viewport.
- * @return the current PageViewport
- *//*
- public PageViewport getCurrentPageViewport() {
- return curPage.getPageViewport();
- }*/
-
- /**
- * Provides access to this object
- * @return this PageSequenceLayoutManager instance
- */
- public PageSequenceLayoutManager getPSLM() {
- return this;
+ /** {@inheritDoc} */
+ protected Page createPage(int pageNumber, boolean isBlank) {
+ return pageProvider.getPage(isBlank,
+ pageNumber, PageProvider.RELTO_PAGE_SEQUENCE);
}
- /**
- * This returns the first PageViewport that contains an id trait
- * matching the idref argument, or null if no such PV exists.
- *
- * @param idref the idref trait needing to be resolved
- * @return the first PageViewport that contains the ID trait
- */
- public PageViewport getFirstPVWithID(String idref) {
- List list = idTracker.getPageViewportsContainingID(idref);
- if (list != null && list.size() > 0) {
- return (PageViewport) list.get(0);
- }
- return null;
- }
-
- /**
- * This returns the last PageViewport that contains an id trait
- * matching the idref argument, or null if no such PV exists.
- *
- * @param idref the idref trait needing to be resolved
- * @return the last PageViewport that contains the ID trait
- */
- public PageViewport getLastPVWithID(String idref) {
- List list = idTracker.getPageViewportsContainingID(idref);
- if (list != null && list.size() > 0) {
- return (PageViewport) list.get(list.size() - 1);
- }
- return null;
- }
-
- /**
- * Add an ID reference to the current page.
- * When adding areas the area adds its ID reference.
- * For the page layout manager it adds the id reference
- * with the current page to the area tree.
- *
- * @param id the ID reference to add
- */
- public void addIDToPage(String id) {
- if (id != null && id.length() > 0) {
- idTracker.associateIDWithPageViewport(id, curPage.getPageViewport());
- }
- }
-
- /**
- * Add an id reference of the layout manager in the AreaTreeHandler,
- * if the id hasn't been resolved yet
- * @param id the id to track
- * @return a boolean indicating if the id has already been resolved
- * TODO Maybe give this a better name
- */
- public boolean associateLayoutManagerID(String id) {
- if (log.isDebugEnabled()) {
- log.debug("associateLayoutManagerID(" + id + ")");
- }
- if (!idTracker.alreadyResolvedID(id)) {
- idTracker.signalPendingID(id);
- return false;
- } else {
- return true;
- }
- }
-
- /**
- * Notify the areaTreeHandler that the LayoutManagers containing
- * idrefs have finished creating areas
- * @param id the id for which layout has finished
- */
- public void notifyEndOfLayout(String id) {
- idTracker.signalIDProcessed(id);
- }
-
- /**
- * Identify an unresolved area (one needing an idref to be
- * resolved, e.g. the internal-destination of an fo:basic-link)
- * for both the AreaTreeHandler and PageViewport object.
- *
- * The IDTracker keeps a document-wide list of idref's
- * and the PV's needing them to be resolved. It uses this to
- * send notifications to the PV's when an id has been resolved.
- *
- * The PageViewport keeps lists of id's needing resolving, along
- * with the child areas (page-number-citation, basic-link, etc.)
- * of the PV needing their resolution.
- *
- * @param id the ID reference to add
- * @param res the resolvable object that needs resolving
- */
- public void addUnresolvedArea(String id, Resolvable res) {
- curPage.getPageViewport().addUnresolvedIDRef(id, res);
- idTracker.addUnresolvedIDRef(id, curPage.getPageViewport());
- }
-
- /**
- * Bind the RetrieveMarker to the corresponding Marker subtree.
- * If the boundary is page then it will only check the
- * current page. For page-sequence and document it will
- * lookup preceding pages from the area tree and try to find
- * a marker.
- * If we retrieve a marker from a preceding page,
- * then the containing page does not have a qualifying area,
- * and all qualifying areas have ended.
- * Therefore we use last-ending-within-page (Constants.EN_LEWP)
- * as the position.
- *
- * @param rm the RetrieveMarker instance whose properties are to
- * used to find the matching Marker.
- * @return a bound RetrieveMarker instance, or null if no Marker
- * could be found.
- */
- public RetrieveMarker resolveRetrieveMarker(RetrieveMarker rm) {
- AreaTreeModel areaTreeModel = areaTreeHandler.getAreaTreeModel();
- String name = rm.getRetrieveClassName();
- int pos = rm.getRetrievePosition();
- int boundary = rm.getRetrieveBoundary();
-
- // get marker from the current markers on area tree
- Marker mark = (Marker)getCurrentPV().getMarker(name, pos);
- if (mark == null && boundary != EN_PAGE) {
- // go back over pages until mark found
- // if document boundary then keep going
- boolean doc = boundary == EN_DOCUMENT;
- int seq = areaTreeModel.getPageSequenceCount();
- int page = areaTreeModel.getPageCount(seq) - 1;
- while (page < 0 && doc && seq > 1) {
- seq--;
- page = areaTreeModel.getPageCount(seq) - 1;
- }
- while (page >= 0) {
- PageViewport pv = areaTreeModel.getPage(seq, page);
- mark = (Marker)pv.getMarker(name, Constants.EN_LEWP);
- if (mark != null) {
- break;
- }
- page--;
- if (page < 0 && doc && seq > 1) {
- seq--;
- page = areaTreeModel.getPageCount(seq) - 1;
- }
- }
- }
-
- if (mark == null) {
- log.debug("found no marker with name: " + name);
- return null;
- } else {
- rm.bindMarker(mark);
- return rm;
- }
- }
-
- /**
- * Makes a new page
- *
- * @param bIsBlank whether this page is blank or not
- * @param bIsLast whether this page is the last page or not
- * @return a new page
- */
- protected Page makeNewPage(boolean bIsBlank, boolean bIsLast) {
- if (curPage != null) {
- finishPage();
- }
-
- currentPageNum++;
-
- curPage = pageProvider.getPage(bIsBlank,
- currentPageNum, PageProvider.RELTO_PAGE_SEQUENCE);
-
- if (log.isDebugEnabled()) {
- log.debug("[" + curPage.getPageViewport().getPageNumberString()
- + (bIsBlank ? "*" : "") + "]");
- }
-
- addIDToPage(pageSeq.getId());
- return curPage;
- }
-
private void layoutSideRegion(int regionID) {
SideRegion reg = (SideRegion)curPage.getSimplePageMaster().getRegion(regionID);
if (reg == null) {
return;
}
- StaticContent sc = pageSeq.getStaticContent(reg.getRegionName());
+ StaticContent sc = getPageSequence().getStaticContent(reg.getRegionName());
if (sc == null) {
return;
}
@@ -406,94 +150,15 @@
lm.doLayout();
}
- private void finishPage() {
- if (log.isTraceEnabled()) {
- curPage.getPageViewport().dumpMarkers();
- }
+ /** {@inheritDoc} */
+ protected void finishPage() {
// Layout side regions
layoutSideRegion(FO_REGION_BEFORE);
layoutSideRegion(FO_REGION_AFTER);
layoutSideRegion(FO_REGION_START);
layoutSideRegion(FO_REGION_END);
- // Try to resolve any unresolved IDs for the current page.
- //
- idTracker.tryIDResolution(curPage.getPageViewport());
- // Queue for ID resolution and rendering
- areaTreeHandler.getAreaTreeModel().addPage(curPage.getPageViewport());
- if (log.isDebugEnabled()) {
- log.debug("page finished: " + curPage.getPageViewport().getPageNumberString()
- + ", current num: " + currentPageNum);
- }
- curPage = null;
+ super.finishPage();
}
- /**
- * Act upon the force-page-count trait,
- * in relation to the initial-page-number trait of the following page-sequence.
- * @param nextPageSeqInitialPageNumber initial-page-number trait of next page-sequence
- */
- public void doForcePageCount(Numeric nextPageSeqInitialPageNumber) {
-
- int forcePageCount = pageSeq.getForcePageCount();
-
- // xsl-spec version 1.0 (15.oct 2001)
- // auto | even | odd | end-on-even | end-on-odd | no-force | inherit
- // auto:
- // Force the last page in this page-sequence to be an odd-page
- // if the initial-page-number of the next page-sequence is even.
- // Force it to be an even-page
- // if the initial-page-number of the next page-sequence is odd.
- // If there is no next page-sequence
- // or if the value of its initial-page-number is "auto" do not force any page.
-
- // if force-page-count is auto then set the value of forcePageCount
- // depending on the initial-page-number of the next page-sequence
- if (nextPageSeqInitialPageNumber != null && forcePageCount == Constants.EN_AUTO) {
- if (nextPageSeqInitialPageNumber.getEnum() != 0) {
- // auto | auto-odd | auto-even
- int nextPageSeqPageNumberType = nextPageSeqInitialPageNumber.getEnum();
- if (nextPageSeqPageNumberType == Constants.EN_AUTO_ODD) {
- forcePageCount = Constants.EN_END_ON_EVEN;
- } else if (nextPageSeqPageNumberType == Constants.EN_AUTO_EVEN) {
- forcePageCount = Constants.EN_END_ON_ODD;
- } else { // auto
- forcePageCount = Constants.EN_NO_FORCE;
- }
- } else { // <integer> for explicit page number
- int nextPageSeqPageStart = nextPageSeqInitialPageNumber.getValue();
- // spec rule
- nextPageSeqPageStart = (nextPageSeqPageStart > 0) ? nextPageSeqPageStart : 1;
- if (nextPageSeqPageStart % 2 == 0) { // explicit even startnumber
- forcePageCount = Constants.EN_END_ON_ODD;
- } else { // explicit odd startnumber
- forcePageCount = Constants.EN_END_ON_EVEN;
- }
- }
- }
-
- if (forcePageCount == Constants.EN_EVEN) {
- if ((currentPageNum - startPageNum + 1) % 2 != 0) { // we have an odd number of pages
- curPage = makeNewPage(true, false);
- }
- } else if (forcePageCount == Constants.EN_ODD) {
- if ((currentPageNum - startPageNum + 1) % 2 == 0) { // we have an even number of pages
- curPage = makeNewPage(true, false);
- }
- } else if (forcePageCount == Constants.EN_END_ON_EVEN) {
- if (currentPageNum % 2 != 0) { // we are now on an odd page
- curPage = makeNewPage(true, false);
- }
- } else if (forcePageCount == Constants.EN_END_ON_ODD) {
- if (currentPageNum % 2 == 0) { // we are now on an even page
- curPage = makeNewPage(true, false);
- }
- } else if (forcePageCount == Constants.EN_NO_FORCE) {
- // i hope: nothing special at all
- }
-
- if (curPage != null) {
- finishPage();
- }
- }
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java?rev=607034&r1=607033&r2=607034&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java Thu Dec 27 02:47:12 2007
@@ -19,12 +19,12 @@
package org.apache.fop.layoutmgr.inline;
-import java.awt.geom.Rectangle2D;
+import java.awt.Dimension;
+import java.awt.Rectangle;
import java.util.LinkedList;
import org.apache.fop.area.Area;
import org.apache.fop.area.inline.Viewport;
-import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.LengthBase;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.flow.AbstractGraphics;
@@ -57,156 +57,29 @@
* @return the viewport inline area
*/
private Viewport getInlineArea() {
+ Dimension intrinsicSize = new Dimension(
+ fobj.getIntrinsicWidth(),
+ fobj.getIntrinsicHeight());
- // viewport size is determined by block-progression-dimension
- // and inline-progression-dimension
+ //TODO Investigate if the line-height property has to be taken into the calculation
+ //somehow. There was some code here that hints in this direction but it was disabled.
- // if replaced then use height then ignore block-progression-dimension
- //int h = this.propertyList.get("height").getLength().mvalue();
-
- // use specified line-height then ignore dimension in height direction
- boolean hasLH = false; //propertyList.get("line-height").getSpecifiedValue() != null;
-
- Length len;
-
- int bpd = -1;
- int ipd = -1;
- if (hasLH) {
- bpd = fobj.getLineHeight().getOptimum(this).getLength().getValue(this);
- } else {
- // this property does not apply when the line-height applies
- // isn't the block-progression-dimension always in the same
- // direction as the line height?
- len = fobj.getBlockProgressionDimension().getOptimum(this).getLength();
- if (len.getEnum() != EN_AUTO) {
- bpd = len.getValue(this);
- } else {
- len = fobj.getHeight();
- if (len.getEnum() != EN_AUTO) {
- bpd = len.getValue(this);
- }
- }
- }
-
- len = fobj.getInlineProgressionDimension().getOptimum(this).getLength();
- if (len.getEnum() != EN_AUTO) {
- ipd = len.getValue(this);
- } else {
- len = fobj.getWidth();
- if (len.getEnum() != EN_AUTO) {
- ipd = len.getValue(this);
- }
- }
-
- // if auto then use the intrinsic size of the content scaled
- // to the content-height and content-width
- int cwidth = -1;
- int cheight = -1;
- len = fobj.getContentWidth();
- if (len.getEnum() != EN_AUTO) {
- if (len.getEnum() == EN_SCALE_TO_FIT) {
- if (ipd != -1) {
- cwidth = ipd;
- }
- } else {
- cwidth = len.getValue(this);
- }
- }
- len = fobj.getContentHeight();
- if (len.getEnum() != EN_AUTO) {
- if (len.getEnum() == EN_SCALE_TO_FIT) {
- if (bpd != -1) {
- cheight = bpd;
- }
- } else {
- cheight = len.getValue(this);
- }
- }
-
- int scaling = fobj.getScaling();
- if ((scaling == EN_UNIFORM) || (cwidth == -1) || cheight == -1) {
- if (cwidth == -1 && cheight == -1) {
- cwidth = fobj.getIntrinsicWidth();
- cheight = fobj.getIntrinsicHeight();
- } else if (cwidth == -1) {
- if (fobj.getIntrinsicHeight() == 0) {
- cwidth = 0;
- } else {
- cwidth = (int)(fobj.getIntrinsicWidth() * (double)cheight
- / fobj.getIntrinsicHeight());
- }
- } else if (cheight == -1) {
- if (fobj.getIntrinsicWidth() == 0) {
- cheight = 0;
- } else {
- cheight = (int)(fobj.getIntrinsicHeight() * (double)cwidth
- / fobj.getIntrinsicWidth());
- }
- } else {
- // adjust the larger
- if (fobj.getIntrinsicWidth() == 0 || fobj.getIntrinsicHeight() == 0) {
- cwidth = 0;
- cheight = 0;
- } else {
- double rat1 = (double) cwidth / fobj.getIntrinsicWidth();
- double rat2 = (double) cheight / fobj.getIntrinsicHeight();
- if (rat1 < rat2) {
- // reduce cheight
- cheight = (int)(rat1 * fobj.getIntrinsicHeight());
- } else if (rat1 > rat2) {
- cwidth = (int)(rat2 * fobj.getIntrinsicWidth());
- }
- }
- }
- }
-
- if (ipd == -1) {
- ipd = cwidth;
- }
- if (bpd == -1) {
- bpd = cheight;
- }
-
- boolean clip = false;
- if (cwidth > ipd || cheight > bpd) {
- int overflow = fobj.getOverflow();
- if (overflow == EN_HIDDEN) {
- clip = true;
- } else if (overflow == EN_ERROR_IF_OVERFLOW) {
- log.error("Object overflows the viewport: clipping");
- clip = true;
- }
- }
-
- int xoffset = fobj.computeXOffset(ipd, cwidth);
- int yoffset = fobj.computeYOffset(bpd, cheight);
+ ImageLayout imageLayout = new ImageLayout(fobj, this, intrinsicSize);
+ Rectangle placement = imageLayout.getPlacement();
CommonBorderPaddingBackground borderProps = fobj.getCommonBorderPaddingBackground();
- //Determine extra BPD from borders etc.
+ //Determine extra BPD from borders and padding
int beforeBPD = borderProps.getPadding(CommonBorderPaddingBackground.BEFORE, false, this);
- beforeBPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.BEFORE,
- false);
- int afterBPD = borderProps.getPadding(CommonBorderPaddingBackground.AFTER, false, this);
- afterBPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.AFTER, false);
+ beforeBPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.BEFORE, false);
- yoffset += beforeBPD;
- //bpd += beforeBPD;
- //bpd += afterBPD;
+ placement.y += beforeBPD;
- //Determine extra IPD from borders etc.
- int startIPD = borderProps.getPadding(CommonBorderPaddingBackground.START,
- false, this);
- startIPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.START,
- false);
- int endIPD = borderProps.getPadding(CommonBorderPaddingBackground.END, false, this);
- endIPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.END, false);
+ //Determine extra IPD from borders and padding
+ int startIPD = borderProps.getPadding(CommonBorderPaddingBackground.START, false, this);
+ startIPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.START, false);
- xoffset += startIPD;
- //ipd += startIPD;
- //ipd += endIPD;
-
- Rectangle2D placement = new Rectangle2D.Float(xoffset, yoffset, cwidth, cheight);
+ placement.x += startIPD;
Area viewportArea = getChildArea();
TraitSetter.setProducerID(viewportArea, fobj.getId());
@@ -214,10 +87,10 @@
Viewport vp = new Viewport(viewportArea);
TraitSetter.setProducerID(vp, fobj.getId());
- vp.setIPD(ipd);
- vp.setBPD(bpd);
+ vp.setIPD(imageLayout.getViewportSize().width);
+ vp.setBPD(imageLayout.getViewportSize().height);
vp.setContentPosition(placement);
- vp.setClip(clip);
+ vp.setClip(imageLayout.isClipped());
vp.setOffset(0);
// Common Border, Padding, and Background Properties
@@ -230,9 +103,7 @@
return vp;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public LinkedList getNextKnuthElements(LayoutContext context,
int alignment) {
Viewport areaCurrent = getInlineArea();
@@ -240,9 +111,7 @@
return super.getNextKnuthElements(context, alignment);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected AlignmentContext makeAlignmentContext(LayoutContext context) {
return new AlignmentContext(
get(context).getAllocBPD()
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java?rev=607034&r1=607033&r2=607034&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java Thu Dec 27 02:47:12 2007
@@ -19,7 +19,6 @@
package org.apache.fop.layoutmgr.inline;
-import java.awt.geom.Rectangle2D;
import org.apache.fop.area.Area;
import org.apache.fop.area.inline.Image;
import org.apache.fop.fo.flow.ExternalGraphic;
@@ -34,7 +33,6 @@
/**
* Constructor
- *
* @param node the fo:external-graphic formatting object that creates the area
*/
public ExternalGraphicLayoutManager(ExternalGraphic node) {
@@ -42,165 +40,7 @@
fobj = node;
}
- /**
- * Setup this image.
- * This gets the sizes for the image and the dimensions and clipping.
- * @todo see if can simplify property handling logic
- */
- /*
- private void setup() {
- // assume lr-tb for now and just use the .optimum value of the range
- Length ipd = fobj.getInlineProgressionDimension().getOptimum(this).getLength();
- if (ipd.getEnum() != EN_AUTO) {
- viewWidth = ipd.getValue(this);
- } else {
- ipd = fobj.getWidth();
- if (ipd.getEnum() != EN_AUTO) {
- viewWidth = ipd.getValue(this);
- }
- }
- Length bpd = fobj.getBlockProgressionDimension().getOptimum(this).getLength();
- if (bpd.getEnum() != EN_AUTO) {
- viewHeight = bpd.getValue(this);
- } else {
- bpd = fobj.getHeight();
- if (bpd.getEnum() != EN_AUTO) {
- viewHeight = bpd.getValue(this);
- }
- }
-
- int cwidth = -1;
- int cheight = -1;
- Length ch = fobj.getContentHeight();
- if (ch.getEnum() != EN_AUTO) {
- if (ch.getEnum() == EN_SCALE_TO_FIT) {
- if (viewHeight != -1) {
- cheight = viewHeight;
- }
- } else {
- cheight = ch.getValue(this);
- }
- }
- Length cw = fobj.getContentWidth();
- if (cw.getEnum() != EN_AUTO) {
- if (cw.getEnum() == EN_SCALE_TO_FIT) {
- if (viewWidth != -1) {
- cwidth = viewWidth;
- }
- } else {
- cwidth = cw.getValue(this);
- }
- }
-
- int scaling = fobj.getScaling();
- if ((scaling == EN_UNIFORM) || (cwidth == -1) || cheight == -1) {
- if (cwidth == -1 && cheight == -1) {
- cwidth = fobj.getIntrinsicWidth();
- cheight = fobj.getIntrinsicHeight();
- } else if (cwidth == -1) {
- cwidth = (int)(fobj.getIntrinsicWidth() * (double)cheight
- / fobj.getIntrinsicHeight());
- } else if (cheight == -1) {
- cheight = (int)(fobj.getIntrinsicHeight() * (double)cwidth
- / fobj.getIntrinsicWidth());
- } else {
- // adjust the larger
- double rat1 = (double)cwidth / fobj.getIntrinsicWidth();
- double rat2 = (double)cheight / fobj.getIntrinsicHeight();
- if (rat1 < rat2) {
- // reduce cheight
- cheight = (int)(rat1 * fobj.getIntrinsicHeight());
- } else if (rat1 > rat2) {
- cwidth = (int)(rat2 * fobj.getIntrinsicWidth());
- }
- }
- }
-
- if (viewWidth == -1) {
- viewWidth = cwidth;
- }
- if (viewHeight == -1) {
- viewHeight = cheight;
- }
-
- if (cwidth > viewWidth || cheight > viewHeight) {
- int overflow = fobj.getOverflow();
- if (overflow == EN_HIDDEN) {
- clip = true;
- } else if (overflow == EN_ERROR_IF_OVERFLOW) {
- fobj.getLogger().error("Image: " + fobj.getURL()
- + " overflows the viewport, clipping to viewport");
- clip = true;
- }
- }
-
- int xoffset = 0;
- int yoffset = 0;
- switch(fobj.getDisplayAlign()) {
- case EN_BEFORE:
- break;
- case EN_AFTER:
- yoffset = viewHeight - cheight;
- break;
- case EN_CENTER:
- yoffset = (viewHeight - cheight) / 2;
- break;
- case EN_AUTO:
- default:
- break;
- }
-
- switch(fobj.getTextAlign()) {
- case EN_CENTER:
- xoffset = (viewWidth - cwidth) / 2;
- break;
- case EN_END:
- xoffset = viewWidth - cwidth;
- break;
- case EN_START:
- break;
- case EN_JUSTIFY:
- default:
- break;
- }
-
-
- CommonBorderPaddingBackground borderProps = fobj.getCommonBorderPaddingBackground();
-
- //Determine extra BPD from borders etc.
- int beforeBPD = borderProps.getPadding(CommonBorderPaddingBackground.BEFORE, false, this);
- beforeBPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.BEFORE,
- false);
- int afterBPD = borderProps.getPadding(CommonBorderPaddingBackground.AFTER, false, this);
- afterBPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.AFTER, false);
-
- yoffset += beforeBPD;
- viewBPD = viewHeight;
- viewHeight += beforeBPD;
- viewHeight += afterBPD;
-
- //Determine extra IPD from borders etc.
- int startIPD = borderProps.getPadding(CommonBorderPaddingBackground.START,
- false, this);
- startIPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.START,
- false);
- int endIPD = borderProps.getPadding(CommonBorderPaddingBackground.END, false, this);
- endIPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.END, false);
-
- xoffset += startIPD;
- viewIPD = viewWidth;
- viewWidth += startIPD;
- viewWidth += endIPD;
-
- placement = new Rectangle2D.Float(xoffset, yoffset, cwidth, cheight);
- }
- */
-
- /**
- * Get the inline area created by this element.
- *
- * @return the inline area
- */
+ /** {@inheritDoc} */
protected Area getChildArea() {
return new Image(fobj.getSrc());
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java?rev=607034&r1=607033&r2=607034&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java Thu Dec 27 02:47:12 2007
@@ -40,11 +40,7 @@
fobj = node;
}
- /**
- * Get the inline area created by this element.
- *
- * @return the inline area
- */
+ /** {@inheritDoc} */
protected Area getChildArea() {
XMLObj child = (XMLObj) fobj.getChildXMLObj();
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java?rev=607034&r1=607033&r2=607034&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java Thu Dec 27 02:47:12 2007
@@ -266,12 +266,12 @@
}
/**
- * Creates and returns a GridUnitPart instance for the content of this cell which
+ * Creates and returns a CellPart instance for the content of this cell which
* is included in the next step.
*
- * @return a GridUnitPart instance
+ * @return a CellPart instance
*/
- GridUnitPart createGridUnitPart() {
+ CellPart createCellPart() {
if (end + 1 == elementList.size()) {
if (pgu.getFlag(GridUnit.KEEP_WITH_NEXT_PENDING)) {
keepWithNextSignal = true;
@@ -284,9 +284,9 @@
&& elementList.size() == 1
&& elementList.get(0) instanceof KnuthBoxCellWithBPD) {
//Special case: Cell with fixed BPD
- return new GridUnitPart(pgu, 0, pgu.getElements().size() - 1);
+ return new CellPart(pgu, 0, pgu.getElements().size() - 1);
} else {
- return new GridUnitPart(pgu, start, end);
+ return new CellPart(pgu, start, end);
}
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/RowPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/RowPainter.java?rev=607034&r1=607033&r2=607034&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/RowPainter.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/RowPainter.java Thu Dec 27 02:47:12 2007
@@ -19,9 +19,10 @@
package org.apache.fop.layoutmgr.table;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
-import java.util.Map;
+import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -47,17 +48,15 @@
private EffRow lastRow = null;
private LayoutContext layoutContext;
/**
- * For each part of the table (header, footer, body), index of the first row of that
- * part present on the current page.
+ * Index of the first row of the current part present on the current page.
*/
- private int[] firstRow = new int[3];
+ private int firstRowIndex;
/**
- * Keeps track of the y-offsets of each row on a page (for body, header and footer separately).
+ * Keeps track of the y-offsets of each row on a page.
* This is particularly needed for spanned cells where you need to know the y-offset
* of the starting row when the area is generated at the time the cell is closed.
*/
- private Map[] rowOffsets = new Map[] {new java.util.HashMap(),
- new java.util.HashMap(), new java.util.HashMap()};
+ private List rowOffsets = new ArrayList();
//These three variables are our buffer to recombine the individual steps into cells
/** Primary grid units corresponding to the currently handled grid units, per row. */
@@ -87,7 +86,7 @@
this.start = new int[colCount];
this.end = new int[colCount];
this.partBPD = new int[colCount];
- Arrays.fill(firstRow, -1);
+ this.firstRowIndex = -1;
Arrays.fill(end, -1);
}
@@ -110,27 +109,30 @@
}
rowFO = tcpos.row.getTableRow();
lastRow = tcpos.row;
- Iterator partIter = tcpos.gridUnitParts.iterator();
+ if (firstRowIndex < 0) {
+ firstRowIndex = lastRow.getIndex();
+ }
+ Iterator partIter = tcpos.cellParts.iterator();
//Iterate over all grid units in the current step
while (partIter.hasNext()) {
- GridUnitPart gup = (GridUnitPart)partIter.next();
+ CellPart cellPart = (CellPart)partIter.next();
if (log.isDebugEnabled()) {
- log.debug(">" + gup);
+ log.debug(">" + cellPart);
}
- int colIndex = gup.pgu.getStartCol();
- if (primaryGridUnits[colIndex] != gup.pgu) {
+ int colIndex = cellPart.pgu.getStartCol();
+ if (primaryGridUnits[colIndex] != cellPart.pgu) {
if (primaryGridUnits[colIndex] != null) {
log.warn("Replacing GU in slot " + colIndex
+ ". Some content may not be painted.");
}
- primaryGridUnits[colIndex] = gup.pgu;
- start[colIndex] = gup.start;
- end[colIndex] = gup.end;
+ primaryGridUnits[colIndex] = cellPart.pgu;
+ start[colIndex] = cellPart.start;
+ end[colIndex] = cellPart.end;
} else {
- if (gup.end < end[colIndex]) {
+ if (cellPart.end < end[colIndex]) {
throw new IllegalStateException("Internal Error: stepper problem");
}
- end[colIndex] = gup.end;
+ end[colIndex] = cellPart.end;
}
}
}
@@ -149,17 +151,16 @@
int addAreasAndFlushRow(boolean forcedFlush) {
int actualRowHeight = 0;
- int bt = lastRow.getBodyType();
if (log.isDebugEnabled()) {
log.debug("Remembering yoffset for row " + lastRow.getIndex() + ": " + yoffset);
}
- rowOffsets[bt].put(new Integer(lastRow.getIndex()), new Integer(yoffset));
+ recordRowOffset(lastRow.getIndex(), yoffset);
for (int i = 0; i < primaryGridUnits.length; i++) {
if ((primaryGridUnits[i] != null)
&& (forcedFlush || (end[i] == primaryGridUnits[i].getElements().size() - 1))) {
actualRowHeight = Math.max(actualRowHeight, computeSpanHeight(
- primaryGridUnits[i], start[i], end[i], i, bt));
+ primaryGridUnits[i], start[i], end[i], i));
}
}
actualRowHeight += 2 * tclm.getTableLM().getHalfBorderSeparationBPD();
@@ -167,15 +168,12 @@
//Add areas for row
tclm.addRowBackgroundArea(rowFO, actualRowHeight, layoutContext.getRefIPD(), yoffset);
for (int i = 0; i < primaryGridUnits.length; i++) {
- GridUnit currentGU = lastRow.safelyGetGridUnit(i);
- //currentGU can be null if there's no grid unit
- //at this place in the current row (empty cell and no borders to process)
-
+ GridUnit currentGU = lastRow.getGridUnit(i);
if (primaryGridUnits[i] != null) {
if (forcedFlush || ((end[i] == primaryGridUnits[i].getElements().size() - 1)
- && (currentGU == null || currentGU.isLastGridUnitRowSpan()))) {
+ && currentGU.isLastGridUnitRowSpan())) {
//the last line in the "if" above is to avoid a premature end of a
- //row-spanned cell because no GridUnitParts are generated after a cell is
+ //row-spanned cell because no CellParts are generated after a cell is
//finished with its content.
//See table-cell_number-rows-spanned_bug38397.xml
addAreasForCell(primaryGridUnits[i], start[i], end[i], lastRow, partBPD[i],
@@ -185,7 +183,7 @@
end[i] = -1;
partBPD[i] = 0;
}
- } else if (currentGU != null && !currentGU.isEmpty()
+ } else if (!currentGU.isEmpty()
&& currentGU.getColSpanIndex() == 0
&& (forcedFlush || currentGU.isLastGridUnitRowSpan())) {
//A row-spanned cell has finished contributing content on the previous page
@@ -226,8 +224,7 @@
* {@link TableRowIterator#BODY}
* @return the cell's height
*/
- private int computeSpanHeight(PrimaryGridUnit pgu, int start, int end, int columnIndex,
- int bodyType) {
+ private int computeSpanHeight(PrimaryGridUnit pgu, int start, int end, int columnIndex) {
if (log.isTraceEnabled()) {
log.trace("getting len for " + columnIndex + " "
+ start + "-" + end);
@@ -292,26 +289,15 @@
len += pgu.getHalfMaxBeforeBorderWidth();
len += pgu.getHalfMaxAfterBorderWidth();
}
- int startRow = Math.max(pgu.getStartRow(), firstRow[bodyType]);
- Integer storedOffset = (Integer)rowOffsets[bodyType].get(new Integer(startRow));
- int effYOffset;
- if (storedOffset != null) {
- effYOffset = storedOffset.intValue();
- } else {
- effYOffset = yoffset;
- }
- len -= yoffset - effYOffset;
+ int cellOffset = getRowOffset(Math.max(pgu.getStartRow(), firstRowIndex));
+ len -= yoffset - cellOffset;
return len;
}
private void addAreasForCell(PrimaryGridUnit pgu, int startPos, int endPos,
EffRow row, int contentHeight, int rowHeight) {
- int bt = row.getBodyType();
- if (firstRow[bt] < 0) {
- firstRow[bt] = row.getIndex();
- }
//Determine the first row in this sequence
- int startRowIndex = Math.max(pgu.getStartRow(), firstRow[bt]);
+ int startRowIndex = Math.max(pgu.getStartRow(), firstRowIndex);
int lastRowIndex = lastRow.getIndex();
// In collapsing-border model, if the cell spans over several columns/rows then
@@ -321,37 +307,28 @@
int[] spannedGridRowHeights = null;
if (!tclm.getTableLM().getTable().isSeparateBorderModel() && pgu.hasSpanning()) {
spannedGridRowHeights = new int[lastRowIndex - startRowIndex + 1];
- int prevOffset = ((Integer)rowOffsets[bt].get(new Integer(startRowIndex))).intValue();
+ int prevOffset = getRowOffset(startRowIndex);
for (int i = 0; i < lastRowIndex - startRowIndex; i++) {
- int newOffset = ((Integer) rowOffsets[bt].get(new Integer(startRowIndex + i + 1)))
- .intValue();
+ int newOffset = getRowOffset(startRowIndex + i + 1);
spannedGridRowHeights[i] = newOffset - prevOffset;
prevOffset = newOffset;
}
spannedGridRowHeights[lastRowIndex - startRowIndex] = rowHeight;
}
- //Determine y offset for the cell
- Integer offset = (Integer)rowOffsets[bt].get(new Integer(startRowIndex));
- while (offset == null) {
- //TODO Figure out what this does and when it's triggered
- //This block is probably never used, at least it's not triggered by any of our tests
- startRowIndex--;
- offset = (Integer)rowOffsets[bt].get(new Integer(startRowIndex));
- }
- int effYOffset = offset.intValue();
+ int cellOffset = getRowOffset(startRowIndex);
int effCellHeight = rowHeight;
- effCellHeight += yoffset - effYOffset;
+ effCellHeight += yoffset - cellOffset;
if (log.isDebugEnabled()) {
log.debug("Creating area for cell:");
log.debug(" current row: " + row.getIndex());
- log.debug(" start row: " + pgu.getStartRow() + " " + yoffset + " " + effYOffset);
+ log.debug(" start row: " + pgu.getStartRow() + " " + yoffset + " " + cellOffset);
log.debug(" contentHeight: " + contentHeight + " rowHeight=" + rowHeight
+ " effCellHeight=" + effCellHeight);
}
TableCellLayoutManager cellLM = pgu.getCellLM();
cellLM.setXOffset(tclm.getXOffsetOfGridUnit(pgu));
- cellLM.setYOffset(effYOffset);
+ cellLM.setYOffset(cellOffset);
cellLM.setContentHeight(contentHeight);
cellLM.setRowHeight(effCellHeight);
//cellLM.setRowHeight(row.getHeight().opt);
@@ -363,5 +340,44 @@
cellLM.addAreas(new KnuthPossPosIter(pgu.getElements(), startPos, endPos + 1),
layoutContext, spannedGridRowHeights, startRowIndex - pgu.getStartRow(),
lastRowIndex - pgu.getStartRow() + 1);
+ }
+
+ /**
+ * Records the y-offset of the row with the given index.
+ *
+ * @param rowIndex index of the row
+ * @param offset y-offset of the row on the page
+ */
+ private void recordRowOffset(int rowIndex, int offset) {
+ /*
+ * In some very rare cases a row may be skipped. See for example Bugzilla #43633:
+ * in a two-column table, a row contains a row-spanning cell and a missing cell.
+ * In TableStepper#goToNextRowIfCurrentFinished this row will immediately be
+ * considered as finished, since it contains no cell ending on this row. Thus no
+ * TableContentPosition will be created for this row. Thus its index will never be
+ * recorded by the #handleTableContentPosition method.
+ *
+ * The yoffset for such a row is the same as the next non-empty row. It's needed
+ * to correctly offset blocks for cells starting on this row. Hence the loop
+ * below.
+ */
+ for (int i = rowOffsets.size(); i <= rowIndex - firstRowIndex; i++) {
+ rowOffsets.add(new Integer(offset));
+ }
+ }
+
+ /**
+ * Returns the offset of the row with the given index.
+ *
+ * @param rowIndex index of the row
+ * @return its y-offset on the page
+ */
+ private int getRowOffset(int rowIndex) {
+ return ((Integer) rowOffsets.get(rowIndex - firstRowIndex)).intValue();
+ }
+
+ void endPart() {
+ firstRowIndex = -1;
+ rowOffsets.clear();
}
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java?rev=607034&r1=607033&r2=607034&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java Thu Dec 27 02:47:12 2007
@@ -387,7 +387,7 @@
if (pos instanceof TableContentPosition) {
TableContentPosition tcpos = (TableContentPosition)pos;
lst.add(tcpos);
- GridUnitPart part = (GridUnitPart)tcpos.gridUnitParts.get(0);
+ CellPart part = (CellPart)tcpos.cellParts.get(0);
if (body == null) {
body = part.pgu.getBody();
}
@@ -418,6 +418,7 @@
handleMarkersAndPositions(lst, body, firstPos, false, painter);
}
painter.addAreasAndFlushRow(true);
+ painter.endPart();
}
private void handleMarkersAndPositions(List positions, TableBody body, boolean firstPos,
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/TableContentPosition.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/TableContentPosition.java?rev=607034&r1=607033&r2=607034&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/TableContentPosition.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/TableContentPosition.java Thu Dec 27 02:47:12 2007
@@ -36,8 +36,8 @@
/** The position is the last of the row group. */
public static final int LAST_IN_ROWGROUP = 2;
- /** the list of GridUnitParts making up this position */
- protected List gridUnitParts;
+ /** the list of CellParts making up this position */
+ protected List cellParts;
/** effective row this position belongs to */
protected EffRow row;
/** flags for the position */
@@ -46,13 +46,13 @@
/**
* Creates a new TableContentPosition.
* @param lm applicable layout manager
- * @param gridUnitParts the list of GridUnitPart instances
+ * @param cellParts the list of CellPart instances
* @param row effective row this position belongs to
*/
- protected TableContentPosition(LayoutManager lm, List gridUnitParts,
+ protected TableContentPosition(LayoutManager lm, List cellParts,
EffRow row) {
super(lm);
- this.gridUnitParts = gridUnitParts;
+ this.cellParts = cellParts;
this.row = row;
}
@@ -90,7 +90,7 @@
sb.append(getFlag(FIRST_IN_ROWGROUP) ? "F" : "-");
sb.append(getFlag(LAST_IN_ROWGROUP) ? "L" : "-").append("]");
sb.append("(");
- sb.append(gridUnitParts);
+ sb.append(cellParts);
sb.append(")");
return sb.toString();
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/TableStepper.java?rev=607034&r1=607033&r2=607034&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/TableStepper.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/layoutmgr/table/TableStepper.java Thu Dec 27 02:47:12 2007
@@ -75,6 +75,7 @@
private void setup(int columnCount) {
this.columnCount = columnCount;
this.activeRowIndex = 0;
+ this.previousRowsLength = 0;
}
/**
@@ -169,26 +170,27 @@
boolean forcedBreak = false;
int breakClass = -1;
//Put all involved grid units into a list
- List gridUnitParts = new java.util.ArrayList(maxColumnCount);
+ List cellParts = new java.util.ArrayList(maxColumnCount);
for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
ActiveCell activeCell = (ActiveCell) iter.next();
if (activeCell.contributesContent()) {
- GridUnitPart gup = activeCell.createGridUnitPart();
- gridUnitParts.add(gup);
+ CellPart part = activeCell.createCellPart();
+ cellParts.add(part);
forcedBreak = activeCell.isLastForcedBreak();
if (forcedBreak) {
breakClass = activeCell.getLastBreakClass();
}
- if (returnList.size() == 0 && gup.isFirstPart() && gup.mustKeepWithPrevious()) {
+ if (returnList.size() == 0 && part.isFirstPart()
+ && part.mustKeepWithPrevious()) {
context.setFlags(LayoutContext.KEEP_WITH_PREVIOUS_PENDING);
}
}
}
- //log.debug(">>> guPARTS: " + gridUnitParts);
+ //log.debug(">>> guPARTS: " + cellParts);
//Create elements for step
TableContentPosition tcpos = new TableContentPosition(getTableLM(),
- gridUnitParts, rowGroup[normalRow]);
+ cellParts, rowGroup[normalRow]);
if (returnList.size() == 0) {
tcpos.setFlag(TableContentPosition.FIRST_IN_ROWGROUP, true);
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/rtf/RTFHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/rtf/RTFHandler.java?rev=607034&r1=607033&r2=607034&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/rtf/RTFHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/rtf/RTFHandler.java Thu Dec 27 02:47:12 2007
@@ -199,7 +199,8 @@
log.warn("Using default simple-page-master from page-sequence-master...");
PageSequenceMaster master
= pageSeq.getRoot().getLayoutMasterSet().getPageSequenceMaster(reference);
- this.pagemaster = master.getNextSimplePageMaster(false, false, false, false);
+ this.pagemaster = master.getNextSimplePageMaster(
+ false, false, false, false, false);
}
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/xml/XMLRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/xml/XMLRenderer.java?rev=607034&r1=607033&r2=607034&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/xml/XMLRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/xml/XMLRenderer.java Thu Dec 27 02:47:12 2007
@@ -524,7 +524,9 @@
addAttribute("key", page.getKey());
addAttribute("nr", page.getPageNumber());
addAttribute("formatted-nr", page.getPageNumberString());
- addAttribute("simple-page-master-name", page.getSimplePageMasterName());
+ if (page.getSimplePageMasterName() != null) {
+ addAttribute("simple-page-master-name", page.getSimplePageMasterName());
+ }
if (page.isBlank()) {
addAttribute("blank", "true");
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/status.xml?rev=607034&r1=607033&r2=607034&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/status.xml (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/status.xml Thu Dec 27 02:47:12 2007
@@ -28,7 +28,18 @@
<changes>
<release version="FOP Trunk">
- <action context="Code" dev="AC" type="add">
+ <action context="Code" dev="JM" type="add">
+ Added new extension element: fox:external-document. It allows to add whole documents
+ such as multi-page TIFF images to be inserted as peers to a page-sequence. Each image
+ will make up an entire page. See the documentation for details.
+ </action>
+ <action context="Code" dev="JM" type="add">
+ Added support for scale-down-to-fit and scale-up-to-fit (introduced in XSL 1.1).
+ </action>
+ <action context="Code" dev="VH" type="fix" fixes-bug="43633">
+ Bugfix: content of a row with zero height overriding the previous row
+ </action>
+ <action context="Code" dev="AC" importance="high" type="add">
Added SVG support for AFP (GOCA).
</action>
<action context="Code" dev="JM" type="fix" fixes-bug="37993">
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org