You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Kelly Campbell <ca...@camk.net> on 2000/12/10 01:35:26 UTC

Re: [commit please] keep-with-next

I just tried this patch, and there seems to be some bugs still. A document 
that previously formatted into 49 pages now takes 328 pages. Many pages 
contain repeated content (especially graphics). 

Also, it seems that it tries to render the entire block of static content
in my region-after which adds many pages with repeated content in the body
region (the region after in this case has more than one line in its flow,
but there's only space for one line in the layout.)

-Kelly

On Sun, Dec 10, 2000 at 01:50:02AM +0530, Dharamveer Salecha wrote:
> Hi
>  The changes (diff) required for handling keep-with-next is attached.  
> Also, Attached is the modified file
> "xml-fop\src\org\apache\fop\fo\flow\Block.java".
> 
>  <<Block.java>>  <<keep-with-next_diff.txt>> 
> 
> The change allows us to handle a case like:
> ----------------
> <fo:block> 
>   Main Block
>   <fo:block>Sub-block 1</fo:block>
>   <fo:block keep-with-next="true">Sub-block 2</fo:block>
>   <fo:block>Sub-block 3</fo:block>
> </fo:block>
> -----------------
> 
> Note: [ Current repository version causes empty page to appear if Sub-block2
> above is the last block on the page.
> In Hani Elabed's change to Block.java ( 11/27/2000 ), if status equals
> (AREA_FULL_SOME), status is returned immediately, without adding the
> blockarea to the "parent area". This was the reason for causing an empty
> page to appear. ]
> 
> I have adequately tested it. Please commit these changes.
> 
> Thanks
> Dharam
> 
> PS: Anyone working on "keep-together" property ??
> 


> cvs diff FONode.java (in directory C:\xml-fop\src\org\apache\fop\fo\)
> Index: FONode.java
> ===================================================================
> RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/fo/FONode.java,v
> retrieving revision 1.10
> diff -r1.10 FONode.java
> 182d181
> < 	// still to do
> 
> *****CVS exited normally with code 1*****
> 
> cvs diff Block.java (in directory C:\xml-fop\src\org\apache\fop\fo\flow\)
> Index: Block.java
> ===================================================================
> RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/fo/flow/Block.java,v
> retrieving revision 1.21
> diff -r1.21 Block.java
> 162,174c162,174
> <             this.paddingLeft = this.paddingTop;
> <             this.paddingRight = this.paddingTop;
> <             this.paddingBottom = this.paddingTop;
> <             if (this.paddingTop == 0) {
> < 	      this.paddingTop =
> < 		  this.properties.get("padding-top").getLength().mvalue();
> < 	      this.paddingLeft =
> < 		  this.properties.get("padding-left").getLength().mvalue();
> < 	      this.paddingBottom =
> < 		  this.properties.get("padding-bottom").getLength().mvalue();
> < 	      this.paddingRight =
> < 		  this.properties.get("padding-right").getLength().mvalue();
> <             }
> ---
> > 		this.paddingLeft = this.paddingTop;
> > 		this.paddingRight = this.paddingTop;
> > 		this.paddingBottom = this.paddingTop;
> > 		if (this.paddingTop == 0) {
> > 			this.paddingTop =
> > 			this.properties.get("padding-top").getLength().mvalue();
> > 			this.paddingLeft =
> > 			this.properties.get("padding-left").getLength().mvalue();
> > 			this.paddingBottom =
> > 			this.properties.get("padding-bottom").getLength().mvalue();
> > 			this.paddingRight =
> > 			this.properties.get("padding-right").getLength().mvalue();
> > 		}
> 181,188c181,188
> < 		this.borderTopColor =
> < 		    this.properties.get("border-top-color").getColorType();
> < 		this.borderBottomColor = 
> < 		    this.properties.get("border-bottom-color").getColorType();
> < 		this.borderLeftColor = 
> < 		    this.properties.get("border-left-color").getColorType();
> < 		this.borderRightColor = 
> < 		    this.properties.get("border-right-color").getColorType();
> ---
> > 			this.borderTopColor =
> > 			    this.properties.get("border-top-color").getColorType();
> > 			this.borderBottomColor = 
> > 			    this.properties.get("border-bottom-color").getColorType();
> > 			this.borderLeftColor = 
> > 			    this.properties.get("border-left-color").getColorType();
> > 			this.borderRightColor = 
> > 			    this.properties.get("border-right-color").getColorType();
> 196,203c196,203
> < 		this.borderTopWidth =
> < 		    this.properties.get("border-top-width").getLength().mvalue();
> < 		this.borderBottomWidth = 
> < 		    this.properties.get("border-bottom-width").getLength().mvalue();
> < 		this.borderLeftWidth = 
> < 		    this.properties.get("border-left-width").getLength().mvalue();
> < 		this.borderRightWidth = 
> < 		    this.properties.get("border-right-width").getLength().mvalue();
> ---
> > 			this.borderTopWidth =
> > 			    this.properties.get("border-top-width").getLength().mvalue();
> > 			this.borderBottomWidth = 
> > 			    this.properties.get("border-bottom-width").getLength().mvalue();
> > 			this.borderLeftWidth = 
> > 			    this.properties.get("border-left-width").getLength().mvalue();
> > 			this.borderRightWidth = 
> > 			    this.properties.get("border-right-width").getLength().mvalue();
> 211,218c211,218
> < 		this.borderTopStyle =
> < 		    this.properties.get("border-top-style").getEnum();
> < 		this.borderBottomStyle = 
> < 		    this.properties.get("border-bottom-style").getEnum();
> < 		this.borderLeftStyle = 
> < 		    this.properties.get("border-left-style").getEnum();
> < 		this.borderRightStyle = 
> < 		    this.properties.get("border-right-style").getEnum();
> ---
> > 			this.borderTopStyle =
> > 			    this.properties.get("border-top-style").getEnum();
> > 			this.borderBottomStyle = 
> > 			    this.properties.get("border-bottom-style").getEnum();
> > 			this.borderLeftStyle = 
> > 			    this.properties.get("border-left-style").getEnum();
> > 			this.borderRightStyle = 
> > 			    this.properties.get("border-right-style").getEnum();
> 221,222c221,222
> <             this.id = 
> <                 this.properties.get("id").getString(); 
> ---
> >         this.id = 
> >             this.properties.get("id").getString(); 
> 225c225
> < 		area.end();
> ---
> > 			area.end();
> 237c237
> <             area.getIDReferences().createID(id); 
> ---
> > 		area.getIDReferences().createID(id); 
> 242c242
> < 		return new Status(Status.FORCE_PAGE_BREAK);
> ---
> > 			return new Status(Status.FORCE_PAGE_BREAK);
> 246c246
> < 		return new Status(Status.FORCE_PAGE_BREAK_ODD);
> ---
> > 			return new Status(Status.FORCE_PAGE_BREAK_ODD);
> 250c250
> < 		return new Status(Status.FORCE_PAGE_BREAK_EVEN);
> ---
> > 			return new Status(Status.FORCE_PAGE_BREAK_EVEN);
> 262,264c262,264
> <         if ( marker==0 ) {
> <                 area.getIDReferences().configureID(id,area);
> <         }
> ---
> >     if ( marker==0 ) {
> > 		area.getIDReferences().configureID(id,area);
> >     }
> 266,271c266,271
> <         this.blockArea =
> < 	    new BlockArea(fs, area.getAllocationWidth(), 
> < 			  area.spaceLeft(), 
> <                           startIndent, 
> <                           endIndent,
> < 			  textIndent, align, alignLast, lineHeight);
> ---
> >     this.blockArea =
> > 		new BlockArea(fs, area.getAllocationWidth(), 
> > 			area.spaceLeft(), 
> > 			startIndent, 
> > 			endIndent,
> > 			textIndent, align, alignLast, lineHeight);
> 275,281c275,281
> < 			     paddingRight);
> <         blockArea.setBorderStyle(borderTopStyle, borderLeftStyle, 
> < 				 borderBottomStyle, borderRightStyle); 
> <         blockArea.setBorderWidth(borderTopWidth, borderLeftWidth, 
> < 				 borderBottomWidth, borderRightWidth); 
> <         blockArea.setBorderColor(borderTopColor, borderLeftColor, 
> < 				 borderBottomColor, borderRightColor); 
> ---
> > 		     paddingRight);
> >     blockArea.setBorderStyle(borderTopStyle, borderLeftStyle, 
> > 			 borderBottomStyle, borderRightStyle); 
> >     blockArea.setBorderWidth(borderTopWidth, borderLeftWidth, 
> > 			 borderBottomWidth, borderRightWidth); 
> >     blockArea.setBorderColor(borderTopColor, borderLeftColor, 
> > 			 borderBottomColor, borderRightColor); 
> 284,285c284,285
> <         blockArea.setAbsoluteHeight(area.getAbsoluteHeight()); 
> <         blockArea.setIDReferences(area.getIDReferences());
> ---
> >     blockArea.setAbsoluteHeight(area.getAbsoluteHeight()); 
> >     blockArea.setIDReferences(area.getIDReferences());
> 287c287,288
> <         blockArea.setTableCellXOffset(area.getTableCellXOffset());
> ---
> >     blockArea.setTableCellXOffset(area.getTableCellXOffset());
> >     boolean prevChildMustKeepWithNext = false;
> 297,315c298
> < 	    if ((status = fo.layout(blockArea)).isIncomplete()) 
> < 	    {
> < 			this.marker = i;
> < 				// this block was modified by
> < 				// Hani Elabed 11/27/2000
> < 			//if ((i != 0) && (status.getCode() == Status.AREA_FULL_NONE)) 
> < 			//{
> < 			//    status = new Status(Status.AREA_FULL_SOME);
> < 			//}
> < 			
> < 				// new block to replace the one above
> < 				// Hani Elabed 11/27/2000
> < 			if( status.getCode() == Status.AREA_FULL_NONE )
> < 			{
> < 					// something has already been laid out
> < 				if( (i != 0)  )
> < 				{
> < 					status = new Status(Status.AREA_FULL_SOME);
> < 				    anythingLaidOut = true;
> ---
> > 	    if ((status = fo.layout(blockArea)).isIncomplete()) {
> 317c300,315
> < 					return status;
> ---
> > 			if (status.laidOutNone()) {
> > 				if (prevChildMustKeepWithNext) {
> > 						// if something has already been laid out
> > 					if (i > this.marker+1)
> > 						status = new Status(Status.AREA_FULL_SOME);
> > 					this.marker = i-1;
> > 					FONode prevChild = (FONode) children.elementAt(this.marker);
> > 					prevChild.removeAreas();
> > 					prevChild.resetMarker();
> > 					((FObj)prevChild).removeID(area.getIDReferences());
> > 				}
> > 				else {
> > 						// if something has already been laid out
> > 					if (i > this.marker )
> > 						status = new Status(Status.AREA_FULL_SOME);
> > 					this.marker = i;
> 319,321c317,320
> < 				else	// i == 0 nothing was laid out..
> < 				{
> < 				    anythingLaidOut = false;
> ---
> > 
> > 				if (status.laidOutNone()) {
> > 					if (i == 0)
> > 					    anythingLaidOut = false;
> 325c324
> < 			
> ---
> > 
> 333c332,339
> < 	    anythingLaidOut = true;
> ---
> > 
> >         if (status.getCode() == Status.KEEP_WITH_NEXT) {
> > 			prevChildMustKeepWithNext = true;
> >         }
> > 		else {
> > 			prevChildMustKeepWithNext = false;
> >         }
> > 		anythingLaidOut = true;
> 341,342c347,348
> <        
> <         area.setAbsoluteHeight(blockArea.getAbsoluteHeight());       
> ---
> > 
> > 	area.setAbsoluteHeight(blockArea.getAbsoluteHeight());
> 372a379,386
> >     }
> > 
> >     public void removeAreas()
> >     {
> >         if (blockArea != null) {
> >     	   	blockArea.remove();
> > 	   		blockArea = null;
> >         }
> 
> *****CVS exited normally with code 1*****
> 


-- 
Kelly A. Campbell                        Software Engineer
camk@channelpoint.com                    Channelpoint, Inc.
camk@camk.net  camk@merlotxml.org        Colorado Springs, Co.