Browse Source

Merged revisions 656546,657465,657521,657921,660979,660998,661276,661310,661999,662009,662203,662417,662807,662991,663045,663493,664347,664349-664350,665691,665699,665740,665793,665995,666596,666967,667367,667831,667862,667864,667893,668177,668576,669423,669436,669835,670217,670222,670323,670325,670332,670335-670336,670341,670344,670401,670409,670411-670412,670422-670424,670492,670689,670723,670760-670761,670763,670765-670767,670770,670773,670777,671145,672010,672026,672495-672496,672499,672537,672539,672564-672565,672617-672618,672670,672833,674039,674043,674056,674065,674245,674267,674269,674272-674273,674276,674325,674468,674470-674471,674484,674486-674487 via svnmerge from

https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk

................
  r656546 | adelmelle | 2008-05-15 09:33:19 +0100 (Thu, 15 May 2008) | 1 line
  
  Tweak: make sure the fo:flow's id is bound to the FObj
................
  r657465 | adelmelle | 2008-05-17 22:18:19 +0100 (Sat, 17 May 2008) | 1 line
  
  Corrected testcase: since the fo:flow's ID is correctly processed...
................
  r657521 | maxberger | 2008-05-18 10:39:03 +0100 (Sun, 18 May 2008) | 1 line
  
  Updated as per suggestions in bug 45019
................
  r657921 | spepping | 2008-05-19 20:02:18 +0100 (Mon, 19 May 2008) | 6 lines
  
  Added event TableEventProducer.forceNextColumnNumber when
  TableFObj.ColumnNumberPropertyMaker forces a zero or negative
  column-number property to the next available column, because this is a
  FOP extension. Fixed TableFObj.ColumnNumberPropertyMaker.make to
  really report a cell overlap event.
................
  r660979 | vhennebert | 2008-05-28 16:24:23 +0100 (Wed, 28 May 2008) | 3 lines
  
  Bugzilla 37579: added support for footnotes in lists and table bodies (not header nor footer).
  This is /not/ to be considered a final fix: similar code is duplicated over several classes (LineLayoutManager, ListItemLayoutManager and to less extent TableStepper). Footnotes should probably be handled another way.
................
  r660998 | maxberger | 2008-05-28 17:10:32 +0100 (Wed, 28 May 2008) | 1 line
  
  Implemented Font auto-selection word-by-word
................
  r661276 | vhennebert | 2008-05-29 10:58:06 +0100 (Thu, 29 May 2008) | 2 lines
  
  Set svn:keywords and svn:eol-style properties for files added in revision 660998
................
  r661310 | maxberger | 2008-05-29 13:03:48 +0100 (Thu, 29 May 2008) | 1 line
  
  Added docs for my recent commit (word-by-word character selection)
................
  r661999 | adelmelle | 2008-05-31 11:56:05 +0100 (Sat, 31 May 2008) | 3 lines
  
  Bugzilla 45097:
  Leading/trailing white-space not removed from nested inline-content when there is no preceding/following text.
................
  r662009 | maxberger | 2008-05-31 12:45:55 +0100 (Sat, 31 May 2008) | 1 line
  
  Code Cleanups (no functional change)
................
  r662203 | maxberger | 2008-06-01 12:57:33 +0100 (Sun, 01 Jun 2008) | 1 line
  
  More code Cleanups (no functional changes)
................
  r662417 | jeremias | 2008-06-02 13:50:55 +0100 (Mon, 02 Jun 2008) | 1 line
  
  Integer keeps inside multi-line blocks and in between block-paragraphs.
................
  r662807 | jeremias | 2008-06-03 15:13:27 +0100 (Tue, 03 Jun 2008) | 3 lines
  
  Bugzilla #45115:
  Added a PCL-specific extension attribute on simple-page-master for controlling the simplex/duplex mode.
  Submitted by: Martin Edge <Martin.Edge.at.asmorphic.net.au>
................
  r662991 | jeremias | 2008-06-04 07:10:37 +0100 (Wed, 04 Jun 2008) | 1 line
  
  ApacheCon EU 2008 is long over.
................
  r663045 | adelmelle | 2008-06-04 10:53:15 +0100 (Wed, 04 Jun 2008) | 1 line
  
  Minor cleanup: remove spurious white-space
................
  r663493 | jeremias | 2008-06-05 08:41:06 +0100 (Thu, 05 Jun 2008) | 1 line
  
  Restored lost overflow warning in static-content.
................
  r664347 | adelmelle | 2008-06-07 15:49:42 +0100 (Sat, 07 Jun 2008) | 5 lines
  
  Extended behavior of preserved linefeeds to codepoints representing mandatory breaks in Unicode UAX#14:
  - NEXT LINE (U+0085)
  - LINE SEPARATOR (U+2028)
  - PARAGRAPH SEPARATOR (U+2029)
................
  r664349 | adelmelle | 2008-06-07 15:54:13 +0100 (Sat, 07 Jun 2008) | 1 line
  
  Minor cleanup: remove unneeded constant
................
  r664350 | adelmelle | 2008-06-07 16:09:42 +0100 (Sat, 07 Jun 2008) | 1 line
  
  Improve code-readability; add some clarifying comments
................
  r665691 | jeremias | 2008-06-09 15:01:53 +0100 (Mon, 09 Jun 2008) | 82 lines
  
  Merged revisions 636407-637074,637076-637118,637120-637790,637792-637856,637858-637992,637994-638047,638049-638307,638309-638315,638318-664698 via svnmerge from 
  https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_95
  
  ........
    r638937 | jeremias | 2008-03-19 18:08:57 +0100 (Mi, 19 Mrz 2008) | 1 line
    
    A nit.
  ........
    r640889 | vhennebert | 2008-03-25 17:43:55 +0100 (Di, 25 Mrz 2008) | 2 lines
    
    Set the final release date and added a news item about the 0.95beta release (the change was made before updating the website)
  ........
    r642906 | jeremias | 2008-03-31 09:12:40 +0200 (Mo, 31 Mrz 2008) | 3 lines
    
    Added version number to xml-apis-ext (as suggested by Karel Vervaeke).
    Moved xml-apis to same version as xml-apis-ext.
    Added missing licensing info about xml-apis-ext.
  ........
    r647403 | jeremias | 2008-04-12 11:02:01 +0200 (Sa, 12 Apr 2008) | 1 line
    
    Fixed NullPointerException when loading a TrueType font using XML font metric files.
  ........
    r647537 | jeremias | 2008-04-13 09:36:00 +0200 (So, 13 Apr 2008) | 1 line
    
    Performance improvement when encoding images: Fixed an important hotspot by extending CloseBlocker from ProxyOutputStream instead of FilterOutputStream as the latter routes all write(byte[]) calls through write(int).
  ........
    r648984 | jeremias | 2008-04-17 09:00:22 +0200 (Do, 17 Apr 2008) | 1 line
    
    HeadURL was missing in the properties.
  ........
    r649006 | jeremias | 2008-04-17 10:42:52 +0200 (Do, 17 Apr 2008) | 1 line
    
    Fixed text extraction problem with ZapfDingbats and Symbol font in PDF output. These fonts are symbolic and must not use an Encoding value in PDF. Applies to the built-in base 14 variant and to the case where these fonts are explicitely embedded.
  ........
    r649014 | jeremias | 2008-04-17 11:10:15 +0200 (Do, 17 Apr 2008) | 1 line
    
    Added missing change information.
  ........
    r650550 | vhennebert | 2008-04-22 17:22:31 +0200 (Di, 22 Apr 2008) | 4 lines
    
    Bugzilla 41621:
    - length of the penalty now correctly computed;
    - AssertionError fixed.
  ........
    r651302 | jeremias | 2008-04-24 18:08:53 +0200 (Do, 24 Apr 2008) | 3 lines
    
    Fixed regression causing bad positioning of block-containers if used as descendant of a table-cell. This was not caught because of the lack of a test case that would have shown the problem in visual testing with BatchDiffer.
    See also: http://mail-archives.apache.org/mod_mbox/xmlgraphics-fop-users/200804.mbox/%3c20080424164128.973A.DEV@jeremias-maerki.ch%3e
  ........
    r653537 | vhennebert | 2008-05-05 19:47:28 +0200 (Mo, 05 Mai 2008) | 2 lines
    
    Bugfix: the before border of cells below a column-spanning cell had their value taken from the leading case, instead of the normal one.
  ........
    r654453 | jeremias | 2008-05-08 11:14:04 +0200 (Do, 08 Mai 2008) | 2 lines
    
    Added /usr/local/share/fonts as additional possible location for fonts on Unixes.
  ........
    r656286 | jeremias | 2008-05-14 16:16:49 +0200 (Mi, 14 Mai 2008) | 1 line
    
    Restored plug-in API compatibility with FOP 0.94. Fixes a NoSuchMethodError when Barcode4J is run.
  ........
    r656524 | jeremias | 2008-05-15 09:07:18 +0200 (Do, 15 Mai 2008) | 1 line
    
    Fixed rendering of fixed block-containers in AFP output. The break-out was actually never implemented which is necessary for supporting fixed positioned viewports.
  ........
    r657520 | maxberger | 2008-05-18 11:38:45 +0200 (So, 18 Mai 2008) | 1 line
    
    Updated as per suggestions in bug 45019
  ........
    r661580 | maxberger | 2008-05-30 08:42:17 +0200 (Fr, 30 Mai 2008) | 1 line
    
    added my key to KEYS, it is used for signing mvn artifacts
  ........
    r663482 | jeremias | 2008-06-05 09:06:37 +0200 (Do, 05 Jun 2008) | 1 line
    
    Fixed positioning of absolutely positioned block-containers in multi-column documents.
  ........
    r664692 | jeremias | 2008-06-09 14:49:45 +0200 (Mo, 09 Jun 2008) | 1 line
    
    Restored PSImageUtils. I had deleted it prematurely. Extensions like Barcode4J rely on this class.
  ........
................
  r665699 | maxberger | 2008-06-09 15:15:38 +0100 (Mon, 09 Jun 2008) | 1 line
  
  Replaced LinkedList with generic List interface
................
  r665740 | adelmelle | 2008-06-09 17:20:08 +0100 (Mon, 09 Jun 2008) | 1 line
  
  Minor update: make the codegen-unicode target create LineBreakUtils.java at the appropriate place in the source tree
................
  r665793 | adelmelle | 2008-06-09 18:27:51 +0100 (Mon, 09 Jun 2008) | 9 lines
  
  Some updates (improvements?) in the UAX#14-related files:
  - LineBreakPairTable.txt: replace tabs with spaces to make the file a bit easier to read (constant column-width, instead of depending on an editor's settings for tabs)
  - GenerateLineBreakUtils.java:
    - generate a public final utility class
    - add some spacing in the generated file, after commas and before/after '=' (same styling as manually created files)
    - use Java 1.4 String.split() to tokenize lines, instead of StringTokenizer
    - add javadoc comments for public constants and methods
  - LineBreakUtils.java: regenerated after the above updates
................
  r665995 | maxberger | 2008-06-10 08:52:36 +0100 (Tue, 10 Jun 2008) | 1 line
  
  Replaced getLast() calls with calls to listUtil
................
  r666596 | vhennebert | 2008-06-11 10:52:04 +0100 (Wed, 11 Jun 2008) | 2 lines
  
  Fixed typo
................
  r666967 | maxberger | 2008-06-12 07:07:28 +0100 (Thu, 12 Jun 2008) | 1 line
  
  Added PMD and Findbugs report, 'reports' target'
................
  r667367 | maxberger | 2008-06-13 07:03:30 +0100 (Fri, 13 Jun 2008) | 1 line
  
  Disabled retroweaver task definition, because it breaks gump
................
  r667831 | maxberger | 2008-06-14 17:21:15 +0100 (Sat, 14 Jun 2008) | 1 line
  
  minor spelling fixes
................
  r667862 | maxberger | 2008-06-14 19:18:14 +0100 (Sat, 14 Jun 2008) | 1 line
  
  minor spelling fixes
................
  r667864 | maxberger | 2008-06-14 19:23:28 +0100 (Sat, 14 Jun 2008) | 1 line
  
  minor spelling & checkstyle fixes
................
  r667893 | maxberger | 2008-06-14 23:20:42 +0100 (Sat, 14 Jun 2008) | 1 line
  
  removed double storage of 'fobj'
................
  r668177 | lfurini | 2008-06-16 15:52:14 +0100 (Mon, 16 Jun 2008) | 2 lines
  
  Fixing the PageBreakingAlgorithm, replacing calls to getLineWidth() with getLineWidth(int) so as to take into account each page's real height.
  This fixes the positioning of footnotes when the page bpd is not the same for all pages.
................
  r668576 | jeremias | 2008-06-17 10:04:05 +0100 (Tue, 17 Jun 2008) | 1 line
  
  Wrong line number reported in the case of a line overflow.
................
  r669423 | jeremias | 2008-06-19 09:25:46 +0100 (Thu, 19 Jun 2008) | 1 line
  
  Simplifications and a Checkstyle fix.
................
  r669436 | jeremias | 2008-06-19 10:46:12 +0100 (Thu, 19 Jun 2008) | 2 lines
  
  Separation of concerns:
  Split FOEventHandler into FOEventHandler and FOTreeBuilderContext. The latter contains stuff only used at tree-building stage. FOEventHandler is oriented towards output.
................
  r669835 | acumiskey | 2008-06-20 10:18:56 +0100 (Fri, 20 Jun 2008) | 1 line
  
  Strict/loose validation of <fo:table-footer/> ordering somehow got lost in processing feedback branch merge.
................
  r670217 | acumiskey | 2008-06-21 17:10:03 +0100 (Sat, 21 Jun 2008) | 1 line
  
  Moved the contents of TableBody into a new abstract base class TablePart, which is now subclassed by TableBody, TableHeader and TableFooter.
................
  r670222 | acumiskey | 2008-06-21 17:28:56 +0100 (Sat, 21 Jun 2008) | 1 line
  
  Moved the contents of TableBody into a new abstract base class TablePart, which is now subclassed by TableBody, TableHeader and TableFooter.
................
  r670323 | adelmelle | 2008-06-22 10:07:47 +0100 (Sun, 22 Jun 2008) | 1 line
  
  Addition to r670217
................
  r670325 | adelmelle | 2008-06-22 10:28:56 +0100 (Sun, 22 Jun 2008) | 1 line
  
  Minor javadoc correction
................
  r670332 | adelmelle | 2008-06-22 11:21:03 +0100 (Sun, 22 Jun 2008) | 1 line
  
  Minor tweak: avoid warning when running through Saxon
................
  r670335 | adelmelle | 2008-06-22 11:53:51 +0100 (Sun, 22 Jun 2008) | 1 line
  
  Avoid StackOverflow on TableColumn.toString() during debugging.
................
  r670336 | adelmelle | 2008-06-22 12:01:27 +0100 (Sun, 22 Jun 2008) | 1 line
  
  Minor tweak: use XG Commons version of the interface
................
  r670341 | adelmelle | 2008-06-22 12:18:03 +0100 (Sun, 22 Jun 2008) | 2 lines
  
  Changed FONode.addCharacters() signature to match the characters() event (use 'length' as a parameter instead of 'end')
................
  r670344 | adelmelle | 2008-06-22 12:28:06 +0100 (Sun, 22 Jun 2008) | 1 line
  
  Changed signature for static handleWhiteSpaceFor(), and used internally to make the code a bit more compact
................
  r670401 | adelmelle | 2008-06-22 20:19:17 +0100 (Sun, 22 Jun 2008) | 1 line
  
  Correction: characters() expects a 'length' not an 'endIndex'
................
  r670409 | adelmelle | 2008-06-22 21:18:27 +0100 (Sun, 22 Jun 2008) | 1 line
  
  Very minor tweak: simplify conditional
................
  r670411 | adelmelle | 2008-06-22 21:38:28 +0100 (Sun, 22 Jun 2008) | 2 lines
  
  Deleted deprecated interface; unused after r670336
................
  r670412 | adelmelle | 2008-06-22 21:57:43 +0100 (Sun, 22 Jun 2008) | 6 lines
  
  Partial fix of FOEventHandler call sequence (see also Bugzilla #45237):
  call startOfNode() after addChildNode()
  moved initialization for tableFOs to processNode()
  moved finishing code to a finalizeNode() method (which is now also used by AbstractRetrieveMarker)
  restored protected status of startOfNode()/endOfNode() in fo.flow.table package
................
  r670422 | adelmelle | 2008-06-22 23:10:55 +0100 (Sun, 22 Jun 2008) | 4 lines
  
  Switch FOText to use a java.nio.CharBuffer, and implement the CharSequence interface.
  TextLayoutManager no longer duplicates the char array, operates on the FOText (charAt(i))
  Additionally: endOfNode() for FOText and Character deferred until after white-space handling.
................
  r670423 | adelmelle | 2008-06-22 23:17:00 +0100 (Sun, 22 Jun 2008) | 1 line
  
  Added missing file from r670422
................
  r670424 | adelmelle | 2008-06-22 23:18:53 +0100 (Sun, 22 Jun 2008) | 1 line
  
  Another missing file...
................
  r670492 | lfurini | 2008-06-23 10:24:14 +0100 (Mon, 23 Jun 2008) | 2 lines
  
  Added support for non-zero borders and padding on page regions.
  Testcase included, now disabled because it is supposed to run with relaxed validation switched on.
................
  r670689 | adelmelle | 2008-06-23 19:01:25 +0100 (Mon, 23 Jun 2008) | 1 line
  
  Fix XMLObj.addCharacters(): incorrect after r670341
................
  r670723 | adelmelle | 2008-06-23 20:56:51 +0100 (Mon, 23 Jun 2008) | 1 line
  
  Javadoc modification + addition of clarifying comments
................
  r670760 | adelmelle | 2008-06-23 22:18:45 +0100 (Mon, 23 Jun 2008) | 1 line
  
  Javadoc fixup
................
  r670761 | adelmelle | 2008-06-23 22:21:09 +0100 (Mon, 23 Jun 2008) | 1 line
  
  Minor cleanup: remove unused parameter from method signature
................
  r670763 | adelmelle | 2008-06-23 22:22:48 +0100 (Mon, 23 Jun 2008) | 1 line
  
  Minor cleanup: remove double storage of the FObj
................
  r670765 | adelmelle | 2008-06-23 22:24:46 +0100 (Mon, 23 Jun 2008) | 1 line
  
  Minor cleanup: remove redundant cast
................
  r670766 | adelmelle | 2008-06-23 22:25:30 +0100 (Mon, 23 Jun 2008) | 1 line
  
  Minor cleanup: remove redundant cast
................
  r670767 | adelmelle | 2008-06-23 22:26:56 +0100 (Mon, 23 Jun 2008) | 1 line
  
  Javadoc fixup
................
  r670770 | adelmelle | 2008-06-23 22:29:53 +0100 (Mon, 23 Jun 2008) | 1 line
  
  Minor cleanup: simplified conditional
................
  r670773 | adelmelle | 2008-06-23 22:32:31 +0100 (Mon, 23 Jun 2008) | 1 line
  
  A nit...
................
  r670777 | adelmelle | 2008-06-23 22:39:19 +0100 (Mon, 23 Jun 2008) | 1 line
  
  Fix imports...
................
  r671145 | maxberger | 2008-06-24 12:59:33 +0100 (Tue, 24 Jun 2008) | 2 lines
  
  Another character handling problem, replaced end-start by length
................
  r672010 | adelmelle | 2008-06-26 20:44:20 +0100 (Thu, 26 Jun 2008) | 1 line
  
  Fixed a possible NullPointerException: if the citation appears in a fo:marker, the property will only be parsed if the marker is retrieved...
................
  r672026 | acumiskey | 2008-06-26 21:49:11 +0100 (Thu, 26 Jun 2008) | 5 lines
  
  Some basic cleanup.
  
  * Duplicated/redundant PSDictionary, PSPageDeviceDictionary and PSDictionaryFormatException removed and now referenced from xmlgraphics commons.
  * Updated xmlgraphics commons jar containing migrated PSPageDeviceDictionary class.
................
  r672495 | adelmelle | 2008-06-28 12:22:58 +0100 (Sat, 28 Jun 2008) | 1 line
  
  Removed unnecessary override
................
  r672496 | adelmelle | 2008-06-28 12:24:20 +0100 (Sat, 28 Jun 2008) | 1 line
  
  Added testcase for r672010
................
  r672499 | adelmelle | 2008-06-28 13:11:40 +0100 (Sat, 28 Jun 2008) | 3 lines
  
  Added basic-checks.xml: file currently only contains one default check.
  Modified testcase2checks.xsl: the added basic-checks.xml will be inserted before the checks particular to the testcase.
................
  r672537 | acumiskey | 2008-06-28 17:05:08 +0100 (Sat, 28 Jun 2008) | 1 line
  
  Corrected minor spelling mistake in javadoc
................
  r672539 | acumiskey | 2008-06-28 17:08:13 +0100 (Sat, 28 Jun 2008) | 1 line
  
  Corrected minor spelling mistake in javadoc
................
  r672564 | adelmelle | 2008-06-28 19:39:39 +0100 (Sat, 28 Jun 2008) | 1 line
  
  Corrected basic checks: check for empty document, as well as empty areaTree...
................
  r672565 | adelmelle | 2008-06-28 19:45:16 +0100 (Sat, 28 Jun 2008) | 1 line
  
  Removed instream-foreign-object in marker; still threw a NPE
................
  r672617 | adelmelle | 2008-06-29 11:52:30 +0100 (Sun, 29 Jun 2008) | 1 line
  
  Added disabled testcase for instream-foreign-object in a marker
................
  r672618 | adelmelle | 2008-06-29 11:58:31 +0100 (Sun, 29 Jun 2008) | 2 lines
  
  Correct svn props
................
  r672670 | adelmelle | 2008-06-29 20:53:17 +0100 (Sun, 29 Jun 2008) | 1 line
  
  Cleanup/re-ordering, and addition of XSL 1.1 FO_ and PR_ constants
................
  r672833 | adelmelle | 2008-06-30 18:34:41 +0100 (Mon, 30 Jun 2008) | 2 lines
  
  Added check for the case where column-number is specified on something other than a fo:table-cell or fo:table-column (strictly not an error)
................
  r674039 | acumiskey | 2008-07-04 14:13:29 +0100 (Fri, 04 Jul 2008) | 2 lines
  
  Minor readability improvement.
................
  r674043 | acumiskey | 2008-07-04 14:17:06 +0100 (Fri, 04 Jul 2008) | 3 lines
  
  The pdf StringBuffer is only used on these two lines and doesn't seem to do anything...
  Very strange... :-S
................
  r674056 | acumiskey | 2008-07-04 14:57:57 +0100 (Fri, 04 Jul 2008) | 3 lines
  
  * Some minor optimizations in AbstractRenderer.
  * Renamed getBooleanTrait() to getTraitAsBoolean() in Area.
................
  r674065 | acumiskey | 2008-07-04 15:12:37 +0100 (Fri, 04 Jul 2008) | 2 lines
  
  Replaced conditional with a switch and capitalized method javadoc description.
................
  r674245 | adelmelle | 2008-07-05 23:53:58 +0100 (Sat, 05 Jul 2008) | 1 line
  
  Fixed ClassCastException when specifying column-number on something other than a fo:table-column or fo:table-cell...
................
  r674267 | adelmelle | 2008-07-06 08:50:23 +0100 (Sun, 06 Jul 2008) | 1 line
  
  Switch AreaTreeParser to use a java.nio.CharBuffer, and ignore characters events for all elements other than <word>, <space> or <character>
................
  r674269 | adelmelle | 2008-07-06 09:15:50 +0100 (Sun, 06 Jul 2008) | 1 line
  
  Remove deprecated Character area class
................
  r674272 | adelmelle | 2008-07-06 09:44:54 +0100 (Sun, 06 Jul 2008) | 1 line
  
  Redo changes made in r674056...
................
  r674273 | adelmelle | 2008-07-06 09:46:50 +0100 (Sun, 06 Jul 2008) | 1 line
  
  Simplified implementation of Area.getTraitAsBoolean()
................
  r674276 | adelmelle | 2008-07-06 10:17:14 +0100 (Sun, 06 Jul 2008) | 3 lines
  
  Extracted conversion methods for String to int[] or double[] to a utility class.
  Made AreaTreeParser.getAttributeAsXXX() methods static to stress their utility character, and removed the private parseRect() in favor of getAttributeAsRectangle2D().
................
  r674325 | adelmelle | 2008-07-06 19:19:48 +0100 (Sun, 06 Jul 2008) | 1 line
  
  Fixed error; inadvertently switched the condition with r674272...
................
  r674468 | acumiskey | 2008-07-07 13:36:57 +0100 (Mon, 07 Jul 2008) | 1 line
  
  Possible NullPointerException avoided
................
  r674470 | acumiskey | 2008-07-07 13:38:04 +0100 (Mon, 07 Jul 2008) | 1 line
  
  Added new set accessor method for EncryptionParams.
................
  r674471 | acumiskey | 2008-07-07 13:42:12 +0100 (Mon, 07 Jul 2008) | 1 line
  
  Added PDF encryption parameter support in configuration.
................
  r674484 | acumiskey | 2008-07-07 14:28:26 +0100 (Mon, 07 Jul 2008) | 1 line
  
  Added new AbstractXMLRenderer base class.
................
  r674486 | acumiskey | 2008-07-07 14:43:19 +0100 (Mon, 07 Jul 2008) | 1 line
  
  Cleaned up some javadocs.
................
  r674487 | acumiskey | 2008-07-07 14:44:14 +0100 (Mon, 07 Jul 2008) | 2 lines
  
  Refactored this class, moving much of its behaviour to  the base AbstractXMLRenderer class.
................


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign@674497 13f79535-47bb-0310-9956-ffa450edef68
pull/17/head
Adrian Cumiskey 16 years ago
parent
commit
4d972de73c
100 changed files with 2916 additions and 2009 deletions
  1. 1
    1
      NOTICE
  2. 241
    454
      build.xml
  3. 2
    2
      fop.bat
  4. BIN
      lib/build/asm-3.1.jar
  5. BIN
      lib/build/asm-commons-3.1.jar
  6. BIN
      lib/build/asm-util-3.1.jar
  7. 28
    0
      lib/build/asm.LICENSE.txt
  8. BIN
      lib/build/backport-util-concurrent-3.1.jar
  9. 2
    0
      lib/build/backport-util-concurrent.LICENSE.txt
  10. BIN
      lib/build/jaxen-1.1.1.jar
  11. 33
    0
      lib/build/jaxen.LICENSE.txt
  12. 31
    0
      lib/build/pmd.LICENSE.txt
  13. BIN
      lib/build/pmd14-4.2.2.jar
  14. BIN
      lib/build/retroweaver-2.0.5.jar
  15. BIN
      lib/build/retroweaver-rt-2.0.5.jar
  16. 25
    0
      lib/build/retroweaver.LICENSE.txt
  17. BIN
      lib/xml-apis-1.3.04.jar
  18. 0
    0
      lib/xml-apis-ext-1.3.04.jar
  19. 73
    0
      lib/xml-apis-ext.LICENSE.dom-documentation.txt
  20. 61
    0
      lib/xml-apis-ext.LICENSE.dom-software.txt
  21. 75
    0
      lib/xml-apis-ext.LICENSE.sac.html
  22. 202
    0
      lib/xml-apis-ext.LICENSE.txt
  23. 16
    0
      lib/xml-apis-ext.NOTICE.txt
  24. 56
    0
      lib/xml-apis-ext.README.dom.txt
  25. BIN
      lib/xmlgraphics-commons-1.4svn.jar
  26. 28
    28
      src/codegen/unicode/data/LineBreakPairTable.txt
  27. 98
    62
      src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java
  28. 8
    0
      src/documentation/content/xdocs/news.xml
  29. 21
    0
      src/documentation/content/xdocs/trunk/configuration.xml
  30. 32
    18
      src/documentation/content/xdocs/trunk/fonts.xml
  31. 25
    0
      src/documentation/content/xdocs/trunk/output.xml
  32. 2
    0
      src/documentation/skinconf.xml
  33. 1
    1
      src/java/org/apache/fop/apps/MimeConstants.java
  34. 2
    7
      src/java/org/apache/fop/area/Area.java
  35. 76
    93
      src/java/org/apache/fop/area/AreaTreeParser.java
  36. 17
    11
      src/java/org/apache/fop/area/Page.java
  37. 13
    1
      src/java/org/apache/fop/area/RegionReference.java
  38. 0
    62
      src/java/org/apache/fop/area/inline/Character.java
  39. 4
    4
      src/java/org/apache/fop/area/inline/InlineArea.java
  40. 1
    1
      src/java/org/apache/fop/events/EventExceptionManager.java
  41. 1
    0
      src/java/org/apache/fop/events/EventFormatter.xml
  42. 1
    1
      src/java/org/apache/fop/events/EventListener.java
  43. 349
    267
      src/java/org/apache/fop/fo/Constants.java
  44. 16
    93
      src/java/org/apache/fop/fo/FOEventHandler.java
  45. 31
    5
      src/java/org/apache/fop/fo/FONode.java
  46. 239
    206
      src/java/org/apache/fop/fo/FOText.java
  47. 30
    15
      src/java/org/apache/fop/fo/FOTreeBuilder.java
  48. 107
    0
      src/java/org/apache/fop/fo/FOTreeBuilderContext.java
  49. 2
    2
      src/java/org/apache/fop/fo/FObj.java
  50. 90
    79
      src/java/org/apache/fop/fo/FObjMixed.java
  51. 1
    1
      src/java/org/apache/fop/fo/RecursiveCharIterator.java
  52. 1
    1
      src/java/org/apache/fop/fo/XMLObj.java
  53. 91
    53
      src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java
  54. 1
    1
      src/java/org/apache/fop/fo/expr/PropertyException.java
  55. 1
    1
      src/java/org/apache/fop/fo/extensions/xmp/XMPMetadata.java
  56. 4
    3
      src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java
  57. 14
    21
      src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java
  58. 5
    5
      src/java/org/apache/fop/fo/flow/Marker.java
  59. 1
    1
      src/java/org/apache/fop/fo/flow/table/BorderResolver.java
  60. 5
    5
      src/java/org/apache/fop/fo/flow/table/CollapsingBorderResolver.java
  61. 3
    3
      src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java
  62. 5
    5
      src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
  63. 4
    4
      src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java
  64. 1
    1
      src/java/org/apache/fop/fo/flow/table/SeparateBorderResolver.java
  65. 26
    25
      src/java/org/apache/fop/fo/flow/table/Table.java
  66. 6
    213
      src/java/org/apache/fop/fo/flow/table/TableBody.java
  67. 13
    6
      src/java/org/apache/fop/fo/flow/table/TableCell.java
  68. 2
    2
      src/java/org/apache/fop/fo/flow/table/TableCellContainer.java
  69. 1
    1
      src/java/org/apache/fop/fo/flow/table/TableColumn.java
  70. 11
    0
      src/java/org/apache/fop/fo/flow/table/TableEventProducer.java
  71. 73
    60
      src/java/org/apache/fop/fo/flow/table/TableFObj.java
  72. 6
    12
      src/java/org/apache/fop/fo/flow/table/TableFooter.java
  73. 6
    12
      src/java/org/apache/fop/fo/flow/table/TableHeader.java
  74. 239
    0
      src/java/org/apache/fop/fo/flow/table/TablePart.java
  75. 17
    12
      src/java/org/apache/fop/fo/flow/table/TableRow.java
  76. 2
    2
      src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java
  77. 1
    0
      src/java/org/apache/fop/fo/pagination/Flow.java
  78. 22
    3
      src/java/org/apache/fop/fo/pagination/Root.java
  79. 3
    3
      src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java
  80. 2
    3
      src/java/org/apache/fop/fo/properties/PageDimensionMaker.java
  81. 8
    3
      src/java/org/apache/fop/fonts/CustomFont.java
  82. 5
    1
      src/java/org/apache/fop/fonts/FontDescriptor.java
  83. 5
    4
      src/java/org/apache/fop/fonts/FontReader.java
  84. 143
    0
      src/java/org/apache/fop/fonts/FontSelector.java
  85. 7
    3
      src/java/org/apache/fop/fonts/LazyFont.java
  86. 2
    2
      src/java/org/apache/fop/fonts/SingleByteFont.java
  87. 1
    0
      src/java/org/apache/fop/fonts/autodetect/UnixFontDirFinder.java
  88. 17
    17
      src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java
  89. 16
    14
      src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
  90. 2
    4
      src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
  91. 22
    18
      src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
  92. 1
    1
      src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
  93. 39
    34
      src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
  94. 13
    9
      src/java/org/apache/fop/layoutmgr/ElementListUtils.java
  95. 10
    9
      src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
  96. 9
    8
      src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java
  97. 4
    5
      src/java/org/apache/fop/layoutmgr/LayoutManager.java
  98. 2
    2
      src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java
  99. 3
    3
      src/java/org/apache/fop/layoutmgr/PageBreaker.java
  100. 0
    0
      src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java

+ 1
- 1
NOTICE View File

Apache FOP Apache FOP
Copyright 1999-2006 The Apache Software Foundation
Copyright 1999-2008 The Apache Software Foundation


This product includes software developed at This product includes software developed at
The Apache Software Foundation (http://www.apache.org/). The Apache Software Foundation (http://www.apache.org/).

+ 241
- 454
build.xml
File diff suppressed because it is too large
View File


+ 2
- 2
fop.bat View File

set LOCALCLASSPATH=%LOCAL_FOP_HOME%build\fop.jar set LOCALCLASSPATH=%LOCAL_FOP_HOME%build\fop.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LOCAL_FOP_HOME%build\fop-sandbox.jar set LOCALCLASSPATH=%LOCALCLASSPATH%;%LOCAL_FOP_HOME%build\fop-sandbox.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LOCAL_FOP_HOME%build\fop-hyph.jar set LOCALCLASSPATH=%LOCALCLASSPATH%;%LOCAL_FOP_HOME%build\fop-hyph.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xml-apis-1.3.02.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xml-apis-ext.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xml-apis-1.3.04.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xml-apis-ext-1.3.04.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xercesImpl-2.7.1.jar set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xercesImpl-2.7.1.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xalan-2.7.0.jar set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xalan-2.7.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\serializer-2.7.0.jar set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\serializer-2.7.0.jar

BIN
lib/build/asm-3.1.jar View File


BIN
lib/build/asm-commons-3.1.jar View File


BIN
lib/build/asm-util-3.1.jar View File


+ 28
- 0
lib/build/asm.LICENSE.txt View File

ASM: a very small and fast Java bytecode manipulation framework
Copyright (c) 2000-2005 INRIA, France Telecom
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.

BIN
lib/build/backport-util-concurrent-3.1.jar View File


+ 2
- 0
lib/build/backport-util-concurrent.LICENSE.txt View File

Public Domain
http://creativecommons.org/licenses/publicdomain

BIN
lib/build/jaxen-1.1.1.jar View File


+ 33
- 0
lib/build/jaxen.LICENSE.txt View File

/*
$Id: LICENSE.txt,v 1.5 2006/02/05 21:49:04 elharo Exp $

Copyright 2003-2006 The Werken Company. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

* Neither the name of the Jaxen Project nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

*/

+ 31
- 0
lib/build/pmd.LICENSE.txt View File

Copyright (c) 2003, InfoEther, LLC
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* The end-user documentation included with the redistribution, if
any, must include the following acknowledgement:
"This product includes software developed in part by support from
the Defense Advanced Research Project Agency (DARPA)"
* Neither the name of InfoEther, LLC nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

BIN
lib/build/pmd14-4.2.2.jar View File


BIN
lib/build/retroweaver-2.0.5.jar View File


BIN
lib/build/retroweaver-rt-2.0.5.jar View File


+ 25
- 0
lib/build/retroweaver.LICENSE.txt View File

Copyright (c) February 2004, Toby Reyelts
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
Neither the name of Toby Reyelts nor the names of his contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

BIN
lib/xml-apis-1.3.02.jar → lib/xml-apis-1.3.04.jar View File


lib/xml-apis-ext.jar → lib/xml-apis-ext-1.3.04.jar View File


+ 73
- 0
lib/xml-apis-ext.LICENSE.dom-documentation.txt View File

xml-commons/java/external/LICENSE.dom-documentation.txt $Id: LICENSE.dom-documentation.txt 226215 2005-06-03 22:49:13Z mrglavas $


This license came from: http://www.w3.org/Consortium/Legal/copyright-documents-20021231


W3C® DOCUMENT LICENSE
http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231

Public documents on the W3C site are provided by the copyright holders under
the following license. By using and/or copying this document, or the W3C
document from which this statement is linked, you (the licensee) agree that
you have read, understood, and will comply with the following terms and
conditions:

Permission to copy, and distribute the contents of this document, or the W3C
document from which this statement is linked, in any medium for any purpose
and without fee or royalty is hereby granted, provided that you include the
following on ALL copies of the document, or portions thereof, that you use:

1. A link or URL to the original W3C document.
2. The pre-existing copyright notice of the original author, or if it
doesn't exist, a notice (hypertext is preferred, but a textual
representation is permitted) of the form: "Copyright © [$date-of-document]
World Wide Web Consortium, (Massachusetts Institute of Technology,
European Research Consortium for Informatics and Mathematics, Keio
University). All Rights Reserved.
http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231"
3. If it exists, the STATUS of the W3C document.
When space permits, inclusion of the full text of this NOTICE should be
provided. We request that authorship attribution be provided in any software,
documents, or other items or products that you create pursuant to the
implementation of the contents of this document, or any portion thereof.

No right to create modifications or derivatives of W3C documents is granted
pursuant to this license. However, if additional requirements (documented in
the Copyright FAQ) are satisfied, the right to create modifications or
derivatives is sometimes granted by the W3C to individuals complying with
those requirements.

THIS DOCUMENT IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO
REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE
FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT
INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.

COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE
PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF.

The name and trademarks of copyright holders may NOT be used in advertising
or publicity pertaining to this document or its contents without specific,
written prior permission. Title to copyright in this document will at all
times remain with copyright holders.

----------------------------------------------------------------------------

This formulation of W3C's notice and license became active on December 31 2002.
This version removes the copyright ownership notice such that this license can
be used with materials other than those owned by the W3C, moves information on
style sheets, DTDs, and schemas to the Copyright FAQ, reflects that ERCIM is
now a host of the W3C, includes references to this specific dated version of
the license, and removes the ambiguous grant of "use". See the older
formulation for the policy prior to this date. Please see our Copyright FAQ for
common questions about using materials from our site, such as the translating
or annotating specifications. Other questions about this notice can be directed
to site-policy@w3.org.

Joseph Reagle <site-policy@w3.org>

Last revised by Reagle $Date: 2005-06-03 18:49:13 -0400 (Fri, 03 Jun 2005) $

+ 61
- 0
lib/xml-apis-ext.LICENSE.dom-software.txt View File

xml-commons/java/external/LICENSE.dom-software.txt $Id: LICENSE.dom-software.txt 226215 2005-06-03 22:49:13Z mrglavas $


This license came from: http://www.w3.org/Consortium/Legal/copyright-software-20021231


W3C® SOFTWARE NOTICE AND LICENSE
http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231

This work (and included software, documentation such as READMEs, or other
related items) is being provided by the copyright holders under the following
license. By obtaining, using and/or copying this work, you (the licensee) agree
that you have read, understood, and will comply with the following terms and
conditions.

Permission to copy, modify, and distribute this software and its documentation,
with or without modification, for any purpose and without fee or royalty is
hereby granted, provided that you include the following on ALL copies of the
software and documentation or portions thereof, including modifications:

1. The full text of this NOTICE in a location viewable to users of the
redistributed or derivative work.
2. Any pre-existing intellectual property disclaimers, notices, or terms
and conditions. If none exist, the W3C Software Short Notice should be
included (hypertext is preferred, text is permitted) within the body
of any redistributed or derivative code.
3. Notice of any changes or modifications to the files, including the date
changes were made. (We recommend you provide URIs to the location from
which the code is derived.)
THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE
NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT
THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.

COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.

The name and trademarks of copyright holders may NOT be used in advertising or
publicity pertaining to the software without specific, written prior permission.
Title to copyright in this software and any associated documentation will at
all times remain with copyright holders.

____________________________________

This formulation of W3C's notice and license became active on December 31 2002.
This version removes the copyright ownership notice such that this license can
be used with materials other than those owned by the W3C, reflects that ERCIM
is now a host of the W3C, includes references to this specific dated version of
the license, and removes the ambiguous grant of "use". Otherwise, this version
is the same as the previous version and is written so as to preserve the Free
Software Foundation's assessment of GPL compatibility and OSI's certification
under the Open Source Definition. Please see our Copyright FAQ for common
questions about using materials from our site, including specific terms and
conditions for packages like libwww, Amaya, and Jigsaw. Other questions about
this notice can be directed to site-policy@w3.org.
Joseph Reagle <site-policy@w3.org>

Last revised by Reagle $Date: 2005-06-03 18:49:13 -0400 (Fri, 03 Jun 2005) $

+ 75
- 0
lib/xml-apis-ext.LICENSE.sac.html View File

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Id: LICENSE.sac.html 477037 2006-11-20 04:30:53Z mrglavas $ -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>W3C IPR SOFTWARE NOTICE</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type='text/css'>
body { background: white; color: black; }
</style>
</head>

<body>
<h1>W3C IPR SOFTWARE NOTICE</h1>

<h3>Copyright © 2002 World Wide Web Consortium, (Massachusetts Institute of
Technology, Institut National de Recherche en Informatique et en Automatique,
Keio University). All Rights Reserved.</h3>

<p><b>Note:</b> The original version of the W3C Software Copyright Notice and
License could be found at <a
href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">http://www.w3.org/Consortium/Legal/copyright-software-19980720</a></p>

<h3>Copyright © 1994-2002 <a href="http://www.w3.org/">World Wide Web
Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts Institute of
Technology</a>, <a href="http://www.inria.fr/">Institut National de Recherche
en Informatique et en Automatique</a>, <a href="http://www.keio.ac.jp/">Keio
University</a>). All Rights Reserved. http://www.w3.org/Consortium/Legal/</h3>

<p>This W3C work (including software, documents, or other related items) is
being provided by the copyright holders under the following license. By
obtaining, using and/or copying this work, you (the licensee) agree that you
have read, understood, and will comply with the following terms and
conditions:</p>

<p>Permission to use, copy, and modify this software and its documentation,
with or without modification,  for any purpose and without fee or royalty is
hereby granted, provided that you include the following on ALL copies of the
software and documentation or portions thereof, including modifications, that
you make:</p>
<ol>
<li>The full text of this NOTICE in a location viewable to users of the
redistributed or derivative work.</li>
<li>Any pre-existing intellectual property disclaimers, notices, or terms
and conditions. If none exist, a short notice of the following form
(hypertext is preferred, text is permitted) should be used within the body
of any redistributed or derivative code: "Copyright © 2002
<a href="http://www.w3.org/">World Wide Web Consortium</a>, (<a
href="http://www.lcs.mit.edu/">Massachusetts Institute of Technology</a>,
<a href="http://www.inria.fr/">Institut National de Recherche en
Informatique et en Automatique</a>, <a href="http://www.keio.ac.jp/">Keio
University</a>). All Rights Reserved.
http://www.w3.org/Consortium/Legal/"</li>
<li>Notice of any changes or modifications to the W3C files, including the
date changes were made. (We recommend you provide URIs to the location
from which the code is derived.)</li>
</ol>

<p>THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS
MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY
THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.</p>

<p>COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
DOCUMENTATION.</p>

<p>The name and trademarks of copyright holders may NOT be used in advertising
or publicity pertaining to the software without specific, written prior
permission. Title to copyright in this software and any associated
documentation will at all times remain with copyright holders.</p>
</body>
</html>

+ 202
- 0
lib/xml-apis-ext.LICENSE.txt View File


Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

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.

+ 16
- 0
lib/xml-apis-ext.NOTICE.txt View File

=========================================================================
== NOTICE file corresponding to section 4(d) of the Apache License, ==
== Version 2.0, in this case for the Apache xml-commons xml-apis ==
== distribution. ==
=========================================================================

Apache XML Commons XML APIs
Copyright 2006 The Apache Software Foundation.

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).

