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

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

  Modified:src/java/org/apache/fop/pdf PDFEncryptionManager.java
   src/java/org/apache/fop/render/pdf PDFRenderer.java
  Log:
  Remove dependency of pdf package to the FOP user agent.
  
  Revision  ChangesPath
  1.5   +6 -10 
xml-fop/src/java/org/apache/fop/pdf/PDFEncryptionManager.java
  
  Index: PDFEncryptionManager.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/pdf/PDFEncryptionManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PDFEncryptionManager.java 31 Mar 2004 10:55:06 -  1.4
  +++ PDFEncryptionManager.java 10 Feb 2005 10:47:11 -  1.5
  @@ -1,5 +1,5 @@
   /*
  - * Copyright 1999-2004 The Apache Software Foundation.
  + * Copyright 1999-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.
  @@ -24,7 +24,6 @@
   import java.security.Security;
   
   import org.apache.commons.logging.Log;
  -import org.apache.fop.apps.FOUserAgent;
   
   /**
* This class acts as a factory for PDF encryption support. It enables the
  @@ -38,7 +37,7 @@
*/
   public static boolean isJCEAvailable() {
   try {
  -Class clazz = Class.forName(javax.crypto.Cipher);
  +/*Class clazz =*/ Class.forName(javax.crypto.Cipher);
   return true;
   } catch (ClassNotFoundException e) {
   return false;
  @@ -71,20 +70,17 @@
* Sets up PDF encryption if PDF encryption is requested by registering
* a codePDFEncryptionParams/code object with the user agent and if
* the necessary cryptographic support is available.
  - * @param userAgent the user agent
  + * @param params the PDF encryption params or null to disable encryption
* @param pdf the PDF document to setup encryption for
* @param log the logger to send warnings to
*/
  -public static void setupPDFEncryption(FOUserAgent userAgent, 
  +public static void setupPDFEncryption(PDFEncryptionParams params, 
 PDFDocument pdf,
 Log log) {
  -if (userAgent == null) {
  -throw new NullPointerException(User agent must not be null);
  -}
   if (pdf == null) {
   throw new NullPointerException(PDF document must not be null);
   }
  -if (userAgent.getPDFEncryptionParams() != null) {
  +if (params != null) {
   if (!checkAvailableAlgorithms()) {
   if (isJCEAvailable()) {
   log.warn(PDF encryption has been requested, JCE is 
  @@ -97,7 +93,7 @@
   + unavailable! The PDF won't be encrypted.);
   }
   }
  -pdf.setEncryption(userAgent.getPDFEncryptionParams());
  +pdf.setEncryption(params);
   }
   }
   
  
  
  
  1.78  +2 -1  
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.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- PDFRenderer.java  25 Jan 2005 12:53:29 -  1.77
  +++ PDFRenderer.java  10 Feb 2005 10:47:11 -  1.78
  @@ -257,7 +257,8 @@
   this.pdfDoc.outputHeader(stream);
   
   //Setup encryption if necessary
  -PDFEncryptionManager.setupPDFEncryption(userAgent, this.pdfDoc, 
getLogger());
  +PDFEncryptionManager.setupPDFEncryption(
  +userAgent.getPDFEncryptionParams(), this.pdfDoc, 
getLogger());
   }
   
   /**
  
  
  

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



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

2005-02-10 Thread jeremias
jeremias2005/02/10 04:50:07

  Modified:test/layoutengine disabled-testcases.txt
  Added:   test/layoutengine/testcases normal-breaking4.xml
  Log:
  Test case which indirectly tests the resetPosition() methods on various LMs. 
Currently, the lines are not rearranged after a page break when a different 
page-master gets active.
  
  Revision  ChangesPath
  1.1  xml-fop/test/layoutengine/testcases/normal-breaking4.xml
  
  Index: normal-breaking4.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: normal-breaking4.xml,v 1.1 2005/02/10 12:50:07 jeremias Exp $ --
  testcase
info
  p
This test checks normal breaking. It checks if lines are properly 
rearranged (reset) 
after a page break, especially when a new page-master becomes active.
  /p
/info
fo
  fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format;
fo:layout-master-set
  fo:simple-page-master master-name=narrow page-height=90pt 
page-width=150pt
fo:region-body/
  /fo:simple-page-master
  fo:simple-page-master master-name=wide page-height=180pt 
page-width=300pt
fo:region-body/
  /fo:simple-page-master
  fo:page-sequence-master master-name=master
fo:single-page-master-reference master-reference=narrow/
fo:single-page-master-reference master-reference=wide/
  /fo:page-sequence-master
/fo:layout-master-set
fo:page-sequence master-reference=master
  fo:flow flow-name=xsl-region-body
fo:block background-color=orange linefeed-treatment=preserve
  Apache FOP is a great tool to create PDF documents with.
  Apache FOP is a great tool to create PDF documents with.
  Apache FOP is a great tool to create PDF documents with.
  Apache FOP is a great tool to create PDF documents with.
  Apache FOP is a great tool to create PDF documents with.
  /fo:block
  /fo:flow
/fo:page-sequence
  /fo:root
/fo
checks
  eval expected=2 xpath=count(//pageViewport)/
  
  eval expected=15 
xpath=//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/@ipda//
  eval expected=15 
xpath=//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@ipda/
  !--eval expected=86400 
xpath=//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@bpda/--
  
  eval expected=30 
xpath=//pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/@ipda//
  eval expected=30 
xpath=//pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@ipda/
  !--eval expected=86400 
xpath=//pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@bpda/--
/checks
  /testcase
  
  
  
  1.14  +1 -0  xml-fop/test/layoutengine/disabled-testcases.txt
  
  Index: disabled-testcases.txt
  ===
  RCS file: /home/cvs/xml-fop/test/layoutengine/disabled-testcases.txt,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- disabled-testcases.txt9 Feb 2005 15:31:21 -   1.13
  +++ disabled-testcases.txt10 Feb 2005 12:50:07 -  1.14
  @@ -1,5 +1,6 @@
   breaks1.xml
   breaks2.xml
   markers5a.xml
  +normal-breaking4.xml
   table-cell3a.xml
   table-fixed2.xml
  \ No newline at end of file
  
  
  

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



cvs commit: xml-fop/test/layoutengine/testcases normal-breaking4.xml

2005-02-10 Thread jeremias
jeremias2005/02/10 04:52:35

  Modified:test/layoutengine/testcases normal-breaking4.xml
  Log:
  Adding an additional block at the end to see if a new block would behave 
differently.
  
  Revision  ChangesPath
  1.2   +2 -1  xml-fop/test/layoutengine/testcases/normal-breaking4.xml
  
  Index: normal-breaking4.xml
  ===
  RCS file: /home/cvs/xml-fop/test/layoutengine/testcases/normal-breaking4.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- normal-breaking4.xml  10 Feb 2005 12:50:07 -  1.1
  +++ normal-breaking4.xml  10 Feb 2005 12:52:35 -  1.2
  @@ -45,6 +45,7 @@
   Apache FOP is a great tool to create PDF documents with.
   Apache FOP is a great tool to create PDF documents with.
   /fo:block
  +fo:block background-color=yellowlast line in new block/fo:block
   /fo:flow
 /fo:page-sequence
   /fo:root
  
  
  

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



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

2005-02-10 Thread jeremias
jeremias2005/02/10 06:18:39

  Modified:src/java/org/apache/fop/layoutmgr AbstractLayoutManager.java
  Log:
  Some LMs don't need the childLM List. So create only when necessary.
  
  Revision  ChangesPath
  1.38  +7 -1  
xml-fop/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
  
  Index: AbstractLayoutManager.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- AbstractLayoutManager.java8 Feb 2005 09:17:50 -   1.37
  +++ AbstractLayoutManager.java10 Feb 2005 14:18:39 -  1.38
  @@ -41,7 +41,7 @@
*/
   public abstract class AbstractLayoutManager implements LayoutManager, 
Constants {
   protected LayoutManager parentLM = null;
  -protected List childLMs = new ArrayList(10);
  +protected List childLMs = null;
   protected ListIterator fobjIter = null;
   protected Map markers = null;
   
  @@ -453,6 +453,9 @@
* @see org.apache.fop.layoutmgr.LayoutManager#getChildLMs
*/
   public List getChildLMs() {
  +if (childLMs == null) {
  +childLMs = new java.util.ArrayList(10);
  +}
   return childLMs;
   }
   
  @@ -465,6 +468,9 @@
   }
   lm.setParent(this);
   lm.initialize();
  +if (childLMs == null) {
  +childLMs = new java.util.ArrayList(10);
  +}
   childLMs.add(lm);
   log.trace(this.getClass().getName()
 + : Adding child LM  + lm.getClass().getName());
  
  
  

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



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

2005-02-10 Thread jeremias
jeremias2005/02/10 07:54:03

  Modified:src/java/org/apache/fop/layoutmgr LineLayoutManager.java
  Log:
  Rearranged the process a bit to better show the different phases. Helped me 
to better understand what's going on there.
  
  Revision  ChangesPath
  1.40  +24 -16
xml-fop/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java
  
  Index: LineLayoutManager.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- LineLayoutManager.java2 Feb 2005 15:05:51 -   1.39
  +++ LineLayoutManager.java10 Feb 2005 15:54:03 -  1.40
  @@ -394,15 +394,15 @@
   }
   prevBP = null;
   
  -// here starts Knuth's algorithm
  -KnuthElement thisElement = null;
  -LinkedList returnedList = null;
  -LineBreakPosition lbp = null;
  -
  +//PHASE 1: Create Knuth elements
  +
   if (knuthParagraphs == null) {
   // it's the first time this method is called
   knuthParagraphs = new ArrayList();
  -breakpoints = new ArrayList();
  +
  +// here starts Knuth's algorithm
  +KnuthElement thisElement = null;
  +LinkedList returnedList = null;
   
   // convert all the text in a sequence of paragraphs made
   // of KnuthBox, KnuthGlue and KnuthPenalty objects
  @@ -490,14 +490,23 @@
   }
   }
   knuthPar.endParagraph();
  +} else {
  +// this method has been called before
  +// all line breaks are already calculated
  +}
   
  -// emergency patch
  -if (knuthParagraphs.size() == 0) {
  -setFinished(true);
  -return null;
  -}
  +// return finished when there's no content
  +if (knuthParagraphs.size() == 0) {
  +setFinished(true);
  +return null;
  +}
  +
  +//PHASE 2: Create line breaks
   
  +LineBreakPosition lbp = null;
  +if (breakpoints == null) {
   // find the optimal line breaking points for each paragraph
  +breakpoints = new ArrayList();
   ListIterator paragraphsIterator
   = knuthParagraphs.listIterator(knuthParagraphs.size());
   Paragraph currPar = null;
  @@ -505,11 +514,10 @@
   currPar = (Paragraph) paragraphsIterator.previous();
   findBreakingPoints(currPar, context.getStackLimit().opt);
   }
  -} else {
  -// this method has been called before
  -// all line breaks are already calculated
   }
   
  +//PHASE 3: Return lines
  +
   // get a break point from the list
   lbp = (LineBreakPosition) breakpoints.get(iReturnedLBP ++);
   if (iReturnedLBP == breakpoints.size()) {
  @@ -1364,9 +1372,9 @@
   }
   while ((LineBreakPosition) breakpoints.get(iReturnedLBP)
  != (LineBreakPosition) resetPos) {
  -iReturnedLBP --;
  +iReturnedLBP--;
   }
  -iReturnedLBP ++;
  +iReturnedLBP++;
   }
   }
   
  
  
  

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



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

2005-02-10 Thread jeremias
jeremias2005/02/10 12:02:36

  Added:   test/layoutengine/testcases table-hf2.xml table-hf1.xml
  Log:
  Test cases for table headers/footers.
  
  Revision  ChangesPath
  1.1  xml-fop/test/layoutengine/testcases/table-hf2.xml
  
  Index: table-hf2.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-hf2.xml,v 1.1 2005/02/10 20:02:36 jeremias Exp $ --
  testcase
info
  p
This test checks tables, especially headers and footers. Now with page 
breaks.
  /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%
  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 
xpath=//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[4]/block[1]/lineArea/
  eval expected=cell2