cvs commit: xml-fop/src/java/org/apache/fop/fo/flow Table.java

2005-02-11 Thread jeremias
jeremias2005/02/11 02:45:24

  Modified:src/java/org/apache/fop/layoutmgr/table
TableLayoutManager.java
   src/java/org/apache/fop/fo/flow Table.java
  Log:
  Implemented table-omit-header-at-break. The same for footers comes later when 
page breaking is revisited.
  
  Revision  ChangesPath
  1.18  +11 -5 
xml-fop/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
  
  Index: TableLayoutManager.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- TableLayoutManager.java   10 Feb 2005 19:40:46 -  1.17
  +++ TableLayoutManager.java   11 Feb 2005 10:45:24 -  1.18
  @@ -57,6 +57,7 @@
   private List bodyBreaks = new java.util.ArrayList();
   private BreakPoss headerBreak;
   private BreakPoss footerBreak;
  +private boolean firstRowHandled = false;
   
   private int referenceIPD;
   private boolean autoLayout = true;
  @@ -185,13 +186,17 @@
   //Calculate the headers and footers only when needed
   MinOptMax headerSize = null;
   if (getTable().getTableHeader() != null) {
  -Body tableHeader = new Body(getTable().getTableHeader());
  -tableHeader.setParent(this);
  -headerBreak = getHeight(tableHeader, context);
  -headerSize = headerBreak.getStackingSize();
  -stackSize.add(headerSize);
  +if (!getTable().omitHeaderAtBreak() || !firstRowHandled) 
{
  +Body tableHeader = new 
Body(getTable().getTableHeader());
  +tableHeader.setParent(this);
  +headerBreak = getHeight(tableHeader, context);
  +headerSize = headerBreak.getStackingSize();
  +stackSize.add(headerSize);
  +}
   }
   
  +//TODO Implement table-omit-footer-at-break once the page 