Portions of this software were originally based on the following:
- software copyright (c) 1999, IBM Corporation., http://www.ibm.com.
- software copyright (c) 1999, Sun Microsystems., http://www.sun.com.
- software copyright (c) 2000 World Wide Web Consortium, http://www.w3.org

+ 56
- 0
lib/xml-apis-ext.README.dom.txt View File

xml-commons/java/external/README.dom.txt $Id: README.dom.txt 477038 2006-11-20 04:40:36Z mrglavas $


HEAR YE, HEAR YE!


All of the .java software and associated documentation about
the DOM in this repository are distributed under the license
from the W3C, which is provided herein.


LICENSE.dom-software.txt covers all software from the W3C
including the following items in the xml-commons project:

xml-commons/java/external/src/org/w3c
and all subdirectories
(Note: SAC (The Simple API for CSS) has been published under an older
version of the W3C license. The original license file is LICENSE.sac.html.)

LICENSE.dom-documentation.txt covers all documentation from the W3C
including the following items in the xml-commons project:

xml-commons/java/external/xdocs/dom
and all subdirectories

The actual DOM Java Language Binding classes in xml-commons came from:
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding.html
The specification of DOM Level 3's various parts is at:
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/
http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/
http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226/

The specification of DOM Level 2's various parts is at:
http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/
http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/
http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/
http://www.w3.org/TR/2000/REC-DOM-Level-2-Views-20001113/
The specification of DOM Level 1's various parts is at:
http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html.html

Links to all available W3C DOM Java Bindings can be found at:
http://www.w3.org/DOM/DOMTR

The actual classes of The Simple API for CSS (SAC) came from:
http://www.w3.org/Style/CSS/SAC/
http://www.w3.org/2002/06/sacjava-1.3.zip

The actual DOM Java Language Binding classes for SMIL came from:
http://dev.w3.org/cvsweb/java/classes/org/w3c/dom/smil/
(both ElementTimeControl.java and TimeEvent.java were taken at revision 1.1)

The actual DOM Java Language Binding classes for SVG 1.1 came from:
http://www.w3.org/TR/SVG11/java.html

BIN
lib/xmlgraphics-commons-1.4svn.jar View File


+ 28
- 28
src/codegen/unicode/data/LineBreakPairTable.txt View File

OP CL QU GL NS EX SY IS PR PO NU AL ID IN HY BA BB B2 ZW CM WJ H2 H3 JL JV JT
OP ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ @ ^ ^ ^ ^ ^ ^
CL _ ^ % % ^ ^ ^ ^ % % % % _ _ % % _ _ ^ # ^ _ _ _ _ _
QU ^ ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
GL % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
NS _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _
EX _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _
SY _ ^ % % % ^ ^ ^ _ _ % _ _ _ % % _ _ ^ # ^ _ _ _ _ _
IS _ ^ % % % ^ ^ ^ _ _ % % _ _ % % _ _ ^ # ^ _ _ _ _ _
PR % ^ % % % ^ ^ ^ _ _ % % % _ % % _ _ ^ # ^ % % % % %
PO % ^ % % % ^ ^ ^ _ _ % % _ _ % % _ _ ^ # ^ _ _ _ _ _
NU % ^ % % % ^ ^ ^ % % % % _ % % % _ _ ^ # ^ _ _ _ _ _
AL % ^ % % % ^ ^ ^ _ _ % % _ % % % _ _ ^ # ^ _ _ _ _ _
ID _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ _
IN _ ^ % % % ^ ^ ^ _ _ _ _ _ % % % _ _ ^ # ^ _ _ _ _ _
HY _ ^ % % % ^ ^ ^ _ _ % _ _ _ % % _ _ ^ # ^ _ _ _ _ _
BA _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _
BB % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
B2 _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ ^ ^ # ^ _ _ _ _ _
ZW _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ^ _ _ _ _ _ _ _
CM _ ^ % % % ^ ^ ^ _ _ % % _ % % % _ _ ^ # ^ _ _ _ _ _
WJ % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
H2 _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ % %
H3 _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ %
JL _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ % % % % _
JV _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ % %
JT _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ %
OP CL QU GL NS EX SY IS PR PO NU AL ID IN HY BA BB B2 ZW CM WJ H2 H3 JL JV JT
OP ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ @ ^ ^ ^ ^ ^ ^
CL _ ^ % % ^ ^ ^ ^ % % % % _ _ % % _ _ ^ # ^ _ _ _ _ _
QU ^ ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
GL % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
NS _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _
EX _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _
SY _ ^ % % % ^ ^ ^ _ _ % _ _ _ % % _ _ ^ # ^ _ _ _ _ _
IS _ ^ % % % ^ ^ ^ _ _ % % _ _ % % _ _ ^ # ^ _ _ _ _ _
PR % ^ % % % ^ ^ ^ _ _ % % % _ % % _ _ ^ # ^ % % % % %
PO % ^ % % % ^ ^ ^ _ _ % % _ _ % % _ _ ^ # ^ _ _ _ _ _
NU % ^ % % % ^ ^ ^ % % % % _ % % % _ _ ^ # ^ _ _ _ _ _
AL % ^ % % % ^ ^ ^ _ _ % % _ % % % _ _ ^ # ^ _ _ _ _ _
ID _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ _
IN _ ^ % % % ^ ^ ^ _ _ _ _ _ % % % _ _ ^ # ^ _ _ _ _ _
HY _ ^ % % % ^ ^ ^ _ _ % _ _ _ % % _ _ ^ # ^ _ _ _ _ _
BA _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _
BB % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
B2 _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ ^ ^ # ^ _ _ _ _ _
ZW _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ^ _ _ _ _ _ _ _
CM _ ^ % % % ^ ^ ^ _ _ % % _ % % % _ _ ^ # ^ _ _ _ _ _
WJ % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
H2 _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ % %
H3 _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ %
JL _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ % % % % _
JV _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ % %
JT _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ %

+ 98
- 62
src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java View File

import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.StringTokenizer;


/** /**
* <p>Utility for generating a Java class representing line break properties * <p>Utility for generating a Java class representing line break properties
private static final byte COMBINING_PROHIBITED_BREAK = 3; // @ in table private static final byte COMBINING_PROHIBITED_BREAK = 3; // @ in table
private static final byte PROHIBITED_BREAK = 4; // ^ in table private static final byte PROHIBITED_BREAK = 4; // ^ in table
private static final byte EXPLICIT_BREAK = 5; // ! in rules private static final byte EXPLICIT_BREAK = 5; // ! in rules
private static final String BREAK_CLASS_TOKENS = "_%#@^!";
private static final String notInPairTable[] = { "AI", "BK", "CB", "CR", "LF", "NL", "SA", "SG", "SP", "XX" }; private static final String notInPairTable[] = { "AI", "BK", "CB", "CR", "LF", "NL", "SA", "SG", "SP", "XX" };


private static final byte lineBreakProperties[] = new byte[0x10000]; private static final byte lineBreakProperties[] = new byte[0x10000];
BufferedReader b = new BufferedReader(new FileReader(breakPairFileName)); BufferedReader b = new BufferedReader(new FileReader(breakPairFileName));
String line = b.readLine(); String line = b.readLine();
int lineNumber = 1; int lineNumber = 1;
String[] lineTokens;
String name;
// read header // read header
if (line != null) { if (line != null) {
StringTokenizer tok = new StringTokenizer(line);
lineTokens = line.split("\\s+");
byte columnNumber = 0; byte columnNumber = 0;
while (tok.hasMoreTokens()) {
String name = tok.nextToken();
if (columnNumber >= columnHeader.length) {
throw new Exception(breakPairFileName + ':' + lineNumber + ": unexpected column header " + name);
}
if (notInPairTableMap.get(name) != null) {
throw new Exception(breakPairFileName + ':' + lineNumber + ": invalid column header " + name);
}
Byte v = (Byte)lineBreakPropertyValues.get(name);
if (v != null) {
byte vv = v.byteValue();
columnHeader[columnNumber] = vv;
columnMap[vv] = columnNumber;
} else {
throw new Exception(breakPairFileName + ':' + lineNumber + ": unknown column header " + name);
for (int i = 0; i < lineTokens.length; ++i) {
name = lineTokens[i];
if (name.length() > 0) {
if (columnNumber >= columnHeader.length) {
throw new Exception(breakPairFileName + ':' + lineNumber + ": unexpected column header " + name);
}
if (notInPairTableMap.get(name) != null) {
throw new Exception(breakPairFileName + ':' + lineNumber + ": invalid column header " + name);
}
Byte v = (Byte)lineBreakPropertyValues.get(name);
if (v != null) {
byte vv = v.byteValue();
columnHeader[columnNumber] = vv;
columnMap[vv] = columnNumber;
} else {
throw new Exception(breakPairFileName + ':' + lineNumber + ": unknown column header " + name);
}
columnNumber++;
} }
columnNumber++;
} }
if (columnNumber < columnHeader.length) { if (columnNumber < columnHeader.length) {
StringBuffer missing = new StringBuffer(); StringBuffer missing = new StringBuffer();
throw new Exception(breakPairFileName + ':' + lineNumber + ": unexpected row " + line); throw new Exception(breakPairFileName + ':' + lineNumber + ": unexpected row " + line);
} }
pairTable[rowNumber] = new byte[tableSize]; pairTable[rowNumber] = new byte[tableSize];
StringTokenizer tok = new StringTokenizer(line);
if (tok.hasMoreTokens()) {
String name = tok.nextToken();
lineTokens = line.split("\\s+");
if (lineTokens.length > 0) {
name = lineTokens[0];
if (notInPairTableMap.get(name) != null) { if (notInPairTableMap.get(name) != null) {
throw new Exception(breakPairFileName + ':' + lineNumber + ": invalid row header " + name); throw new Exception(breakPairFileName + ':' + lineNumber + ": invalid row header " + name);
} }
throw new Exception(breakPairFileName + ':' + lineNumber + ": can't read row header"); throw new Exception(breakPairFileName + ':' + lineNumber + ": can't read row header");
} }
int columnNumber = 0; int columnNumber = 0;
while (tok.hasMoreTokens()) {
String token = tok.nextToken();
String token;
for (int i = 1; i < lineTokens.length; ++i) {
token = lineTokens[i];
if (token.length() == 1) { if (token.length() == 1) {
switch (token.charAt(0)) {
case '^' :
pairTable[rowNumber][columnNumber] = PROHIBITED_BREAK;
break;
case '%' :
pairTable[rowNumber][columnNumber] = INDIRECT_BREAK;
break;
case '_' :
pairTable[rowNumber][columnNumber] = DIRECT_BREAK;
break;
case '#' :
pairTable[rowNumber][columnNumber] = COMBINING_INDIRECT_BREAK;
break;
case '@' :
pairTable[rowNumber][columnNumber] = COMBINING_PROHIBITED_BREAK;
break;
default :
throw new Exception(breakPairFileName + ':' + lineNumber + ": unexpected token: " + token);
byte tokenBreakClass = (byte)BREAK_CLASS_TOKENS.indexOf(token.charAt(0));
if (tokenBreakClass >= 0) {
pairTable[rowNumber][columnNumber] = tokenBreakClass;
} else {
throw new Exception(breakPairFileName + ':' + lineNumber + ": unexpected token: " + token);
} }
} else { } else {
throw new Exception(breakPairFileName + ':' + lineNumber + ": token too long: " + token); throw new Exception(breakPairFileName + ':' + lineNumber + ": token too long: " + token);
out.println("package org.apache.fop.text.linebreak;"); out.println("package org.apache.fop.text.linebreak;");
out.println(); out.println();
out.println("/* "); out.println("/* ");
out.println(" * This is a generated file, DO NOT CHANGE!");
out.println(" * !!! THIS IS A GENERATED FILE !!! ");
out.println(" * If updates to the source are needed, then:");
out.println(" * - apply the necessary modifications to ");
out.println(" * 'src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java'");
out.println(" * - run 'ant codegen-unicode', which will generate a new LineBreakUtils.java");
out.println(" * in 'src/java/org/apache/fop/text/linebreak'");
out.println(" * - commit BOTH changed files");
out.println(" */"); out.println(" */");
out.println(); out.println();
out.println("class LineBreakUtils {");
out.println("public final class LineBreakUtils {");
out.println(); out.println();
out.println(" /** Break class constant */");
out.println(" public static final byte DIRECT_BREAK = " + DIRECT_BREAK + ';'); out.println(" public static final byte DIRECT_BREAK = " + DIRECT_BREAK + ';');
out.println(" /** Break class constant */");
out.println(" public static final byte INDIRECT_BREAK = " + INDIRECT_BREAK + ';'); out.println(" public static final byte INDIRECT_BREAK = " + INDIRECT_BREAK + ';');
out.println(" /** Break class constant */");
out.println(" public static final byte COMBINING_INDIRECT_BREAK = " + COMBINING_INDIRECT_BREAK + ';'); out.println(" public static final byte COMBINING_INDIRECT_BREAK = " + COMBINING_INDIRECT_BREAK + ';');
out.println(" /** Break class constant */");
out.println(" public static final byte COMBINING_PROHIBITED_BREAK = " + COMBINING_PROHIBITED_BREAK + ';'); out.println(" public static final byte COMBINING_PROHIBITED_BREAK = " + COMBINING_PROHIBITED_BREAK + ';');
out.println(" /** Break class constant */");
out.println(" public static final byte PROHIBITED_BREAK = " + PROHIBITED_BREAK + ';'); out.println(" public static final byte PROHIBITED_BREAK = " + PROHIBITED_BREAK + ';');
out.println(" /** Break class constant */");
out.println(" public static final byte EXPLICIT_BREAK = " + EXPLICIT_BREAK + ';'); out.println(" public static final byte EXPLICIT_BREAK = " + EXPLICIT_BREAK + ';');
out.println(); out.println();
out.println(" private static final byte PAIR_TABLE[][] = {"); out.println(" private static final byte PAIR_TABLE[][] = {");
boolean printComma = false; boolean printComma = false;
for (int i = 1; i <= lineBreakPropertyValueCount; i++) { for (int i = 1; i <= lineBreakPropertyValueCount; i++) {
if (printComma) { if (printComma) {
out.println(',');
out.println(", ");
} else { } else {
printComma = true; printComma = true;
} }
boolean localPrintComma = false; boolean localPrintComma = false;
for (int j = 1; j <= lineBreakPropertyValueCount; j++) { for (int j = 1; j <= lineBreakPropertyValueCount; j++) {
if (localPrintComma) { if (localPrintComma) {
out.print(',');
out.print(", ");
} else { } else {
localPrintComma = true; localPrintComma = true;
} }
found = true; found = true;
doStaticLinkCode.append(" lineBreakProperties["); doStaticLinkCode.append(" lineBreakProperties[");
doStaticLinkCode.append(i); doStaticLinkCode.append(i);
doStaticLinkCode.append("]=lineBreakProperties[");
doStaticLinkCode.append("] = lineBreakProperties[");
doStaticLinkCode.append(j); doStaticLinkCode.append(j);
doStaticLinkCode.append("];\n"); doStaticLinkCode.append("];\n");
break; break;
} }
if (!found) { if (!found) {
if (rowsPrinted >= 64) { if (rowsPrinted >= 64) {
out.println(" };");
out.println(" }");
out.println(); out.println();
initSections++; initSections++;
out.println(" private static void init_" + initSections + "() {"); out.println(" private static void init_" + initSections + "() {");
for (int k = 0; k < blocksize; k++) { for (int k = 0; k < blocksize; k++) {
row[i][k] = lineBreakProperties[idx + k]; row[i][k] = lineBreakProperties[idx + k];
if (printLocalComma) { if (printLocalComma) {
out.print(',');
out.print(", ");
} else { } else {
printLocalComma = true; printLocalComma = true;
} }
} }
idx += blocksize; idx += blocksize;
} }
out.println(" };");
out.println(" }");
out.println(); out.println();
out.println(" static {"); out.println(" static {");
for (int i = 0; i <= initSections; i++) { for (int i = 0; i <= initSections; i++) {
out.println(" init_" + i + "();"); out.println(" init_" + i + "();");
} }
out.print(doStaticLinkCode); out.print(doStaticLinkCode);
out.println(" };");
out.println(" }");
out.println(); out.println();
for (int i = 0; i < lineBreakPropertyShortNames.size(); i++) { for (int i = 0; i < lineBreakPropertyShortNames.size(); i++) {
String shortName = (String)lineBreakPropertyShortNames.get(i); String shortName = (String)lineBreakPropertyShortNames.get(i);
out.println(" /** Linebreak property constant */");
out.print(" public static final byte LINE_BREAK_PROPERTY_"); out.print(" public static final byte LINE_BREAK_PROPERTY_");
out.print(shortName); out.print(shortName);
out.print('=');
out.print(" = ");
out.print(i + 1); out.print(i + 1);
out.println(';'); out.println(';');
} }
int lineLength = shortNamePrefix.length(); int lineLength = shortNamePrefix.length();
printComma = false; printComma = false;
for (int i = 0; i < lineBreakPropertyShortNames.size(); i++) { for (int i = 0; i < lineBreakPropertyShortNames.size(); i++) {
String name = (String)lineBreakPropertyShortNames.get(i);
name = (String)lineBreakPropertyShortNames.get(i);
if (printComma) { if (printComma) {
out.print(',');
out.print(", ");
lineLength++; lineLength++;
} else { } else {
printComma = true; printComma = true;
lineLength = longNamePrefix.length(); lineLength = longNamePrefix.length();
printComma = false; printComma = false;
for (int i = 0; i < lineBreakPropertyLongNames.size(); i++) { for (int i = 0; i < lineBreakPropertyLongNames.size(); i++) {
String name = (String)lineBreakPropertyLongNames.get(i);
name = (String)lineBreakPropertyLongNames.get(i);
if (printComma) { if (printComma) {
out.print(','); out.print(',');
lineLength++; lineLength++;
} }
out.println("};"); out.println("};");
out.println(); out.println();
out.println(" /**");
out.println(" * Return the short name for the linebreak property corresponding ");
out.println(" * to the given symbolic constant.");
out.println(" *");
out.println(" * @param i the numeric value of the linebreak property");
out.println(" * @return the short name of the linebreak property");
out.println(" */");
out.println(" public static String getLineBreakPropertyShortName(byte i) {"); out.println(" public static String getLineBreakPropertyShortName(byte i) {");
out.println(" if (i>0 && i<=lineBreakPropertyShortNames.length) {");
out.println(" return lineBreakPropertyShortNames[i-1];");
out.println(" if (i > 0 && i <= lineBreakPropertyShortNames.length) {");
out.println(" return lineBreakPropertyShortNames[i - 1];");
out.println(" } else {"); out.println(" } else {");
out.println(" return null;"); out.println(" return null;");
out.println(" }"); out.println(" }");
out.println(" }"); out.println(" }");
out.println(); out.println();
out.println(" /**");
out.println(" * Return the long name for the linebreak property corresponding ");
out.println(" * to the given symbolic constant.");
out.println(" *");
out.println(" * @param i the numeric value of the linebreak property");
out.println(" * @return the long name of the linebreak property");
out.println(" */");
out.println(" public static String getLineBreakPropertyLongName(byte i) {"); out.println(" public static String getLineBreakPropertyLongName(byte i) {");
out.println(" if (i>0 && i<=lineBreakPropertyLongNames.length) {");
out.println(" return lineBreakPropertyLongNames[i-1];");
out.println(" if (i > 0 && i <= lineBreakPropertyLongNames.length) {");
out.println(" return lineBreakPropertyLongNames[i - 1];");
out.println(" } else {"); out.println(" } else {");
out.println(" return null;"); out.println(" return null;");
out.println(" }"); out.println(" }");
out.println(" }"); out.println(" }");
out.println(); out.println();
out.println(" /**");
out.println(" * Return the linebreak property constant for the given <code>char</code>");
out.println(" *");
out.println(" * @param c the <code>char</code> whose linebreak property to return");
out.println(" * @return the constant representing the linebreak property");
out.println(" */");
out.println(" public static byte getLineBreakProperty(char c) {"); out.println(" public static byte getLineBreakProperty(char c) {");
out.println(" return lineBreakProperties[c/" + blocksize + "][c%" + blocksize + "];");
out.println(" return lineBreakProperties[c / " + blocksize + "][c % " + blocksize + "];");
out.println(" }"); out.println(" }");
out.println(); out.println();
out.println(" /**");
out.println(" * Return the break class constant for the given pair of linebreak ");
out.println(" * property constants.");
out.println(" *");
out.println(" * @param lineBreakPropertyBefore the linebreak property for the first character");
out.println(" * in a two-character sequence");
out.println(" * @param lineBreakPropertyAfter the linebreak property for the second character");
out.println(" * in a two-character sequence");
out.println(" * @return the constant representing the break class");
out.println(" */");
out.println( out.println(
" public static byte getLineBreakPairProperty(int lineBreakPropertyBefore,int lineBreakPropertyAfter) {");
out.println(" return PAIR_TABLE[lineBreakPropertyBefore-1][lineBreakPropertyAfter-1];");
" public static byte getLineBreakPairProperty(int lineBreakPropertyBefore, int lineBreakPropertyAfter) {");
out.println(" return PAIR_TABLE[lineBreakPropertyBefore - 1][lineBreakPropertyAfter - 1];");
out.println(" }"); out.println(" }");
out.println(); out.println();
out.println("};");
out.println("}");
out.flush(); out.flush();
out.close(); out.close();
} }

+ 8
- 0
src/documentation/content/xdocs/news.xml View File

<version>$Revision$</version> <version>$Revision$</version>
</header> </header>
<body> <body>
<section>
<title>26th March 2007 - Apache FOP 0.95beta Released</title>
<p>The Apache FOP team is delighted to present you a beta version of the
next production grade release of the new FOP codebase. This release
contains many bug fixes and new features. See the <a
href="0.95/releaseNotes_0.95beta.html">Release Notes</a> for a list of
the most important changes.</p>
</section>
<section> <section>
<title>30 October 2007 - New Committer</title> <title>30 October 2007 - New Committer</title>
<p>Welcome Max Berger!</p> <p>Welcome Max Berger!</p>

+ 21
- 0
src/documentation/content/xdocs/trunk/configuration.xml View File

<fonts.... <fonts....
</renderer>]]></source> </renderer>]]></source>
<p>FOP supports encryption of PDF output, thanks to Patrick C. Lankswert.
This feature is commonly used to prevent unauthorized viewing, printing, editing, copying text
from the document and doing annotations. It is also possible to ask the user for a password in
order to view the contents. Note that there already exist third party applications which can
decrypt an encrypted PDF without effort and allow the aforementioned operations, therefore the
degree of protection is limited. For further information about features and restrictions
regarding PDF encryption, look at the documentation coming with Adobe Acrobat or the technical
documentation on the Adobe web site.</p>
<source><![CDATA[
<renderer mime="application/pdf">
<encryption-params>
<user-password>testuserpass</user-password>
<owner-password>testownerpass</owner-password>
<noprint/>
<nocopy/>
<noedit/>
<noannotations/>
</encryption-params>
</renderer>]]></source>
</section> </section>
<section id="ps-renderer"> <section id="ps-renderer">
<title>Special Settings for the PostScript Renderer</title> <title>Special Settings for the PostScript Renderer</title>

+ 32
- 18
src/documentation/content/xdocs/trunk/fonts.xml View File

<title>Apache FOP: Fonts</title> <title>Apache FOP: Fonts</title>
<version>$Revision$</version> <version>$Revision$</version>
<authors> <authors>
<person name="Jeremias Märki" email=""/>
<person name="Jeremias M&#xE4;rki" email=""/>
<person name="Tore Engvig" email=""/> <person name="Tore Engvig" email=""/>
<person name="Adrian Cumiskey" email=""/> <person name="Adrian Cumiskey" email=""/>
<person name="Max Berger" email=""/> <person name="Max Berger" email=""/>
<td>yes (used for layout but not for output)</td> <td>yes (used for layout but not for output)</td>
<td>no</td> <td>no</td>
</tr> </tr>
<!--tr> NOT AVAILABLE
<!--tr> NOT AVAILABLE
<td>MIF</td> <td>MIF</td>
<td>n/a (font metrics not needed)</td> <td>n/a (font metrics not needed)</td>
<td>n/a</td> <td>n/a</td>
<td>n/a</td> <td>n/a</td>
<td>n/a</td> <td>n/a</td>
</tr--> </tr-->
<!--tr> NOT AVAILABLE
<!--tr> NOT AVAILABLE
<td>SVG</td> <td>SVG</td>
<td>if available from OS</td> <td>if available from OS</td>
<td>yes</td> <td>yes</td>
PDF or PostScript. PDF or PostScript.
</p> </p>
</section> </section>
<section id="custom"> <section id="custom">
<title>Custom Fonts</title> <title>Custom Fonts</title>
<p> <p>
Basic information about fonts can be found at: Basic information about fonts can be found at:
</p> </p>
<ul> <ul>
<li><a href="http://partners.adobe.com/asn/developer/type/ftypes.html">Adobe font types</a></li>
<li><a href="http://partners.adobe.com/asn/developer/technotes/fonts.html">Adobe Font Technote</a></li>
<li>
<a href="http://partners.adobe.com/asn/developer/type/ftypes.html">Adobe font types</a>
</li>
<li>
<a href="http://partners.adobe.com/asn/developer/technotes/fonts.html">Adobe Font Technote</a>
</li>
</ul> </ul>
</section> </section>
<section id="basics"> <section id="basics">
<title>Basic font configuration</title> <title>Basic font configuration</title>
<p> <p>
not possible to easily configure fonts from Java code. not possible to easily configure fonts from Java code.
</note> </note>
</section> </section>
<section id="advanced"> <section id="advanced">
<title>Advanced font configuration</title> <title>Advanced font configuration</title>
<p> <p>
relative to the base directory. relative to the base directory.
</li> </li>
</ul> </ul>
<!--note>Cocoon users will need to setup the config, see FOPSerializer for more information.</note-->
<!--note>Cocoon users will need to setup the config, see FOPSerializer for more information.</note-->
</section> </section>
<section id="autodetect"> <section id="autodetect">
<title>Auto-Detect and auto-embed feature</title> <title>Auto-Detect and auto-embed feature</title>
</ul> </ul>
</section> </section>
<section id="substitution"> <section id="substitution">
<title>Substitution</title>
<p>When a &lt;substitutions/&gt; section is defined in the configuration, FOP will re-map any font-family references found in your FO input to a given substitution font.</p>
<ul>
<li>If a &lt;substitution/&gt; is declared, it is mandatory that both a &lt;from/&gt; and &lt;to/&gt; child element is declared with a font-family attribute.</li>
<li>Both font-weight and font-style are optional attributes, if they are provided then a value of 'normal' is assumed.</li>
</ul>
<p>For example you could make all FO font-family references to 'Arial' with weights between 700 and 900 reference the normal 'Arial Black' font.</p>
<source><![CDATA[
<title>Substitution</title>
<p>When a &lt;substitutions/&gt; section is defined in the configuration, FOP will re-map any font-family references found in your FO input to a given substitution font.</p>
<ul>
<li>If a &lt;substitution/&gt; is declared, it is mandatory that both a &lt;from/&gt; and &lt;to/&gt; child element is declared with a font-family attribute.</li>
<li>Both font-weight and font-style are optional attributes, if they are provided then a value of 'normal' is assumed.</li>
</ul>
<p>For example you could make all FO font-family references to 'Arial' with weights between 700 and 900 reference the normal 'Arial Black' font.</p>
<source><![CDATA[
<fop version="1.0"> <fop version="1.0">
<fonts> <fonts>
<substitutions> <substitutions>
</fonts> </fonts>
</fop>]]></source> </fop>]]></source>
</section> </section>
<!-- The following section should no longer be required
<!-- The following section should no longer be required
<section id="embedding-base14"> <section id="embedding-base14">
<title>Explicitly embedding the base 14 fonts</title> <title>Explicitly embedding the base 14 fonts</title>
<p> <p>
[..]]]></source> [..]]]></source>
</section--> </section-->
</section> </section>
<section id="selection">
<title>Font Selection Strategies</title>
<p>
There are two font selection strategies: character-by-character or auto. The default is auto.</p>
<p>Auto selected the first font from the list which is able to display the most characters in a given word. This means (assume font A has characters for abclmn, font B for lnmxyz, fontlist is A,B):</p>
<ul>
<li>aaa lll xxx would be displayed in fonts A A B</li>
<li>aaaxx would be displayed in font A</li>
<li>aaaxxx would be displayed in font A</li>
<li>aaaxxxx would be displayed in font B</li>
</ul>
<p>Character-by-Character is NOT yet supported!</p>
</section>
</body> </body>
</document> </document>

+ 25
- 0
src/documentation/content/xdocs/trunk/output.xml View File

Consult the technical reference for your printer for all available values. Consult the technical reference for your printer for all available values.
</p> </p>
</section> </section>
<section id="pcl-duplex-mode">
<title>Page Duplex Mode</title>
<p>
The duplex-mode extension attribute on fo:simple-page-master allows to
select the duplex mode to be used for a particular simple-page-master.
Example:
</p>
<source><![CDATA[
<fo:layout-master-set>
<fo:simple-page-master master-name="simple" pcl:duplex-mode="0">
...
</fo:simple-page-master>
</fo:layout-master-set>
]]></source>
<p>
Note: the duplex is a positive integer and the value depends on
the target printer. Not all PCL printers support duplexing.
Usually,
"0" is simplex,
"1" is duplex (long-edge binding),
"2" is duplex (short-edge binding).

Consult the technical reference for your printer for all available values.
</p>
</section>
</section> </section>
</section> </section>
<section id="afp"> <section id="afp">

+ 2
- 0
src/documentation/skinconf.xml View File

<width>88</width> <width>88</width>
<height>31</height> <height>31</height>
</credit> </credit>
<!--
<credit box-location="alt2"> <credit box-location="alt2">
<name>ApacheCon Europe 2008</name> <name>ApacheCon Europe 2008</name>
<url>http://eu.apachecon.com/</url> <url>http://eu.apachecon.com/</url>
<width>125</width> <width>125</width>
<height>125</height> <height>125</height>
</credit> </credit>
-->
<credit box-location="alt2"> <credit box-location="alt2">
<name>ApacheCon US 2008</name> <name>ApacheCon US 2008</name>
<url>http://us.apachecon.com/</url> <url>http://us.apachecon.com/</url>

+ 1
- 1
src/java/org/apache/fop/apps/MimeConstants.java View File

/** FrameMaker's MIF */ /** FrameMaker's MIF */
String MIME_MIF = "application/mif"; String MIME_MIF = "application/mif";
/** Structured Vector Graphics */
/** Scalable Vector Graphics */
String MIME_SVG = "image/svg+xml"; String MIME_SVG = "image/svg+xml";
/** GIF images */ /** GIF images */

+ 2
- 7
src/java/org/apache/fop/area/Area.java View File

* @param oTraitCode the trait key * @param oTraitCode the trait key
* @return the trait value * @return the trait value
*/ */
public boolean getBooleanTrait(Object oTraitCode) {
final Object obj = getTrait(oTraitCode);
if (obj instanceof Boolean) {
return ((Boolean)obj).booleanValue();
} else {
return false;
}
public boolean getTraitAsBoolean(Object oTraitCode) {
return Boolean.TRUE.equals(getTrait(oTraitCode));
} }


/** /**

+ 76
- 93
src/java/org/apache/fop/area/AreaTreeParser.java View File

import java.util.Set; import java.util.Set;
import java.util.Stack; import java.util.Stack;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.nio.CharBuffer;


import javax.xml.transform.Source; import javax.xml.transform.Source;
import javax.xml.transform.Transformer; import javax.xml.transform.Transformer;
import org.apache.fop.area.Trait.Background; import org.apache.fop.area.Trait.Background;
import org.apache.fop.area.Trait.InternalLink; import org.apache.fop.area.Trait.InternalLink;
import org.apache.fop.area.inline.AbstractTextArea; import org.apache.fop.area.inline.AbstractTextArea;
import org.apache.fop.area.inline.Character;
import org.apache.fop.area.inline.ForeignObject; import org.apache.fop.area.inline.ForeignObject;
import org.apache.fop.area.inline.Image; import org.apache.fop.area.inline.Image;
import org.apache.fop.area.inline.InlineArea; import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.util.ColorUtil; import org.apache.fop.util.ColorUtil;
import org.apache.fop.util.ContentHandlerFactory; import org.apache.fop.util.ContentHandlerFactory;
import org.apache.fop.util.ContentHandlerFactoryRegistry; import org.apache.fop.util.ContentHandlerFactoryRegistry;
import org.apache.fop.util.ConversionUtils;
import org.apache.fop.util.DefaultErrorListener; import org.apache.fop.util.DefaultErrorListener;


/** /**
private ElementMappingRegistry elementMappingRegistry; private ElementMappingRegistry elementMappingRegistry;


private Attributes lastAttributes; private Attributes lastAttributes;
private StringBuffer content = new StringBuffer();


private CharBuffer content = CharBuffer.allocate(64);
private boolean ignoreCharacters = true;
private PageViewport currentPageViewport; private PageViewport currentPageViewport;
private Map pageViewportsByKey = new java.util.HashMap(); private Map pageViewportsByKey = new java.util.HashMap();
// set of "ID firsts" that have already been assigned to a PV: // set of "ID firsts" that have already been assigned to a PV:
makers.put("text", new TextMaker()); makers.put("text", new TextMaker());
makers.put("word", new WordMaker()); makers.put("word", new WordMaker());
makers.put("space", new SpaceMaker()); makers.put("space", new SpaceMaker());
makers.put("char", new CharMaker());
makers.put("leader", new LeaderMaker()); makers.put("leader", new LeaderMaker());
makers.put("viewport", new ViewportMaker()); makers.put("viewport", new ViewportMaker());
makers.put("image", new ImageMaker()); makers.put("image", new ImageMaker());
makers.put("destination", new DestinationMaker()); makers.put("destination", new DestinationMaker());
} }


private static Rectangle2D parseRect(String rect) {
StringTokenizer tokenizer = new StringTokenizer(rect, " ");
return new Rectangle2D.Double(
Double.parseDouble(tokenizer.nextToken()),
Double.parseDouble(tokenizer.nextToken()),
Double.parseDouble(tokenizer.nextToken()),
Double.parseDouble(tokenizer.nextToken()));
}

private Area findAreaType(Class clazz) { private Area findAreaType(Class clazz) {
if (areaStack.size() > 0) { if (areaStack.size() > 0) {
int pos = areaStack.size() - 1; int pos = areaStack.size() - 1;
boolean handled = true; boolean handled = true;
if ("".equals(uri)) { if ("".equals(uri)) {
Maker maker = (Maker)makers.get(localName); Maker maker = (Maker)makers.get(localName);
content.clear();
ignoreCharacters = true;
if (maker != null) { if (maker != null) {
ignoreCharacters = maker.ignoreCharacters();
maker.startElement(attributes); maker.startElement(attributes);
} else if ("extension-attachments".equals(localName)) { } else if ("extension-attachments".equals(localName)) {
//TODO implement me //TODO implement me
Maker maker = (Maker)makers.get(localName); Maker maker = (Maker)makers.get(localName);
if (maker != null) { if (maker != null) {
maker.endElement(); maker.endElement();
content.clear();
} }
ignoreCharacters = true;
} else { } else {
//log.debug("Ignoring " + localName + " in namespace: " + uri); //log.debug("Ignoring " + localName + " in namespace: " + uri);
} }
content.setLength(0); //Reset text buffer (see characters())
} }
} }


private static interface Maker { private static interface Maker {
void startElement(Attributes attributes) throws SAXException; void startElement(Attributes attributes) throws SAXException;
void endElement(); void endElement();
boolean ignoreCharacters();
} }


private abstract class AbstractMaker implements Maker { private abstract class AbstractMaker implements Maker {
public void endElement() { public void endElement() {
//nop //nop
} }
public boolean ignoreCharacters() {
return true;
}
} }


private class AreaTreeMaker extends AbstractMaker { private class AreaTreeMaker extends AbstractMaker {
if (currentPageViewport != null) { if (currentPageViewport != null) {
throw new IllegalStateException("currentPageViewport must be null"); throw new IllegalStateException("currentPageViewport must be null");
} }
Rectangle2D viewArea = parseRect(attributes.getValue("bounds"));
Rectangle2D viewArea = getAttributeAsRectangle2D(attributes, "bounds");
int pageNumber = getAttributeAsInteger(attributes, "nr", -1); int pageNumber = getAttributeAsInteger(attributes, "nr", -1);
String key = attributes.getValue("key"); String key = attributes.getValue("key");
String pageNumberString = attributes.getValue("formatted-nr"); String pageNumberString = attributes.getValue("formatted-nr");
if (rv != null) { if (rv != null) {
throw new IllegalStateException("Current RegionViewport must be null"); throw new IllegalStateException("Current RegionViewport must be null");
} }
Rectangle2D viewArea = parseRect(attributes.getValue("rect"));
Rectangle2D viewArea = getAttributeAsRectangle2D(attributes, "rect");
rv = new RegionViewport(viewArea); rv = new RegionViewport(viewArea);
transferForeignObjects(attributes, rv); transferForeignObjects(attributes, rv);
rv.setClip(getAttributeAsBoolean(attributes, "clipped", false)); rv.setClip(getAttributeAsBoolean(attributes, "clipped", false));
public void endElement() { public void endElement() {
assertObjectOfClass(areaStack.pop(), RegionReference.class); assertObjectOfClass(areaStack.pop(), RegionReference.class);
}
}
} }


private class RegionAfterMaker extends AbstractMaker { private class RegionAfterMaker extends AbstractMaker {


public void endElement() { public void endElement() {
assertObjectOfClass(areaStack.pop(), RegionReference.class); assertObjectOfClass(areaStack.pop(), RegionReference.class);
}
}
} }


private class RegionStartMaker extends AbstractMaker { private class RegionStartMaker extends AbstractMaker {


public void endElement() { public void endElement() {
assertObjectOfClass(areaStack.pop(), RegionReference.class); assertObjectOfClass(areaStack.pop(), RegionReference.class);
}
}
} }
private class RegionEndMaker extends AbstractMaker { private class RegionEndMaker extends AbstractMaker {


public void endElement() { public void endElement() {
assertObjectOfClass(areaStack.pop(), RegionReference.class); assertObjectOfClass(areaStack.pop(), RegionReference.class);
}
}
} }


private class RegionBodyMaker extends AbstractMaker { private class RegionBodyMaker extends AbstractMaker {
public void endElement() { public void endElement() {
assertObjectOfClass(areaStack.pop(), BeforeFloat.class); assertObjectOfClass(areaStack.pop(), BeforeFloat.class);
}
}
} }


private class BlockMaker extends AbstractMaker { private class BlockMaker extends AbstractMaker {
public void endElement() { public void endElement() {
assertObjectOfClass(areaStack.pop(), Block.class); assertObjectOfClass(areaStack.pop(), Block.class);
}
}
} }


private class LineAreaMaker extends AbstractMaker { private class LineAreaMaker extends AbstractMaker {
public void endElement() { public void endElement() {
assertObjectOfClass(areaStack.pop(), TextArea.class); assertObjectOfClass(areaStack.pop(), TextArea.class);
}
}
} }


private class WordMaker extends AbstractMaker { private class WordMaker extends AbstractMaker {


private int[] toIntArray(String s) {
if (s == null || s.length() == 0) {
return null;
}
StringTokenizer tokenizer = new StringTokenizer(s, " ");
List values = new java.util.ArrayList();
while (tokenizer.hasMoreTokens()) {
values.add(new Integer(tokenizer.nextToken()));
}
int[] res = new int[values.size()];
for (int i = 0, c = res.length; i < c; i++) {
res[i] = ((Integer)values.get(i)).intValue();
}
return res;
}
public void endElement() { public void endElement() {
int offset = getAttributeAsInteger(lastAttributes, "offset", 0); int offset = getAttributeAsInteger(lastAttributes, "offset", 0);
int[] letterAdjust = toIntArray(lastAttributes.getValue("letter-adjust"));
String txt = content.toString();
WordArea word = new WordArea(txt, offset, letterAdjust);
int[] letterAdjust
= ConversionUtils.toIntArray(
lastAttributes.getValue("letter-adjust"), "\\s");
content.flip();
WordArea word = new WordArea(content.toString().trim(), offset, letterAdjust);
AbstractTextArea text = getCurrentText(); AbstractTextArea text = getCurrentText();
word.setParentArea(text); word.setParentArea(text);
text.addChildArea(word); text.addChildArea(word);
}
}
public boolean ignoreCharacters() {
return false;
}
} }


private class SpaceMaker extends AbstractMaker { private class SpaceMaker extends AbstractMaker {

public void endElement() { public void endElement() {
int offset = getAttributeAsInteger(lastAttributes, "offset", 0); int offset = getAttributeAsInteger(lastAttributes, "offset", 0);
String txt = content.toString();
//TODO the isAdjustable parameter is currently not used/implemented //TODO the isAdjustable parameter is currently not used/implemented
if (txt.length() > 0) {
if (content.position() > 0) {
content.flip();
boolean adjustable = getAttributeAsBoolean(lastAttributes, "adj", true); boolean adjustable = getAttributeAsBoolean(lastAttributes, "adj", true);
SpaceArea space = new SpaceArea(txt.charAt(0), offset, adjustable);
SpaceArea space = new SpaceArea(content.charAt(0), offset, adjustable);
AbstractTextArea text = getCurrentText(); AbstractTextArea text = getCurrentText();
space.setParentArea(text); space.setParentArea(text);
text.addChildArea(space); text.addChildArea(space);
Area parent = (Area)areaStack.peek(); Area parent = (Area)areaStack.peek();
parent.addChildArea(space); parent.addChildArea(space);
} }
}
}

private class CharMaker extends AbstractMaker {

public void endElement() {
String txt = content.toString();
Character ch = new Character(txt.charAt(0));
transferForeignObjects(lastAttributes, ch);
setAreaAttributes(lastAttributes, ch);
setTraits(lastAttributes, ch, SUBSET_COMMON);
setTraits(lastAttributes, ch, SUBSET_BOX);
setTraits(lastAttributes, ch, SUBSET_COLOR);
setTraits(lastAttributes, ch, SUBSET_FONT);
ch.setOffset(getAttributeAsInteger(lastAttributes, "offset", 0));
ch.setBaselineOffset(getAttributeAsInteger(lastAttributes, "baseline", 0));
Area parent = (Area)areaStack.peek();
parent.addChildArea(ch);
}
}
public boolean ignoreCharacters() {
return false;
}
} }


private class LeaderMaker extends AbstractMaker { private class LeaderMaker extends AbstractMaker {
Area parent = (Area)areaStack.peek(); Area parent = (Area)areaStack.peek();
parent.addChildArea(leader); parent.addChildArea(leader);
} }
public void endElement() {
}
} }


private class ViewportMaker extends AbstractMaker { private class ViewportMaker extends AbstractMaker {
public void endElement() { public void endElement() {
assertObjectOfClass(areaStack.pop(), Viewport.class); assertObjectOfClass(areaStack.pop(), Viewport.class);
}
}
} }
private class ImageMaker extends AbstractMaker { private class ImageMaker extends AbstractMaker {
} }
} }


private boolean getAttributeAsBoolean(Attributes attributes, String name,
private static boolean getAttributeAsBoolean(Attributes attributes, String name,
boolean defaultValue) { boolean defaultValue) {
String s = attributes.getValue(name); String s = attributes.getValue(name);
if (s == null) { if (s == null) {
} }
} }


private int getAttributeAsInteger(Attributes attributes, String name,
private static int getAttributeAsInteger(Attributes attributes, String name,
int defaultValue) { int defaultValue) {
String s = attributes.getValue(name); String s = attributes.getValue(name);
if (s == null) { if (s == null) {
} }
} }


private CTM getAttributeAsCTM(Attributes attributes, String name) {
private static CTM getAttributeAsCTM(Attributes attributes, String name) {
String s = attributes.getValue(name).trim(); String s = attributes.getValue(name).trim();
if (s.startsWith("[") && s.endsWith("]")) { if (s.startsWith("[") && s.endsWith("]")) {
s = s.substring(1, s.length() - 1); s = s.substring(1, s.length() - 1);
StringTokenizer tokenizer = new StringTokenizer(s, " ");
double[] values = new double[] {
Double.parseDouble(tokenizer.nextToken()),
Double.parseDouble(tokenizer.nextToken()),
Double.parseDouble(tokenizer.nextToken()),
Double.parseDouble(tokenizer.nextToken()),
Double.parseDouble(tokenizer.nextToken()),
Double.parseDouble(tokenizer.nextToken())};
double[] values = ConversionUtils.toDoubleArray(s, "\\s");
if (values.length != 6) {
throw new IllegalArgumentException("CTM must consist of 6 double values!");
}
return new CTM(values[0], values[1], values[2], values[3], values[4], values[5]); return new CTM(values[0], values[1], values[2], values[3], values[4], values[5]);
} else { } else {
throw new IllegalArgumentException("CTM must be surrounded by square brackets");
throw new IllegalArgumentException("CTM must be surrounded by square brackets!");
} }
} }


private Rectangle2D getAttributeAsRectangle2D(Attributes attributes, String name) {
private static Rectangle2D getAttributeAsRectangle2D(Attributes attributes, String name) {
String s = attributes.getValue(name).trim(); String s = attributes.getValue(name).trim();
StringTokenizer tokenizer = new StringTokenizer(s, " ");
double[] values = new double[] {
Double.parseDouble(tokenizer.nextToken()),
Double.parseDouble(tokenizer.nextToken()),
Double.parseDouble(tokenizer.nextToken()),
Double.parseDouble(tokenizer.nextToken())};
double[] values = ConversionUtils.toDoubleArray(s, "\\s");
if (values.length != 4) {
throw new IllegalArgumentException("Rectangle must consist of 4 double values!");
}
return new Rectangle2D.Double(values[0], values[1], values[2], values[3]); return new Rectangle2D.Double(values[0], values[1], values[2], values[3]);
} }


private void transferForeignObjects(Attributes atts, AreaTreeObject ato) {
private static void transferForeignObjects(Attributes atts, AreaTreeObject ato) {
for (int i = 0, c = atts.getLength(); i < c; i++) { for (int i = 0, c = atts.getLength(); i < c; i++) {
String ns = atts.getURI(i); String ns = atts.getURI(i);
if (ns.length() > 0) { if (ns.length() > 0) {
public void characters(char[] ch, int start, int length) throws SAXException { public void characters(char[] ch, int start, int length) throws SAXException {
if (delegate != null) { if (delegate != null) {
delegate.characters(ch, start, length); delegate.characters(ch, start, length);
} else {
content.append(ch, start, length);
} else if (!ignoreCharacters) {
int maxLength = this.content.capacity() - this.content.position();
if (maxLength < length) {
// allocate a larger buffer and transfer content
CharBuffer newContent
= CharBuffer.allocate(this.content.position() + length);
this.content.flip();
newContent.put(this.content);
this.content = newContent;
}
// make sure the full capacity is used
this.content.limit(this.content.capacity());
// add characters to the buffer
this.content.put(ch, start, length);
// decrease the limit, if necessary
if (this.content.position() < this.content.limit()) {
this.content.limit(this.content.position());
}
} }
} }

} }

} }

+ 17
- 11
src/java/org/apache/fop/area/Page.java View File

} else { } else {
rr = new RegionReference(r, rvp); rr = new RegionReference(r, rvp);
} }
// set borders and padding traits
// (a little extensions wrt what prescribed by the specs at 6.4.14)
TraitSetter.addBorders(rr, r.getCommonBorderPaddingBackground(), false, false, false, false, null);
TraitSetter.addPadding(rr, r.getCommonBorderPaddingBackground(), false, false, false, false, null);
setRegionReferencePosition(rr, r, rvp.getViewArea()); setRegionReferencePosition(rr, r, rvp.getViewArea());
rvp.setRegionReference(rr); rvp.setRegionReference(rr);
setRegionViewport(r.getNameId(), rvp); setRegionViewport(r.getNameId(), rvp);
/** /**
* Get the region from this page. * Get the region from this page.
* *
* @param areaclass the region area class
* @param areaClass the region area class
* @return the region viewport or null if none * @return the region viewport or null if none
*/ */
public RegionViewport getRegionViewport(int areaclass) {
if (areaclass == Constants.FO_REGION_BEFORE) {
public RegionViewport getRegionViewport(int areaClass) {
switch (areaClass) {
case Constants.FO_REGION_BEFORE:
return regionBefore; return regionBefore;
} else if (areaclass == Constants.FO_REGION_START) {
case Constants.FO_REGION_START:
return regionStart; return regionStart;
} else if (areaclass == Constants.FO_REGION_BODY) {
return regionBody;
} else if (areaclass == Constants.FO_REGION_END) {
case Constants.FO_REGION_BODY:
return regionBody;
case Constants.FO_REGION_END:
return regionEnd; return regionEnd;
} else if (areaclass == Constants.FO_REGION_AFTER) {
case Constants.FO_REGION_AFTER:
return regionAfter; return regionAfter;
default:
throw new IllegalArgumentException("No such area class with ID = " + areaClass);
} }
throw new IllegalArgumentException("No such area class with ID = "
+ areaclass);
} }


/** /**
* indicates whether any FOs have been added to the body region
* Indicates whether any FOs have been added to the body region
* *
* @return whether any FOs have been added to the body region * @return whether any FOs have been added to the body region
*/ */


} }




+ 13
- 1
src/java/org/apache/fop/area/RegionReference.java View File

blocks.add(child); blocks.add(child);
} }


/** {@inheritDoc} */
public int getBPD() {
// subtract bpd of borders and padding before / after
return super.getBPD() - getBorderAndPaddingWidthBefore() - getBorderAndPaddingWidthAfter();
}
/** {@inheritDoc} */
public int getIPD() {
// subtract ipd of borders and padding start / end
return super.getIPD() - getBorderAndPaddingWidthStart() - getBorderAndPaddingWidthEnd();
}

/** /**
* Set the Coordinate Transformation Matrix which transforms content * Set the Coordinate Transformation Matrix which transforms content
* coordinates in this region reference area which are specified in * coordinates in this region reference area which are specified in
public void addBlock(Block block) { public void addBlock(Block block) {
addChildArea(block); addChildArea(block);
} }
/** /**
* Clone this region. * Clone this region.
* This is used when cloning the page by the page master. * This is used when cloning the page by the page master.

+ 0
- 62
src/java/org/apache/fop/area/inline/Character.java View File

/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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$ */

package org.apache.fop.area.inline;

/**
* Single character inline area.
* This inline area holds a single character.
* @deprecated A TextArea with a single WordArea as its child should be used instead.
*/
public class Character extends AbstractTextArea {
// use a String instead of a character because if this character
// ends a syllable the hyphenation character must be added
private String character;

/**
* Create a new character inline area with the given character.
*
* @param ch the character for this inline area
*/
public Character(char ch) {
character = new String() + ch;
}

/**
* Get the character for this inline character area.
*
* @return the character
*/
public String getChar() {
return character;
}

/**
* Add the hyphenation character and its length.
*
* @param hyphChar the hyphenation character
* @param hyphSize the size of the hyphenation character
*/
public void addHyphen(char hyphChar, int hyphSize) {
character += hyphChar;
this.setIPD(this.getIPD() + hyphSize);
}

}


+ 4
- 4
src/java/org/apache/fop/area/inline/InlineArea.java View File

*@return true if the inline area is underlined. *@return true if the inline area is underlined.
*/ */
public boolean hasUnderline() { public boolean hasUnderline() {
return getBooleanTrait(Trait.UNDERLINE);
return getTraitAsBoolean(Trait.UNDERLINE);
} }