breaking
  +//is improved, so we don't have to do this twice
   MinOptMax footerSize = null;
   if (getTable().getTableFooter() != null) {
   Body tableFooter = new Body(getTable().getTableFooter());
  @@ -244,6 +249,7 @@
   stackSize.add(bp.getStackingSize());
   lastPos = bp;
   bodyBreaks.add(bp);
  +firstRowHandled = true;
   
   if (bp.nextBreakOverflows()) {
   over = true;
  
  
  
  1.48  +10 -0 xml-fop/src/java/org/apache/fop/fo/flow/Table.java
  
  Index: Table.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Table.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- Table.java9 Feb 2005 15:38:15 -   1.47
  +++ Table.java11 Feb 2005 10:45:24 -  1.48
  @@ -179,6 +179,16 @@
   public TableBody getTableFooter() {
   return tableFooter;
   }
  +
  +/** @return true if the table-header should be omitted at breaks */
  +public boolean omitHeaderAtBreak() {
  +return (this.tableOmitHeaderAtBreak == EN_TRUE);
  +}
  +
  +/** @return true if the table-footer should be omitted at breaks */
  +public boolean omitFooterAtBreak() {
  +return (this.tableOmitFooterAtBreak == EN_TRUE);
  +}
   
   /**
* @return the inline-progression-dimension property.
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: xml-fop/test/layoutengine disabled-testcases.txt

2005-02-11 Thread jeremias
jeremias2005/02/11 02:47:26

  Modified:test/layoutengine disabled-testcases.txt
  Added:   test/layoutengine/testcases table-hf3.xml table-hf4.xml
  Log:
  Test cases for table-omit-*-at-break. The one for footer is disabled because 
it's not implemented, yet.
  
  Revision  ChangesPath
  1.1  xml-fop/test/layoutengine/testcases/table-hf3.xml
  
  Index: table-hf3.xml
  ===
  ?xml version=1.0 encoding=UTF-8?
  !--
Copyright 2005 The Apache Software Foundation
  
Licensed under the Apache License, Version 2.0 (the License);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
  
 http://www.apache.org/licenses/LICENSE-2.0
  
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an AS IS BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
  --
  !-- $Id: table-hf3.xml,v 1.1 2005/02/11 10:47:26 jeremias Exp $ --
  testcase
info
  p
This test checks tables, especially headers and footers. Now with page 
breaks and omit-header-at-break.
  /p
/info
fo
  fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format; 
xmlns:svg=http://www.w3.org/2000/svg;
fo:layout-master-set
  fo:simple-page-master master-name=normal page-width=5in 
page-height=5in
fo:region-body/
  /fo:simple-page-master
/fo:layout-master-set
fo:page-sequence master-reference=normal white-space-collapse=true
  fo:flow flow-name=xsl-region-body
fo:table table-layout=fixed width=100% 
table-omit-header-at-break=true
  fo:table-column number-columns-repeated=2/
  fo:table-header
fo:table-row background-color=yellow
  fo:table-cell
fo:blockheader/fo:block
  /fo:table-cell
  fo:table-cell
fo:blockstart of page fo:page-number//fo:block
  /fo:table-cell
/fo:table-row
  /fo:table-header
  fo:table-footer
fo:table-row background-color=orange
  fo:table-cell
fo:blockfooter/fo:block
  /fo:table-cell
  fo:table-cell
fo:blockend of page fo:page-number//fo:block
  /fo:table-cell
/fo:table-row
  /fo:table-footer
  fo:table-body
fo:table-row height=100pt
  fo:table-cell
fo:blockcell1/fo:block
  /fo:table-cell
  fo:table-cell background-color=lightgray
fo:blockcell2/fo:block
  /fo:table-cell
/fo:table-row
fo:table-row height=100pt
  fo:table-cell background-color=lightgray
fo:blockcell3/fo:block
  /fo:table-cell
  fo:table-cell
fo:blockcell4/fo:block
  /fo:table-cell
/fo:table-row
fo:table-row height=100pt
  fo:table-cell
fo:blockcell5/fo:block
  /fo:table-cell
  fo:table-cell background-color=lightgray
fo:blockcell6/fo:block
  /fo:table-cell
/fo:table-row
fo:table-row height=100pt
  fo:table-cell background-color=lightgray
fo:blockcell7/fo:block
  /fo:table-cell
  fo:table-cell
fo:blockcell8/fo:block
  /fo:table-cell
/fo:table-row
  /fo:table-body
/fo:table
  /fo:flow
/fo:page-sequence
  /fo:root
/fo
checks
  !-- page 1 --
  eval expected=header 
xpath=//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[2]/block[1]/lineArea/
  eval expected=18 
xpath=//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[2]/@ipda/
  !--eval expected=14400 
xpath=//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[2]/@bpda/--
  true 
xpath=contains(//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[3]/block[1]/lineArea,
 '1')/
  eval expected=18 
xpath=//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[3]/@ipda/
  !--eval expected=14400 
xpath=//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[3]/@bpda/--
  
  eval expected=cell1 

cvs commit: xml-fop/test/layoutengine/testcases table-cell6.xml

2005-02-11 Thread jeremias
jeremias2005/02/11 04:17:06

  Added:   test/layoutengine/testcases table-cell6.xml
  Log:
  Test case for column spanning.
  
  Revision  ChangesPath
  1.1  xml-fop/test/layoutengine/testcases/table-cell6.xml
  
  Index: table-cell6.xml
  ===
  ?xml version=1.0 encoding=UTF-8?
  !--
Copyright 2005 The Apache Software Foundation
  
Licensed under the Apache License, Version 2.0 (the License);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
  
 http://www.apache.org/licenses/LICENSE-2.0
  
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an AS IS BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
  --
  !-- $Id: table-cell6.xml,v 1.1 2005/02/11 12:17:06 jeremias Exp $ --
  testcase
info
  p
This test checks tables, especially table-cells. This test: simple 
horizontal spans.
  /p
/info
fo
  fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format; 
xmlns:svg=http://www.w3.org/2000/svg;
fo:layout-master-set
  fo:simple-page-master master-name=normal page-width=5in 
page-height=5in
fo:region-body/
  /fo:simple-page-master
/fo:layout-master-set
fo:page-sequence master-reference=normal white-space-collapse=true
  fo:flow flow-name=xsl-region-body
fo:table table-layout=fixed border-collapse=separate 
border-spacing=5pt 0pt
  fo:table-column column-width=68pt number-columns-repeated=5/
  fo:table-body
fo:table-row
  fo:table-cell
fo:blockcell1/fo:block
  /fo:table-cell
  fo:table-cell background-color=yellow
fo:blockcell2/fo:block
  /fo:table-cell
  fo:table-cell background-color=lightgreen
fo:blockcell3/fo:block
  /fo:table-cell
  fo:table-cell background-color=yellow
fo:blockcell4/fo:block
  /fo:table-cell
  fo:table-cell background-color=lightgreen
fo:blockcell5/fo:block
  /fo:table-cell
/fo:table-row
fo:table-row
  fo:table-cell
fo:blockcell6a/fo:block
fo:blockcell6b/fo:block
  /fo:table-cell
  fo:table-cell number-columns-spanned=2 
background-color=orange text-align=center
fo:blockcell7a/fo:block
fo:blockcell7b/fo:block
  /fo:table-cell
  fo:table-cell
fo:blockcell8a/fo:block
fo:blockcell8b/fo:block
  /fo:table-cell
/fo:table-row
fo:table-row
  fo:table-cell column-number=2 number-columns-spanned=3 
background-color=orange text-align=center
fo:blockcell9a/fo:block
fo:blockcell9b/fo:block
  /fo:table-cell
/fo:table-row
  /fo:table-body
/fo:table
  /fo:flow
/fo:page-sequence
  /fo:root
/fo
checks
  eval expected=cell1 
xpath=//flow/block[1]/block[1]/block[1]/lineArea/
  eval expected=63000 xpath=//flow/block[1]/block[1]/@ipda/
  eval expected=2500 xpath=//flow/block[1]/block[1]/@left-offset/
  eval expected=cell2 
xpath=//flow/block[1]/block[2]/block[1]/lineArea/
  eval expected=63000 xpath=//flow/block[1]/block[2]/@ipda/
  eval expected=70500 xpath=//flow/block[1]/block[2]/@left-offset/
  eval expected=cell3 
xpath=//flow/block[1]/block[3]/block[1]/lineArea/
  eval expected=63000 xpath=//flow/block[1]/block[3]/@ipda/
  eval expected=138500 xpath=//flow/block[1]/block[3]/@left-offset/
  eval expected=cell4 
xpath=//flow/block[1]/block[4]/block[1]/lineArea/
  eval expected=63000 xpath=//flow/block[1]/block[4]/@ipda/
  eval expected=206500 xpath=//flow/block[1]/block[4]/@left-offset/
  eval expected=cell5 
xpath=//flow/block[1]/block[5]/block[1]/lineArea/
  eval expected=63000 xpath=//flow/block[1]/block[5]/@ipda/
  eval expected=274500 xpath=//flow/block[1]/block[5]/@left-offset/
  
  eval expected=cell6a 
xpath=//flow/block[1]/block[6]/block[1]/lineArea/
  eval expected=cell6b 
xpath=//flow/block[1]/block[6]/block[2]/lineArea/
  eval expected=63000 xpath=//flow/block[1]/block[6]/@ipda/
  eval expected=2500 xpath=//flow/block[1]/block[6]/@left-offset/
  eval expected=cell7a 
xpath=//flow/block[1]/block[7]/block[1]/lineArea/
  eval 

cvs commit: xml-fop/test/layoutengine/testcases table-cell7.xml

2005-02-11 Thread jeremias
jeremias2005/02/11 04:17:32

  Added:   test/layoutengine/testcases table-cell7.xml
  Log:
  Test case for empty-cells attribute.
  
  Revision  ChangesPath
  1.1  xml-fop/test/layoutengine/testcases/table-cell7.xml
  
  Index: table-cell7.xml
  ===
  ?xml version=1.0 encoding=UTF-8?
  !--
Copyright 2005 The Apache Software Foundation
  
Licensed under the Apache License, Version 2.0 (the License);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
  
 http://www.apache.org/licenses/LICENSE-2.0
  
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an AS IS BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
  --
  !-- $Id: table-cell7.xml,v 1.1 2005/02/11 12:17:32 jeremias Exp $ --
  testcase
info
  p
This test checks tables, especially table-cells. This test: borders in 
conjunction with empty-cells.
  /p
/info
fo
  fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format; 
xmlns:svg=http://www.w3.org/2000/svg;
fo:layout-master-set
  fo:simple-page-master master-name=normal page-width=5in 
page-height=5in
fo:region-body/
  /fo:simple-page-master
/fo:layout-master-set
fo:page-sequence master-reference=normal white-space-collapse=true
  fo:flow flow-name=xsl-region-body
fo:table table-layout=fixed border-collapse=separate
  fo:table-column column-width=160pt/
  fo:table-column column-width=200pt/
  fo:table-body
fo:table-row
  fo:table-cell background-color=yellow border=solid 5pt
fo:block/
  /fo:table-cell
  fo:table-cell border=solid 5pt
fo:blockcell2/fo:block
  /fo:table-cell
/fo:table-row
fo:table-row empty-cells=show
  fo:table-cell background-color=yellow border=solid 5pt
fo:block/
  /fo:table-cell
  fo:table-cell border=solid 5pt
fo:blockcell4/fo:block
  /fo:table-cell
/fo:table-row
fo:table-row empty-cells=hide
  fo:table-cell background-color=yellow border=solid 5pt
fo:block/
  /fo:table-cell
  fo:table-cell border=solid 5pt
fo:blockcell6/fo:block
  /fo:table-cell
/fo:table-row
  /fo:table-body
/fo:table
  /fo:flow
/fo:page-sequence
  /fo:root
/fo
checks
  eval expected=color=#00,repeat=0,horiz=0,vertical=0 
xpath=//flow/block[1]/block[1]/@background/
  eval expected=5000 5000 5000 5000 
xpath=//flow/block[1]/block[1]/@bap/
  eval expected=cell2 
xpath=//flow/block[1]/block[2]/block[1]/lineArea/
  
  eval expected=color=#00,repeat=0,horiz=0,vertical=0 
xpath=//flow/block[1]/block[3]/@background/
  eval expected=5000 5000 5000 5000 
xpath=//flow/block[1]/block[3]/@bap/
  eval expected=cell4 
xpath=//flow/block[1]/block[4]/block[1]/lineArea/
  
  true xpath=not(boolean(//flow/block[1]/block[5]/@background))/
  eval expected=0 0 0 0 xpath=//flow/block[1]/block[5]/@bap/
  eval expected=cell6 
xpath=//flow/block[1]/block[6]/block[1]/lineArea/
/checks
  /testcase
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr/table Cell.java

2005-02-11 Thread jeremias
jeremias2005/02/11 04:19:05

  Modified:src/java/org/apache/fop/fo/flow TableCell.java
   src/java/org/apache/fop/layoutmgr/table Cell.java
  Log:
  empty-cells implemented.
  
  Revision  ChangesPath
  1.46  +5 -0  xml-fop/src/java/org/apache/fop/fo/flow/TableCell.java
  
  Index: TableCell.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/TableCell.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- TableCell.java8 Feb 2005 16:16:48 -   1.45
  +++ TableCell.java11 Feb 2005 12:19:04 -  1.46
  @@ -298,6 +298,11 @@
   return Math.max(columnNumber.getValue(), 0);
   }
   
  +/** @return true if empty-cells is show */
  +public boolean showEmptyCells() {
  +return (this.emptyCells == EN_SHOW);
  +}
  +
   /**
* @return the id property.
*/
  
  
  
  1.20  +10 -3 xml-fop/src/java/org/apache/fop/layoutmgr/table/Cell.java
  
  Index: Cell.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/table/Cell.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Cell.java 9 Feb 2005 11:51:30 -   1.19
  +++ Cell.java 11 Feb 2005 12:19:05 -  1.20
  @@ -34,7 +34,6 @@
   import org.apache.fop.layoutmgr.TraitSetter;
   import org.apache.fop.area.Area;
   import org.apache.fop.area.Block;
  -import org.apache.fop.area.CTM;
   import org.apache.fop.area.Trait;
   import org.apache.fop.traits.MinOptMax;
   
  @@ -61,6 +60,7 @@
   private int rowHeight;
   private int usedBPD;
   private int borderAndPaddingBPD;
  +private boolean emptyCell = true;
   
   /**
* Create a new Cell layout manager.
  @@ -168,6 +168,9 @@
   }
   
   usedBPD = stackSize.opt;
  +if (usedBPD  0) {
  +emptyCell = false;
  +}
   
   LengthRangeProperty specifiedBPD = 
fobj.getBlockProgressionDimension();
   if (specifiedBPD.getEnum() != EN_AUTO) {
  @@ -249,6 +252,12 @@
   addID(fobj.getId());
   }
   
  +if (!emptyCell || (getTable().getBorderCollapse() == EN_SEPARATE 
  + fobj.showEmptyCells())) {
  +TraitSetter.addBorders(curBlockArea, 
fobj.getCommonBorderPaddingBackground());
  +TraitSetter.addBackground(curBlockArea, 
fobj.getCommonBorderPaddingBackground());
  +}
  +
   //Handle display-align
   if (usedBPD  rowHeight) {
   if (fobj.getDisplayAlign() == EN_CENTER) {
  @@ -277,8 +286,6 @@
   }
   }
   
  -TraitSetter.addBorders(curBlockArea, 
fobj.getCommonBorderPaddingBackground());
  -TraitSetter.addBackground(curBlockArea, 
fobj.getCommonBorderPaddingBackground());
   
   int contentBPD = rowHeight;
   contentBPD -= borderAndPaddingBPD;
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: xml-fop/test/layoutengine/testcases border3.xml

2005-02-11 Thread jeremias
jeremias2005/02/11 12:56:44

  Added:   test/layoutengine/testcases border3.xml
  Log:
  Test for all border-styles.
  
  Revision  ChangesPath
  1.1  xml-fop/test/layoutengine/testcases/border3.xml
  
  Index: border3.xml
  ===
  ?xml version=1.0 encoding=UTF-8?
  !--
Copyright 2005 The Apache Software Foundation
  
Licensed under the Apache License, Version 2.0 (the License);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
  
 http://www.apache.org/licenses/LICENSE-2.0
  
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an AS IS BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
  --
  !-- $Id: border3.xml,v 1.1 2005/02/11 20:56:44 jeremias Exp $ --
  testcase
info
  p
This test checks painting of borders and border-style.
  /p
/info
fo
  fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format; 
xmlns:svg=http://www.w3.org/2000/svg;
fo:layout-master-set
  fo:simple-page-master master-name=normal page-width=5in 
page-height=5in
fo:region-body/
  /fo:simple-page-master
/fo:layout-master-set
fo:page-sequence master-reference=normal white-space-collapse=true
  fo:flow flow-name=xsl-region-body
fo:table table-layout=fixed width=100% 
border-collapse=separate
  fo:table-column column-width=1in number-columns-repeated=5/
  fo:table-body
fo:table-row
  fo:table-cell border=solid 5pt black 
background-color=lightgray
fo:blocksolid/fo:block
  /fo:table-cell
  fo:table-cell border=dashed 5pt red
fo:blockdashed/fo:block
  /fo:table-cell
  fo:table-cell border=dotted 5pt green 
background-color=lightgray
fo:blockdotted/fo:block
  /fo:table-cell
  fo:table-cell border=double 5pt blue
fo:blockdouble/fo:block
  /fo:table-cell
  fo:table-cell border=groove 5pt orange 
background-color=orange
fo:blockgroove/fo:block
  /fo:table-cell
/fo:table-row
fo:table-row
  fo:table-cell border=solid 2pt black 
background-color=lightgray
fo:blocksolid/fo:block
  /fo:table-cell
  fo:table-cell border=dashed 2pt red
fo:blockdashed/fo:block
  /fo:table-cell
  fo:table-cell border=dotted 2pt green 
background-color=lightgray
fo:blockdotted/fo:block
  /fo:table-cell
  fo:table-cell border=double 2pt blue
fo:blockdouble/fo:block
  /fo:table-cell
  fo:table-cell border=groove 2pt orange 
background-color=orange
fo:blockgroove/fo:block
  /fo:table-cell
/fo:table-row
fo:table-row
  fo:table-cell border=groove 5pt gray 
background-color=gray
fo:block color=whitegroove/fo:block
  /fo:table-cell
  fo:table-cell border=ridge 5pt red
fo:blockridge/fo:block
  /fo:table-cell
  fo:table-cell border=inset 5pt green
fo:blockinset/fo:block
  /fo:table-cell
  fo:table-cell border=outset 5pt blue 
background-color=lightgray
fo:blockoutset/fo:block
  /fo:table-cell
/fo:table-row
fo:table-row
  fo:table-cell border=groove 2pt gray 
background-color=gray
fo:block color=whitegroove/fo:block
  /fo:table-cell
  fo:table-cell border=ridge 2pt red
fo:blockridge/fo:block
  /fo:table-cell
  fo:table-cell border=inset 2pt green
fo:blockinset/fo:block
  /fo:table-cell
  fo:table-cell border=outset 2pt blue 
background-color=lightgray
fo:blockoutset/fo:block
  /fo:table-cell
/fo:table-row
fo:table-row
  fo:table-cell border=none 5pt yellow 
background-color=brown
fo:blocknone/fo:block
  /fo:table-cell
  fo:table-cell border=hidden 5pt yellow 
background-color=brown
fo:blockhidden/fo:block
  /fo:table-cell
 

cvs commit: xml-fop/src/java/org/apache/fop/pdf PDFColor.java

2005-02-11 Thread jeremias
jeremias2005/02/11 13:30:03

  Modified:src/java/org/apache/fop/render/pdf PDFRenderer.java
   src/java/org/apache/fop/pdf PDFColor.java
  Log:
  Implemented the rest of the border styles. Now uses clipping while painting 
the borders to paint nicer edges. Some of this code should later be extracted 
into utility classes so other renderers can use the same code.
  Dotted-style could use some tweaking (dots are clipped at the edges).
  
  Revision  ChangesPath
  1.79  +311 -40   
xml-fop/src/java/org/apache/fop/render/pdf/PDFRenderer.java
  
  Index: PDFRenderer.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/render/pdf/PDFRenderer.java,v
  retrieving revision 1.78
  retrieving revision 1.79
  diff -u -r1.78 -r1.79
  --- PDFRenderer.java  10 Feb 2005 10:47:11 -  1.78
  +++ PDFRenderer.java  11 Feb 2005 21:30:03 -  1.79
  @@ -651,48 +651,265 @@
   }
   }
   
  +boolean b[] = new boolean[] {
  +(bpsBefore != null), (bpsEnd != null), 
  +(bpsAfter != null), (bpsStart != null)};
  +float bw[] = new float[] {
  +(b[0] ? bpsBefore.width / 1000f : 0.0f),
  +(b[1] ? bpsEnd.width / 1000f : 0.0f),
  +(b[2] ? bpsAfter.width / 1000f : 0.0f),
  +(b[3] ? bpsStart.width / 1000f : 0.0f)};
  +boolean slant[] = new boolean[] {
  +(b[3]  b[0]), (b[0]  b[1]), (b[1]  b[2]), (b[2]  b[3])};
   if (bpsBefore != null) {
   endTextObject();
   
  -float bwidth = bpsBefore.width / 1000f;
  -updateColor(bpsBefore.color, false, null);
  -updateLineStyle(bpsBefore.style);
  -updateLineWidth(bwidth);
  -float y1 = starty + bwidth / 2;
  -drawLine(startx, y1, startx + width, y1);
  +float sx1 = startx;
  +float sx2 = (slant[0] ? sx1 + bw[3] : sx1);
  +float ex1 = startx + width;
  +float ex2 = (slant[1] ? ex1 - bw[1] : ex1);
  +float outery = starty;
  +float innery = outery + bw[0];
  +
  +saveGraphicsState();
  +moveTo(sx1, outery);
  +lineTo(ex1, outery);
  +lineTo(ex2, innery);
  +lineTo(sx2, innery);
  +closePath();
  +clip();
  +drawBorderLine(sx1, outery, ex1, innery, true, true, 
bpsBefore.style, bpsBefore.color);
  +restoreGraphicsState();
   }
  -if (bpsAfter != null) {
  +if (bpsEnd != null) {
   endTextObject();
   
  -float bwidth = bpsAfter.width / 1000f;
  -updateColor(bpsAfter.color, false, null);
  -updateLineStyle(bpsAfter.style);
  -updateLineWidth(bwidth);
  -float y1 = starty - bwidth / 2;
  -drawLine(startx, y1 + height, startx + width, y1 + height);
  +float sy1 = starty;
  +float sy2 = (slant[1] ? sy1 + bw[0] : sy1);
  +float ey1 = starty + height;
  +float ey2 = (slant[2] ? ey1 - bw[2] : ey1);
  +float outerx = startx + width;
  +float innerx = outerx - bw[1];
  +
  +saveGraphicsState();
  +moveTo(outerx, sy1);
  +lineTo(outerx, ey1);
  +lineTo(innerx, ey2);
  +lineTo(innerx, sy2);
  +closePath();
  +clip();
  +drawBorderLine(innerx, sy1, outerx, ey1, false, false, 
bpsEnd.style, bpsEnd.color);
  +restoreGraphicsState();
   }
  -if (bpsStart != null) {
  +if (bpsAfter != null) {
   endTextObject();
   
  -float bwidth = bpsStart.width / 1000f;
  -updateColor(bpsStart.color, false, null);
  -updateLineStyle(bpsStart.style);
  -updateLineWidth(bwidth);
  -float x1 = startx + bwidth / 2;
  -drawLine(x1, starty, x1, starty + height);
  +float sx1 = startx;
  +float sx2 = (slant[3] ? sx1 + bw[3] : sx1);
  +float ex1 = startx + width;
  +float ex2 = (slant[2] ? ex1 - bw[1] : ex1);
  +float outery = starty + height;
  +float innery = outery - bw[2];
  +
  +saveGraphicsState();
  +moveTo(ex1, outery);
  +lineTo(sx1, outery);
  +lineTo(sx2, innery);
  +lineTo(ex2, innery);
  +closePath();
  +clip();
  +drawBorderLine(sx1, innery, ex1, outery, true, false, 
bpsAfter.style, bpsAfter.color);
  +restoreGraphicsState();
   }
  -if (bpsEnd != null) {
  +if (bpsStart != null) {
   endTextObject();
   
  -float bwidth = bpsEnd.width / 1000f;
  -updateColor(bpsEnd.color, false,