/** @return true if the inline area is overlined. */ /** @return true if the inline area is overlined. */
public boolean hasOverline() { public boolean hasOverline() {
return getBooleanTrait(Trait.OVERLINE);
return getTraitAsBoolean(Trait.OVERLINE);
} }
/** @return true if the inline area has a line through. */ /** @return true if the inline area has a line through. */
public boolean hasLineThrough() { public boolean hasLineThrough() {
return getBooleanTrait(Trait.LINETHROUGH);
return getTraitAsBoolean(Trait.LINETHROUGH);
} }
/** @return true if the inline area is blinking. */ /** @return true if the inline area is blinking. */
public boolean isBlinking() { public boolean isBlinking() {
return getBooleanTrait(Trait.BLINK);
return getTraitAsBoolean(Trait.BLINK);
} }
/** /**

+ 1
- 1
src/java/org/apache/fop/events/EventExceptionManager.java View File

import org.apache.xmlgraphics.util.Service; import org.apache.xmlgraphics.util.Service;


/** /**
* This class is reponsible for converting events into exceptions.
* This class is responsible for converting events into exceptions.
*/ */
public class EventExceptionManager { public class EventExceptionManager {



+ 1
- 0
src/java/org/apache/fop/events/EventFormatter.xml View File

<message key="org.apache.fop.fo.flow.table.TableEventProducer.warnImplicitColumns">table-layout=\"fixed\" and column-width unspecified =&gt; falling back to proportional-column-width(1){{locator}}</message> <message key="org.apache.fop.fo.flow.table.TableEventProducer.warnImplicitColumns">table-layout=\"fixed\" and column-width unspecified =&gt; falling back to proportional-column-width(1){{locator}}</message>
<message key="org.apache.fop.fo.flow.table.TableEventProducer.paddingNotApplicable">padding-* properties are not applicable to {elementName}, but a non-zero value for padding was found.{{locator}}</message> <message key="org.apache.fop.fo.flow.table.TableEventProducer.paddingNotApplicable">padding-* properties are not applicable to {elementName}, but a non-zero value for padding was found.{{locator}}</message>
<message key="org.apache.fop.fo.flow.table.TableEventProducer.cellOverlap">{elementName} overlaps in column {column}.<!-- no locator here, exception will be wrapped --></message> <message key="org.apache.fop.fo.flow.table.TableEventProducer.cellOverlap">{elementName} overlaps in column {column}.<!-- no locator here, exception will be wrapped --></message>
<message key="org.apache.fop.fo.flow.table.TableEventProducer.forceNextColumnNumber">Negative value {propValue} of property column-number of element {elementName} forced into the next available column number {columnNumber}.{{locator}}</message>
<message key="org.apache.fop.fo.flow.table.TableEventProducer.breakIgnoredDueToRowSpanning">{breakBefore,if,break-before,break-after} ignored on {elementName} because of row spanning in progress (See XSL 1.1, {breakBefore,if,7.20.2,7.20.1}){{locator}}</message> <message key="org.apache.fop.fo.flow.table.TableEventProducer.breakIgnoredDueToRowSpanning">{breakBefore,if,break-before,break-after} ignored on {elementName} because of row spanning in progress (See XSL 1.1, {breakBefore,if,7.20.2,7.20.1}){{locator}}</message>
<message key="org.apache.fop.events.ResourceEventProducer.imageNotFound">Image not found.[ URI: {uri}.]{{locator}}</message> <message key="org.apache.fop.events.ResourceEventProducer.imageNotFound">Image not found.[ URI: {uri}.]{{locator}}</message>
<message key="org.apache.fop.events.ResourceEventProducer.imageError">Image not available.[ URI: {uri}.] Reason:[ {reason}][ {e}]{{locator}}</message> <message key="org.apache.fop.events.ResourceEventProducer.imageError">Image not available.[ URI: {uri}.] Reason:[ {reason}][ {e}]{{locator}}</message>

+ 1
- 1
src/java/org/apache/fop/events/EventListener.java View File

* This method is called for each event that is generated. With the event's ID it is possible * This method is called for each event that is generated. With the event's ID it is possible
* to react to certain events. Events can also simply be recorded and presented to a user. * to react to certain events. Events can also simply be recorded and presented to a user.
* It is possible to throw an (unchecked) exception if the processing needs to be aborted * It is possible to throw an (unchecked) exception if the processing needs to be aborted
* because some special event occured. This way the client can configure the behaviour of
* because some special event occurred. This way the client can configure the behaviour of
* the observed application. * the observed application.
* @param event the event * @param event the event
*/ */

+ 349
- 267
src/java/org/apache/fop/fo/Constants.java View File

* There are sets of constants describing: * There are sets of constants describing:
* <ul> * <ul>
* <li>Input and output formats</li> * <li>Input and output formats</li>
* <li>Formatting objects</li>
* <li>Formatting properties</li>
* <li>Enumerated values used in formatting properties</li>
* <li>Formatting objects (<em>FO_XXX</em>)</li>
* <li>Formatting properties (<em>PR_XXX</em>)</li>
* <li>Enumerated values used in formatting properties (<em>EN_XXX</em>)</li>
* </ul> * </ul>
*/ */
public interface Constants { public interface Constants {
int FO_BLOCK = 3; int FO_BLOCK = 3;
/** FO element constant */ /** FO element constant */
int FO_BLOCK_CONTAINER = 4; int FO_BLOCK_CONTAINER = 4;
/** FO element constant - XSL 1.1 */
int FO_BOOKMARK_TREE = 5;
/** FO element constant - XSL 1.1 */
int FO_BOOKMARK = 6;
/** FO element constant - XSL 1.1 */
int FO_BOOKMARK_TITLE = 7;
/** FO element constant - XSL 1.1 */
int FO_CHANGE_BAR_BEGIN = 8;
/** FO element constant - XSL 1.1 */
int FO_CHANGE_BAR_END = 9;
/** FO element constant */ /** FO element constant */
int FO_CHARACTER = 5;
int FO_CHARACTER = 10;
/** FO element constant */ /** FO element constant */
int FO_COLOR_PROFILE = 6;
int FO_COLOR_PROFILE = 11;
/** FO element constant */ /** FO element constant */
int FO_CONDITIONAL_PAGE_MASTER_REFERENCE = 7;
int FO_CONDITIONAL_PAGE_MASTER_REFERENCE = 12;
/** FO element constant */ /** FO element constant */
int FO_DECLARATIONS = 8;
int FO_DECLARATIONS = 13;
/** FO element constant */ /** FO element constant */
int FO_EXTERNAL_GRAPHIC = 9;
int FO_EXTERNAL_GRAPHIC = 14;
/** FO element constant */ /** FO element constant */
int FO_FLOAT = 10;
int FO_FLOAT = 15;
/** FO element constant */ /** FO element constant */
int FO_FLOW = 11;
int FO_FLOW = 16;
/** FO element constant - XSL 1.1 */
int FO_FLOW_ASSIGNMENT = 17;
/** FO element constant - XSL 1.1 */
int FO_FLOW_MAP = 18;
/** FO element constant - XSL 1.1 */
int FO_FLOW_NAME_SPECIFIER = 19;
/** FO element constant - XSL 1.1 */
int FO_FLOW_SOURCE_LIST = 20;
/** FO element constant - XSL 1.1 */
int FO_FLOW_TARGET_LIST = 21;
/** FO element constant - XSL 1.1 */
int FO_FOLIO_PREFIX = 22;
/** FO element constant - XSL 1.1 */
int FO_FOLIO_SUFFIX = 23;
/** FO element constant */ /** FO element constant */
int FO_FOOTNOTE = 12;
int FO_FOOTNOTE = 24;
/** FO element constant */ /** FO element constant */
int FO_FOOTNOTE_BODY = 13;
int FO_FOOTNOTE_BODY = 25;
/** FO element constant - XSL 1.1 */
int FO_INDEX_KEY_REFERENCE = 26;
/** FO element constant - XSL 1.1 */
int FO_INDEX_PAGE_NUMBER_PREFIX = 27;
/** FO element constant - XSL 1.1 */
int FO_INDEX_PAGE_NUMBER_SUFFIX = 28;
/** FO element constant - XSL 1.1 */
int FO_INDEX_PAGE_CITATION_LIST = 29;
/** FO element constant - XSL 1.1 */
int FO_INDEX_PAGE_CITATION_LIST_SEPARATOR = 30;
/** FO element constant - XSL 1.1 */
int FO_INDEX_PAGE_CITATION_RANGE_SEPARATOR = 31;
/** FO element constant - XSL 1.1 */
int FO_INDEX_RANGE_BEGIN = 32;
/** FO element constant - XSL 1.1 */
int FO_INDEX_RANGE_END = 33;
/** FO element constant */ /** FO element constant */
int FO_INITIAL_PROPERTY_SET = 14;
int FO_INITIAL_PROPERTY_SET = 34;
/** FO element constant */ /** FO element constant */
int FO_INLINE = 15;
int FO_INLINE = 35;
/** FO element constant */ /** FO element constant */
int FO_INLINE_CONTAINER = 16;
int FO_INLINE_CONTAINER = 36;
/** FO element constant */ /** FO element constant */
int FO_INSTREAM_FOREIGN_OBJECT = 17;
int FO_INSTREAM_FOREIGN_OBJECT = 37;
/** FO element constant */ /** FO element constant */
int FO_LAYOUT_MASTER_SET = 18;
int FO_LAYOUT_MASTER_SET = 38;
/** FO element constant */ /** FO element constant */
int FO_LEADER = 19;
int FO_LEADER = 39;
/** FO element constant */ /** FO element constant */
int FO_LIST_BLOCK = 20;
int FO_LIST_BLOCK = 40;
/** FO element constant */ /** FO element constant */
int FO_LIST_ITEM = 21;
int FO_LIST_ITEM = 41;
/** FO element constant */ /** FO element constant */
int FO_LIST_ITEM_BODY = 22;
int FO_LIST_ITEM_BODY = 42;
/** FO element constant */ /** FO element constant */
int FO_LIST_ITEM_LABEL = 23;
int FO_LIST_ITEM_LABEL = 43;
/** FO element constant */ /** FO element constant */
int FO_MARKER = 24;
int FO_MARKER = 44;
/** FO element constant */ /** FO element constant */
int FO_MULTI_CASE = 25;
int FO_MULTI_CASE = 45;
/** FO element constant */ /** FO element constant */
int FO_MULTI_PROPERTIES = 26;
int FO_MULTI_PROPERTIES = 46;
/** FO element constant */ /** FO element constant */
int FO_MULTI_PROPERTY_SET = 27;
int FO_MULTI_PROPERTY_SET = 47;
/** FO element constant */ /** FO element constant */
int FO_MULTI_SWITCH = 28;
int FO_MULTI_SWITCH = 48;
/** FO element constant */ /** FO element constant */
int FO_MULTI_TOGGLE = 29;
int FO_MULTI_TOGGLE = 49;
/** FO element constant */ /** FO element constant */
int FO_PAGE_NUMBER = 30;
int FO_PAGE_NUMBER = 50;
/** FO element constant */ /** FO element constant */
int FO_PAGE_NUMBER_CITATION = 31;
int FO_PAGE_NUMBER_CITATION = 51;
/** FO element constant - XSL 1.1 */
int FO_PAGE_NUMBER_CITATION_LAST = 52;
/** FO element constant */ /** FO element constant */
int FO_PAGE_SEQUENCE = 32;
int FO_PAGE_SEQUENCE = 53;
/** FO element constant */ /** FO element constant */
int FO_PAGE_SEQUENCE_MASTER = 33;
int FO_PAGE_SEQUENCE_MASTER = 54;
/** FO element constant - XSL 1.1 */
int FO_PAGE_SEQUENCE_WRAPPER = 55;
/** FO element constant */ /** FO element constant */
int FO_REGION_AFTER = 34;
int FO_REGION_AFTER = 56;
/** FO element constant */ /** FO element constant */
int FO_REGION_BEFORE = 35;
int FO_REGION_BEFORE = 57;
/** FO element constant */ /** FO element constant */
int FO_REGION_BODY = 36;
int FO_REGION_BODY = 58;
/** FO element constant */ /** FO element constant */
int FO_REGION_END = 37;
int FO_REGION_END = 59;
/** FO element constant - XSL 1.1 */
int FO_REGION_NAME_SPECIFIER = 60;
/** FO element constant */ /** FO element constant */
int FO_REGION_START = 38;
int FO_REGION_START = 61;
/** FO element constant */ /** FO element constant */
int FO_REPEATABLE_PAGE_MASTER_ALTERNATIVES = 39;
int FO_REPEATABLE_PAGE_MASTER_ALTERNATIVES = 62;
/** FO element constant */ /** FO element constant */
int FO_REPEATABLE_PAGE_MASTER_REFERENCE = 40;
int FO_REPEATABLE_PAGE_MASTER_REFERENCE = 63;
/** FO element constant */ /** FO element constant */
int FO_RETRIEVE_MARKER = 41;
int FO_RETRIEVE_MARKER = 64;
/** FO element constant - XSL 1.1 */
int FO_RETRIEVE_TABLE_MARKER = 65;
/** FO element constant */ /** FO element constant */
int FO_ROOT = 42;
int FO_ROOT = 66;
/** FO element constant - XSL 1.1 */
int FO_SCALING_VALUE_CITATION = 67;
/** FO element constant */ /** FO element constant */
int FO_SIMPLE_PAGE_MASTER = 43;
int FO_SIMPLE_PAGE_MASTER = 68;
/** FO element constant */ /** FO element constant */
int FO_SINGLE_PAGE_MASTER_REFERENCE = 44;
int FO_SINGLE_PAGE_MASTER_REFERENCE = 69;
/** FO element constant */ /** FO element constant */
int FO_STATIC_CONTENT = 45;
int FO_STATIC_CONTENT = 70;
/** FO element constant */ /** FO element constant */
int FO_TABLE = 46;
int FO_TABLE = 71;
/** FO element constant */ /** FO element constant */
int FO_TABLE_AND_CAPTION = 47;
int FO_TABLE_AND_CAPTION = 72;
/** FO element constant */ /** FO element constant */
int FO_TABLE_BODY = 48;
int FO_TABLE_BODY = 73;
/** FO element constant */ /** FO element constant */
int FO_TABLE_CAPTION = 49;
int FO_TABLE_CAPTION = 74;
/** FO element constant */ /** FO element constant */
int FO_TABLE_CELL = 50;
int FO_TABLE_CELL = 75;
/** FO element constant */ /** FO element constant */
int FO_TABLE_COLUMN = 51;
int FO_TABLE_COLUMN = 76;
/** FO element constant */ /** FO element constant */
int FO_TABLE_FOOTER = 52;
int FO_TABLE_FOOTER = 77;
/** FO element constant */ /** FO element constant */
int FO_TABLE_HEADER = 53;
int FO_TABLE_HEADER = 78;
/** FO element constant */ /** FO element constant */
int FO_TABLE_ROW = 54;
int FO_TABLE_ROW = 79;
/** FO element constant */ /** FO element constant */
int FO_TITLE = 55;
int FO_TITLE = 80;
/** FO element constant */ /** FO element constant */
int FO_WRAPPER = 56;
/** FO element constant - XSL 1.1 */
int FO_BOOKMARK_TREE = 57;
/** FO element constant - XSL 1.1 */
int FO_BOOKMARK = 58;
/** FO element constant - XSL 1.1 */
int FO_BOOKMARK_TITLE = 59;
/** FO element constant - XSL 1.1 */
int FO_PAGE_SEQUENCE_WRAPPER = 60;
/** FO element constant - XSL 1.1 */
int FO_PAGE_NUMBER_CITATION_LAST = 61;
/** FO element constant - XSL 1.1 */
int FO_RETRIEVE_TABLE_MARKER = 62;
int FO_WRAPPER = 81;
/** Number of FO element constants defined */ /** Number of FO element constants defined */
int FRM_OBJ_COUNT = 62;
int FRM_OBJ_COUNT = 81;


// Masks // Masks
/** /**
int PR_CASE_NAME = 61; int PR_CASE_NAME = 61;
/** Property constant */ /** Property constant */
int PR_CASE_TITLE = 62; int PR_CASE_TITLE = 62;
/** Property constant - XSL 1.1 */
int PR_CHANGE_BAR_CLASS = 63;
/** Property constant - XSL 1.1 */
int PR_CHANGE_BAR_COLOR = 64;
/** Property constant - XSL 1.1 */
int PR_CHANGE_BAR_OFFSET = 65;
/** Property constant - XSL 1.1 */
int PR_CHANGE_BAR_PLACEMENT = 66;
/** Property constant - XSL 1.1 */
int PR_CHANGE_BAR_STYLE = 67;
/** Property constant - XSL 1.1 */
int PR_CHANGE_BAR_WIDTH = 68;
/** Property constant */ /** Property constant */
int PR_CHARACTER = 63;
int PR_CHARACTER = 69;
/** Property constant */ /** Property constant */
int PR_CLEAR = 64;
int PR_CLEAR = 70;
/** Property constant */ /** Property constant */
int PR_CLIP = 65;
int PR_CLIP = 71;
/** Property constant */ /** Property constant */
int PR_COLOR = 66;
int PR_COLOR = 72;
/** Property constant */ /** Property constant */
int PR_COLOR_PROFILE_NAME = 67;
int PR_COLOR_PROFILE_NAME = 73;
/** Property constant */ /** Property constant */
int PR_COLUMN_COUNT = 68;
int PR_COLUMN_COUNT = 74;
/** Property constant */ /** Property constant */
int PR_COLUMN_GAP = 69;
int PR_COLUMN_GAP = 75;
/** Property constant */ /** Property constant */
int PR_COLUMN_NUMBER = 70;
int PR_COLUMN_NUMBER = 76;
/** Property constant */ /** Property constant */
int PR_COLUMN_WIDTH = 71;
int PR_COLUMN_WIDTH = 77;
/** Property constant */ /** Property constant */
int PR_CONTENT_HEIGHT = 72;
int PR_CONTENT_HEIGHT = 78;
/** Property constant */ /** Property constant */
int PR_CONTENT_TYPE = 73;
int PR_CONTENT_TYPE = 79;
/** Property constant */ /** Property constant */
int PR_CONTENT_WIDTH = 74;
int PR_CONTENT_WIDTH = 80;
/** Property constant */ /** Property constant */
int PR_COUNTRY = 75;
int PR_COUNTRY = 81;
/** Property constant */ /** Property constant */
int PR_CUE = 76;
int PR_CUE = 82;
/** Property constant */ /** Property constant */
int PR_CUE_AFTER = 77;
int PR_CUE_AFTER = 83;
/** Property constant */ /** Property constant */
int PR_CUE_BEFORE = 78;
int PR_CUE_BEFORE = 84;
/** Property constant */ /** Property constant */
int PR_DESTINATION_PLACEMENT_OFFSET = 79;
int PR_DESTINATION_PLACEMENT_OFFSET = 85;
/** Property constant */ /** Property constant */
int PR_DIRECTION = 80;
int PR_DIRECTION = 86;
/** Property constant */ /** Property constant */
int PR_DISPLAY_ALIGN = 81;
int PR_DISPLAY_ALIGN = 87;
/** Property constant */ /** Property constant */
int PR_DOMINANT_BASELINE = 82;
int PR_DOMINANT_BASELINE = 88;
/** Property constant */ /** Property constant */
int PR_ELEVATION = 83;
int PR_ELEVATION = 89;
/** Property constant */ /** Property constant */
int PR_EMPTY_CELLS = 84;
int PR_EMPTY_CELLS = 90;
/** Property constant */ /** Property constant */
int PR_END_INDENT = 85;
int PR_END_INDENT = 91;
/** Property constant */ /** Property constant */
int PR_ENDS_ROW = 86;
int PR_ENDS_ROW = 92;
/** Property constant */ /** Property constant */
int PR_EXTENT = 87;
int PR_EXTENT = 93;
/** Property constant */ /** Property constant */
int PR_EXTERNAL_DESTINATION = 88;
int PR_EXTERNAL_DESTINATION = 94;
/** Property constant */ /** Property constant */
int PR_FLOAT = 89;
int PR_FLOAT = 95;
/** Property constant -- XSL 1.1 */
int PR_FLOW_MAP_NAME = 96;
/** Property constant -- XSL 1.1 */
int PR_FLOW_MAP_REFERENCE = 97;
/** Property constant */ /** Property constant */
int PR_FLOW_NAME = 90;
int PR_FLOW_NAME = 98;
/** Property constant -- XSL 1.1 */
int PR_FLOW_NAME_REFERENCE = 99;
/** Property constant */ /** Property constant */
int PR_FONT = 91;
int PR_FONT = 100;
/** Property constant */ /** Property constant */
int PR_FONT_FAMILY = 92;
int PR_FONT_FAMILY = 101;
/** Property constant */ /** Property constant */
int PR_FONT_SELECTION_STRATEGY = 93;
int PR_FONT_SELECTION_STRATEGY = 102;
/** Property constant */ /** Property constant */
int PR_FONT_SIZE = 94;
int PR_FONT_SIZE = 103;
/** Property constant */ /** Property constant */
int PR_FONT_SIZE_ADJUST = 95;
int PR_FONT_SIZE_ADJUST = 104;
/** Property constant */ /** Property constant */
int PR_FONT_STRETCH = 96;
int PR_FONT_STRETCH = 105;
/** Property constant */ /** Property constant */
int PR_FONT_STYLE = 97;
int PR_FONT_STYLE = 106;
/** Property constant */ /** Property constant */
int PR_FONT_VARIANT = 98;
int PR_FONT_VARIANT = 107;
/** Property constant */ /** Property constant */
int PR_FONT_WEIGHT = 99;
int PR_FONT_WEIGHT = 108;
/** Property constant */ /** Property constant */
int PR_FORCE_PAGE_COUNT = 100;
int PR_FORCE_PAGE_COUNT = 109;
/** Property constant */ /** Property constant */
int PR_FORMAT = 101;
int PR_FORMAT = 110;
/** Property constant */ /** Property constant */
int PR_GLYPH_ORIENTATION_HORIZONTAL = 102;
int PR_GLYPH_ORIENTATION_HORIZONTAL = 111;
/** Property constant */ /** Property constant */
int PR_GLYPH_ORIENTATION_VERTICAL = 103;
int PR_GLYPH_ORIENTATION_VERTICAL = 112;
/** Property constant */ /** Property constant */
int PR_GROUPING_SEPARATOR = 104;
int PR_GROUPING_SEPARATOR = 113;
/** Property constant */ /** Property constant */
int PR_GROUPING_SIZE = 105;
int PR_GROUPING_SIZE = 114;
/** Property constant */ /** Property constant */
int PR_HEIGHT = 106;
int PR_HEIGHT = 115;
/** Property constant */ /** Property constant */
int PR_HYPHENATE = 107;
int PR_HYPHENATE = 116;
/** Property constant */ /** Property constant */
int PR_HYPHENATION_CHARACTER = 108;
int PR_HYPHENATION_CHARACTER = 117;
/** Property constant */ /** Property constant */
int PR_HYPHENATION_KEEP = 109;
int PR_HYPHENATION_KEEP = 118;
/** Property constant */ /** Property constant */
int PR_HYPHENATION_LADDER_COUNT = 110;
int PR_HYPHENATION_LADDER_COUNT = 119;
/** Property constant */ /** Property constant */
int PR_HYPHENATION_PUSH_CHARACTER_COUNT = 111;
int PR_HYPHENATION_PUSH_CHARACTER_COUNT = 120;
/** Property constant */ /** Property constant */
int PR_HYPHENATION_REMAIN_CHARACTER_COUNT = 112;
int PR_HYPHENATION_REMAIN_CHARACTER_COUNT = 121;
/** Property constant */ /** Property constant */
int PR_ID = 113;
int PR_ID = 122;
/** Property constant */ /** Property constant */
int PR_INDICATE_DESTINATION = 114;
int PR_INDICATE_DESTINATION = 123;
/** Property constant - XSL 1.1 */
int PR_INDEX_CLASS = 124;
/** Property constant - XSL 1.1 */
int PR_INDEX_KEY = 125;
/** Property constant */ /** Property constant */
int PR_INITIAL_PAGE_NUMBER = 115;
int PR_INITIAL_PAGE_NUMBER = 126;
/** Property constant */ /** Property constant */
int PR_INLINE_PROGRESSION_DIMENSION = 116;
int PR_INLINE_PROGRESSION_DIMENSION = 127;
/** Property constant */ /** Property constant */
int PR_INTERNAL_DESTINATION = 117;
int PR_INTERNAL_DESTINATION = 128;
/** Property constant - XSL 1.1 */
int PR_INTRINSIC_SCALE_VALUE = 129;
/** Property constant */ /** Property constant */
int PR_KEEP_TOGETHER = 118;
int PR_INTRUSION_DISPLACE = 130;
/** Property constant */ /** Property constant */
int PR_KEEP_WITH_NEXT = 119;
int PR_KEEP_TOGETHER = 131;
/** Property constant */ /** Property constant */
int PR_KEEP_WITH_PREVIOUS = 120;
int PR_KEEP_WITH_NEXT = 132;
/** Property constant */ /** Property constant */
int PR_LANGUAGE = 121;
int PR_KEEP_WITH_PREVIOUS = 133;
/** Property constant */ /** Property constant */
int PR_LAST_LINE_END_INDENT = 122;
int PR_LANGUAGE = 134;
/** Property constant */ /** Property constant */
int PR_LEADER_ALIGNMENT = 123;
int PR_LAST_LINE_END_INDENT = 135;
/** Property constant */ /** Property constant */
int PR_LEADER_LENGTH = 124;
int PR_LEADER_ALIGNMENT = 136;
/** Property constant */ /** Property constant */
int PR_LEADER_PATTERN = 125;
int PR_LEADER_LENGTH = 137;
/** Property constant */ /** Property constant */
int PR_LEADER_PATTERN_WIDTH = 126;
int PR_LEADER_PATTERN = 138;
/** Property constant */ /** Property constant */
int PR_LEFT = 127;
int PR_LEADER_PATTERN_WIDTH = 139;
/** Property constant */ /** Property constant */
int PR_LETTER_SPACING = 128;
int PR_LEFT = 140;
/** Property constant */ /** Property constant */
int PR_LETTER_VALUE = 129;
int PR_LETTER_SPACING = 141;
/** Property constant */ /** Property constant */
int PR_LINEFEED_TREATMENT = 130;
int PR_LETTER_VALUE = 142;
/** Property constant */ /** Property constant */
int PR_LINE_HEIGHT = 131;
int PR_LINEFEED_TREATMENT = 143;
/** Property constant */ /** Property constant */
int PR_LINE_HEIGHT_SHIFT_ADJUSTMENT = 132;
int PR_LINE_HEIGHT = 144;
/** Property constant */ /** Property constant */
int PR_LINE_STACKING_STRATEGY = 133;
int PR_LINE_HEIGHT_SHIFT_ADJUSTMENT = 145;
/** Property constant */ /** Property constant */
int PR_MARGIN = 134;
int PR_LINE_STACKING_STRATEGY = 146;
/** Property constant */ /** Property constant */
int PR_MARGIN_BOTTOM = 135;
int PR_MARGIN = 147;
/** Property constant */ /** Property constant */
int PR_MARGIN_LEFT = 136;
int PR_MARGIN_BOTTOM = 148;
/** Property constant */ /** Property constant */
int PR_MARGIN_RIGHT = 137;
int PR_MARGIN_LEFT = 149;
/** Property constant */ /** Property constant */
int PR_MARGIN_TOP = 138;
int PR_MARGIN_RIGHT = 150;
/** Property constant */ /** Property constant */
int PR_MARKER_CLASS_NAME = 139;
int PR_MARGIN_TOP = 151;
/** Property constant */ /** Property constant */
int PR_MASTER_NAME = 140;
int PR_MARKER_CLASS_NAME = 152;
/** Property constant */ /** Property constant */
int PR_MASTER_REFERENCE = 141;
int PR_MASTER_NAME = 153;
/** Property constant */ /** Property constant */
int PR_MAX_HEIGHT = 142;
int PR_MASTER_REFERENCE = 154;
/** Property constant */ /** Property constant */
int PR_MAXIMUM_REPEATS = 143;
int PR_MAX_HEIGHT = 155;
/** Property constant */ /** Property constant */
int PR_MAX_WIDTH = 144;
int PR_MAXIMUM_REPEATS = 156;
/** Property constant */ /** Property constant */
int PR_MEDIA_USAGE = 145;
int PR_MAX_WIDTH = 157;
/** Property constant - XSL 1.1 */
int PR_MERGE_PAGES_ACROSS_INDEX_KEY_REFERENCES = 158;
/** Property constant - XSL 1.1 */
int PR_MERGE_RANGES_ACROSS_INDEX_KEY_REFERENCES = 159;
/** Property constant - XSL 1.1 */
int PR_MERGE_SEQUENTIAL_PAGE_NUMBERS = 160;
/** Property constant */ /** Property constant */
int PR_MIN_HEIGHT = 146;
int PR_MEDIA_USAGE = 161;
/** Property constant */ /** Property constant */
int PR_MIN_WIDTH = 147;
int PR_MIN_HEIGHT = 162;
/** Property constant */ /** Property constant */
int PR_NUMBER_COLUMNS_REPEATED = 148;
int PR_MIN_WIDTH = 163;
/** Property constant */ /** Property constant */
int PR_NUMBER_COLUMNS_SPANNED = 149;
int PR_NUMBER_COLUMNS_REPEATED = 164;
/** Property constant */ /** Property constant */
int PR_NUMBER_ROWS_SPANNED = 150;
int PR_NUMBER_COLUMNS_SPANNED = 165;
/** Property constant */ /** Property constant */
int PR_ODD_OR_EVEN = 151;
int PR_NUMBER_ROWS_SPANNED = 166;
/** Property constant */ /** Property constant */
int PR_ORPHANS = 152;
int PR_ODD_OR_EVEN = 167;
/** Property constant */ /** Property constant */
int PR_OVERFLOW = 153;
int PR_ORPHANS = 168;
/** Property constant */ /** Property constant */
int PR_PADDING = 154;
int PR_OVERFLOW = 169;
/** Property constant */ /** Property constant */
int PR_PADDING_AFTER = 155;
int PR_PADDING = 170;
/** Property constant */ /** Property constant */
int PR_PADDING_BEFORE = 156;
int PR_PADDING_AFTER = 171;
/** Property constant */ /** Property constant */
int PR_PADDING_BOTTOM = 157;
int PR_PADDING_BEFORE = 172;
/** Property constant */ /** Property constant */
int PR_PADDING_END = 158;
int PR_PADDING_BOTTOM = 173;
/** Property constant */ /** Property constant */
int PR_PADDING_LEFT = 159;
int PR_PADDING_END = 174;
/** Property constant */ /** Property constant */
int PR_PADDING_RIGHT = 160;
int PR_PADDING_LEFT = 175;
/** Property constant */ /** Property constant */
int PR_PADDING_START = 161;
int PR_PADDING_RIGHT = 176;
/** Property constant */ /** Property constant */
int PR_PADDING_TOP = 162;
int PR_PADDING_START = 177;
/** Property constant */ /** Property constant */
int PR_PAGE_BREAK_AFTER = 163;
int PR_PADDING_TOP = 178;
/** Property constant */ /** Property constant */
int PR_PAGE_BREAK_BEFORE = 164;
int PR_PAGE_BREAK_AFTER = 179;
/** Property constant */ /** Property constant */
int PR_PAGE_BREAK_INSIDE = 165;
int PR_PAGE_BREAK_BEFORE = 180;
/** Property constant */ /** Property constant */
int PR_PAGE_HEIGHT = 166;
int PR_PAGE_BREAK_INSIDE = 181;
/** Property constant - XSL 1.1 */
int PR_PAGE_CITATION_STRATEGY = 182;
/** Property constant */ /** Property constant */
int PR_PAGE_POSITION = 167;
int PR_PAGE_HEIGHT = 183;
/** Property constant - XSL 1.1 */
int PR_PAGE_NUMBER_TREATMENT = 184;
/** Property constant */ /** Property constant */
int PR_PAGE_WIDTH = 168;
int PR_PAGE_POSITION = 185;
/** Property constant */ /** Property constant */
int PR_PAUSE = 169;
int PR_PAGE_WIDTH = 186;
/** Property constant */ /** Property constant */
int PR_PAUSE_AFTER = 170;
int PR_PAUSE = 187;
/** Property constant */ /** Property constant */
int PR_PAUSE_BEFORE = 171;
int PR_PAUSE_AFTER = 188;
/** Property constant */ /** Property constant */
int PR_PITCH = 172;
int PR_PAUSE_BEFORE = 189;
/** Property constant */ /** Property constant */
int PR_PITCH_RANGE = 173;
int PR_PITCH = 190;
/** Property constant */ /** Property constant */
int PR_PLAY_DURING = 174;
int PR_PITCH_RANGE = 191;
/** Property constant */ /** Property constant */
int PR_POSITION = 175;
int PR_PLAY_DURING = 192;
/** Property constant */ /** Property constant */
int PR_PRECEDENCE = 176;
int PR_POSITION = 193;
/** Property constant */ /** Property constant */
int PR_PROVISIONAL_DISTANCE_BETWEEN_STARTS = 177;
int PR_PRECEDENCE = 194;
/** Property constant */ /** Property constant */
int PR_PROVISIONAL_LABEL_SEPARATION = 178;
int PR_PROVISIONAL_DISTANCE_BETWEEN_STARTS = 195;
/** Property constant */ /** Property constant */
int PR_REFERENCE_ORIENTATION = 179;
int PR_PROVISIONAL_LABEL_SEPARATION = 196;
/** Property constant */ /** Property constant */
int PR_REF_ID = 180;
int PR_REFERENCE_ORIENTATION = 197;
/** Property constant */ /** Property constant */
int PR_REGION_NAME = 181;
int PR_REF_ID = 198;
/** Property constant */ /** Property constant */
int PR_RELATIVE_ALIGN = 182;
int PR_REGION_NAME = 199;
/** Property constant - XSL 1.1 */
int PR_REGION_NAME_REFERENCE = 200;
/** Property constant - XSL 1.1 */
int PR_REF_INDEX_KEY = 201;
/** Property constant */ /** Property constant */
int PR_RELATIVE_POSITION = 183;
int PR_RELATIVE_ALIGN = 202;
/** Property constant */ /** Property constant */
int PR_RENDERING_INTENT = 184;
int PR_RELATIVE_POSITION = 203;
/** Property constant */ /** Property constant */
int PR_RETRIEVE_BOUNDARY = 185;
int PR_RENDERING_INTENT = 204;
/** Property constant */ /** Property constant */
int PR_RETRIEVE_CLASS_NAME = 186;
int PR_RETRIEVE_BOUNDARY = 205;
/** Property constant - XSL 1.1 */
int PR_RETRIEVE_BOUNDARY_WITHIN_TABLE = 206;
/** Property constant */ /** Property constant */
int PR_RETRIEVE_POSITION = 187;
int PR_RETRIEVE_CLASS_NAME = 207;
/** Property constant */ /** Property constant */
int PR_RICHNESS = 188;
int PR_RETRIEVE_POSITION = 208;
/** Property constant - XSL 1.1 */
int PR_RETRIEVE_POSITION_WITHIN_TABLE = 209;
/** Property constant */ /** Property constant */
int PR_RIGHT = 189;
int PR_RICHNESS = 210;
/** Property constant */ /** Property constant */
int PR_ROLE = 190;
int PR_RIGHT = 211;
/** Property constant */ /** Property constant */
int PR_RULE_STYLE = 191;
int PR_ROLE = 212;
/** Property constant */ /** Property constant */
int PR_RULE_THICKNESS = 192;
int PR_RULE_STYLE = 213;
/** Property constant */ /** Property constant */
int PR_SCALING = 193;
int PR_RULE_THICKNESS = 214;
/** Property constant */ /** Property constant */
int PR_SCALING_METHOD = 194;
int PR_SCALING = 215;
/** Property constant */ /** Property constant */
int PR_SCORE_SPACES = 195;
int PR_SCALING_METHOD = 216;
/** Property constant */ /** Property constant */
int PR_SCRIPT = 196;
int PR_SCORE_SPACES = 217;
/** Property constant */ /** Property constant */
int PR_SHOW_DESTINATION = 197;
int PR_SCRIPT = 218;
/** Property constant */ /** Property constant */
int PR_SIZE = 198;
int PR_SHOW_DESTINATION = 219;
/** Property constant */ /** Property constant */
int PR_SOURCE_DOCUMENT = 199;
int PR_SIZE = 220;
/** Property constant */ /** Property constant */
int PR_SPACE_AFTER = 200;
int PR_SOURCE_DOCUMENT = 221;
/** Property constant */ /** Property constant */
int PR_SPACE_BEFORE = 201;
int PR_SPACE_AFTER = 222;
/** Property constant */ /** Property constant */
int PR_SPACE_END = 202;
int PR_SPACE_BEFORE = 223;
/** Property constant */ /** Property constant */
int PR_SPACE_START = 203;
int PR_SPACE_END = 224;
/** Property constant */ /** Property constant */
int PR_SPAN = 204;
int PR_SPACE_START = 225;
/** Property constant */ /** Property constant */
int PR_SPEAK = 205;
int PR_SPAN = 226;
/** Property constant */ /** Property constant */
int PR_SPEAK_HEADER = 206;
int PR_SPEAK = 227;
/** Property constant */ /** Property constant */
int PR_SPEAK_NUMERAL = 207;
int PR_SPEAK_HEADER = 228;
/** Property constant */ /** Property constant */
int PR_SPEAK_PUNCTUATION = 208;
int PR_SPEAK_NUMERAL = 229;
/** Property constant */ /** Property constant */
int PR_SPEECH_RATE = 209;
int PR_SPEAK_PUNCTUATION = 230;
/** Property constant */ /** Property constant */
int PR_SRC = 210;
int PR_SPEECH_RATE = 231;
/** Property constant */ /** Property constant */
int PR_START_INDENT = 211;
int PR_SRC = 232;
/** Property constant */ /** Property constant */
int PR_STARTING_STATE = 212;
int PR_START_INDENT = 233;
/** Property constant */ /** Property constant */
int PR_STARTS_ROW = 213;
int PR_STARTING_STATE = 234;
/** Property constant */ /** Property constant */
int PR_STRESS = 214;
int PR_STARTS_ROW = 235;
/** Property constant */ /** Property constant */
int PR_SUPPRESS_AT_LINE_BREAK = 215;
int PR_STRESS = 236;
/** Property constant */ /** Property constant */
int PR_SWITCH_TO = 216;
int PR_SUPPRESS_AT_LINE_BREAK = 237;
/** Property constant */ /** Property constant */
int PR_TABLE_LAYOUT = 217;
int PR_SWITCH_TO = 238;
/** Property constant */ /** Property constant */
int PR_TABLE_OMIT_FOOTER_AT_BREAK = 218;
int PR_TABLE_LAYOUT = 239;
/** Property constant */ /** Property constant */
int PR_TABLE_OMIT_HEADER_AT_BREAK = 219;
int PR_TABLE_OMIT_FOOTER_AT_BREAK = 240;
/** Property constant */ /** Property constant */
int PR_TARGET_PRESENTATION_CONTEXT = 220;
int PR_TABLE_OMIT_HEADER_AT_BREAK = 241;
/** Property constant */ /** Property constant */
int PR_TARGET_PROCESSING_CONTEXT = 221;
int PR_TARGET_PRESENTATION_CONTEXT = 242;
/** Property constant */ /** Property constant */
int PR_TARGET_STYLESHEET = 222;
int PR_TARGET_PROCESSING_CONTEXT = 243;
/** Property constant */ /** Property constant */
int PR_TEXT_ALIGN = 223;
int PR_TARGET_STYLESHEET = 244;
/** Property constant */ /** Property constant */
int PR_TEXT_ALIGN_LAST = 224;
int PR_TEXT_ALIGN = 245;
/** Property constant */ /** Property constant */
int PR_TEXT_ALTITUDE = 225;
int PR_TEXT_ALIGN_LAST = 246;
/** Property constant */ /** Property constant */
int PR_TEXT_DECORATION = 226;
int PR_TEXT_ALTITUDE = 247;
/** Property constant */ /** Property constant */
int PR_TEXT_DEPTH = 227;
int PR_TEXT_DECORATION = 248;
/** Property constant */ /** Property constant */
int PR_TEXT_INDENT = 228;
int PR_TEXT_DEPTH = 249;
/** Property constant */ /** Property constant */
int PR_TEXT_SHADOW = 229;
int PR_TEXT_INDENT = 250;
/** Property constant */ /** Property constant */
int PR_TEXT_TRANSFORM = 230;
int PR_TEXT_SHADOW = 251;
/** Property constant */ /** Property constant */
int PR_TOP = 231;
int PR_TEXT_TRANSFORM = 252;
/** Property constant */ /** Property constant */
int PR_TREAT_AS_WORD_SPACE = 232;
int PR_TOP = 253;
/** Property constant */ /** Property constant */
int PR_UNICODE_BIDI = 233;
int PR_TREAT_AS_WORD_SPACE = 254;
/** Property constant */ /** Property constant */
int PR_VERTICAL_ALIGN = 234;
int PR_UNICODE_BIDI = 255;
/** Property constant */ /** Property constant */
int PR_VISIBILITY = 235;
int PR_VERTICAL_ALIGN = 256;
/** Property constant */ /** Property constant */
int PR_VOICE_FAMILY = 236;
int PR_VISIBILITY = 257;
/** Property constant */ /** Property constant */
int PR_VOLUME = 237;
int PR_VOICE_FAMILY = 258;
/** Property constant */ /** Property constant */
int PR_WHITE_SPACE = 238;
int PR_VOLUME = 259;
/** Property constant */ /** Property constant */
int PR_WHITE_SPACE_COLLAPSE = 239;
int PR_WHITE_SPACE = 260;
/** Property constant */ /** Property constant */
int PR_WHITE_SPACE_TREATMENT = 240;
int PR_WHITE_SPACE_COLLAPSE = 261;
/** Property constant */ /** Property constant */
int PR_WIDOWS = 241;
int PR_WHITE_SPACE_TREATMENT = 262;
/** Property constant */ /** Property constant */
int PR_WIDTH = 242;
int PR_WIDOWS = 263;
/** Property constant */ /** Property constant */
int PR_WORD_SPACING = 243;
int PR_WIDTH = 264;
/** Property constant */ /** Property constant */
int PR_WRAP_OPTION = 244;
int PR_WORD_SPACING = 265;
/** Property constant */ /** Property constant */
int PR_WRITING_MODE = 245;
int PR_WRAP_OPTION = 266;
/** Property constant */ /** Property constant */
int PR_XML_LANG = 246;
int PR_WRITING_MODE = 267;
/** Property constant */ /** Property constant */
int PR_Z_INDEX = 247;
int PR_XML_LANG = 268;
/** Property constant */ /** Property constant */
int PR_INTRUSION_DISPLACE = 248;
/** Property constant - XSL 1.1 */
int PR_INDEX_CLASS = 249;
/** Property constant - XSL 1.1 */
int PR_INDEX_KEY = 250;
int PR_Z_INDEX = 269;
/** Property constant - FOP proprietary: Custom extension for line alignment */ /** Property constant - FOP proprietary: Custom extension for line alignment */
int PR_X_BLOCK_PROGRESSION_UNIT = 251;
int PR_X_BLOCK_PROGRESSION_UNIT = 270;
/** Property constant - FOP proprietary: limit for widow content in lists and tables */ /** Property constant - FOP proprietary: limit for widow content in lists and tables */
int PR_X_WIDOW_CONTENT_LIMIT = 252;
int PR_X_WIDOW_CONTENT_LIMIT = 271;
/** Property constant - FOP proprietary: limit for orphan content in lists and tables */ /** Property constant - FOP proprietary: limit for orphan content in lists and tables */
int PR_X_ORPHAN_CONTENT_LIMIT = 253;
/** Property constant */
int PR_RETRIEVE_POSITION_WITHIN_TABLE = 254;
/** Property constant */
int PR_RETRIEVE_BOUNDARY_WITHIN_TABLE = 255;
int PR_X_ORPHAN_CONTENT_LIMIT = 272;
/** Number of property constants defined */ /** Number of property constants defined */
int PROPERTY_COUNT = 255;
int PROPERTY_COUNT = 272;


// compound property constants // compound property constants


int EN_TABLE = 194; int EN_TABLE = 194;
/** Enumeration constant -- for fo:retrieve-table-marker */ /** Enumeration constant -- for fo:retrieve-table-marker */
int EN_TABLE_FRAGMENT = 195; int EN_TABLE_FRAGMENT = 195;
/** Enumeration constant -- XSL 1.1 */
int EN_MERGE = 196;
/** Enumeration constant -- XSL 1.1 */
int EN_LEAVE_SEPARATE = 197;
/** Enumeration constant -- XSL 1.1 */
int EN_LINK = 198;
/** Enumeration constant -- XSL 1.1 */
int EN_NO_LINK = 199;
/** Enumeration constant -- XSL 1.1 */
int EN_ALTERNATE = 200;
/** Number of enumeration constants defined */ /** Number of enumeration constants defined */
int ENUM_COUNT = 195;
int ENUM_COUNT = 200;
} }

+ 16
- 93
src/java/org/apache/fop/fo/FOEventHandler.java View File



package org.apache.fop.fo; package org.apache.fop.fo;


import java.util.HashSet;
import java.util.Set;

import org.xml.sax.SAXException; import org.xml.sax.SAXException;


import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.fo.flow.PageNumberCitationLast; import org.apache.fop.fo.flow.PageNumberCitationLast;
import org.apache.fop.fo.flow.table.Table; import org.apache.fop.fo.flow.table.Table;
import org.apache.fop.fo.flow.table.TableBody; import org.apache.fop.fo.flow.table.TableBody;
import org.apache.fop.fo.flow.table.TableFooter;
import org.apache.fop.fo.flow.table.TableHeader;
import org.apache.fop.fo.flow.table.TablePart;
import org.apache.fop.fo.flow.table.TableCell; import org.apache.fop.fo.flow.table.TableCell;
import org.apache.fop.fo.flow.table.TableColumn; import org.apache.fop.fo.flow.table.TableColumn;
import org.apache.fop.fo.flow.table.TableRow; import org.apache.fop.fo.flow.table.TableRow;
*/ */
protected FontInfo fontInfo; protected FontInfo fontInfo;


/**
* The current set of id's in the FO tree.
* This is used so we know if the FO tree contains duplicates.
*/
private Set idReferences = new HashSet();
/**
* The property list maker.
*/
protected PropertyListMaker propertyListMaker;

/**
* The XMLWhitespaceHandler for this tree
*/
protected XMLWhiteSpaceHandler whiteSpaceHandler = new XMLWhiteSpaceHandler();
/**
* Indicates whether processing descendants of a marker
*/
private boolean inMarker = false;
/** /**
* Main constructor * Main constructor
* @param foUserAgent the apps.FOUserAgent instance for this process * @param foUserAgent the apps.FOUserAgent instance for this process
this.fontInfo.setEventListener(new FontEventAdapter(foUserAgent.getEventBroadcaster())); this.fontInfo.setEventListener(new FontEventAdapter(foUserAgent.getEventBroadcaster()));
} }


/**
* Retuns the set of ID references.
* @return the ID references
*/
public Set getIDReferences() {
return idReferences;
}

/** /**
* Returns the User Agent object associated with this FOEventHandler. * Returns the User Agent object associated with this FOEventHandler.
* @return the User Agent object * @return the User Agent object
return this.fontInfo; return this.fontInfo;
} }


/**
* Return the propertyListMaker.
*
* @return the currently active {@link PropertyListMaker}
*/
public PropertyListMaker getPropertyListMaker() {
return propertyListMaker;
}
/**
* Set a new propertyListMaker.
*
* @param propertyListMaker the new {@link PropertyListMaker} to use
*/
public void setPropertyListMaker(PropertyListMaker propertyListMaker) {
this.propertyListMaker = propertyListMaker;
}
/**
* Return the XMLWhiteSpaceHandler
* @return the whiteSpaceHandler
*/
public XMLWhiteSpaceHandler getXMLWhiteSpaceHandler() {
return whiteSpaceHandler;
}

/**
* Switch to or from marker context
* (used by FOTreeBuilder when processing
* a marker)
*
* @param inMarker true if a marker is being processed;
* false otherwise
*
*/
protected void switchMarkerContext(boolean inMarker) {
this.inMarker = inMarker;
}
/**
* Check whether in marker context
*
* @return true if a marker is being processed
*/
protected boolean inMarker() {
return this.inMarker;
}
/** /**
* This method is called to indicate the start of a new document run. * This method is called to indicate the start of a new document run.
* @throws SAXException In case of a problem * @throws SAXException In case of a problem


/** /**
* *
* @param th TableBody that is starting;
* @param header TableHeader that is starting;
*/ */
public void startHeader(TableBody th) {
public void startHeader(TableHeader header) {
} }


/** /**
* *
* @param th TableBody that is ending.
* @param header TableHeader that is ending.
*/ */
public void endHeader(TableBody th) {
public void endHeader(TableHeader header) {
} }


/** /**
* *
* @param tf TableFooter that is starting.
* @param footer TableFooter that is starting.
*/ */
public void startFooter(TableBody tf) {
public void startFooter(TableFooter footer) {
} }


/** /**
* *
* @param tf TableFooter that is ending.
* @param footer TableFooter that is ending.
*/ */
public void endFooter(TableBody tf) {
public void endFooter(TableFooter footer) {
} }


/** /**
* *
* @param tb TableBody that is starting.
* @param body TableBody that is starting.
*/ */
public void startBody(TableBody tb) {
public void startBody(TableBody body) {
} }


/** /**
* *
* @param tb TableBody that is ending.
* @param body TableBody that is ending.
*/ */
public void endBody(TableBody tb) {
public void endBody(TableBody body) {
} }


/** /**
* @param start Offset for characters to process. * @param start Offset for characters to process.
* @param length Portion of array to process. * @param length Portion of array to process.
*/ */
public void characters(char data[], int start, int length) {
public void characters(char[] data, int start, int length) {
} }


/** /**

+ 31
- 5
src/java/org/apache/fop/fo/FONode.java View File

// Java // Java
import java.util.ListIterator; import java.util.ListIterator;
import java.util.Map; import java.util.Map;
import java.util.NoSuchElementException;


import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import org.xml.sax.Locator; import org.xml.sax.Locator;
return parent.getFOEventHandler(); return parent.getFOEventHandler();
} }


/**
* Returns the context class providing information used during FO tree building.
* @return the builder context
*/
public FOTreeBuilderContext getBuilderContext() {
return parent.getBuilderContext();
}
/** /**
* Indicates whether this node is a child of an fo:marker. * Indicates whether this node is a child of an fo:marker.
* @return true if this node is a child of an fo:marker * @return true if this node is a child of an fo:marker
*/ */
protected boolean inMarker() { protected boolean inMarker() {
return getFOEventHandler().inMarker();
return getBuilderContext().inMarker();
} }


/** /**
* *
* @param data array of characters containing text to be added * @param data array of characters containing text to be added
* @param start starting array element to add * @param start starting array element to add
* @param end ending array element to add
* @param length number of elements to add
* @param pList currently applicable PropertyList * @param pList currently applicable PropertyList
* @param locator location in the XSL-FO source file. * @param locator location in the XSL-FO source file.
* @throws FOPException if there's a problem during processing * @throws FOPException if there's a problem during processing
*/ */
protected void addCharacters(char[] data, int start, int end,
protected void addCharacters(char[] data, int start, int length,
PropertyList pList, PropertyList pList,
Locator locator) throws FOPException { Locator locator) throws FOPException {
// ignore // ignore
* Primarily used for making final content model validation checks * Primarily used for making final content model validation checks
* and/or informing the {@link FOEventHandler} that the end of this FO * and/or informing the {@link FOEventHandler} that the end of this FO
* has been reached. * has been reached.
* The default implementation simply calls {@link #finalizeNode()}, without
* sending any event to the {@link FOEventHandler}.
* <br/><i>Note: the recommended way to override this method in subclasses is</i>
* <br/><br/><code>super.endOfNode(); // invoke finalizeNode()
* <br/>getFOEventHandler().endXXX(); // send endOfNode() notification</code>
* *
* @throws FOPException if there's a problem during processing * @throws FOPException if there's a problem during processing
*/ */
protected void endOfNode() throws FOPException { protected void endOfNode() throws FOPException {
// do nothing by default
this.finalizeNode();
} }


/** /**
//nop //nop
} }


/**
* Finalize this node.
* This method can be overridden by subclasses to perform finishing
* tasks (cleanup, validation checks, ...) without triggering
* endXXX() events in the {@link FOEventHandler}.
* The method is called by the default {@link #endOfNode()}
* implementation.
*
* @throws FOPException in case there was an error
*/
public void finalizeNode() throws FOPException {
// do nothing by default
}

/** /**
* Return the parent node of this node * Return the parent node of this node
* *

+ 239
- 206
src/java/org/apache/fop/fo/FOText.java View File

package org.apache.fop.fo; package org.apache.fop.fo;


import java.awt.Color; import java.awt.Color;
import java.nio.CharBuffer;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;


import org.xml.sax.Locator; import org.xml.sax.Locator;
import org.apache.fop.fo.properties.KeepProperty; import org.apache.fop.fo.properties.KeepProperty;
import org.apache.fop.fo.properties.Property; import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.SpaceProperty; import org.apache.fop.fo.properties.SpaceProperty;
import org.apache.fop.util.CharUtilities;


/** /**
* A text node (PCDATA) in the formatting object tree. * A text node (PCDATA) in the formatting object tree.
*
* Unfortunately the BufferManager implementatation holds
* onto references to the character data in this object
* longer than the lifetime of the object itself, causing
* excessive memory consumption and OOM errors.
*/ */
public class FOText extends FONode {
public class FOText extends FONode implements CharSequence {


/**
* the character array containing the text
*/
public char[] ca;

/**
* The starting valid index of the ca array
* to be processed.
*
* This value is originally equal to 0, but becomes
* incremented during leading whitespace removal by the flow.Block class,
* via the TextCharIterator.remove() method below.
*/
public int startIndex = 0;
/** the <code>CharBuffer</code> containing the text */
private CharBuffer charBuffer;


/**
* The ending valid index of the ca array
* to be processed.
*
* This value is originally equal to ca.length, but becomes
* decremented during between-word whitespace removal by the
* XMLWhiteSpaceHandler via the TextCharIterator.remove()
* method below.
*/
public int endIndex = 0;

/** properties relevant for PCDATA */
/* TODO: these are basically always the same as the parent FObj or FObjMixed
* so maybe those can be removed, and the accessors could
* dispatch the call to the parent?
*/
/** properties relevant for #PCDATA */
private CommonFont commonFont; private CommonFont commonFont;
private CommonHyphenation commonHyphenation; private CommonHyphenation commonHyphenation;
private Color color; private Color color;
* which FOText nodes are descendants of the same block. * which FOText nodes are descendants of the same block.
*/ */
private Block ancestorBlock = null; private Block ancestorBlock = null;
/** Holds the text decoration values. May be null */ /** Holds the text decoration values. May be null */
private CommonTextDecoration textDecoration; private CommonTextDecoration textDecoration;
private static final int IS_WORD_CHAR_FALSE = 0; private static final int IS_WORD_CHAR_FALSE = 0;
private static final int IS_WORD_CHAR_TRUE = 1; private static final int IS_WORD_CHAR_TRUE = 1;
private static final int IS_WORD_CHAR_MAYBE = 2; private static final int IS_WORD_CHAR_MAYBE = 2;
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
protected void addCharacters(char[] data, int start, int end,
protected void addCharacters(char[] data, int start, int length,
PropertyList list, Locator locator) throws FOPException { PropertyList list, Locator locator) throws FOPException {


int length = end - start;
int calength = 0;
char[] nca;
if (ca != null) {
calength = ca.length;
nca = new char[calength + length];
System.arraycopy(ca, 0, nca, 0, calength);
if (this.charBuffer == null) {
// buffer not yet initialized, do so now
this.charBuffer = CharBuffer.allocate(length);
} else { } else {
nca = new char[length];
// allocate a larger buffer, and transfer contents
int newLength = this.charBuffer.limit() + length;
CharBuffer newBuffer = CharBuffer.allocate(newLength);
this.charBuffer.rewind();
newBuffer.put(this.charBuffer);
this.charBuffer = newBuffer;
} }
System.arraycopy(data, start, nca, calength, length);
endIndex = nca.length;
this.ca = nca;
}
// append characters
this.charBuffer.put(data, start, length);
}


/** /**
* {@inheritDoc}
* Return the array of characters for this instance.
*
* @return a char array containing the text
*/ */
public char[] getCharArray() {

if (this.charBuffer == null) {
return null;
}

if (this.charBuffer.hasArray()) {
return this.charBuffer.array();
}

// only if the buffer implementation has
// no accessible backing array, return a new one
char[] ca = new char[this.charBuffer.limit()];
this.charBuffer.rewind();
this.charBuffer.get(ca);
return ca;

}

/** {@inheritDoc} */
public FONode clone(FONode parent, boolean removeChildren) public FONode clone(FONode parent, boolean removeChildren)
throws FOPException { throws FOPException {
FOText ft = (FOText) super.clone(parent, removeChildren); FOText ft = (FOText) super.clone(parent, removeChildren);
if (removeChildren) { if (removeChildren) {
//not really removing, but just make sure the char array
//pointed to is really a different one, and reset any
//possible whitespace-handling effects
if (ca != null) {
ft.ca = new char[ca.length];
System.arraycopy(ca, 0, ft.ca, 0, ca.length);
// not really removing, just make sure the char buffer
// pointed to is really a different one
if (this.charBuffer != null) {
ft.charBuffer = CharBuffer.allocate(this.charBuffer.limit());
this.charBuffer.rewind();
ft.charBuffer.put(this.charBuffer);
ft.charBuffer.rewind();
} }
} }
ft.prevFOTextThisBlock = null; ft.prevFOTextThisBlock = null;
return ft; return ft;
} }


/**
* {@inheritDoc}
*/
/** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException { public void bind(PropertyList pList) throws FOPException {
commonFont = pList.getFontProps();
commonHyphenation = pList.getHyphenationProps();
color = pList.get(Constants.PR_COLOR).getColor(getUserAgent());
keepTogether = pList.get(Constants.PR_KEEP_TOGETHER).getKeep();
lineHeight = pList.get(Constants.PR_LINE_HEIGHT).getSpace();
letterSpacing = pList.get(Constants.PR_LETTER_SPACING);
whiteSpaceCollapse = pList.get(Constants.PR_WHITE_SPACE_COLLAPSE).getEnum();
whiteSpaceTreatment = pList.get(Constants.PR_WHITE_SPACE_TREATMENT).getEnum();
textTransform = pList.get(Constants.PR_TEXT_TRANSFORM).getEnum();
wordSpacing = pList.get(Constants.PR_WORD_SPACING);
wrapOption = pList.get(Constants.PR_WRAP_OPTION).getEnum();
textDecoration = pList.getTextDecorationProps();
baselineShift = pList.get(Constants.PR_BASELINE_SHIFT).getLength();
this.commonFont = pList.getFontProps();
this.commonHyphenation = pList.getHyphenationProps();
this.color = pList.get(Constants.PR_COLOR).getColor(getUserAgent());
this.keepTogether = pList.get(Constants.PR_KEEP_TOGETHER).getKeep();
this.lineHeight = pList.get(Constants.PR_LINE_HEIGHT).getSpace();
this.letterSpacing = pList.get(Constants.PR_LETTER_SPACING);
this.whiteSpaceCollapse = pList.get(Constants.PR_WHITE_SPACE_COLLAPSE).getEnum();
this.whiteSpaceTreatment = pList.get(Constants.PR_WHITE_SPACE_TREATMENT).getEnum();
this.textTransform = pList.get(Constants.PR_TEXT_TRANSFORM).getEnum();
this.wordSpacing = pList.get(Constants.PR_WORD_SPACING);
this.wrapOption = pList.get(Constants.PR_WRAP_OPTION).getEnum();
this.textDecoration = pList.getTextDecorationProps();
this.baselineShift = pList.get(Constants.PR_BASELINE_SHIFT).getLength();
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
protected void endOfNode() throws FOPException { protected void endOfNode() throws FOPException {
super.endOfNode();
getFOEventHandler().characters(
this.getCharArray(), 0, this.charBuffer.limit());
}

/** {@inheritDoc} */
public void finalizeNode() {
textTransform(); textTransform();
getFOEventHandler().characters(ca, startIndex, endIndex);
} }


/** /**
*/ */
public boolean willCreateArea() { public boolean willCreateArea() {
if (whiteSpaceCollapse == Constants.EN_FALSE if (whiteSpaceCollapse == Constants.EN_FALSE
&& endIndex - startIndex > 0) {
&& this.charBuffer.limit() > 0) {
return true; return true;
} }


for (int i = startIndex; i < endIndex; i++) {
char ch = ca[i];
if (!((ch == ' ')
|| (ch == '\n')
|| (ch == '\r')
|| (ch == '\t'))) { // whitespace
char ch;
this.charBuffer.rewind();
while (this.charBuffer.hasRemaining()) {
ch = this.charBuffer.get();
if (!((ch == CharUtilities.SPACE)
|| (ch == CharUtilities.LINEFEED_CHAR)
|| (ch == CharUtilities.CARRIAGE_RETURN)
|| (ch == CharUtilities.TAB))) {
// not whitespace
this.charBuffer.rewind();
return true; return true;
} }
} }
} }


/** /**
* This method is run as part of the ancestor Block's flushText(), to
* This method is run as part of the ancestor Block's flushText(), to
* create xref pointers to the previous FOText objects within the same Block * create xref pointers to the previous FOText objects within the same Block
* @param ancestorBlock the ancestor fo:block * @param ancestorBlock the ancestor fo:block
*/ */
this.ancestorBlock = ancestorBlock; this.ancestorBlock = ancestorBlock;
// if the last FOText is a sibling, point to it, and have it point here // if the last FOText is a sibling, point to it, and have it point here
if (ancestorBlock.lastFOTextProcessed != null) { if (ancestorBlock.lastFOTextProcessed != null) {
if (ancestorBlock.lastFOTextProcessed.ancestorBlock
if (ancestorBlock.lastFOTextProcessed.ancestorBlock
== this.ancestorBlock) { == this.ancestorBlock) {
prevFOTextThisBlock = ancestorBlock.lastFOTextProcessed; prevFOTextThisBlock = ancestorBlock.lastFOTextProcessed;
prevFOTextThisBlock.nextFOTextThisBlock = this; prevFOTextThisBlock.nextFOTextThisBlock = this;
} }


/** /**
* This method is run as part of the Constructor, to handle the
* text-transform property.
* This method is run as part of endOfNode(), to handle the
* text-transform property for accumulated FOText
*/ */
private void textTransform() { private void textTransform() {
if (getFOEventHandler().inMarker()
if (getBuilderContext().inMarker()
|| textTransform == Constants.EN_NONE) { || textTransform == Constants.EN_NONE) {
return; return;
} }
for (int i = 0; i < endIndex; i++) {
ca[i] = charTransform(i);

this.charBuffer.rewind();
CharBuffer tmp = this.charBuffer.slice();
char c;
int lim = this.charBuffer.limit();
int pos = -1;
while (++pos < lim) {
c = this.charBuffer.get();
switch (textTransform) {
case Constants.EN_UPPERCASE:
tmp.put(Character.toUpperCase(c));
break;
case Constants.EN_LOWERCASE:
tmp.put(Character.toLowerCase(c));
break;
case Constants.EN_CAPITALIZE:
if (isStartOfWord(pos)) {
/*
Use toTitleCase here. Apparently, some languages use
a different character to represent a letter when using
initial caps than when all of the letters in the word
are capitalized. We will try to let Java handle this.
*/
tmp.put(Character.toTitleCase(c));
} else {
tmp.put(c);
}
break;
default:
//should never happen as the property subsystem catches that case
assert false;
//nop
}
} }
} }


* well, such as word-spacing. The definition of "word" is somewhat ambiguous * well, such as word-spacing. The definition of "word" is somewhat ambiguous
* and appears to be definable by the user agent. * and appears to be definable by the user agent.
* *
* @param i index into ca[]
* @param i index into charBuffer
* *
* @return True if the character at this location is the start of a new * @return True if the character at this location is the start of a new
* word. * word.
private boolean isStartOfWord(int i) { private boolean isStartOfWord(int i) {
char prevChar = getRelativeCharInBlock(i, -1); char prevChar = getRelativeCharInBlock(i, -1);
/* All we are really concerned about here is of what type prevChar /* All we are really concerned about here is of what type prevChar
is. If inputChar is not part of a word, then the Java
conversions will (we hope) simply return inputChar.
*/
switch (isWordChar(prevChar)) {
case IS_WORD_CHAR_TRUE:
return false;
case IS_WORD_CHAR_FALSE:
return true;
/* "MAYBE" implies that additional context is needed. An example is a
* single-quote, either straight or closing, which might be interpreted
* as a possessive or a contraction, or might be a closing quote.
* is. If inputChar is not part of a word, then the Java
* conversions will (we hope) simply return inputChar.
*/ */
case IS_WORD_CHAR_MAYBE:
char prevPrevChar = getRelativeCharInBlock(i, -2);
switch (isWordChar(prevPrevChar)) {
switch (isWordChar(prevChar)) {
case IS_WORD_CHAR_TRUE: case IS_WORD_CHAR_TRUE:
return false; return false;
case IS_WORD_CHAR_FALSE: case IS_WORD_CHAR_FALSE:
return true; return true;
/* "MAYBE" implies that additional context is needed. An example is a
* single-quote, either straight or closing, which might be interpreted
* as a possessive or a contraction, or might be a closing quote.
*/
case IS_WORD_CHAR_MAYBE: case IS_WORD_CHAR_MAYBE:
return true;
char prevPrevChar = getRelativeCharInBlock(i, -2);
switch (isWordChar(prevPrevChar)) {
case IS_WORD_CHAR_TRUE:
return false;
case IS_WORD_CHAR_FALSE:
return true;
case IS_WORD_CHAR_MAYBE:
return true;
default:
return false;
}
default: default:
return false; return false;
} }
default:
return false;
}
} }


/** /**
* block as one unit, allowing text in adjoining FOText objects to be * block as one unit, allowing text in adjoining FOText objects to be
* returned if the parameters are outside of the current object. * returned if the parameters are outside of the current object.
* *
* @param i index into ca[]
* @param i index into the CharBuffer
* @param offset signed integer with relative position within the * @param offset signed integer with relative position within the
* block of the character to return. To return the character immediately * block of the character to return. To return the character immediately
* preceding i, pass -1. To return the character immediately after i, * preceding i, pass -1. To return the character immediately after i,
* the offset points to an area outside of the block. * the offset points to an area outside of the block.
*/ */
private char getRelativeCharInBlock(int i, int offset) { private char getRelativeCharInBlock(int i, int offset) {

int charIndex = i + offset;
// The easy case is where the desired character is in the same FOText // The easy case is where the desired character is in the same FOText
if (((i + offset) >= 0) && ((i + offset) <= this.endIndex)) {
return ca[i + offset];
if (charIndex >= 0 && charIndex < this.length()) {
return this.charAt(i + offset);
} }

// For now, we can't look at following FOText nodes // For now, we can't look at following FOText nodes
if (offset > 0) { if (offset > 0) {
return '\u0000';
}
return CharUtilities.NULL_CHAR;
}

// Remaining case has the text in some previous FOText node // Remaining case has the text in some previous FOText node
boolean foundChar = false; boolean foundChar = false;
char charToReturn = '\u0000';
char charToReturn = CharUtilities.NULL_CHAR;
FOText nodeToTest = this; FOText nodeToTest = this;
int remainingOffset = offset + i; int remainingOffset = offset + i;
while (!foundChar) { while (!foundChar) {
if (nodeToTest.prevFOTextThisBlock == null) { if (nodeToTest.prevFOTextThisBlock == null) {
foundChar = true;
break; break;
} }
nodeToTest = nodeToTest.prevFOTextThisBlock; nodeToTest = nodeToTest.prevFOTextThisBlock;
if ((nodeToTest.endIndex + remainingOffset) >= 0) {
charToReturn = nodeToTest.ca[nodeToTest.endIndex + remainingOffset];
int diff = nodeToTest.length() + remainingOffset - 1;
if (diff >= 0) {
charToReturn = nodeToTest.charAt(diff);
foundChar = true; foundChar = true;
} else { } else {
remainingOffset = remainingOffset + nodeToTest.endIndex;
remainingOffset += diff;
} }
} }
return charToReturn; return charToReturn;
return ancestorBlock; return ancestorBlock;
} }


/**
* Transforms one character in ca[] using the text-transform property.
*
* @param i the index into ca[]
* @return char with transformed value
*/
private char charTransform(int i) {
switch (textTransform) {
/* put NONE first, as this is probably the common case */
case Constants.EN_NONE:
return ca[i];
case Constants.EN_UPPERCASE:
return Character.toUpperCase(ca[i]);
case Constants.EN_LOWERCASE:
return Character.toLowerCase(ca[i]);
case Constants.EN_CAPITALIZE:
if (isStartOfWord(i)) {
/*
Use toTitleCase here. Apparently, some languages use
a different character to represent a letter when using
initial caps than when all of the letters in the word
are capitalized. We will try to let Java handle this.
*/
return Character.toTitleCase(ca[i]);
} else {
return ca[i];
}
default:
assert false; //should never happen as the property subsystem catches that case
return ca[i];
}
}

/** /**
* Determines whether the input char should be considered part of a * Determines whether the input char should be considered part of a
* "word". This is used primarily to determine whether the character * "word". This is used primarily to determine whether the character
} }


private class TextCharIterator extends CharIterator { private class TextCharIterator extends CharIterator {
private int curIndex = 0;

/* Current space removal process: just increment the startIndex
to "remove" leading spaces from ca, until an unremoved character
is found. Then perform arraycopy's to remove extra spaces
between words. nextCharCalled is used to determine if an
unremoved character has already been found--if its value > 2
than it means that has occurred (it is reset to zero each time we
remove a space via incrementing the startIndex.) */
private int nextCharCalled = 0;

int currentPosition = 0;

boolean canRemove = false;
boolean canReplace = false;

/** {@inheritDoc} */
public boolean hasNext() { public boolean hasNext() {
if (curIndex == 0) {
// log.debug("->" + new String(ca) + "<-");
}
return (curIndex < endIndex);
return (this.currentPosition < charBuffer.limit());
} }


/** {@inheritDoc} */
public char nextChar() { public char nextChar() {
if (curIndex < endIndex) {
nextCharCalled++;
// Just a char class? Don't actually care about the value!
return ca[curIndex++];

if (this.currentPosition < charBuffer.limit()) {
this.canRemove = true;
this.canReplace = true;
return charBuffer.get(currentPosition++);
} else { } else {
throw new NoSuchElementException(); throw new NoSuchElementException();
} }

} }


/** {@inheritDoc} */
public void remove() { public void remove() {
if (curIndex < endIndex && nextCharCalled < 2) {
startIndex++;
nextCharCalled = 0;
// log.debug("removeA: " + new String(ca, startIndex, endIndex - startIndex));
} else if (curIndex < endIndex) {
// copy from curIndex to end to curIndex-1
System.arraycopy(ca, curIndex, ca, curIndex - 1,
endIndex - curIndex);
endIndex--;
curIndex--;
// log.debug("removeB: " + new String(ca, startIndex, endIndex - startIndex));
} else if (curIndex == endIndex) {
// log.debug("removeC: " + new String(ca, startIndex, endIndex - startIndex));
endIndex--;
curIndex--;

if (this.canRemove) {
charBuffer.position(currentPosition);
// Slice the buffer at the current position
CharBuffer tmp = charBuffer.slice();
// Reset position to before current character
charBuffer.position(--currentPosition);
if (tmp.hasRemaining()) {
// Transfer any remaining characters
charBuffer.mark();
charBuffer.put(tmp);
charBuffer.reset();
}
// Decrease limit
charBuffer.limit(charBuffer.limit() - 1);
// Make sure following calls fail, unless nextChar() was called
this.canRemove = false;
} else {
throw new IllegalStateException();
} }

} }


/** {@inheritDoc} */
public void replaceChar(char c) { public void replaceChar(char c) {
if (curIndex > 0 && curIndex <= endIndex) {
ca[curIndex - 1] = c;

if (this.canReplace) {
charBuffer.put(currentPosition - 1, c);
} else {
throw new IllegalStateException();
} }

} }


} }
return color; return color;
} }


/**
/**
* @return the "keep-together" property. * @return the "keep-together" property.
*/ */
public KeepProperty getKeepTogether() { public KeepProperty getKeepTogether() {
* @return the "letter-spacing" property. * @return the "letter-spacing" property.
*/ */
public Property getLetterSpacing() { public Property getLetterSpacing() {
return letterSpacing;
return letterSpacing;
} }
/** /**
* @return the "line-height" property. * @return the "line-height" property.
*/ */
public SpaceProperty getLineHeight() { public SpaceProperty getLineHeight() {
return lineHeight; return lineHeight;
} }
/** /**
* @return the "white-space-treatment" property * @return the "white-space-treatment" property
*/ */
public int getWhitespaceTreatment() { public int getWhitespaceTreatment() {
return whiteSpaceTreatment; return whiteSpaceTreatment;
} }
/** /**
* @return the "word-spacing" property. * @return the "word-spacing" property.
*/ */
public Property getWordSpacing() { public Property getWordSpacing() {
return wordSpacing;
return wordSpacing;
} }
/** /**
* @return the "wrap-option" property. * @return the "wrap-option" property.
*/ */
public int getWrapOption() { public int getWrapOption() {
return wrapOption;
return wrapOption;
} }
/** @return the "text-decoration" property. */ /** @return the "text-decoration" property. */
public CommonTextDecoration getTextDecoration() { public CommonTextDecoration getTextDecoration() {
return textDecoration;
return textDecoration;
} }


/** @return the baseline-shift property */ /** @return the baseline-shift property */


/** {@inheritDoc} */ /** {@inheritDoc} */
public String toString() { public String toString() {
StringBuffer sb = new StringBuffer(super.toString());
sb.append(" (").append(ca).append(")");
return sb.toString();
return (this.charBuffer == null) ? "" : this.charBuffer.toString();
} }

/** {@inheritDoc} */ /** {@inheritDoc} */
public String getLocalName() { public String getLocalName() {
return null;
return "#PCDATA";
} }


/** {@inheritDoc} */ /** {@inheritDoc} */


/** {@inheritDoc} */ /** {@inheritDoc} */
protected String gatherContextInfo() { protected String gatherContextInfo() {
if (getLocator() != null) {
if (this.locator != null) {
return super.gatherContextInfo(); return super.gatherContextInfo();
} else { } else {
return new String(ca).trim();
return this.toString();
}
}

/** {@inheritDoc} */
public char charAt(int position) {
return this.charBuffer.get(position);
}

/** {@inheritDoc} */
public CharSequence subSequence(int start, int end) {
return this.charBuffer.subSequence(start, end);
}

/** {@inheritDoc} */
public int length() {
return this.charBuffer.limit();
}

/**
* Resets the backing <code>java.nio.CharBuffer</code>
*/
public void resetBuffer() {
if (this.charBuffer != null) {
this.charBuffer.rewind();
} }
}
}
}
}

+ 30
- 15
src/java/org/apache/fop/fo/FOTreeBuilder.java View File

/** Current delegate ContentHandler to receive the SAX events */ /** Current delegate ContentHandler to receive the SAX events */
protected ContentHandler delegate; protected ContentHandler delegate;

/** Provides information used during tree building stage. */
private FOTreeBuilderContext builderContext;
/** The object that handles formatting and rendering to a stream */ /** The object that handles formatting and rendering to a stream */
private FOEventHandler foEventHandler; private FOEventHandler foEventHandler;
//one of the RTF-, MIF- etc. Handlers. //one of the RTF-, MIF- etc. Handlers.
foEventHandler = foUserAgent.getRendererFactory().createFOEventHandler( foEventHandler = foUserAgent.getRendererFactory().createFOEventHandler(
foUserAgent, outputFormat, stream); foUserAgent, outputFormat, stream);
foEventHandler.setPropertyListMaker(new PropertyListMaker() {
builderContext = new FOTreeBuilderContext();
builderContext.setPropertyListMaker(new PropertyListMaker() {
public PropertyList make(FObj fobj, PropertyList parentPropertyList) { public PropertyList make(FObj fobj, PropertyList parentPropertyList) {
return new StaticPropertyList(fobj, parentPropertyList); return new StaticPropertyList(fobj, parentPropertyList);
} }
log.debug("Building formatting object tree"); log.debug("Building formatting object tree");
} }
foEventHandler.startDocument(); foEventHandler.startDocument();
this.mainFOHandler = new MainFOHandler();
this.mainFOHandler = new MainFOHandler();
this.mainFOHandler.startDocument(); this.mainFOHandler.startDocument();
this.delegate = this.mainFOHandler; this.delegate = this.mainFOHandler;
} }
this.delegate.endDocument(); this.delegate.endDocument();
if (this.rootFObj == null && empty) { if (this.rootFObj == null && empty) {
FOValidationEventProducer eventProducer FOValidationEventProducer eventProducer
= FOValidationEventProducer.Provider.get(
foEventHandler.getUserAgent().getEventBroadcaster());
= FOValidationEventProducer.Provider.get(userAgent.getEventBroadcaster());
eventProducer.emptyDocument(this); eventProducer.emptyDocument(this);
} }
rootFObj = null; rootFObj = null;
} else { } else {
//No formatting results available for output formats no //No formatting results available for output formats no
//involving the layout engine. //involving the layout engine.
return null;
return null;
} }
} }
|| !localName.equals("root")) { || !localName.equals("root")) {
FOValidationEventProducer eventProducer FOValidationEventProducer eventProducer
= FOValidationEventProducer.Provider.get( = FOValidationEventProducer.Provider.get(
foEventHandler.getUserAgent().getEventBroadcaster());
userAgent.getEventBroadcaster());
eventProducer.invalidFORoot(this, FONode.getNodeString(namespaceURI, localName), eventProducer.invalidFORoot(this, FONode.getNodeString(namespaceURI, localName),
getEffectiveLocator()); getEffectiveLocator());
} }
foNode = fobjMaker.make(currentFObj); foNode = fobjMaker.make(currentFObj);
if (rootFObj == null) { if (rootFObj == null) {
rootFObj = (Root) foNode; rootFObj = (Root) foNode;
rootFObj.setBuilderContext(builderContext);
rootFObj.setFOEventHandler(foEventHandler); rootFObj.setFOEventHandler(foEventHandler);
} }
propertyList = foNode.createPropertyList( propertyList = foNode.createPropertyList(
foNode.processNode(localName, getEffectiveLocator(), foNode.processNode(localName, getEffectiveLocator(),
attlist, propertyList); attlist, propertyList);
if (foNode.getNameId() == Constants.FO_MARKER) { if (foNode.getNameId() == Constants.FO_MARKER) {
if (foEventHandler.inMarker()) {
if (builderContext.inMarker()) {
nestedMarkerDepth++; nestedMarkerDepth++;
} else { } else {
foEventHandler.switchMarkerContext(true);
builderContext.switchMarkerContext(true);
} }
} }
foNode.startOfNode();
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
throw new SAXException(e); throw new SAXException(e);
} }
} }


currentFObj = foNode; currentFObj = foNode;
if (propertyList != null && !foEventHandler.inMarker()) {
if (propertyList != null && !builderContext.inMarker()) {
currentPropertyList = propertyList; currentPropertyList = propertyList;
} }

// fo:characters can potentially be removed during
// white-space handling.
// Do not notify the FOEventHandler.
if (currentFObj.getNameId() != Constants.FO_CHARACTER) {
currentFObj.startOfNode();
}
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
+ ") vs. " + localName + " (" + uri + ")"); + ") vs. " + localName + " (" + uri + ")");
} }
currentFObj.endOfNode();
// fo:characters can potentially be removed during
// white-space handling.
// Do not notify the FOEventHandler.
if (currentFObj.getNameId() != Constants.FO_CHARACTER) {
currentFObj.endOfNode();
}
if (currentPropertyList != null if (currentPropertyList != null
&& currentPropertyList.getFObj() == currentFObj && currentPropertyList.getFObj() == currentFObj
&& !foEventHandler.inMarker()) {
&& !builderContext.inMarker()) {
currentPropertyList = currentPropertyList.getParentPropertyList(); currentPropertyList = currentPropertyList.getParentPropertyList();
} }
if (currentFObj.getNameId() == Constants.FO_MARKER) { if (currentFObj.getNameId() == Constants.FO_MARKER) {
if (nestedMarkerDepth == 0) { if (nestedMarkerDepth == 0) {
foEventHandler.switchMarkerContext(false);
builderContext.switchMarkerContext(false);
} else { } else {
nestedMarkerDepth--; nestedMarkerDepth--;
} }
public void characters(char[] data, int start, int length) public void characters(char[] data, int start, int length)
throws FOPException { throws FOPException {
if (currentFObj != null) { if (currentFObj != null) {
currentFObj.addCharacters(data, start, start + length,
currentFObj.addCharacters(data, start, length,
currentPropertyList, getEffectiveLocator()); currentPropertyList, getEffectiveLocator());
} }
} }
if (maker instanceof UnknownXMLObj.Maker) { if (maker instanceof UnknownXMLObj.Maker) {
FOValidationEventProducer eventProducer FOValidationEventProducer eventProducer
= FOValidationEventProducer.Provider.get( = FOValidationEventProducer.Provider.get(
foEventHandler.getUserAgent().getEventBroadcaster());
userAgent.getEventBroadcaster());
eventProducer.unknownFormattingObject(this, currentFObj.getName(), eventProducer.unknownFormattingObject(this, currentFObj.getName(),
new QName(namespaceURI, localName), new QName(namespaceURI, localName),
getEffectiveLocator()); getEffectiveLocator());

+ 107
- 0
src/java/org/apache/fop/fo/FOTreeBuilderContext.java View File

/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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$ */

package org.apache.fop.fo;

import java.util.HashSet;
import java.util.Set;

/**
* Context class providing information needed while building the FO tree.
*/
public class FOTreeBuilderContext {

/**
* The current set of id's in the FO tree.
* This is used so we know if the FO tree contains duplicates.
*/
private Set idReferences = new HashSet();
/**
* The property list maker.
*/
protected PropertyListMaker propertyListMaker;

/**
* The XMLWhitespaceHandler for this tree
*/
protected XMLWhiteSpaceHandler whiteSpaceHandler = new XMLWhiteSpaceHandler();
/**
* Indicates whether processing descendants of a marker
*/
private boolean inMarker = false;
/**
* Returns the set of ID references.
* @return the ID references
*/
public Set getIDReferences() {
return idReferences;
}

/**
* Return the propertyListMaker.
*
* @return the currently active {@link PropertyListMaker}
*/
public PropertyListMaker getPropertyListMaker() {
return propertyListMaker;
}
/**
* Set a new propertyListMaker.
*
* @param propertyListMaker the new {@link PropertyListMaker} to use
*/
public void setPropertyListMaker(PropertyListMaker propertyListMaker) {
this.propertyListMaker = propertyListMaker;
}
/**
* Return the XMLWhiteSpaceHandler
* @return the whiteSpaceHandler
*/
public XMLWhiteSpaceHandler getXMLWhiteSpaceHandler() {
return whiteSpaceHandler;
}

/**
* Switch to or from marker context
* (used by FOTreeBuilder when processing
* a marker)
*
* @param inMarker true if a marker is being processed;
* false otherwise
*
*/
protected void switchMarkerContext(boolean inMarker) {
this.inMarker = inMarker;
}
/**
* Check whether in marker context
*
* @return true if a marker is being processed
*/
protected boolean inMarker() {
return this.inMarker;
}
}

+ 2
- 2
src/java/org/apache/fop/fo/FObj.java View File

*/ */
protected PropertyList createPropertyList(PropertyList parent, protected PropertyList createPropertyList(PropertyList parent,
FOEventHandler foEventHandler) throws FOPException { FOEventHandler foEventHandler) throws FOPException {
return foEventHandler.getPropertyListMaker().make(this, parent);
return getBuilderContext().getPropertyListMaker().make(this, parent);
} }


/** /**
*/ */
private void checkId(String id) throws ValidationException { private void checkId(String id) throws ValidationException {
if (!inMarker() && !id.equals("")) { if (!inMarker() && !id.equals("")) {
Set idrefs = getFOEventHandler().getIDReferences();
Set idrefs = getBuilderContext().getIDReferences();
if (!idrefs.contains(id)) { if (!idrefs.contains(id)) {
idrefs.add(id); idrefs.add(id);
} else { } else {

+ 90
- 79
src/java/org/apache/fop/fo/FObjMixed.java View File

* (= those that can contain both child {@link FONode}s and <code>#PCDATA</code>). * (= those that can contain both child {@link FONode}s and <code>#PCDATA</code>).
*/ */
public abstract class FObjMixed extends FObj { public abstract class FObjMixed extends FObj {
/** Represents accumulated, pending FO text. See {@link #flushText()}. */ /** Represents accumulated, pending FO text. See {@link #flushText()}. */
protected FOText ft = null;
private FOText ft = null;
/** Used for white-space handling; start CharIterator at node ... */ /** Used for white-space handling; start CharIterator at node ... */
protected FONode currentTextNode; protected FONode currentTextNode;
/** Used in creating pointers between subsequent {@link FOText} nodes /** Used in creating pointers between subsequent {@link FOText} nodes
* in the same {@link org.apache.fop.fo.flow.Block}
* in the same {@link org.apache.fop.fo.flow.Block}
* (for handling text-transform) */ * (for handling text-transform) */
protected FOText lastFOTextProcessed = null; protected FOText lastFOTextProcessed = null;
/** /**
* Base constructor * Base constructor
*
*
* @param parent FONode that is the parent of this object * @param parent FONode that is the parent of this object
*/ */
protected FObjMixed(FONode parent) { protected FObjMixed(FONode parent) {
super(parent); super(parent);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
protected void addCharacters(char[] data, int start, int end,
protected void addCharacters(char[] data, int start, int length,
PropertyList pList, PropertyList pList,
Locator locator) throws FOPException { Locator locator) throws FOPException {
if (ft == null) { if (ft == null) {
ft.bind(pList); ft.bind(pList);
} }
} }
ft.addCharacters(data, start, end, null, null);
ft.addCharacters(data, start, length, null, null);
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
protected void endOfNode() throws FOPException { protected void endOfNode() throws FOPException {
flushText();
if (!inMarker()
|| getNameId() == FO_MARKER) {
getFOEventHandler().whiteSpaceHandler
.handleWhiteSpace(this, currentTextNode);
}

super.endOfNode(); super.endOfNode();
if (!inMarker() || getNameId() == FO_MARKER) {
// send character[s]() events to the FOEventHandler
sendCharacters();
}
} }


/** /**
* Handles white-space for the node that is passed in,
* Handles white-space for the node that is passed in,
* starting at its current text-node * starting at its current text-node
* (used by {@link org.apache.fop.fo.flow.RetrieveMarker}
* (used by {@link org.apache.fop.fo.flow.RetrieveMarker}
* to trigger 'end-of-node' white-space handling) * to trigger 'end-of-node' white-space handling)
*
*
* @param fobj the node for which to handle white-space * @param fobj the node for which to handle white-space
* @param nextChild the next child to be added
*/ */
protected static void handleWhiteSpaceFor(FObjMixed fobj) {
fobj.getFOEventHandler().getXMLWhiteSpaceHandler()
.handleWhiteSpace(fobj, fobj.currentTextNode);
protected static void handleWhiteSpaceFor(FObjMixed fobj, FONode nextChild) {
fobj.getBuilderContext().getXMLWhiteSpaceHandler()
.handleWhiteSpace(fobj, fobj.currentTextNode, nextChild);
} }
/** /**
* Adds accumulated text as one FOText instance, unless
* the one instance's <code>char</code> array contains more than
* <code>Short.MAX_VALUE</code> characters. In the latter case the
* instance is split up into more manageable chunks.
*
* Creates block-pointers between subsequent FOText nodes
* in the same Block. (used for handling text-transform)
*
* TODO: !! Revisit: does not take into account fo:characters !!
*
* @throws FOPException if there is a problem during processing * @throws FOPException if there is a problem during processing
*/ */
protected void flushText() throws FOPException {
private void flushText() throws FOPException {
if (ft != null) { if (ft != null) {
FOText lft = ft; FOText lft = ft;
/* make sure nested calls to itself have no effect */ /* make sure nested calls to itself have no effect */
ft = null; ft = null;
FOText tmpText;
int indexStart = 0;
int indexEnd = (lft.ca.length > Short.MAX_VALUE
? Short.MAX_VALUE : lft.ca.length) - 1;
int charCount = 0;
short tmpSize;
while (charCount < lft.ca.length) {
tmpSize = (short) (indexEnd - indexStart + 1);
charCount += tmpSize;
tmpText = (FOText) lft.clone(this, false);
tmpText.ca = new char[tmpSize];
tmpText.startIndex = 0;
tmpText.endIndex = tmpSize;
System.arraycopy(lft.ca, indexStart,
tmpText.ca, 0, indexEnd - indexStart + 1);
if (getNameId() == FO_BLOCK) {
tmpText.createBlockPointers((org.apache.fop.fo.flow.Block) this);
this.lastFOTextProcessed = tmpText;
} else if (getNameId() != FO_MARKER
&& getNameId() != FO_TITLE
&& getNameId() != FO_BOOKMARK_TITLE) {
FONode fo = parent;
int foNameId = fo.getNameId();
while (foNameId != FO_BLOCK
&& foNameId != FO_MARKER
&& foNameId != FO_TITLE
&& foNameId != FO_BOOKMARK_TITLE
&& foNameId != FO_PAGE_SEQUENCE) {
fo = fo.getParent();
foNameId = fo.getNameId();
}
if (foNameId == FO_BLOCK) {
tmpText.createBlockPointers((org.apache.fop.fo.flow.Block) fo);
((FObjMixed) fo).lastFOTextProcessed = tmpText;
} else if (foNameId == FO_PAGE_SEQUENCE
&& tmpText.willCreateArea()) {
log.error("Could not create block pointers."
+ " FOText w/o Block ancestor.");
}
if (getNameId() == FO_BLOCK) {
lft.createBlockPointers((org.apache.fop.fo.flow.Block) this);
this.lastFOTextProcessed = lft;
} else if (getNameId() != FO_MARKER
&& getNameId() != FO_TITLE
&& getNameId() != FO_BOOKMARK_TITLE) {
FONode fo = parent;
int foNameId = fo.getNameId();
while (foNameId != FO_BLOCK
&& foNameId != FO_MARKER
&& foNameId != FO_TITLE
&& foNameId != FO_BOOKMARK_TITLE
&& foNameId != FO_PAGE_SEQUENCE) {
fo = fo.getParent();
foNameId = fo.getNameId();
}
if (foNameId == FO_BLOCK) {
lft.createBlockPointers((org.apache.fop.fo.flow.Block) fo);
((FObjMixed) fo).lastFOTextProcessed = lft;
} else if (foNameId == FO_PAGE_SEQUENCE
&& lft.willCreateArea()) {
log.error("Could not create block pointers."
+ " FOText w/o Block ancestor.");
}
}
this.addChildNode(lft);
}
}

private void sendCharacters() throws FOPException {

if (this.currentTextNode != null) {
FONodeIterator nodeIter
= this.getChildNodes(this.currentTextNode);
FONode node;
while (nodeIter.hasNext()) {
node = nodeIter.nextNode();
assert (node instanceof FOText
|| node.getNameId() == FO_CHARACTER);
if (node.getNameId() == FO_CHARACTER) {
node.startOfNode();
} }
tmpText.endOfNode();
addChildNode(tmpText);
indexStart = indexEnd + 1;
indexEnd = (((lft.ca.length - charCount) < Short.MAX_VALUE)
? lft.ca.length : charCount + Short.MAX_VALUE) - 1;
node.endOfNode();
} }
} }
this.currentTextNode = null;
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
protected void addChildNode(FONode child) throws FOPException { protected void addChildNode(FONode child) throws FOPException {

flushText(); flushText();
if (!inMarker()) { if (!inMarker()) {
if (child instanceof FOText || child.getNameId() == FO_CHARACTER) { if (child instanceof FOText || child.getNameId() == FO_CHARACTER) {
if (currentTextNode == null) {
currentTextNode = child;
if (this.currentTextNode == null) {
this.currentTextNode = child;
} }
} else { } else {
// handle white-space for all text up to here // handle white-space for all text up to here
getFOEventHandler().whiteSpaceHandler
.handleWhiteSpace(this, currentTextNode, child);
currentTextNode = null;
handleWhiteSpaceFor(this, child);
// send character[s]() events to the FOEventHandler
sendCharacters();
} }
} }
super.addChildNode(child); super.addChildNode(child);
} }

/** {@inheritDoc} */
public void finalizeNode() throws FOPException {

flushText();
if (!inMarker() || getNameId() == FO_MARKER) {
handleWhiteSpaceFor(this, null);
}

}

/** /**
* Returns a {@link CharIterator} over this FO's character content * Returns a {@link CharIterator} over this FO's character content
* *

+ 1
- 1
src/java/org/apache/fop/fo/RecursiveCharIterator.java View File

*/ */
public boolean hasNext() { public boolean hasNext() {
while (curCharIter != null) { while (curCharIter != null) {
if (curCharIter.hasNext() == false) {
if (!curCharIter.hasNext()) {
getNextCharIter(); getNextCharIter();
} else { } else {
return true; return true;

+ 1
- 1
src/java/org/apache/fop/fo/XMLObj.java View File

*/ */
protected void addCharacters(char[] data, int start, int length, protected void addCharacters(char[] data, int start, int length,
PropertyList pList, Locator locator) { PropertyList pList, Locator locator) {
String str = new String(data, start, length - start);
String str = new String(data, start, length);
org.w3c.dom.Text text = doc.createTextNode(str); org.w3c.dom.Text text = doc.createTextNode(str);
element.appendChild(text); element.appendChild(text);
} }

+ 91
- 53
src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java View File

* @param nextChild the node that will be added to the list * @param nextChild the node that will be added to the list
* after firstTextNode * after firstTextNode
*/ */
public void handleWhiteSpace(FObjMixed fo, FONode firstTextNode, FONode nextChild) {
public void handleWhiteSpace(FObjMixed fo,
FONode firstTextNode,
FONode nextChild) {

Block currentBlock = null; Block currentBlock = null;
int foId = fo.getNameId(); int foId = fo.getNameId();
if (foId == Constants.FO_BLOCK) {
currentBlock = (Block) fo;
if (nestedBlockStack.isEmpty() || fo != nestedBlockStack.peek()) {
if (nextChild != null) {
/* if already in a block, push the current block
* onto the stack of nested blocks
*/
nestedBlockStack.push(currentBlock);
/* set the current block */
switch (foId) {
case Constants.FO_BLOCK:
currentBlock = (Block) fo;
if (nestedBlockStack.empty() || fo != nestedBlockStack.peek()) {
if (nextChild != null) {
/* if already in a block, push the current block
* onto the stack of nested blocks
*/
nestedBlockStack.push(currentBlock);
}
} else {
if (nextChild == null) {
nestedBlockStack.pop();
}
} }
} else {
if (nextChild == null) {
nestedBlockStack.pop();
break;
case Constants.FO_RETRIEVE_MARKER:
/* look for the nearest block ancestor, if any */
FONode ancestor = fo;
do {
ancestor = ancestor.getParent();
} while (ancestor.getNameId() != Constants.FO_BLOCK
&& ancestor.getNameId() != Constants.FO_STATIC_CONTENT);
if (ancestor.getNameId() == Constants.FO_BLOCK) {
currentBlock = (Block) ancestor;
nestedBlockStack.push(currentBlock);
} }
}
} else if (foId == Constants.FO_RETRIEVE_MARKER) {
/* look for the nearest block ancestor, if any */
FONode ancestor = fo;
do {
ancestor = ancestor.getParent();
} while (ancestor.getNameId() != Constants.FO_BLOCK
&& ancestor.getNameId() != Constants.FO_STATIC_CONTENT);
break;
if (ancestor.getNameId() == Constants.FO_BLOCK) {
currentBlock = (Block) ancestor;
nestedBlockStack.push(currentBlock);
}
} else if (!nestedBlockStack.isEmpty()) {
currentBlock = (Block) nestedBlockStack.peek();
default:
if (!nestedBlockStack.empty()) {
currentBlock = (Block) nestedBlockStack.peek();
}
} }
if (currentBlock != null) { if (currentBlock != null) {
whiteSpaceTreatment = Constants.EN_IGNORE_IF_SURROUNDING_LINEFEED; whiteSpaceTreatment = Constants.EN_IGNORE_IF_SURROUNDING_LINEFEED;
} }
endOfBlock = (nextChild == null && fo == currentBlock);
if (firstTextNode == null) { if (firstTextNode == null) {
//nothing to do but initialize related properties
//no text means no white-space to handle; return early
afterLinefeed = (fo == currentBlock && fo.firstChild == null);
nonWhiteSpaceCount = 0;
if (endOfBlock) {
handlePendingInlines();
}
return; return;
} }
|| currentBlock == null || currentBlock == null
|| (foId == Constants.FO_RETRIEVE_MARKER || (foId == Constants.FO_RETRIEVE_MARKER
&& fo.getParent() == currentBlock)) { && fo.getParent() == currentBlock)) {
afterLinefeed = (
(firstTextNode == fo.firstChild)
|| (firstTextNode.siblings[0].getNameId()
== Constants.FO_BLOCK));
if (firstTextNode == fo.firstChild) {
afterLinefeed = true;
} else {
int previousChildId = firstTextNode.siblings[0].getNameId();
afterLinefeed = (previousChildId == Constants.FO_BLOCK
|| previousChildId == Constants.FO_TABLE_AND_CAPTION
|| previousChildId == Constants.FO_TABLE
|| previousChildId == Constants.FO_LIST_BLOCK
|| previousChildId == Constants.FO_BLOCK_CONTAINER);
}
} }
endOfBlock = (nextChild == null && fo == currentBlock);
if (foId == Constants.FO_WRAPPER) {
FONode parent = fo.parent;
int parentId = parent.getNameId();
while (parentId == Constants.FO_WRAPPER) {
parent = parent.parent;
parentId = parent.getNameId();
}
if (parentId == Constants.FO_FLOW
|| parentId == Constants.FO_STATIC_CONTENT
|| parentId == Constants.FO_BLOCK_CONTAINER
|| parentId == Constants.FO_TABLE_CELL) {
endOfBlock = (nextChild == null);
}
}
if (nextChild != null) { if (nextChild != null) {
int nextChildId = nextChild.getNameId(); int nextChildId = nextChild.getNameId();
handleWhiteSpace(); handleWhiteSpace();
if (fo == currentBlock if (fo == currentBlock
&& pendingInlines != null
&& !pendingInlines.isEmpty()) {
/* current FO is a block, and has pending inlines */
if (endOfBlock || nextChildIsBlockLevel) {
if (nonWhiteSpaceCount == 0) {
/* handle white-space for all pending inlines*/
PendingInline p;
for (int i = pendingInlines.size(); --i >= 0;) {
p = (PendingInline)pendingInlines.get(i);
charIter = (RecursiveCharIterator)p.firstTrailingWhiteSpace;
handleWhiteSpace();
pendingInlines.remove(p);
}
} else {
/* there is non-white-space text between the pending
* inline(s) and the end of the block;
* clear list of pending inlines */
pendingInlines.clear();
}
}
&& (endOfBlock || nextChildIsBlockLevel)) {
handlePendingInlines();
} }
if (nextChild == null) { if (nextChild == null) {
pendingInlines.add(new PendingInline(fo, firstWhiteSpaceInSeq)); pendingInlines.add(new PendingInline(fo, firstWhiteSpaceInSeq));
} }
private void handlePendingInlines() {
if (!(pendingInlines == null || pendingInlines.isEmpty())) {
if (nonWhiteSpaceCount == 0) {
/* handle white-space for all pending inlines*/
PendingInline p;
for (int i = pendingInlines.size(); --i >= 0;) {
p = (PendingInline)pendingInlines.get(i);
charIter = (RecursiveCharIterator)p.firstTrailingWhiteSpace;
handleWhiteSpace();
pendingInlines.remove(p);
}
} else {
/* there is non-white-space text between the pending
* inline(s) and the end of the block;
* clear list of pending inlines */
pendingInlines.clear();
}
}
}
/** /**
* Helper class, used during white-space handling to look ahead, and * Helper class, used during white-space handling to look ahead, and
* see if the next character is a linefeed (or if there will be * see if the next character is a linefeed (or if there will be

+ 1
- 1
src/java/org/apache/fop/fo/expr/PropertyException.java View File



/** /**
* Constructor * Constructor
* @param the Exception causing this PropertyException
* @param cause the Exception causing this PropertyException
*/ */
public PropertyException(Exception cause) { public PropertyException(Exception cause) {
super(cause); super(cause);

+ 1
- 1
src/java/org/apache/fop/fo/extensions/xmp/XMPMetadata.java View File

import java.io.Serializable; import java.io.Serializable;


import org.apache.fop.fo.extensions.ExtensionAttachment; import org.apache.fop.fo.extensions.ExtensionAttachment;
import org.apache.fop.util.XMLizable;
import org.apache.xmlgraphics.util.XMLizable;
import org.apache.xmlgraphics.xmp.Metadata; import org.apache.xmlgraphics.xmp.Metadata;
import org.apache.xmlgraphics.xmp.XMPConstants; import org.apache.xmlgraphics.xmp.XMPConstants;
import org.xml.sax.ContentHandler; import org.xml.sax.ContentHandler;

+ 4
- 3
src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java View File

import java.awt.Color; import java.awt.Color;


import org.xml.sax.Locator; import org.xml.sax.Locator;
import org.xml.sax.Attributes;


import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length; import org.apache.fop.datatypes.Length;
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
protected void startOfNode() throws FOPException {
super.startOfNode();
if (refId.equals("")) {
public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList pList) throws FOPException {
super.processNode(elementName, locator, attlist, pList);
if (!inMarker() && (refId == null || "".equals(refId))) {
missingPropertyError("ref-id"); missingPropertyError("ref-id");
} }
} }

+ 14
- 21
src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java View File

*/ */


/* $Id$ */ /* $Id$ */

package org.apache.fop.fo.flow; package org.apache.fop.fo.flow;


import java.util.Iterator;

import org.xml.sax.Locator;

import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode; import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FOText; import org.apache.fop.fo.FOText;
import org.apache.fop.fo.FObj; import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FObjMixed; import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException; import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.flow.table.TableFObj;
import org.apache.fop.fo.flow.table.Table; import org.apache.fop.fo.flow.table.Table;
import org.apache.fop.apps.FOPException;
import org.xml.sax.Locator;

import java.util.Iterator;
import org.apache.fop.fo.flow.table.TableFObj;


/** /**
* Abstract base class for the <a href="http://www.w3.org/TR/xsl/#fo_retrieve-marker"> * Abstract base class for the <a href="http://www.w3.org/TR/xsl/#fo_retrieve-marker">
} }


private PropertyList createPropertyListFor(FObj fo, PropertyList parent) { private PropertyList createPropertyListFor(FObj fo, PropertyList parent) {
return getFOEventHandler().getPropertyListMaker().make(fo, parent);
return getBuilderContext().getPropertyListMaker().make(fo, parent);
} }


private void cloneSingleNode(FONode child, FONode newParent, private void cloneSingleNode(FONode child, FONode newParent,
getLocator(), getLocator(),
pList, pList,
newPropertyList); newPropertyList);
if (newChild instanceof TableFObj) {
// TODO calling startOfNode (and endOfNode, below) on other fobjs may
// have undesirable side-effects. This is really ugly and will need to
// be addressed sooner or later
((TableFObj) newChild).startOfNode();
}
addChildTo(newChild, (FObj) newParent); addChildTo(newChild, (FObj) newParent);
if (newChild.getNameId() == FO_TABLE) { if (newChild.getNameId() == FO_TABLE) {
Table t = (Table) child; Table t = (Table) child;
cloneSubtree(t.getColumns().listIterator(),
cloneSubtree(t.getColumns().iterator(),
newChild, marker, newPropertyList); newChild, marker, newPropertyList);
cloneSingleNode(t.getTableHeader(), cloneSingleNode(t.getTableHeader(),
newChild, marker, newPropertyList); newChild, marker, newPropertyList);
} }
cloneSubtree(child.getChildNodes(), newChild, cloneSubtree(child.getChildNodes(), newChild,
marker, newPropertyList); marker, newPropertyList);
if (newChild instanceof TableFObj) {
// TODO this is ugly
((TableFObj) newChild).endOfNode();
}
} else if (child instanceof FOText) { } else if (child instanceof FOText) {
FOText ft = (FOText) newChild; FOText ft = (FOText) newChild;
ft.bind(parentPropertyList); ft.bind(parentPropertyList);
addChildTo(newChild, (FObj) newParent); addChildTo(newChild, (FObj) newParent);
} }
if (newChild instanceof FObjMixed) {
handleWhiteSpaceFor((FObjMixed) newChild);
}

// trigger end-of-node white-space handling
// and finalization for table-FOs
newChild.finalizeNode();
} }
} }


} }
cloneSubtree(marker.getChildNodes(), this, cloneSubtree(marker.getChildNodes(), this,
marker, propertyList); marker, propertyList);
handleWhiteSpaceFor(this);
handleWhiteSpaceFor(this, null);
} }


/** /**

+ 5
- 5
src/java/org/apache/fop/fo/flow/Marker.java View File

import org.xml.sax.Locator; import org.xml.sax.Locator;


import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FOEventHandler;
import org.apache.fop.fo.FONode; import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FOTreeBuilderContext;
import org.apache.fop.fo.FObj; import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FObjMixed; import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.PropertyList;
/** {@inheritDoc} */ /** {@inheritDoc} */
protected void startOfNode() { protected void startOfNode() {
FOEventHandler foEventHandler = getFOEventHandler();
FOTreeBuilderContext builderContext = getBuilderContext();
// Push a new property list maker which will make MarkerPropertyLists. // Push a new property list maker which will make MarkerPropertyLists.
savePropertyListMaker = foEventHandler.getPropertyListMaker();
foEventHandler.setPropertyListMaker(new PropertyListMaker() {
savePropertyListMaker = builderContext.getPropertyListMaker();
builderContext.setPropertyListMaker(new PropertyListMaker() {
public PropertyList make(FObj fobj, PropertyList parentPropertyList) { public PropertyList make(FObj fobj, PropertyList parentPropertyList) {
PropertyList pList = new MarkerPropertyList(fobj, parentPropertyList); PropertyList pList = new MarkerPropertyList(fobj, parentPropertyList);
descendantPropertyLists.put(fobj, pList); descendantPropertyLists.put(fobj, pList);
protected void endOfNode() throws FOPException { protected void endOfNode() throws FOPException {
super.endOfNode(); super.endOfNode();
// Pop the MarkerPropertyList maker. // Pop the MarkerPropertyList maker.
getFOEventHandler().setPropertyListMaker(savePropertyListMaker);
getBuilderContext().setPropertyListMaker(savePropertyListMaker);
savePropertyListMaker = null; savePropertyListMaker = null;
} }



+ 1
- 1
src/java/org/apache/fop/fo/flow/table/BorderResolver.java View File

* *
* @param part the part that has started * @param part the part that has started
*/ */
void startPart(TableBody part);
void startPart(TablePart part);


/** /**
* Receives notification of the end of a table-header/footer/body. * Receives notification of the end of a table-header/footer/body.

+ 5
- 5
src/java/org/apache/fop/fo/flow/table/CollapsingBorderResolver.java View File

*/ */
private abstract class Resolver { private abstract class Resolver {


protected TableBody tablePart;
protected TablePart tablePart;


protected boolean firstInPart; protected boolean firstInPart;


} }
} }


void startPart(TableBody part) {
void startPart(TablePart part) {
tablePart = part; tablePart = part;
firstInPart = true; firstInPart = true;
borderStartTableAndBody = collapsingBorderModel.determineWinner(table.borderStart, borderStartTableAndBody = collapsingBorderModel.determineWinner(table.borderStart,
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
public void startPart(TableBody part) {
if (part.isTableHeader()) {
public void startPart(TablePart part) {
if (part instanceof TableHeader) {
delegate = new ResolverInHeader(); delegate = new ResolverInHeader();
} else { } else {
if (leadingBorders == null || table.omitHeaderAtBreak()) { if (leadingBorders == null || table.omitHeaderAtBreak()) {
leadingBorders.add(border); leadingBorders.add(border);
} }
} }
if (part.isTableFooter()) {
if (part instanceof TableFooter) {
resolverInFooter = new ResolverInFooter(); resolverInFooter = new ResolverInFooter();
delegate = resolverInFooter; delegate = resolverInFooter;
} else { } else {

+ 3
- 3
src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java View File

} }


/** {@inheritDoc} */ /** {@inheritDoc} */
void endRow(TableBody body) {
handleRowEnd(body);
void endRow(TablePart part) {
handleRowEnd(part);
} }


private void handleRowEnd(TableCellContainer container) { private void handleRowEnd(TableCellContainer container) {
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
void startTablePart(TableBody part) {
void startTablePart(TablePart part) {
firstInPart = true; firstInPart = true;
borderResolver.startPart(part); borderResolver.startPart(part);
} }

+ 5
- 5
src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java View File

/** Cell layout manager. */ /** Cell layout manager. */
private TableCellLayoutManager cellLM; private TableCellLayoutManager cellLM;
/** List of Knuth elements representing the contents of the cell. */ /** List of Knuth elements representing the contents of the cell. */
private LinkedList elements;
private List elements;


/** Index of the row where this cell starts. */ /** Index of the row where this cell starts. */
private int rowIndex; private int rowIndex;
* *
* @return the enclosing table part * @return the enclosing table part
*/ */
public TableBody getTableBody() {
public TablePart getTablePart() {
FONode node = cell.getParent(); FONode node = cell.getParent();
if (node instanceof TableRow) { if (node instanceof TableRow) {
node = node.getParent(); node = node.getParent();
} }
return (TableBody) node;
return (TablePart) node;
} }


public TableCellLayoutManager getCellLM() { public TableCellLayoutManager getCellLM() {
* *
* @param elements a list of ListElement (?) * @param elements a list of ListElement (?)
*/ */
public void setElements(LinkedList elements) {
public void setElements(List elements) {
this.elements = elements; this.elements = elements;
} }


public LinkedList getElements() {
public List getElements() {
return this.elements; return this.elements;
} }



+ 4
- 4
src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java View File



/** /**
* Receives notification of the end of the current row. If the current row finishes * Receives notification of the end of the current row. If the current row finishes
* the row group, the {@link TableBody#addRowGroup(List)} method of the parent table
* the row group, the {@link TablePart#addRowGroup(List)} method of the parent table
* part will be called. * part will be called.
*/ */
abstract void endTableRow(); abstract void endTableRow();
/** /**
* Receives notification of the end of the current row, when the source contains no * Receives notification of the end of the current row, when the source contains no
* fo:table-row element. If the current row finishes the row group, the * fo:table-row element. If the current row finishes the row group, the
* {@link TableBody#addRowGroup(List)} method of the given table part will be called.
* {@link TablePart#addRowGroup(List)} method of the given table part will be called.
* *
* <p>If the source does contain explicit fo:table-row elements, then the * <p>If the source does contain explicit fo:table-row elements, then the
* {@link #endTableRow()} method will be called instead.</p> * {@link #endTableRow()} method will be called instead.</p>
* *
* @param part the part containing the current row * @param part the part containing the current row
*/ */
abstract void endRow(TableBody part);
abstract void endRow(TablePart part);


/** /**
* Receives notification of the start of a table-header/footer/body. * Receives notification of the start of a table-header/footer/body.
* *
* @param part the part being started * @param part the part being started
*/ */
abstract void startTablePart(TableBody part);
abstract void startTablePart(TablePart part);


/** /**
* Receives notification of the end of a table-header/footer/body. The current * Receives notification of the end of a table-header/footer/body. The current

+ 1
- 1
src/java/org/apache/fop/fo/flow/table/SeparateBorderResolver.java View File

} }


/** {@inheritDoc} */ /** {@inheritDoc} */
public void startPart(TableBody part) {
public void startPart(TablePart part) {
} }


/** {@inheritDoc} */ /** {@inheritDoc} */

+ 26
- 25
src/java/org/apache/fop/fo/flow/table/Table.java View File

private ColumnNumberManager columnNumberManager = new ColumnNumberManager(); private ColumnNumberManager columnNumberManager = new ColumnNumberManager();


/** the table-header and -footer */ /** the table-header and -footer */
private TableBody tableHeader = null;
private TableBody tableFooter = null;
private TableHeader tableHeader = null;
private TableFooter tableFooter = null;


/** used for validation */ /** used for validation */
private boolean tableColumnFound = false; private boolean tableColumnFound = false;
this.propList = pList; this.propList = pList;
} }


/**
* {@inheritDoc}
*/
public void startOfNode() throws FOPException {
/** {@inheritDoc} */
protected void startOfNode() throws FOPException {
super.startOfNode(); super.startOfNode();
getFOEventHandler().startTable(this); getFOEventHandler().startTable(this);
} }
} else { } else {
tableFooterFound = true; tableFooterFound = true;
if (tableBodyFound) { if (tableBodyFound) {
nodesOutOfOrderError(loc, "fo:table-footer", "(table-body+)", true);
if (getUserAgent().validateStrictly()) {
nodesOutOfOrderError(loc, "fo:table-footer", "(table-body+)", true);
}
if (!isSeparateBorderModel()) { if (!isSeparateBorderModel()) {
TableEventProducer eventProducer = TableEventProducer.Provider.get( TableEventProducer eventProducer = TableEventProducer.Provider.get(
getUserAgent().getEventBroadcaster()); getUserAgent().getEventBroadcaster());
} }
} }


/**
* {@inheritDoc}
*/
public void endOfNode() throws FOPException {
/** {@inheritDoc} */
protected void endOfNode() throws FOPException {
super.endOfNode();
getFOEventHandler().endTable(this);
}


/** {@inheritDoc} */
public void finalizeNode() throws FOPException {
if (!tableBodyFound) { if (!tableBodyFound) {
missingChildElementError( missingChildElementError(
"(marker*,table-column*,table-header?,table-footer?" "(marker*,table-column*,table-header?,table-footer?"
this.propList = null; this.propList = null;
rowGroupBuilder = null; rowGroupBuilder = null;
} }
getFOEventHandler().endTable(this);

} }

/**
* {@inheritDoc}
*/
/** {@inheritDoc} */
protected void addChildNode(FONode child) throws FOPException { protected void addChildNode(FONode child) throws FOPException {


int childId = child.getNameId(); int childId = child.getNameId();
} }
switch (childId) { switch (childId) {
case FO_TABLE_FOOTER: case FO_TABLE_FOOTER:
tableFooter = (TableBody) child;
tableFooter = (TableFooter) child;
break; break;
case FO_TABLE_HEADER: case FO_TABLE_HEADER:
tableHeader = (TableBody) child;
tableHeader = (TableHeader) child;
break; break;
default: default:
super.addChildNode(child); super.addChildNode(child);
} }


/** @return the body for the table-header. */ /** @return the body for the table-header. */
public TableBody getTableHeader() {
public TableHeader getTableHeader() {
return tableHeader; return tableHeader;
} }


/** @return the body for the table-footer. */ /** @return the body for the table-footer. */
public TableBody getTableFooter() {
public TableFooter getTableFooter() {
return tableFooter; return tableFooter;
} }


return FO_TABLE; return FO_TABLE;
} }


/**
* {@inheritDoc}
*/
/** {@inheritDoc} */
public FONode clone(FONode parent, boolean removeChildren) public FONode clone(FONode parent, boolean removeChildren)
throws FOPException { throws FOPException {
Table clone = (Table) super.clone(parent, removeChildren); Table clone = (Table) super.clone(parent, removeChildren);
clone.columnsFinalized = false;
if (removeChildren) { if (removeChildren) {
clone.columns = new ArrayList(); clone.columns = new ArrayList();
clone.columnsFinalized = false;
clone.columnNumberManager = new ColumnNumberManager();
clone.tableHeader = null; clone.tableHeader = null;
clone.tableFooter = null; clone.tableFooter = null;
clone.rowGroupBuilder = null;
} }
return clone; return clone;
} }

+ 6
- 213
src/java/org/apache/fop/fo/flow/table/TableBody.java View File

* limitations under the License. * limitations under the License.
*/ */


/* $Id$ */
/* $Id: $ */


package org.apache.fop.fo.flow.table; package org.apache.fop.fo.flow.table;


import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

import org.xml.sax.Attributes;
import org.xml.sax.Locator;

import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode; import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.apps.FOPException;


/** /**
* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_table-body"> * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_table-body">
* <code>fo:table-body</code></a> object. * <code>fo:table-body</code></a> object.
*/ */
public class TableBody extends TableCellContainer {
// The value of properties relevant for fo:table-body.
private CommonBorderPaddingBackground commonBorderPaddingBackground;
// Unused but valid items, commented out for performance:
// private CommonAccessibility commonAccessibility;
// private CommonAural commonAural;
// private CommonRelativePosition commonRelativePosition;
// private int visibility;
// End of property values

/**
* used for validation
*/
protected boolean tableRowsFound = false;
protected boolean tableCellsFound = false;

private boolean firstRow = true;

private boolean rowsStarted = false;

private boolean lastCellEndsRow = true;

/** The last encountered table-row. */
private TableRow lastRow;

private List rowGroups = new LinkedList();
public class TableBody extends TablePart {


/** /**
* Create a TableBody instance with the given {@link FONode} * Create a TableBody instance with the given {@link FONode}
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
super.bind(pList);
}

/** {@inheritDoc} */
public void processNode(String elementName, Locator locator,
Attributes attlist, PropertyList pList)
throws FOPException {
if (!inMarker()) {
Table t = getTable();
if (t.hasExplicitColumns()) {
int size = t.getNumberOfColumns();
pendingSpans = new ArrayList(size);
for (int i = 0; i < size; i++) {
pendingSpans.add(null);
}
} else {
pendingSpans = new ArrayList();
}
columnNumberManager = new ColumnNumberManager();
}
super.processNode(elementName, locator, attlist, pList);
}

/** {@inheritDoc} */
public void startOfNode() throws FOPException {
protected void startOfNode() throws FOPException {
super.startOfNode(); super.startOfNode();
getFOEventHandler().startBody(this); getFOEventHandler().startBody(this);
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
public void endOfNode() throws FOPException {

if (!inMarker()) {
pendingSpans = null;
columnNumberManager = null;
}

protected void endOfNode() throws FOPException {
super.endOfNode();
getFOEventHandler().endBody(this); getFOEventHandler().endBody(this);

if (!(tableRowsFound || tableCellsFound)) {
missingChildElementError("marker* (table-row+|table-cell+)", true);
getParent().removeChild(this);
} else {
finishLastRowGroup();
}
}

/** {@inheritDoc} */
TableBody getTablePart() {
return this;
}

protected void finishLastRowGroup() throws ValidationException {
if (!inMarker()) {
RowGroupBuilder rowGroupBuilder = getTable().getRowGroupBuilder();
if (tableRowsFound) {
rowGroupBuilder.endTableRow();
} else if (!lastCellEndsRow) {
rowGroupBuilder.endRow(this);
}
try {
rowGroupBuilder.endTablePart();
} catch (ValidationException e) {
e.setLocator(locator);
throw e;
}
}
}

/**
* {@inheritDoc}
* <br>XSL Content Model: marker* (table-row+|table-cell+)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
throws ValidationException {
if (FO_URI.equals(nsURI)) {
if (localName.equals("marker")) {
if (tableRowsFound || tableCellsFound) {
nodesOutOfOrderError(loc, "fo:marker", "(table-row+|table-cell+)");
}
} else if (localName.equals("table-row")) {
tableRowsFound = true;
if (tableCellsFound) {
TableEventProducer eventProducer = TableEventProducer.Provider.get(
getUserAgent().getEventBroadcaster());
eventProducer.noMixRowsAndCells(this, getName(), getLocator());
}
} else if (localName.equals("table-cell")) {
tableCellsFound = true;
if (tableRowsFound) {
TableEventProducer eventProducer = TableEventProducer.Provider.get(
getUserAgent().getEventBroadcaster());
eventProducer.noMixRowsAndCells(this, getName(), getLocator());
}
} else {
invalidChildError(loc, nsURI, localName);
}
}
}

/** {@inheritDoc} */
protected void addChildNode(FONode child) throws FOPException {
if (!inMarker()) {
switch (child.getNameId()) {
case FO_TABLE_ROW:
if (!rowsStarted) {
getTable().getRowGroupBuilder().startTablePart(this);
} else {
columnNumberManager.prepareForNextRow(pendingSpans);
getTable().getRowGroupBuilder().endTableRow();
}
rowsStarted = true;
lastRow = (TableRow) child;
getTable().getRowGroupBuilder().startTableRow(lastRow);
break;
case FO_TABLE_CELL:
if (!rowsStarted) {
getTable().getRowGroupBuilder().startTablePart(this);
}
rowsStarted = true;
TableCell cell = (TableCell) child;
addTableCellChild(cell, firstRow);
lastCellEndsRow = cell.endsRow();
if (lastCellEndsRow) {
firstRow = false;
columnNumberManager.prepareForNextRow(pendingSpans);
getTable().getRowGroupBuilder().endRow(this);
}
break;
default:
//nop
}
}
super.addChildNode(child);
}

void addRowGroup(List rowGroup) {
rowGroups.add(rowGroup);
}

public List getRowGroups() {
return rowGroups;
}

/**
* Get the {@link CommonBorderPaddingBackground} instance attached
* to this TableBody.
* @return the {@link CommonBorderPaddingBackground} instance.
*/
public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
return commonBorderPaddingBackground;
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
public int getNameId() { public int getNameId() {
return FO_TABLE_BODY; return FO_TABLE_BODY;
} }

protected boolean isTableHeader() {
return false;
}

protected boolean isTableFooter() {
return false;
}

/**
* @param obj table row in question
* @return true if the given table row is the first row of this body.
*/
public boolean isFirst(TableRow obj) {
return (firstChild == null
|| firstChild == obj);
}

void signalNewRow() {
if (rowsStarted) {
firstRow = false;
if (!lastCellEndsRow) {
columnNumberManager.prepareForNextRow(pendingSpans);
getTable().getRowGroupBuilder().endRow(this);
}
}
}

} }

+ 13
- 6
src/java/org/apache/fop/fo/flow/table/TableCell.java View File

startsRow = pList.get(PR_STARTS_ROW).getEnum(); startsRow = pList.get(PR_STARTS_ROW).getEnum();
// For properly computing columnNumber // For properly computing columnNumber
if (startsRow() && getParent().getNameId() != FO_TABLE_ROW) { if (startsRow() && getParent().getNameId() != FO_TABLE_ROW) {
((TableBody) getParent()).signalNewRow();
((TablePart) getParent()).signalNewRow();
} }
endsRow = pList.get(PR_ENDS_ROW).getEnum(); endsRow = pList.get(PR_ENDS_ROW).getEnum();
columnNumber = pList.get(PR_COLUMN_NUMBER).getNumeric().getValue(); columnNumber = pList.get(PR_COLUMN_NUMBER).getNumeric().getValue();
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
public void startOfNode() throws FOPException {
protected void startOfNode() throws FOPException {
super.startOfNode(); super.startOfNode();
getFOEventHandler().startCell(this); getFOEventHandler().startCell(this);
} }


/** /**
* Make sure content model satisfied, if so then tell the * Make sure content model satisfied, if so then tell the
* FOEventHandler that we are at the end of the flow.
* FOEventHandler that we are at the end of the table-cell.
* {@inheritDoc} * {@inheritDoc}
*/ */
public void endOfNode() throws FOPException {
protected void endOfNode() throws FOPException {
super.endOfNode();
getFOEventHandler().endCell(this);
}

/** {@inheritDoc} */
public void finalizeNode() throws FOPException {
if (!blockItemFound) { if (!blockItemFound) {
missingChildElementError("marker* (%block;)+", true); missingChildElementError("marker* (%block;)+", true);
} }
getUserAgent().getEventBroadcaster()); getUserAgent().getEventBroadcaster());
eventProducer.startEndRowUnderTableRowWarning(this, getLocator()); eventProducer.startEndRowUnderTableRowWarning(this, getLocator());
} }
getFOEventHandler().endCell(this);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
* <br>XSL Content Model: marker* (%block;)+ * <br>XSL Content Model: marker* (%block;)+

+ 2
- 2
src/java/org/apache/fop/fo/flow/table/TableCellContainer.java View File

/** /**
* Returns the enclosing table-header/footer/body of this container. * Returns the enclosing table-header/footer/body of this container.
* *
* @return <code>this</code> for TableBody, or the parent element for TableRow
* @return <code>this</code> for TablePart, or the parent element for TableRow
*/ */
abstract TableBody getTablePart();
abstract TablePart getTablePart();


/** {@inheritDoc} */ /** {@inheritDoc} */
public ColumnNumberManager getColumnNumberManager() { public ColumnNumberManager getColumnNumberManager() {

+ 1
- 1
src/java/org/apache/fop/fo/flow/table/TableColumn.java View File

sb.append(" number-columns-spanned=") sb.append(" number-columns-spanned=")
.append(getNumberColumnsSpanned()); .append(getNumberColumnsSpanned());
} }
sb.append(" column-width=").append(getColumnWidth());
sb.append(" column-width=").append(((Property)getColumnWidth()).getString());
return sb.toString(); return sb.toString();
} }



+ 11
- 0
src/java/org/apache/fop/fo/flow/table/TableEventProducer.java View File

void cellOverlap(Object source, String elementName, int column, void cellOverlap(Object source, String elementName, int column,
Locator loc) throws PropertyException; Locator loc) throws PropertyException;


/**
* @param source the event source
* @param elementName the name of the context node
* @param propValue the user-specified value of the column-number property
* @param columnNumber the generated value for the column-number property
* @param loc the location of the error or null
* @event.severity WARN
*/
void forceNextColumnNumber(Object source, String elementName, Number propValue,
int columnNumber, Locator loc);

/** /**
* Break ignored due to row spanning. * Break ignored due to row spanning.
* @param source the event source * @param source the event source

+ 73
- 60
src/java/org/apache/fop/fo/flow/table/TableFObj.java View File

import org.apache.fop.fo.properties.Property; import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.PropertyMaker; import org.apache.fop.fo.properties.PropertyMaker;
import org.apache.fop.layoutmgr.table.CollapsingBorderModel; import org.apache.fop.layoutmgr.table.CollapsingBorderModel;
import org.xml.sax.Locator;
import org.xml.sax.Attributes;


/** /**
* Common base class for table-related FOs * Common base class for table-related FOs
CollapsingBorderModel collapsingBorderModel; CollapsingBorderModel collapsingBorderModel;


/** /**
* Main constructor
* Create a TableFObj instance that is a child
* of the given {@link FONode}
* *
* @param parent the parent node
* @param parent the parent {@link FONode}
*/ */
public TableFObj(FONode parent) { public TableFObj(FONode parent) {
super(parent); super(parent);
} }


/** /**
* Return the value for the "border-precedence" property
* for the given side.
* *
* @param side the side for which to return the border precedence * @param side the side for which to return the border precedence
* @return the "border-precedence" value for the given side * @return the "border-precedence" value for the given side


/** /**
* Convenience method to returns a reference * Convenience method to returns a reference
* to the base Table instance
* to the base {@link Table} instance.
* *
* @return the base table instance * @return the base table instance
* *
*/ */
public Table getTable() { public Table getTable() {
// Will be overridden in Table; for any other Table-node, recursive call to
// Overridden in Table; for any other Table-node, recursive call to
// parent.getTable() // parent.getTable()
return ((TableFObj) parent).getTable(); return ((TableFObj) parent).getTable();
} }
public abstract CommonBorderPaddingBackground getCommonBorderPaddingBackground(); public abstract CommonBorderPaddingBackground getCommonBorderPaddingBackground();


/** /**
* PropertyMaker subclass for the column-number property
*
* {@link PropertyMaker} subclass for the column-number property
*/ */
public static class ColumnNumberPropertyMaker extends PropertyMaker { public static class ColumnNumberPropertyMaker extends PropertyMaker {


/** /**
* Constructor * Constructor
*
* @param propId the id of the property for which the maker should * @param propId the id of the property for which the maker should
* be created * be created
*/ */




/** /**
* {@inheritDoc}
* Check the value of the column-number property. * Check the value of the column-number property.
* Return the parent's column index (initial value) in case
* of a negative or zero value
*
* @see org.apache.fop.fo.properties.PropertyMaker#make(PropertyList, String, FObj)
*/ */
public Property make(PropertyList propertyList, String value, FObj fo) public Property make(PropertyList propertyList, String value, FObj fo)
throws PropertyException { throws PropertyException {

Property p = super.make(propertyList, value, fo); Property p = super.make(propertyList, value, fo);


ColumnNumberManagerHolder parent
= (ColumnNumberManagerHolder) propertyList.getParentFObj();
ColumnNumberManager columnIndexManager = parent.getColumnNumberManager();
int columnIndex = p.getNumeric().getValue(); int columnIndex = p.getNumeric().getValue();
int colSpan = propertyList.get(Constants.PR_NUMBER_COLUMNS_SPANNED) int colSpan = propertyList.get(Constants.PR_NUMBER_COLUMNS_SPANNED)
.getNumeric().getValue(); .getNumeric().getValue();
int i = columnIndex - 1;
int lastIndex = (columnIndex + colSpan) - 1;
while (++i < lastIndex) {
if (columnIndexManager.isColumnNumberUsed(i)) {
/* if column-number is already in use by another
* cell/column => error!
*/
TableEventProducer eventProducer = TableEventProducer.Provider.get(
fo.getUserAgent().getEventBroadcaster());
eventProducer.cellOverlap(this, propertyList.getFObj().getName(),
i, fo.getLocator());

// only check whether the column-number is occupied in case it was
// specified on a fo:table-cell or fo:table-column
int foId = propertyList.getFObj().getNameId();
if (foId == FO_TABLE_COLUMN || foId == FO_TABLE_CELL) {
ColumnNumberManagerHolder parent
= (ColumnNumberManagerHolder) propertyList.getParentFObj();
ColumnNumberManager columnIndexManager = parent.getColumnNumberManager();
int lastIndex = columnIndex - 1 + colSpan;
for (int i = columnIndex; i <= lastIndex; ++i) {
if (columnIndexManager.isColumnNumberUsed(i)) {
/* if column-number is already in use by another
* cell/column => error!
*/
TableEventProducer eventProducer
= TableEventProducer.Provider.get(
fo.getUserAgent().getEventBroadcaster());
eventProducer.cellOverlap(
this, propertyList.getFObj().getName(),
i, propertyList.getFObj().getLocator());
}
} }
} }

return p; return p;
} }
/** /**
* If the value is not positive, return a property whose value is the next column number
*
* {@inheritDoc} * {@inheritDoc}
* If the value is not positive, return a property whose value
* is the next column number.
*/ */
public Property convertProperty(Property p,
PropertyList propertyList, FObj fo)
public Property convertProperty(Property p,
PropertyList propertyList, FObj fo)
throws PropertyException { throws PropertyException {
if (p instanceof EnumProperty) { if (p instanceof EnumProperty) {
return EnumNumber.getInstance(p); return EnumNumber.getInstance(p);
Number val = p.getNumber(); Number val = p.getNumber();
if (val != null) { if (val != null) {
int i = Math.round(val.floatValue()); int i = Math.round(val.floatValue());
int foId = propertyList.getFObj().getNameId();
if (i <= 0) { if (i <= 0) {
ColumnNumberManagerHolder parent =
(ColumnNumberManagerHolder) propertyList.getParentFObj();
ColumnNumberManager columnIndexManager = parent.getColumnNumberManager();
i = columnIndexManager.getCurrentColumnNumber();
if (foId == FO_TABLE_CELL || foId == FO_TABLE_COLUMN) {
ColumnNumberManagerHolder parent =
(ColumnNumberManagerHolder) propertyList.getParentFObj();
ColumnNumberManager columnIndexManager = parent.getColumnNumberManager();
i = columnIndexManager.getCurrentColumnNumber();
} else {
/* very exceptional case:
* negative column-number specified on
* a FO that is not a fo:table-cell or fo:table-column
*/
i = 1;
}
TableEventProducer eventProducer =
TableEventProducer.Provider.get(fo.getUserAgent().getEventBroadcaster());
eventProducer.forceNextColumnNumber(this, propertyList.getFObj().getName(),
val, i, propertyList.getFObj().getLocator());
} }
return NumberProperty.getInstance(i); return NumberProperty.getInstance(i);
} }
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
public void startOfNode() throws FOPException {
super.startOfNode();
public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList pList) throws FOPException {
super.processNode(elementName, locator, attlist, pList);
Table table = getTable(); Table table = getTable();
if (!inMarker() && !table.isSeparateBorderModel()) { if (!inMarker() && !table.isSeparateBorderModel()) {
collapsingBorderModel = CollapsingBorderModel.getBorderModelFor(table collapsingBorderModel = CollapsingBorderModel.getBorderModelFor(table
setCollapsedBorders(); setCollapsedBorders();
} }
} }

/*
* TODO made public so that RetrieveMarker can access it.
*/
/** {@inheritDoc} */
public void endOfNode() throws FOPException {
super.endOfNode();
}

/** /**
* Prepares the borders of this element if the collapsing-border model is in use. * Prepares the borders of this element if the collapsing-border model is in use.
* Conflict resolution with parent elements is done where applicable. * Conflict resolution with parent elements is done where applicable.
/** /**
* Creates a BorderSpecification from the border set on the given side. If no border * Creates a BorderSpecification from the border set on the given side. If no border
* is set, a BorderSpecification with border-style none is created. * is set, a BorderSpecification with border-style none is created.
*
*
* @param side one of CommonBorderPaddingBackground.BEFORE|AFTER|START|END * @param side one of CommonBorderPaddingBackground.BEFORE|AFTER|START|END
*/ */
private void createBorder(int side) { private void createBorder(int side) {
BorderSpecification borderSpec = new BorderSpecification( BorderSpecification borderSpec = new BorderSpecification(
getCommonBorderPaddingBackground().getBorderInfo(side), getNameId()); getCommonBorderPaddingBackground().getBorderInfo(side), getNameId());
switch (side) { switch (side) {
case CommonBorderPaddingBackground.BEFORE:
borderBefore = new ConditionalBorder(borderSpec, collapsingBorderModel);
break;
case CommonBorderPaddingBackground.AFTER:
borderAfter = new ConditionalBorder(borderSpec, collapsingBorderModel);
break;
case CommonBorderPaddingBackground.START:
borderStart = borderSpec;
break;
case CommonBorderPaddingBackground.END:
borderEnd = borderSpec;
break;
default: assert false;
case CommonBorderPaddingBackground.BEFORE:
borderBefore = new ConditionalBorder(borderSpec, collapsingBorderModel);
break;
case CommonBorderPaddingBackground.AFTER:
borderAfter = new ConditionalBorder(borderSpec, collapsingBorderModel);
break;
case CommonBorderPaddingBackground.START:
borderStart = borderSpec;
break;
case CommonBorderPaddingBackground.END:
borderEnd = borderSpec;
break;
default: assert false;
} }
} }
} }

+ 6
- 12
src/java/org/apache/fop/fo/flow/table/TableFooter.java View File

* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_table-footer"> * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_table-footer">
* <code>fo:table-footer</code></a> object. * <code>fo:table-footer</code></a> object.
*/ */
public class TableFooter extends TableBody {
public class TableFooter extends TablePart {


/** /**
* Create a TableFooter instance with the given {@link FONode} * Create a TableFooter instance with the given {@link FONode}
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
public void startOfNode() throws FOPException {
protected void startOfNode() throws FOPException {
super.startOfNode(); super.startOfNode();
getFOEventHandler().startFooter(this);
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
public void endOfNode() throws FOPException {
if (!(tableRowsFound || tableCellsFound)) {
missingChildElementError("marker* (table-row+|table-cell+)");
} else {
finishLastRowGroup();
}
protected void endOfNode() throws FOPException {
super.endOfNode();
getFOEventHandler().endFooter(this);
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
return FO_TABLE_FOOTER; return FO_TABLE_FOOTER;
} }


/** {@inheritDoc} */
protected boolean isTableFooter() {
return true;
}
} }

+ 6
- 12
src/java/org/apache/fop/fo/flow/table/TableHeader.java View File

* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_table-header"> * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_table-header">
* <code>fo:table-header</code></a> object. * <code>fo:table-header</code></a> object.
*/ */
public class TableHeader extends TableBody {
public class TableHeader extends TablePart {


/** /**
* Create a TableHeader instance with the given {@link FONode} * Create a TableHeader instance with the given {@link FONode}
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
public void startOfNode() throws FOPException {
protected void startOfNode() throws FOPException {
super.startOfNode(); super.startOfNode();
getFOEventHandler().startHeader(this);
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
public void endOfNode() throws FOPException {
if (!(tableRowsFound || tableCellsFound)) {
missingChildElementError("marker* (table-row+|table-cell+)");
} else {
finishLastRowGroup();
}
protected void endOfNode() throws FOPException {
super.endOfNode();
getFOEventHandler().endHeader(this);
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
return FO_TABLE_HEADER; return FO_TABLE_HEADER;
} }


/** {@inheritDoc} */
protected boolean isTableHeader() {
return true;
}
} }

+ 239
- 0
src/java/org/apache/fop/fo/flow/table/TablePart.java View File

/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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: TableBody.java 655614 2008-05-12 19:37:39Z vhennebert $ */

package org.apache.fop.fo.flow.table;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

import org.xml.sax.Attributes;
import org.xml.sax.Locator;

import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;

/**
* An abstract base class modelling a TablePart
* (i.e. fo:table-header, fo:table-footer and fo:table-body).
*/
public abstract class TablePart extends TableCellContainer {
// The value of properties relevant for fo:table-body.
private CommonBorderPaddingBackground commonBorderPaddingBackground;
// Unused but valid items, commented out for performance:
// private CommonAccessibility commonAccessibility;
// private CommonAural commonAural;
// private CommonRelativePosition commonRelativePosition;
// private int visibility;
// End of property values

/**
* used for validation
*/
protected boolean tableRowsFound = false;
protected boolean tableCellsFound = false;

private boolean firstRow = true;

private boolean rowsStarted = false;

private boolean lastCellEndsRow = true;

private List rowGroups = new LinkedList();

/**
* Create a TablePart instance with the given {@link FONode}
* as parent.
* @param parent FONode that is the parent of the object
*/
public TablePart(FONode parent) {
super(parent);
}

/** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
super.bind(pList);
}

/** {@inheritDoc} */
public void processNode(String elementName, Locator locator,
Attributes attlist, PropertyList pList)
throws FOPException {
super.processNode(elementName, locator, attlist, pList);
if (!inMarker()) {
Table t = getTable();
if (t.hasExplicitColumns()) {
int size = t.getNumberOfColumns();
pendingSpans = new ArrayList(size);
for (int i = 0; i < size; i++) {
pendingSpans.add(null);
}
} else {
pendingSpans = new ArrayList();
}
columnNumberManager = new ColumnNumberManager();
}
}

/** {@inheritDoc} */
public void finalizeNode() throws FOPException {
if (!inMarker()) {
pendingSpans = null;
columnNumberManager = null;
}

if (!(tableRowsFound || tableCellsFound)) {
missingChildElementError("marker* (table-row+|table-cell+)", true);
getParent().removeChild(this);
} else {
finishLastRowGroup();
}
}

/** {@inheritDoc} */
TablePart getTablePart() {
return this;
}

protected void finishLastRowGroup() throws ValidationException {
if (!inMarker()) {
RowGroupBuilder rowGroupBuilder = getTable().getRowGroupBuilder();
if (tableRowsFound) {
rowGroupBuilder.endTableRow();
} else if (!lastCellEndsRow) {
rowGroupBuilder.endRow(this);
}
try {
rowGroupBuilder.endTablePart();
} catch (ValidationException e) {
e.setLocator(locator);
throw e;
}
}
}

/**
* {@inheritDoc}
* <br>XSL Content Model: marker* (table-row+|table-cell+)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
throws ValidationException {
if (FO_URI.equals(nsURI)) {
if (localName.equals("marker")) {
if (tableRowsFound || tableCellsFound) {
nodesOutOfOrderError(loc, "fo:marker", "(table-row+|table-cell+)");
}
} else if (localName.equals("table-row")) {
tableRowsFound = true;
if (tableCellsFound) {
TableEventProducer eventProducer = TableEventProducer.Provider.get(
getUserAgent().getEventBroadcaster());
eventProducer.noMixRowsAndCells(this, getName(), getLocator());
}
} else if (localName.equals("table-cell")) {
tableCellsFound = true;
if (tableRowsFound) {
TableEventProducer eventProducer = TableEventProducer.Provider.get(
getUserAgent().getEventBroadcaster());
eventProducer.noMixRowsAndCells(this, getName(), getLocator());
}
} else {
invalidChildError(loc, nsURI, localName);
}
}
}

/** {@inheritDoc} */
protected void addChildNode(FONode child) throws FOPException {
if (!inMarker()) {
switch (child.getNameId()) {
case FO_TABLE_ROW:
if (!rowsStarted) {
getTable().getRowGroupBuilder().startTablePart(this);
} else {
columnNumberManager.prepareForNextRow(pendingSpans);
getTable().getRowGroupBuilder().endTableRow();
}
rowsStarted = true;
getTable().getRowGroupBuilder().startTableRow((TableRow)child);
break;
case FO_TABLE_CELL:
if (!rowsStarted) {
getTable().getRowGroupBuilder().startTablePart(this);
}
rowsStarted = true;
TableCell cell = (TableCell) child;
addTableCellChild(cell, firstRow);
lastCellEndsRow = cell.endsRow();
if (lastCellEndsRow) {
firstRow = false;
columnNumberManager.prepareForNextRow(pendingSpans);
getTable().getRowGroupBuilder().endRow(this);
}
break;
default:
//nop
}
}
super.addChildNode(child);
}

void addRowGroup(List rowGroup) {
rowGroups.add(rowGroup);
}

public List getRowGroups() {
return rowGroups;
}

/**
* Get the {@link CommonBorderPaddingBackground} instance attached
* to this TableBody.
* @return the {@link CommonBorderPaddingBackground} instance.
*/
public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
return commonBorderPaddingBackground;
}

/**
* @param obj table row in question
* @return true if the given table row is the first row of this body.
*/
public boolean isFirst(TableRow obj) {
return (firstChild == null
|| firstChild == obj);
}

void signalNewRow() {
if (rowsStarted) {
firstRow = false;
if (!lastCellEndsRow) {
columnNumberManager.prepareForNextRow(pendingSpans);
getTable().getRowGroupBuilder().endRow(this);
}
}
}

}

+ 17
- 12
src/java/org/apache/fop/fo/flow/table/TableRow.java View File

/** {@inheritDoc} */ /** {@inheritDoc} */
public void processNode(String elementName, Locator locator, public void processNode(String elementName, Locator locator,
Attributes attlist, PropertyList pList) throws FOPException { Attributes attlist, PropertyList pList) throws FOPException {
super.processNode(elementName, locator, attlist, pList);
if (!inMarker()) { if (!inMarker()) {
TableBody body = (TableBody) parent;
pendingSpans = body.pendingSpans;
columnNumberManager = body.columnNumberManager;
TablePart part = (TablePart) parent;
pendingSpans = part.pendingSpans;
columnNumberManager = part.columnNumberManager;
} }
super.processNode(elementName, locator, attlist, pList);
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
protected void addChildNode(FONode child) throws FOPException { protected void addChildNode(FONode child) throws FOPException {
if (!inMarker()) { if (!inMarker()) {
TableCell cell = (TableCell) child; TableCell cell = (TableCell) child;
TableBody body = (TableBody) getParent();
addTableCellChild(cell, body.isFirst(this));
TablePart part = (TablePart) getParent();
addTableCellChild(cell, part.isFirst(this));
} }
super.addChildNode(child); super.addChildNode(child);
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
public void startOfNode() throws FOPException {
protected void startOfNode() throws FOPException {
super.startOfNode(); super.startOfNode();
getFOEventHandler().startRow(this); getFOEventHandler().startRow(this);
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
public void endOfNode() throws FOPException {
protected void endOfNode() throws FOPException {
super.endOfNode();
getFOEventHandler().endRow(this);
}

/** {@inheritDoc} */
public void finalizeNode() throws FOPException {
if (firstChild == null) { if (firstChild == null) {
missingChildElementError("(table-cell+)"); missingChildElementError("(table-cell+)");
} }
pendingSpans = null; pendingSpans = null;
columnNumberManager = null; columnNumberManager = null;
} }
getFOEventHandler().endRow(this);
} }
/** /**
* {@inheritDoc} String, String) * {@inheritDoc} String, String)
* <br>XSL Content Model: (table-cell+) * <br>XSL Content Model: (table-cell+)
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
TableBody getTablePart() {
return (TableBody) parent;
TablePart getTablePart() {
return (TablePart) parent;
} }


/** {@inheritDoc} */ /** {@inheritDoc} */

+ 2
- 2
src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java View File

} }


/** {@inheritDoc} */ /** {@inheritDoc} */
void endRow(final TableBody part) {
void endRow(final TablePart part) {
events.add(new Event() { events.add(new Event() {
public void play(RowGroupBuilder rowGroupBuilder) { public void play(RowGroupBuilder rowGroupBuilder) {
rowGroupBuilder.endRow(part); rowGroupBuilder.endRow(part);
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
void startTablePart(final TableBody part) {
void startTablePart(final TablePart part) {
events.add(new Event() { events.add(new Event() {
public void play(RowGroupBuilder rowGroupBuilder) { public void play(RowGroupBuilder rowGroupBuilder) {
rowGroupBuilder.startTablePart(part); rowGroupBuilder.startTablePart(part);

+ 1
- 0
src/java/org/apache/fop/fo/pagination/Flow.java View File



/** {@inheritDoc} */ /** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException { public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
flowName = pList.get(PR_FLOW_NAME).getString(); flowName = pList.get(PR_FLOW_NAME).getString();
} }

+ 22
- 3
src/java/org/apache/fop/fo/pagination/Root.java View File

import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FOEventHandler; import org.apache.fop.fo.FOEventHandler;
import org.apache.fop.fo.FONode; import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FOTreeBuilderContext;
import org.apache.fop.fo.FObj; import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException; import org.apache.fop.fo.ValidationException;
private int endingPageNumberOfPreviousSequence = 0; private int endingPageNumberOfPreviousSequence = 0;
private int totalPagesGenerated = 0; private int totalPagesGenerated = 0;


/**
* Context class used while building the FO tree.
*/
private FOTreeBuilderContext builderContext;
/** /**
* FOEventHandler object for this FO Tree * FOEventHandler object for this FO Tree
*/ */
return foEventHandler; return foEventHandler;
} }


/**
* Gets the last page number generated by the previous page-sequence
* @return the last page number, 0 if no page sequences yet generated
/**
* Sets the builder context for this FO tree.
* @param context the builder context to be used
*/ */
public void setBuilderContext(FOTreeBuilderContext context) {
this.builderContext = context;
}

/** {@inheritDoc} */
public FOTreeBuilderContext getBuilderContext() {
return this.builderContext;
}
/**
* Gets the last page number generated by the previous page-sequence
* @return the last page number, 0 if no page sequences yet generated
*/
public int getEndingPageNumberOfPreviousSequence() { public int getEndingPageNumberOfPreviousSequence() {
return endingPageNumberOfPreviousSequence; return endingPageNumberOfPreviousSequence;
} }

+ 3
- 3
src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java View File

* *
* @param data the character data * @param data the character data
* @param start the start position in the data array * @param start the start position in the data array
* @param end the end position in the character array
* @param length the length of the character array
* @param locator location in fo source file. * @param locator location in fo source file.
*/ */
protected void addCharacters(char[] data, int start, int end,
protected void addCharacters(char[] data, int start, int length,
PropertyList pList, PropertyList pList,
Locator locator) { Locator locator) {
title += new String(data, start, end - start);
title += new String(data, start, length);
} }


/** /**

+ 2
- 3
src/java/org/apache/fop/fo/properties/PageDimensionMaker.java View File

import org.apache.fop.fo.FObj; import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.expr.PropertyException;
import org.apache.fop.fo.properties.LengthProperty;


/** /**
* Custom Maker for page-height / page-width * Custom Maker for page-height / page-width
Property p = super.get(0, propertyList, tryInherit, tryDefault); Property p = super.get(0, propertyList, tryInherit, tryDefault);
FObj fo = propertyList.getFObj(); FObj fo = propertyList.getFObj();
String fallbackValue = (propId == Constants.PR_PAGE_HEIGHT) String fallbackValue = (propId == Constants.PR_PAGE_HEIGHT)
? fo.getFOEventHandler().getUserAgent().getPageHeight()
: fo.getFOEventHandler().getUserAgent().getPageWidth();
? fo.getUserAgent().getPageHeight()
: fo.getUserAgent().getPageWidth();
if (p.getEnum() == Constants.EN_INDEFINITE) { if (p.getEnum() == Constants.EN_INDEFINITE) {
int otherId = (propId == Constants.PR_PAGE_HEIGHT) int otherId = (propId == Constants.PR_PAGE_HEIGHT)

+ 8
- 3
src/java/org/apache/fop/fonts/CustomFont.java View File

return fontBBox; return fontBBox;
} }


/**
* {@inheritDoc}
*/
/** {@inheritDoc} */
public int getFlags() { public int getFlags() {
return flags; return flags;
} }
/** {@inheritDoc} */
public boolean isSymbolicFont() {
return ((getFlags() & 4) != 0) || "ZapfDingbatsEncoding".equals(getEncodingName());
//Note: The check for ZapfDingbats is necessary as the PFM does not reliably indicate
//if a font is symbolic.
}


/** /**
* Returns the font weight (100, 200...800, 900). This value may be different from the * Returns the font weight (100, 200...800, 900). This value may be different from the

+ 5
- 1
src/java/org/apache/fop/fonts/FontDescriptor.java View File

*/ */
int getFlags(); int getFlags();



/**
* Indicates whether the font is a symbolic font.
* @return true if the font is a symbolic font (i.e. Symbol or ZapfDingbats)
*/
boolean isSymbolicFont();
/** /**
* Returns the font's bounding box. * Returns the font's bounding box.
* @return the bounding box * @return the bounding box

+ 5
- 4
src/java/org/apache/fop/fonts/FontReader.java View File



import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.SAXParserFactory;


import org.apache.fop.apps.FOPException;
import org.apache.fop.fonts.apps.TTFReader;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import org.xml.sax.InputSource; import org.xml.sax.InputSource;
import org.xml.sax.Locator; import org.xml.sax.Locator;
import org.xml.sax.XMLReader; import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.helpers.DefaultHandler;


import org.apache.fop.apps.FOPException;
import org.apache.fop.fonts.apps.TTFReader;

/** /**
* Class for reading a metric.xml file and creating a font object. * Class for reading a metric.xml file and creating a font object.
* Typical usage: * Typical usage:
if ("font-name".equals(localName)) { if ("font-name".equals(localName)) {
returnFont.setFontName(content); returnFont.setFontName(content);
} else if ("full-name".equals(localName)) { } else if ("full-name".equals(localName)) {
multiFont.setFullName(content);
returnFont.setFullName(content);
} else if ("family-name".equals(localName)) { } else if ("family-name".equals(localName)) {
Set s = new java.util.HashSet(); Set s = new java.util.HashSet();
s.add(content); s.add(content);
multiFont.setFamilyNames(s);
returnFont.setFamilyNames(s);
} else if ("ttc-name".equals(localName) && isCID) { } else if ("ttc-name".equals(localName) && isCID) {
multiFont.setTTCName(content); multiFont.setTTCName(content);
} else if ("encoding".equals(localName)) { } else if ("encoding".equals(localName)) {

+ 143
- 0
src/java/org/apache/fop/fonts/FontSelector.java View File

/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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$ */

package org.apache.fop.fonts;

import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FOText;
import org.apache.fop.fo.flow.Character;
import org.apache.fop.fo.properties.CommonFont;

/**
* Helper class for automatic font selection.
* <p>
* TODO: Check if this could be merged with another font class, such as
* {@link FontManager}.
*/
public final class FontSelector {
private FontSelector() {
// Static since this is an utility class.
}

private static Font selectFontForCharacter(char c, FONode fonode,
CommonFont commonFont, PercentBaseContext context) {
FontInfo fi = fonode.getFOEventHandler().getFontInfo();
FontTriplet[] fontkeys = commonFont.getFontState(fi);
for (int i = 0; i < fontkeys.length; i++) {
Font font = fi.getFontInstance(fontkeys[i], commonFont.fontSize
.getValue(context));
if (font.hasChar(c)) {
return font;
}
}
return fi.getFontInstance(fontkeys[0], commonFont.fontSize
.getValue(context));

}

/**
* Selects a font which is able to display the given character.
*
* @param fobj
* a Character object containing the character and its
* attributes.
* @param context
* the Percent-based context needed for creating the actual font.
* @return a Font object.
*/
public static Font selectFontForCharacter(Character fobj,
PercentBaseContext context) {
return FontSelector.selectFontForCharacter(fobj.getCharacter(), fobj,
fobj.getCommonFont(), context);
}

/**
* Selects a font which is able to display the given character.
*
* @param c
* character to find.
* @param text
* the text object which contains the character
* @param context
* the Percent-based context needed for creating the actual font.
* @return a Font object.
*/
public static Font selectFontForCharacterInText(char c, FOText text,
PercentBaseContext context) {
return FontSelector.selectFontForCharacter(c, text, text
.getCommonFont(), context);
}

/**
* Selects a font which is able to display the most of the given characters.
*
* @param charSeq
* Text to go through
* @param firstIndex
* first index within text.
* @param breakIndex
* last index +1 within text.
* @param text
* the text object which contains the character
* @param context
* the Percent-based context needed for creating the actual font.
* @return a Font object.
*/
public static Font selectFontForCharactersInText(CharSequence charSeq,
int firstIndex, int breakIndex, FOText text,
PercentBaseContext context) {

final FontInfo fi = text.getFOEventHandler().getFontInfo();
final CommonFont commonFont = text.getCommonFont();
final FontTriplet[] fontkeys = commonFont.getFontState(fi);
final int numFonts = fontkeys.length;
final Font[] fonts = new Font[numFonts];
final int[] fontCount = new int[numFonts];

for (int fontnum = 0; fontnum < numFonts; fontnum++) {
final Font font = fi.getFontInstance(fontkeys[fontnum],
commonFont.fontSize.getValue(context));
fonts[fontnum] = font;
for (int pos = firstIndex; pos < breakIndex; pos++) {
if (font.hasChar(charSeq.charAt(pos))) {
fontCount[fontnum]++;
}
}

// quick fall through if all characters can be displayed
if (fontCount[fontnum] == (breakIndex - firstIndex)) {
return font;
}
}

Font font = fonts[0];
int max = fontCount[0];

for (int fontnum = 1; fontnum < numFonts; fontnum++) {
final int curCount = fontCount[fontnum];
if (curCount > max) {
font = fonts[fontnum];
max = curCount;
}
}
return font;
}

}

+ 7
- 3
src/java/org/apache/fop/fonts/LazyFont.java View File

return realFontDescriptor.getAscender(); return realFontDescriptor.getAscender();
} }


/**
* {@inheritDoc}
*/
/** {@inheritDoc} */
public int getFlags() { public int getFlags() {
load(true); load(true);
return realFontDescriptor.getFlags(); return realFontDescriptor.getFlags();
} }


/** {@inheritDoc} */
public boolean isSymbolicFont() {
load(true);
return realFontDescriptor.isSymbolicFont();
}

/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */

+ 2
- 2
src/java/org/apache/fop/fonts/SingleByteFont.java View File

/** {@inheritDoc} */ /** {@inheritDoc} */
public boolean isEmbeddable() { public boolean isEmbeddable() {
return (getEmbedFileName() == null && getEmbedResourceName() == null) ? false
: true;
return (!(getEmbedFileName() == null
&& getEmbedResourceName() == null));
} }


/** {@inheritDoc} */ /** {@inheritDoc} */

+ 1
- 0
src/java/org/apache/fop/fonts/autodetect/UnixFontDirFinder.java View File

return new String[] { return new String[] {
System.getProperty("user.home") + "/.fonts", // user System.getProperty("user.home") + "/.fonts", // user
"/usr/local/fonts", // local "/usr/local/fonts", // local
"/usr/local/share/fonts", // local shared
"/usr/share/fonts", // system "/usr/share/fonts", // system
"/usr/X11R6/lib/X11/fonts" // X "/usr/X11R6/lib/X11/fonts" // X
}; };

+ 17
- 17
src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java View File

public abstract class AbstractBaseLayoutManager public abstract class AbstractBaseLayoutManager
implements LayoutManager, PercentBaseContext { implements LayoutManager, PercentBaseContext {
/** Indicator if this LM generates reference areas */
/** Indicator if this LM generates reference areas. */
protected boolean generatesReferenceArea = false; protected boolean generatesReferenceArea = false;
/** Indicator if this LM generates block areas */
/** Indicator if this LM generates block areas. */
protected boolean generatesBlockArea = false; protected boolean generatesBlockArea = false;
/** The formatting object for this LM */
/** The formatting object for this LM. */
protected final FObj fobj; protected final FObj fobj;


/** /**
* logging instance * logging instance
*/ */
private static Log log = LogFactory.getLog(AbstractBaseLayoutManager.class);
private static final Log LOG = LogFactory.getLog(AbstractBaseLayoutManager.class);


/** /**
* Abstract base layout manager. * Abstract base layout manager.
// --------- Property Resolution related functions --------- // // --------- Property Resolution related functions --------- //
/** {@inheritDoc} */ /** {@inheritDoc} */
public int getBaseLength(int lengthBase, FObj fobj) {
if (fobj == this.fobj) {
public int getBaseLength(int lengthBase, FObj fobjx) {
if (fobjx == this.fobj) {
switch (lengthBase) { switch (lengthBase) {
case LengthBase.CONTAINING_BLOCK_WIDTH: case LengthBase.CONTAINING_BLOCK_WIDTH:
return getAncestorBlockAreaIPD(); return getAncestorBlockAreaIPD();
case LengthBase.CONTAINING_REFAREA_WIDTH: case LengthBase.CONTAINING_REFAREA_WIDTH:
return getReferenceAreaIPD(); return getReferenceAreaIPD();
default: default:
log.error("Unknown base type for LengthBase:" + lengthBase);
LOG.error("Unknown base type for LengthBase:" + lengthBase);
return 0; return 0;
} }
} else { } else {
LayoutManager lm = getParent(); LayoutManager lm = getParent();
while (lm != null && fobj != lm.getFObj()) {
while (lm != null && fobjx != lm.getFObj()) {
lm = lm.getParent(); lm = lm.getParent();
} }
if (lm != null) { if (lm != null) {
return lm.getBaseLength(lengthBase, fobj);
return lm.getBaseLength(lengthBase, fobjx);
} }
} }
log.error("Cannot find LM to handle given FO for LengthBase. ("
+ fobj.getContextInfo() + ")");
LOG.error("Cannot find LM to handle given FO for LengthBase. ("
+ fobjx.getContextInfo() + ")");
return 0; return 0;
} }


} }
lm = lm.getParent(); lm = lm.getParent();
} }
log.error("No parent LM found");
LOG.error("No parent LM found");
return 0; return 0;
} }


} }
lm = lm.getParent(); lm = lm.getParent();
} }
log.error("No parent LM found");
LOG.error("No parent LM found");
return 0; return 0;
} }


if (lm != null) { if (lm != null) {
return lm.getContentAreaIPD(); return lm.getContentAreaIPD();
} }
log.error("No parent LM found");
LOG.error("No parent LM found");
return 0; return 0;
} }


if (lm != null) { if (lm != null) {
return lm.getContentAreaBPD(); return lm.getContentAreaBPD();
} }
log.error("No parent LM found");
LOG.error("No parent LM found");
return 0; return 0;
} }


} }
lm = lm.getParent(); lm = lm.getParent();
} }
log.error("No parent LM found");
LOG.error("No parent LM found");
return 0; return 0;
} }


} }
lm = lm.getParent(); lm = lm.getParent();
} }
log.error("No parent LM found");
LOG.error("No parent LM found");
return 0; return 0;
} }



+ 16
- 14
src/java/org/apache/fop/layoutmgr/AbstractBreaker.java View File



import org.apache.fop.fo.Constants; import org.apache.fop.fo.Constants;
import org.apache.fop.traits.MinOptMax; import org.apache.fop.traits.MinOptMax;
import org.apache.fop.util.ListUtil;


/** /**
* Abstract base class for breakers (page breakers, static region handlers etc.). * Abstract base class for breakers (page breakers, static region handlers etc.).
public KnuthSequence endSequence(Position breakPosition) { public KnuthSequence endSequence(Position breakPosition) {
// remove glue and penalty item at the end of the paragraph // remove glue and penalty item at the end of the paragraph
while (this.size() > ignoreAtStart while (this.size() > ignoreAtStart
&& !((KnuthElement)this.get(this.size() - 1)).isBox()) {
this.remove(this.size() - 1);
&& !((KnuthElement) ListUtil.getLast(this)).isBox()) {
ListUtil.removeLast(this);
} }
if (this.size() > ignoreAtStart) { if (this.size() > ignoreAtStart) {
// add the elements representing the space at the end of the last line // add the elements representing the space at the end of the last line
* getNextKnuthElements() implementation(s) that are to be called. * getNextKnuthElements() implementation(s) that are to be called.
* @return LinkedList of Knuth elements. * @return LinkedList of Knuth elements.
*/ */
protected abstract LinkedList getNextKnuthElements(LayoutContext context, int alignment);
protected abstract List getNextKnuthElements(LayoutContext context, int alignment);


/** @return true if there's no content that could be handled. */ /** @return true if there's no content that could be handled. */
public boolean isEmpty() { public boolean isEmpty() {
return (this.blockLists.size() == 0);
return (this.blockLists.isEmpty());
} }
protected void startPart(BlockSequence list, int breakClass) { protected void startPart(BlockSequence list, int breakClass) {
childLC.signalSpanChange(Constants.NOT_SET); childLC.signalSpanChange(Constants.NOT_SET);
BlockSequence blockList; BlockSequence blockList;
LinkedList returnedList = getNextKnuthElements(childLC, alignment);
List returnedList = getNextKnuthElements(childLC, alignment);
if (returnedList != null) { if (returnedList != null) {
if (returnedList.size() == 0) {
if (returnedList.isEmpty()) {
nextSequenceStartsOn = handleSpanChange(childLC, nextSequenceStartsOn); nextSequenceStartsOn = handleSpanChange(childLC, nextSequenceStartsOn);
return nextSequenceStartsOn; return nextSequenceStartsOn;
} }
nextSequenceStartsOn = handleSpanChange(childLC, nextSequenceStartsOn); nextSequenceStartsOn = handleSpanChange(childLC, nextSequenceStartsOn);
Position breakPosition = null; Position breakPosition = null;
if (((KnuthElement) returnedList.getLast()).isForcedBreak()) {
KnuthPenalty breakPenalty = (KnuthPenalty)returnedList.removeLast();
if (((KnuthElement) ListUtil.getLast(returnedList)).isForcedBreak()) {
KnuthPenalty breakPenalty = (KnuthPenalty) ListUtil
.removeLast(returnedList);
breakPosition = breakPenalty.getPosition(); breakPosition = breakPenalty.getPosition();
switch (breakPenalty.getBreakClass()) { switch (breakPenalty.getBreakClass()) {
case Constants.EN_PAGE: case Constants.EN_PAGE:
if (!bBoxSeen) { if (!bBoxSeen) {
// this is the first box met in this page // this is the first box met in this page
bBoxSeen = true; bBoxSeen = true;
} else if (unconfirmedList.size() > 0) {
// glue items in unconfirmedList were not after
// the last box
// in this page; they must be added to
// blockSpaceList
while (unconfirmedList.size() > 0) {
} else {
while (!unconfirmedList.isEmpty()) {
// glue items in unconfirmedList were not after
// the last box
// in this page; they must be added to
// blockSpaceList
KnuthGlue blockSpace = (KnuthGlue) unconfirmedList KnuthGlue blockSpace = (KnuthGlue) unconfirmedList
.removeFirst(); .removeFirst();
spaceMaxAdjustment.max += ((KnuthGlue) blockSpace) spaceMaxAdjustment.max += ((KnuthGlue) blockSpace)

+ 2
- 4
src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java View File

package org.apache.fop.layoutmgr; package org.apache.fop.layoutmgr;


import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;
import java.util.Map; import java.util.Map;


import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;

import org.apache.fop.area.Area; import org.apache.fop.area.Area;
import org.apache.fop.area.PageViewport; import org.apache.fop.area.PageViewport;
import org.apache.fop.fo.Constants; import org.apache.fop.fo.Constants;
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
public LinkedList getNextKnuthElements(LayoutContext context,
public List getNextKnuthElements(LayoutContext context,
int alignment) { int alignment) {
log.warn("null implementation of getNextKnuthElements() called!"); log.warn("null implementation of getNextKnuthElements() called!");
setFinished(true); setFinished(true);
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
public LinkedList getChangedKnuthElements(List oldList,
public List getChangedKnuthElements(List oldList,
int alignment) { int alignment) {
log.warn("null implementation of getChangeKnuthElement() called!"); log.warn("null implementation of getChangeKnuthElement() called!");
return null; return null;

+ 22
- 18
src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java View File

import org.apache.fop.fo.properties.CommonAbsolutePosition; import org.apache.fop.fo.properties.CommonAbsolutePosition;
import org.apache.fop.traits.MinOptMax; import org.apache.fop.traits.MinOptMax;
import org.apache.fop.traits.SpaceVal; import org.apache.fop.traits.SpaceVal;
import org.apache.fop.util.ListUtil;


/** /**
* LayoutManager for a block-container FO. * LayoutManager for a block-container FO.
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
public List getNextKnuthElements(LayoutContext context, int alignment) {
resetSpaces(); resetSpaces();
if (isAbsoluteOrFixed()) { if (isAbsoluteOrFixed()) {
return getNextKnuthElementsAbsolute(context, alignment); return getNextKnuthElementsAbsolute(context, alignment);
MinOptMax stackLimit = new MinOptMax(relDims.bpd); MinOptMax stackLimit = new MinOptMax(relDims.bpd);


LinkedList returnedList;
LinkedList contentList = new LinkedList();
LinkedList returnList = new LinkedList();
List returnedList;
List contentList = new LinkedList();
List returnList = new LinkedList();
if (!breakBeforeServed) { if (!breakBeforeServed) {
try { try {


// get elements from curLM // get elements from curLM
returnedList = curLM.getNextKnuthElements(childLC, alignment); returnedList = curLM.getNextKnuthElements(childLC, alignment);
if (contentList.size() == 0 && childLC.isKeepWithPreviousPending()) {
if (contentList.isEmpty() && childLC.isKeepWithPreviousPending()) {
//Propagate keep-with-previous up from the first child //Propagate keep-with-previous up from the first child
context.updateKeepWithPreviousPending(childLC.getKeepWithPreviousPending()); context.updateKeepWithPreviousPending(childLC.getKeepWithPreviousPending());
childLC.clearKeepWithPreviousPending(); childLC.clearKeepWithPreviousPending();
} }
if (returnedList.size() == 1 if (returnedList.size() == 1
&& ((ListElement)returnedList.getFirst()).isForcedBreak()) {
&& ((ListElement)returnedList.get(0)).isForcedBreak()) {
// a descendant of this block has break-before // a descendant of this block has break-before
/* /*
if (returnList.size() == 0) { if (returnList.size() == 0) {
addInBetweenBreak(contentList, context, childLC); addInBetweenBreak(contentList, context, childLC);
} }
contentList.addAll(returnedList); contentList.addAll(returnedList);
if (returnedList.size() == 0) {
if (returnedList.isEmpty()) {
//Avoid NoSuchElementException below (happens with empty blocks) //Avoid NoSuchElementException below (happens with empty blocks)
continue; continue;
} }
if (((ListElement)returnedList.getLast()).isForcedBreak()) {
if (((ListElement) ListUtil.getLast(returnedList))
.isForcedBreak()) {
// a descendant of this block has break-after // a descendant of this block has break-after
if (curLM.isFinished()) { if (curLM.isFinished()) {
// there is no other content in this block; // there is no other content in this block;
return returnList; return returnList;
} }
private LinkedList getNextKnuthElementsAbsolute(LayoutContext context, int alignment) {
private List getNextKnuthElementsAbsolute(LayoutContext context, int alignment) {
autoHeight = false; autoHeight = false;


boolean switchedProgressionDirection boolean switchedProgressionDirection
} }
updateRelDims(0, 0, false); updateRelDims(0, 0, false);
} }
LinkedList returnList = new LinkedList();
List returnList = new LinkedList();
if (!breaker.isEmpty()) { if (!breaker.isEmpty()) {
Position bcPosition = new BlockContainerPosition(this, breaker); Position bcPosition = new BlockContainerPosition(this, breaker);
returnList.add(new KnuthBox(0, notifyPos(bcPosition), false)); returnList.add(new KnuthBox(0, notifyPos(bcPosition), false));
return lc; return lc;
} }
protected LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
protected List getNextKnuthElements(LayoutContext context, int alignment) {
LayoutManager curLM; // currently active LM LayoutManager curLM; // currently active LM
LinkedList returnList = new LinkedList();
List returnList = new LinkedList();


while ((curLM = getChildLM()) != null) { while ((curLM = getChildLM()) != null) {
LayoutContext childLC = new LayoutContext(0); LayoutContext childLC = new LayoutContext(0);
childLC.setRefIPD(context.getRefIPD()); childLC.setRefIPD(context.getRefIPD());
childLC.setWritingMode(getBlockContainerFO().getWritingMode()); childLC.setWritingMode(getBlockContainerFO().getWritingMode());
LinkedList returnedList = null;
List returnedList = null;
if (!curLM.isFinished()) { if (!curLM.isFinished()) {
returnedList = curLM.getNextKnuthElements(childLC, alignment); returnedList = curLM.getNextKnuthElements(childLC, alignment);
} }


// "unwrap" the NonLeafPositions stored in parentIter // "unwrap" the NonLeafPositions stored in parentIter
// and put them in a new list; // and put them in a new list;
LinkedList positionList = new LinkedList();
List positionList = new LinkedList();
Position pos; Position pos;
boolean bSpaceBefore = false; boolean bSpaceBefore = false;
boolean bSpaceAfter = false; boolean bSpaceAfter = false;
// pos was created by this BCLM and was inside an element // pos was created by this BCLM and was inside an element
// representing space before or after // representing space before or after
// this means the space was not discarded // this means the space was not discarded
if (positionList.size() == 0 && bcpos == null) {
if (positionList.isEmpty() && bcpos == null) {
// pos was in the element representing space-before // pos was in the element representing space-before
bSpaceBefore = true; bSpaceBefore = true;
} else { } else {
// // the last item inside positionList is a Position; // // the last item inside positionList is a Position;
// // this means that the paragraph has been split // // this means that the paragraph has been split
// // between consecutive pages // // between consecutive pages
LinkedList splitList = new LinkedList();
List splitList = new LinkedList();
int splitLength = 0; int splitLength = 0;
int iFirst = ((MappingPosition) positionList.getFirst()).getFirstIndex();
int iLast = ((MappingPosition) positionList.getLast()).getLastIndex();
int iFirst = ((MappingPosition) positionList.get(0))
.getFirstIndex();
int iLast = ((MappingPosition) ListUtil.getLast(positionList))
.getLastIndex();
// copy from storedList to splitList all the elements from // copy from storedList to splitList all the elements from
// iFirst to iLast // iFirst to iLast
ListIterator storedListIterator = storedList.listIterator(iFirst); ListIterator storedListIterator = storedList.listIterator(iFirst);

+ 1
- 1
src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java View File

} }


/** {@inheritDoc} */ /** {@inheritDoc} */
public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
public List getNextKnuthElements(LayoutContext context, int alignment) {
resetSpaces(); resetSpaces();
return super.getNextKnuthElements(context, alignment); return super.getNextKnuthElements(context, alignment);
} }

+ 39
- 34
src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java View File

import org.apache.fop.layoutmgr.inline.InlineLayoutManager; import org.apache.fop.layoutmgr.inline.InlineLayoutManager;
import org.apache.fop.layoutmgr.inline.LineLayoutManager; import org.apache.fop.layoutmgr.inline.LineLayoutManager;
import org.apache.fop.traits.MinOptMax; import org.apache.fop.traits.MinOptMax;
import org.apache.fop.util.ListUtil;


/** /**
* Base LayoutManager class for all areas which stack their child * Base LayoutManager class for all areas which stack their child
/** space-after value adjusted for block-progression-unit handling */ /** space-after value adjusted for block-progression-unit handling */
protected int adjustedSpaceAfter = 0; protected int adjustedSpaceAfter = 0;
/** Only used to store the original list when createUnitElements is called */ /** Only used to store the original list when createUnitElements is called */
protected LinkedList storedList = null;
protected List storedList = null;
/** Indicates whether break before has been served or not */ /** Indicates whether break before has been served or not */
protected boolean breakBeforeServed = false; protected boolean breakBeforeServed = false;
/** Indicates whether the first visible mark has been returned by this LM, yet */ /** Indicates whether the first visible mark has been returned by this LM, yet */
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
public List getNextKnuthElements(LayoutContext context, int alignment) {
//log.debug("BLM.getNextKnuthElements> keep-together = " //log.debug("BLM.getNextKnuthElements> keep-together = "
// + layoutProps.keepTogether.getType()); // + layoutProps.keepTogether.getType());
//log.debug(" keep-with-previous = " + //log.debug(" keep-with-previous = " +
updateContentAreaIPDwithOverconstrainedAdjust(); updateContentAreaIPDwithOverconstrainedAdjust();


LinkedList returnedList = null;
LinkedList contentList = new LinkedList();
LinkedList returnList = new LinkedList();
List returnedList = null;
List contentList = new LinkedList();
List returnList = new LinkedList();


if (!breakBeforeServed) { if (!breakBeforeServed) {
try { try {


// get elements from curLM // get elements from curLM
returnedList = curLM.getNextKnuthElements(childLC, alignment); returnedList = curLM.getNextKnuthElements(childLC, alignment);
if (contentList.size() == 0 && childLC.isKeepWithPreviousPending()) {
if (contentList.isEmpty() && childLC.isKeepWithPreviousPending()) {
//Propagate keep-with-previous up from the first child //Propagate keep-with-previous up from the first child
context.updateKeepWithPreviousPending(childLC.getKeepWithPreviousPending()); context.updateKeepWithPreviousPending(childLC.getKeepWithPreviousPending());
childLC.clearKeepWithPreviousPending(); childLC.clearKeepWithPreviousPending();
} }
if (returnedList != null if (returnedList != null
&& returnedList.size() == 1 && returnedList.size() == 1
&& ((ListElement) returnedList.getFirst()).isForcedBreak()) {
&& ((ListElement) returnedList.get(0)).isForcedBreak()) {


if (curLM.isFinished() && !hasNextChildLM()) { if (curLM.isFinished() && !hasNextChildLM()) {
// a descendant of this block has break-before // a descendant of this block has break-before
forcedBreakAfterLast = (BreakElement) returnedList.getFirst();
forcedBreakAfterLast = (BreakElement) returnedList.get(0);
context.clearPendingMarks(); context.clearPendingMarks();
break; break;
} }


if (contentList.size() == 0) {
if (contentList.isEmpty()) {
// Empty fo:block, zero-length box makes sure the IDs and/or markers // Empty fo:block, zero-length box makes sure the IDs and/or markers
// are registered and borders/padding are painted. // are registered and borders/padding are painted.
returnList.add(new KnuthBox(0, notifyPos(new Position(this)), false)); returnList.add(new KnuthBox(0, notifyPos(new Position(this)), false));
// before the one handled by curLM // before the one handled by curLM
addInBetweenBreak(contentList, context, childLC); addInBetweenBreak(contentList, context, childLC);
} }
if (returnedList == null || returnedList.size() == 0) {
if (returnedList == null || returnedList.isEmpty()) {
//Avoid NoSuchElementException below (happens with empty blocks) //Avoid NoSuchElementException below (happens with empty blocks)
continue; continue;
} }
contentList.addAll(returnedList); contentList.addAll(returnedList);
if (((ListElement) returnedList.getLast()).isForcedBreak()) {
if (((ListElement) ListUtil.getLast(returnedList))
.isForcedBreak()) {
// a descendant of this block has break-after // a descendant of this block has break-after
if (curLM.isFinished() && !hasNextChildLM()) { if (curLM.isFinished() && !hasNextChildLM()) {
forcedBreakAfterLast = (BreakElement)contentList.removeLast();
forcedBreakAfterLast = (BreakElement) ListUtil
.removeLast(contentList);
context.clearPendingMarks(); context.clearPendingMarks();
break; break;
} }
/* end of extension */ /* end of extension */


returnedList = new LinkedList(); returnedList = new LinkedList();
if (contentList.size() > 0) {
if (!contentList.isEmpty()) {
wrapPositionElements(contentList, returnList); wrapPositionElements(contentList, returnList);
} else if (forcedBreakAfterLast == null) { } else if (forcedBreakAfterLast == null) {
// Empty fo:block, zero-length box makes sure the IDs and/or markers // Empty fo:block, zero-length box makes sure the IDs and/or markers
* @param context the current layout context * @param context the current layout context
* @param childLC the currently active child layout context * @param childLC the currently active child layout context
*/ */
protected void addInBetweenBreak(LinkedList contentList, LayoutContext context,
protected void addInBetweenBreak(List contentList, LayoutContext context,
LayoutContext childLC) { LayoutContext childLC) {
if (mustKeepTogether() if (mustKeepTogether()
|| context.isKeepWithNextPending() || context.isKeepWithNextPending()
return; return;
} }
ListElement last = (ListElement)contentList.getLast();
ListElement last = (ListElement) ListUtil.getLast(contentList);
if (last.isGlue()) { if (last.isGlue()) {
// the last element in contentList is a glue; // the last element in contentList is a glue;
// it is a feasible breakpoint, there is no need to add // it is a feasible breakpoint, there is no need to add
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public LinkedList getChangedKnuthElements(List oldList, int alignment) {
public List getChangedKnuthElements(List oldList, int alignment) {
/*LF*/ //log.debug(""); /*LF*/ //log.debug("");
/*LF*/ //log.debug(" BLM.getChangedKnuthElements> inizio: oldList.size() = " /*LF*/ //log.debug(" BLM.getChangedKnuthElements> inizio: oldList.size() = "
// + oldList.size()); // + oldList.size());
KnuthElement returnedElement; KnuthElement returnedElement;
KnuthElement currElement = null; KnuthElement currElement = null;
KnuthElement prevElement = null; KnuthElement prevElement = null;
LinkedList returnedList = new LinkedList();
LinkedList returnList = new LinkedList();
List returnedList = new LinkedList();
List returnList = new LinkedList();
int fromIndex = 0; int fromIndex = 0;


// "unwrap" the Positions stored in the elements // "unwrap" the Positions stored in the elements
// add an infinite penalty to forbid a break between blocks // add an infinite penalty to forbid a break between blocks
returnedList.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, returnedList.add(new KnuthPenalty(0, KnuthElement.INFINITE, false,
new Position(this), false)); new Position(this), false));
} else if (bSomethingAdded && !((KnuthElement) returnedList.getLast()).isGlue()) {
} else if (bSomethingAdded
&& !((KnuthElement) ListUtil.getLast(returnedList))
.isGlue()) {
// add a null penalty to allow a break between blocks // add a null penalty to allow a break between blocks
returnedList.add(new KnuthPenalty(0, 0, false, new Position(this), false)); returnedList.add(new KnuthPenalty(0, 0, false, new Position(this), false));
} }
// currLM == this // currLM == this
// there are no more elements to add // there are no more elements to add
// remove the last penalty added to returnedList // remove the last penalty added to returnedList
if (returnedList.size() > 0) {
returnedList.removeLast();
if (!returnedList.isEmpty()) {
ListUtil.removeLast(returnedList);
} }
//log.debug(" BLM.getChangedKnuthElements> elementi propri, ignorati, da " //log.debug(" BLM.getChangedKnuthElements> elementi propri, ignorati, da "
// + fromIndex + " a " + workList.size()); // + fromIndex + " a " + workList.size());
* @param isFirst true if this is the first time a layout manager instance needs to generate * @param isFirst true if this is the first time a layout manager instance needs to generate
* border and padding * border and padding
*/ */
protected void addKnuthElementsForBorderPaddingBefore(LinkedList returnList, boolean isFirst) {
protected void addKnuthElementsForBorderPaddingBefore(List returnList, boolean isFirst) {
//Border and Padding (before) //Border and Padding (before)
CommonBorderPaddingBackground borderAndPadding = getBorderPaddingBackground(); CommonBorderPaddingBackground borderAndPadding = getBorderPaddingBackground();
if (borderAndPadding != null) { if (borderAndPadding != null) {
* @param isLast true if this is the last time a layout manager instance needs to generate * @param isLast true if this is the last time a layout manager instance needs to generate
* border and padding * border and padding
*/ */
protected void addKnuthElementsForBorderPaddingAfter(LinkedList returnList, boolean isLast) {
protected void addKnuthElementsForBorderPaddingAfter(List returnList, boolean isLast) {
//Border and Padding (after) //Border and Padding (after)
CommonBorderPaddingBackground borderAndPadding = getBorderPaddingBackground(); CommonBorderPaddingBackground borderAndPadding = getBorderPaddingBackground();
if (borderAndPadding != null) { if (borderAndPadding != null) {
* @param context the layout context * @param context the layout context
* @return true if an element has been added due to a break-before. * @return true if an element has been added due to a break-before.
*/ */
protected boolean addKnuthElementsForBreakBefore(LinkedList returnList,
protected boolean addKnuthElementsForBreakBefore(List returnList,
LayoutContext context) { LayoutContext context) {
int breakBefore = -1; int breakBefore = -1;
if (fobj instanceof org.apache.fop.fo.flow.Block) { if (fobj instanceof org.apache.fop.fo.flow.Block) {
* @param context the layout context * @param context the layout context
* @return true if an element has been added due to a break-after. * @return true if an element has been added due to a break-after.
*/ */
protected boolean addKnuthElementsForBreakAfter(LinkedList returnList,
protected boolean addKnuthElementsForBreakAfter(List returnList,
LayoutContext context) { LayoutContext context) {
int breakAfter = -1; int breakAfter = -1;
if (fobj instanceof org.apache.fop.fo.flow.Block) { if (fobj instanceof org.apache.fop.fo.flow.Block) {
* @param returnList return list to add the additional elements to * @param returnList return list to add the additional elements to
* @param alignment vertical alignment * @param alignment vertical alignment
*/ */
protected void addKnuthElementsForSpaceBefore(LinkedList returnList/*,
protected void addKnuthElementsForSpaceBefore(List returnList/*,
Position returnPosition*/, int alignment) { Position returnPosition*/, int alignment) {
SpaceProperty spaceBefore = getSpaceBeforeProperty(); SpaceProperty spaceBefore = getSpaceBeforeProperty();
// append elements representing space-before // append elements representing space-before
* @param returnList return list to add the additional elements to * @param returnList return list to add the additional elements to
* @param alignment vertical alignment * @param alignment vertical alignment
*/ */
protected void addKnuthElementsForSpaceAfter(LinkedList returnList/*, Position returnPosition*/,
protected void addKnuthElementsForSpaceAfter(List returnList/*, Position returnPosition*/,
int alignment) { int alignment) {
SpaceProperty spaceAfter = getSpaceAfterProperty(); SpaceProperty spaceAfter = getSpaceAfterProperty();
// append elements representing space-after // append elements representing space-after
}*/ }*/
} }


protected LinkedList createUnitElements(LinkedList oldList) {
protected List createUnitElements(List oldList) {
//log.debug("Start conversion: " + oldList.size() //log.debug("Start conversion: " + oldList.size()
// + " elements, space-before.min=" + layoutProps.spaceBefore.getSpace().min // + " elements, space-before.min=" + layoutProps.spaceBefore.getSpace().min
// + " space-after.min=" + layoutProps.spaceAfter.getSpace().min); // + " space-after.min=" + layoutProps.spaceAfter.getSpace().min);
// add elements at the beginning and at the end of oldList // add elements at the beginning and at the end of oldList
// representing minimum spaces // representing minimum spaces
LayoutManager lm = ((KnuthElement)oldList.getFirst()).getLayoutManager();
LayoutManager lm = ((KnuthElement)oldList.get(0)).getLayoutManager();
boolean bAddedBoxBefore = false; boolean bAddedBoxBefore = false;
boolean bAddedBoxAfter = false; boolean bAddedBoxAfter = false;
if (adjustedSpaceBefore > 0) { if (adjustedSpaceBefore > 0) {
oldList.addFirst(new KnuthBox(adjustedSpaceBefore,
oldList.add(0, new KnuthBox(adjustedSpaceBefore,
new Position(lm), true)); new Position(lm), true));
bAddedBoxBefore = true; bAddedBoxBefore = true;
} }
if (adjustedSpaceAfter > 0) { if (adjustedSpaceAfter > 0) {
oldList.addLast(new KnuthBox(adjustedSpaceAfter,
oldList.add(new KnuthBox(adjustedSpaceAfter,
new Position(lm), true)); new Position(lm), true));
bAddedBoxAfter = true; bAddedBoxAfter = true;
} }
// remove elements at the beginning and at the end of oldList // remove elements at the beginning and at the end of oldList
// representing minimum spaces // representing minimum spaces
if (adjustedSpaceBefore > 0) { if (adjustedSpaceBefore > 0) {
oldList.removeFirst();
oldList.remove(0);
} }
if (adjustedSpaceAfter > 0) { if (adjustedSpaceAfter > 0) {
oldList.removeLast();
ListUtil.removeLast(oldList);
} }


// if space-before.conditionality is "discard", correct newList // if space-before.conditionality is "discard", correct newList
newList.addLast(new KnuthBox(wrongBox.getW() - decreasedLength, newList.addLast(new KnuthBox(wrongBox.getW() - decreasedLength,
wrongBox.getPosition(), false)); wrongBox.getPosition(), false));
// add preserved elements // add preserved elements
if (preserveList.size() > 0) {
if (!preserveList.isEmpty()) {
newList.addAll(preserveList); newList.addAll(preserveList);
} }
// insert the correct glue // insert the correct glue

+ 13
- 9
src/java/org/apache/fop/layoutmgr/ElementListUtils.java View File



package org.apache.fop.layoutmgr; package org.apache.fop.layoutmgr;


import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;


import org.apache.fop.traits.MinOptMax; import org.apache.fop.traits.MinOptMax;
import org.apache.fop.util.ListUtil;


/** /**
* Utilities for Knuth element lists. * Utilities for Knuth element lists.
*/ */
public class ElementListUtils {
public final class ElementListUtils {
private ElementListUtils() {
// Utility class.
}


/** /**
* Removes legal breaks in an element list. A constraint can be specified to limit the * Removes legal breaks in an element list. A constraint can be specified to limit the
* @param constraint min/opt/max value to restrict the range in which the breaks are removed. * @param constraint min/opt/max value to restrict the range in which the breaks are removed.
* @return true if the opt constraint is bigger than the list contents * @return true if the opt constraint is bigger than the list contents
*/ */
public static boolean removeLegalBreaks(LinkedList elements, MinOptMax constraint) {
public static boolean removeLegalBreaks(List elements, MinOptMax constraint) {
return removeLegalBreaks(elements, constraint.opt); return removeLegalBreaks(elements, constraint.opt);
} }


* @param constraint value to restrict the range in which the breaks are removed. * @param constraint value to restrict the range in which the breaks are removed.
* @return true if the constraint is bigger than the list contents * @return true if the constraint is bigger than the list contents
*/ */
public static boolean removeLegalBreaks(LinkedList elements, int constraint) {
public static boolean removeLegalBreaks(List elements, int constraint) {
int len = 0; int len = 0;
ListIterator iter = elements.listIterator(); ListIterator iter = elements.listIterator();
while (iter.hasNext()) { while (iter.hasNext()) {
* @param constraint value to restrict the range in which the breaks are removed. * @param constraint value to restrict the range in which the breaks are removed.
* @return true if the constraint is bigger than the list contents * @return true if the constraint is bigger than the list contents
*/ */
public static boolean removeLegalBreaksFromEnd(LinkedList elements, int constraint) {
public static boolean removeLegalBreaksFromEnd(List elements, int constraint) {
int len = 0; int len = 0;
ListIterator i = elements.listIterator(elements.size()); ListIterator i = elements.listIterator(elements.size());
while (i.hasPrevious()) { while (i.hasPrevious()) {
* @param elems the element list * @param elems the element list
* @return true if the list ends with a forced break * @return true if the list ends with a forced break
*/ */
public static boolean endsWithForcedBreak(LinkedList elems) {
ListElement last = (ListElement)elems.getLast();
public static boolean endsWithForcedBreak(List elems) {
ListElement last = (ListElement) ListUtil.getLast(elems);
return last.isForcedBreak(); return last.isForcedBreak();
} }


* @param elems the element list * @param elems the element list
* @return true if the list ends with a non-infinite penalty * @return true if the list ends with a non-infinite penalty
*/ */
public static boolean endsWithNonInfinitePenalty(LinkedList elems) {
ListElement last = (ListElement)elems.getLast();
public static boolean endsWithNonInfinitePenalty(List elems) {
ListElement last = (ListElement) ListUtil.getLast(elems);
if (last.isPenalty() && ((KnuthPenalty)last).getP() < KnuthElement.INFINITE) { if (last.isPenalty() && ((KnuthPenalty)last).getP() < KnuthElement.INFINITE) {
return true; return true;
} else if (last instanceof BreakElement } else if (last instanceof BreakElement

+ 10
- 9
src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java View File

} }


/** {@inheritDoc} */ /** {@inheritDoc} */
public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
public List getNextKnuthElements(LayoutContext context, int alignment) {


// set layout dimensions // set layout dimensions
int flowIPD = getCurrentPV().getCurrentSpan().getColumnWidth(); int flowIPD = getCurrentPV().getCurrentSpan().getColumnWidth();
int flowBPD = (int) getCurrentPV().getBodyRegion().getBPD();
int flowBPD = getCurrentPV().getBodyRegion().getBPD();


// currently active LM // currently active LM
LayoutManager curLM; LayoutManager curLM;
LinkedList returnedList;
LinkedList returnList = new LinkedList();
List returnedList;
List returnList = new LinkedList();


while ((curLM = getChildLM()) != null) { while ((curLM = getChildLM()) != null) {
if (!(curLM instanceof WrapperLayoutManager) if (!(curLM instanceof WrapperLayoutManager)
} }


// "wrap" the Position inside each element // "wrap" the Position inside each element
LinkedList tempList = returnedList;
List tempList = returnedList;
returnedList = new LinkedList(); returnedList = new LinkedList();
wrapPositionElements(tempList, returnedList); wrapPositionElements(tempList, returnedList);


} }
/** {@inheritDoc} */ /** {@inheritDoc} */
public LinkedList getChangedKnuthElements(List oldList, /*int flaggedPenalty,*/ int alignment) {
public List getChangedKnuthElements(List oldList, /*int flaggedPenalty,*/ int alignment) {
ListIterator oldListIterator = oldList.listIterator(); ListIterator oldListIterator = oldList.listIterator();
KnuthElement returnedElement; KnuthElement returnedElement;
LinkedList returnedList = new LinkedList();
LinkedList returnList = new LinkedList();
List returnedList = new LinkedList();
List returnList = new LinkedList();
KnuthElement prevElement = null; KnuthElement prevElement = null;
KnuthElement currElement = null; KnuthElement currElement = null;
int fromIndex = 0; int fromIndex = 0;
// add an infinite penalty to forbid a break between blocks // add an infinite penalty to forbid a break between blocks
returnedList.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, returnedList.add(new KnuthPenalty(0, KnuthElement.INFINITE, false,
new Position(this), false)); new Position(this), false));
} else if (!((KnuthElement) returnedList.getLast()).isGlue()) {
} else if (!((KnuthElement) returnedList.get(returnedList
.size() - 1)).isGlue()) {
// add a null penalty to allow a break between blocks // add a null penalty to allow a break between blocks
returnedList.add(new KnuthPenalty(0, 0, false, new Position(this), false)); returnedList.add(new KnuthPenalty(0, 0, false, new Position(this), false));
} }

+ 9
- 8
src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java View File



package org.apache.fop.layoutmgr; package org.apache.fop.layoutmgr;


import org.apache.fop.traits.MinOptMax;

import java.util.LinkedList; import java.util.LinkedList;
import java.util.List;

import org.apache.fop.traits.MinOptMax;


/** /**
* Knuth box used to represent a line in block-progression-dimension (i.e. the width is its height). * Knuth box used to represent a line in block-progression-dimension (i.e. the width is its height).
* it isn't possible to get the opt value stored in a MinOptMax object. * it isn't possible to get the opt value stored in a MinOptMax object.
*/ */
private int bpd; private int bpd;
private LinkedList footnoteList;
private List footnoteList;
/** List of Knuth elements. This is a list of LinkedList elements. */ /** List of Knuth elements. This is a list of LinkedList elements. */
private LinkedList elementLists = null;
private List elementLists = null;


/** /**
* Creates a new box. * Creates a new box.
* @param pos the Position stored in this box * @param pos the Position stored in this box
* @param bAux is this box auxiliary? * @param bAux is this box auxiliary?
*/ */
public KnuthBlockBox(int w, LinkedList list, Position pos, boolean bAux) {
public KnuthBlockBox(int w, List list, Position pos, boolean bAux) {
super(w, pos, bAux); super(w, pos, bAux);
ipdRange = new MinOptMax(0); ipdRange = new MinOptMax(0);
bpd = 0; bpd = 0;
/** /**
* @return the LMs for the footnotes cited in this box. * @return the LMs for the footnotes cited in this box.
*/ */
public LinkedList getFootnoteBodyLMs() {
public List getFootnoteBodyLMs() {
return footnoteList; return footnoteList;
} }


* Adds the given list of Knuth elements to this box' list of elements. * Adds the given list of Knuth elements to this box' list of elements.
* @param list elements corresponding to a footnote body * @param list elements corresponding to a footnote body
*/ */
public void addElementList(LinkedList list) {
public void addElementList(List list) {
if (elementLists == null) { if (elementLists == null) {
elementLists = new LinkedList(); elementLists = new LinkedList();
} }
* @return a list of KnuthElement sequences corresponding to footnotes cited in this * @return a list of KnuthElement sequences corresponding to footnotes cited in this
* box * box
*/ */
public LinkedList getElementLists() {
public List getElementLists() {
return elementLists; return elementLists;
} }



+ 4
- 5
src/java/org/apache/fop/layoutmgr/LayoutManager.java View File

package org.apache.fop.layoutmgr; package org.apache.fop.layoutmgr;


import java.util.LinkedList;
import java.util.List; import java.util.List;


import org.apache.fop.area.Area; import org.apache.fop.area.Area;
* of the node assigned to the LM * of the node assigned to the LM
* *
* @param context the LayoutContext used to store layout information * @param context the LayoutContext used to store layout information
* @param alignment the desired text alignement
* @param alignment the desired text alignment
* @return the list of KnuthElements * @return the list of KnuthElements
*/ */
LinkedList getNextKnuthElements(LayoutContext context, int alignment);
List getNextKnuthElements(LayoutContext context, int alignment);


/** /**
* Get a sequence of KnuthElements representing the content * Get a sequence of KnuthElements representing the content
* *
* In the context of line breaking, this method is called after hyphenation has * In the context of line breaking, this method is called after hyphenation has
* been performed, in order to receive the sequence of elements representing the * been performed, in order to receive the sequence of elements representing the
* text together with all possibile hyphenation points.
* text together with all possible hyphenation points.
* For example, if the text "representation" originates a single box element * For example, if the text "representation" originates a single box element
* when getNextKnuthElements() is called, it will be now split in syllables * when getNextKnuthElements() is called, it will be now split in syllables
* (rep-re-sen-ta-tion) each one originating a box and divided by additional * (rep-re-sen-ta-tion) each one originating a box and divided by additional
* @param alignment the desired text alignment * @param alignment the desired text alignment
* @return the updated list of KnuthElements * @return the updated list of KnuthElements
*/ */
LinkedList getChangedKnuthElements(List oldList, int alignment);
List getChangedKnuthElements(List oldList, int alignment);
/** /**
* Returns the IPD of the content area * Returns the IPD of the content area

+ 2
- 2
src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java View File

import org.apache.fop.fo.flow.ExternalGraphic; import org.apache.fop.fo.flow.ExternalGraphic;
import org.apache.fop.fo.flow.Footnote; import org.apache.fop.fo.flow.Footnote;
import org.apache.fop.fo.flow.Inline; import org.apache.fop.fo.flow.Inline;
import org.apache.fop.fo.flow.InlineLevel;
import org.apache.fop.fo.flow.InlineContainer; import org.apache.fop.fo.flow.InlineContainer;
import org.apache.fop.fo.flow.InlineLevel;
import org.apache.fop.fo.flow.InstreamForeignObject; import org.apache.fop.fo.flow.InstreamForeignObject;
import org.apache.fop.fo.flow.Leader; import org.apache.fop.fo.flow.Leader;
import org.apache.fop.fo.flow.ListBlock; import org.apache.fop.fo.flow.ListBlock;
public static class FOTextLayoutManagerMaker extends Maker { public static class FOTextLayoutManagerMaker extends Maker {
public void make(FONode node, List lms) { public void make(FONode node, List lms) {
FOText foText = (FOText) node; FOText foText = (FOText) node;
if (foText.endIndex - foText.startIndex > 0) {
if (foText.length() > 0) {
lms.add(new TextLayoutManager(foText)); lms.add(new TextLayoutManager(foText));
} }
} }

+ 3
- 3
src/java/org/apache/fop/layoutmgr/PageBreaker.java View File

} }
/** {@inheritDoc} */ /** {@inheritDoc} */
protected LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
LinkedList contentList = null;
protected List getNextKnuthElements(LayoutContext context, int alignment) {
List contentList = null;
while (!childFLM.isFinished() && contentList == null) { while (!childFLM.isFinished() && contentList == null) {
contentList = childFLM.getNextKnuthElements(context, alignment); contentList = childFLM.getNextKnuthElements(context, alignment);
footnoteContext.setStackLimitBP(context.getStackLimitBP()); footnoteContext.setStackLimitBP(context.getStackLimitBP());
footnoteContext.setRefIPD(pslm.getCurrentPV() footnoteContext.setRefIPD(pslm.getCurrentPV()
.getRegionReference(Constants.FO_REGION_BODY).getIPD()); .getRegionReference(Constants.FO_REGION_BODY).getIPD());
LinkedList footnoteBodyLMs = ((KnuthBlockBox) element).getFootnoteBodyLMs();
List footnoteBodyLMs = ((KnuthBlockBox) element).getFootnoteBodyLMs();
ListIterator footnoteBodyIterator = footnoteBodyLMs.listIterator(); ListIterator footnoteBodyIterator = footnoteBodyLMs.listIterator();
// store the lists of elements representing the footnote bodies // store the lists of elements representing the footnote bodies
// in the box representing the line containing their references // in the box representing the line containing their references

+ 0
- 0
src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save