Merged revisions 636407-637074,637076-637118,637120-637790,637792-637856,637858-637992,637994-638047,638049-638307,638309-638315,638318-638936,638938-640888,640890-642905,642907-647402,647404-647536,647538-648983,648985-649005,649007-649013,649015-650549,650551-651301,651303-653536,653538-654452,654454-656285,656287-656523,656525-657519,657521-661579,661581-663481,663483-664691,664693-681285,681287-681290,681292-681298 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_95
........
r666635 | jeremias | 2008-06-11 14:18:53 +0200 (Mi, 11 Jun 2008) | 1 line
Fixed resolution handling inside AWT preview dialog.
........
r666662 | jeremias | 2008-06-11 15:33:20 +0200 (Mi, 11 Jun 2008) | 1 line
Some notes on RTF and print output.
........
r668533 | jeremias | 2008-06-17 09:57:55 +0200 (Di, 17 Jun 2008) | 2 lines
Bugzilla #45151:
Note on the "compiling" page that Ant 1.7 is required. The README file already points to this page.
........
r668534 | jeremias | 2008-06-17 09:58:40 +0200 (Di, 17 Jun 2008) | 2 lines
Update known issues.
Remove ApacheConEU logo.
........
r668550 | jeremias | 2008-06-17 10:05:22 +0200 (Di, 17 Jun 2008) | 2 lines
Bugzilla #45146:
Removed duplicate LICENSE.txt and Notice.txt from the JAR.
........
r668570 | jeremias | 2008-06-17 10:54:07 +0200 (Di, 17 Jun 2008) | 1 line
Wrong line number reported in the case of a line overflow.
........
r668641 | jeremias | 2008-06-17 14:59:25 +0200 (Di, 17 Jun 2008) | 1 line
Fixed potential NPE.
........
r669118 | jeremias | 2008-06-18 11:02:45 +0200 (Mi, 18 Jun 2008) | 4 lines
Bugzilla #44412:
Regression fix for empty pages caused by multiple collapsible breaks.
No more empty block areas if a break-before occurs on the first child of an FO to match the behaviour of tables and other FO implementations (clarification by XSL WG pending).
Added an accessor interface for break-before/-after to avoid long if..else lists in BlockStackingLayoutManager.
........
r669173 | jeremias | 2008-06-18 16:07:27 +0200 (Mi, 18 Jun 2008) | 7 lines
Bugzilla #44887:
Fixed potential multi-threading problem concerning the use of DecimalFormat.
Results from performance measurements in a separate test (operation repeated 100'000 times, exemplary):
shared static variable: ~220ms (old choice, problematic!)
always create new instance: ~480ms
ThreadLocal: ~220ms (new choice)
........
r669478 | jeremias | 2008-06-19 15:03:57 +0200 (Do, 19 Jun 2008) | 4 lines
Bugzilla #44412:
Improvements after Vincent's feedback:
Removal of the somewhat ugly Reference.
getBreakBefore() reduced to private visibility.
........
r670551 | jeremias | 2008-06-23 14:54:27 +0200 (Mo, 23 Jun 2008) | 3 lines
Use configured source and target resolution for foreign objects in RTF output.
Fixed intrinsic size calculation for SVG images when source resolution is not 72 dpi.
Fixed calculation of px2mm values in the SVG to G2D converter (used by RTF output).
........
r673750 | adelmelle | 2008-07-03 20:25:01 +0200 (Do, 03 Jul 2008) | 1 line
Fix for Bugzilla 45295 (already committed to the trunk with r672010, r672495 and r672496)
........
r674304 | jeremias | 2008-07-06 17:09:10 +0200 (So, 06 Jul 2008) | 18 lines
Bugzilla #43606:
column-width accepts percent values (proportional-column-width and % working)
Table width accepts percent values (100% of the page width as standard)
Nested tables are working
It is also possible to make nested tables with a higher depth than 3 without causing word to crash
Submitted by: Maximilan Aster <maximilian.aster.at.boc-eu.com>
Changes to the patch by Jeremias:
- Patch simplified (reuse of ColumnSetup from the layoutmgr package)
- Percentages and proportional-column-width didn't work properly in my tests -> fixed
- Adjustments for FOP code conventions
Bugzilla #43824:
page-number-citation working but has to be refreshed inside word to show the correct values
Submitted by: Maximilan Aster <maximilian.aster.at.boc-eu.com>
Changes to the patch by Jeremias:
- Adjustments for FOP code conventions
........
r674314 | jeremias | 2008-07-06 18:40:08 +0200 (So, 06 Jul 2008) | 7 lines
Bugzilla #43825:
leader supports fixed percent values for leader-length, most other properties
use-content, leader-pattern-width not implemented
Submitted by: Maximilan Aster <maximilian.aster.at.boc-eu.com>
Changes to the patch by Jeremias:
- Adjustments for FOP code conventions
........
r674317 | jeremias | 2008-07-06 18:44:43 +0200 (So, 06 Jul 2008) | 1 line
Doc update after RTF changes.
........
r675106 | jeremias | 2008-07-09 09:03:46 +0200 (Mi, 09 Jul 2008) | 2 lines
Bugzilla #45366:
Document missing feature.
........
r675150 | jeremias | 2008-07-09 14:56:41 +0200 (Mi, 09 Jul 2008) | 2 lines
Bugzilla #39980:
Fixed image scaling for RTF output.
........
r675151 | jeremias | 2008-07-09 14:57:06 +0200 (Mi, 09 Jul 2008) | 1 line
Removed unused code.
........
r675152 | jeremias | 2008-07-09 14:58:18 +0200 (Mi, 09 Jul 2008) | 1 line
Don't generate commands for default values.
........
r675707 | jeremias | 2008-07-10 21:58:27 +0200 (Do, 10 Jul 2008) | 1 line
Bugfix: -imagein didn't work because the stylesheet didn't get copied into fop.jar.
........
r680715 | jeremias | 2008-07-29 16:37:10 +0200 (Di, 29 Jul 2008) | 1 line
Found a surplus "pop state" which somehow causes a regression (fill color doesn't get properly reset) between 0.94 and 0.95. Shows in Barcode4J's fop-extension-demo.fo. The line has already been there in 0.94 but only shows in 0.95 probably due to an additional save/restore state pair added in PDFRenderer for reference areas after the block-container area refactoring.
........
r680820 | jeremias | 2008-07-29 22:02:14 +0200 (Di, 29 Jul 2008) | 2 lines
Bugzilla #41306:
The AWT Renderer is really not out-of-order capable.
........
r681284 | jeremias | 2008-07-31 08:47:49 +0200 (Do, 31 Jul 2008) | 1 line
Some updates to status.xml (I was not the only one working on the final release).
........
r681290 | jeremias | 2008-07-31 09:44:51 +0200 (Do, 31 Jul 2008) | 2 lines
Website updates for the 0.95 release.
The projectInfo plug-in of Forrest is not ideal for doing a bugfix release. It's not possible to combine the changes for two releases.
........
r681292 | jeremias | 2008-07-31 09:47:13 +0200 (Do, 31 Jul 2008) | 1 line
Disabling the ApacheCon ad for the release build.
........
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@681307 13f79535-47bb-0310-9956-ffa450edef68
преди 16 години Merged revisions 636407-637074,637076-637118,637120-637790,637792-637856,637858-637992,637994-638047,638049-638307,638309-638315,638318-638936,638938-640888,640890-642905,642907-647402,647404-647536,647538-648983,648985-649005,649007-649013,649015-650549,650551-651301,651303-653536,653538-654452,654454-656285,656287-656523,656525-657519,657521-661579,661581-663481,663483-664691,664693-681285,681287-681290,681292-681298 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_95
........
r666635 | jeremias | 2008-06-11 14:18:53 +0200 (Mi, 11 Jun 2008) | 1 line
Fixed resolution handling inside AWT preview dialog.
........
r666662 | jeremias | 2008-06-11 15:33:20 +0200 (Mi, 11 Jun 2008) | 1 line
Some notes on RTF and print output.
........
r668533 | jeremias | 2008-06-17 09:57:55 +0200 (Di, 17 Jun 2008) | 2 lines
Bugzilla #45151:
Note on the "compiling" page that Ant 1.7 is required. The README file already points to this page.
........
r668534 | jeremias | 2008-06-17 09:58:40 +0200 (Di, 17 Jun 2008) | 2 lines
Update known issues.
Remove ApacheConEU logo.
........
r668550 | jeremias | 2008-06-17 10:05:22 +0200 (Di, 17 Jun 2008) | 2 lines
Bugzilla #45146:
Removed duplicate LICENSE.txt and Notice.txt from the JAR.
........
r668570 | jeremias | 2008-06-17 10:54:07 +0200 (Di, 17 Jun 2008) | 1 line
Wrong line number reported in the case of a line overflow.
........
r668641 | jeremias | 2008-06-17 14:59:25 +0200 (Di, 17 Jun 2008) | 1 line
Fixed potential NPE.
........
r669118 | jeremias | 2008-06-18 11:02:45 +0200 (Mi, 18 Jun 2008) | 4 lines
Bugzilla #44412:
Regression fix for empty pages caused by multiple collapsible breaks.
No more empty block areas if a break-before occurs on the first child of an FO to match the behaviour of tables and other FO implementations (clarification by XSL WG pending).
Added an accessor interface for break-before/-after to avoid long if..else lists in BlockStackingLayoutManager.
........
r669173 | jeremias | 2008-06-18 16:07:27 +0200 (Mi, 18 Jun 2008) | 7 lines
Bugzilla #44887:
Fixed potential multi-threading problem concerning the use of DecimalFormat.
Results from performance measurements in a separate test (operation repeated 100'000 times, exemplary):
shared static variable: ~220ms (old choice, problematic!)
always create new instance: ~480ms
ThreadLocal: ~220ms (new choice)
........
r669478 | jeremias | 2008-06-19 15:03:57 +0200 (Do, 19 Jun 2008) | 4 lines
Bugzilla #44412:
Improvements after Vincent's feedback:
Removal of the somewhat ugly Reference.
getBreakBefore() reduced to private visibility.
........
r670551 | jeremias | 2008-06-23 14:54:27 +0200 (Mo, 23 Jun 2008) | 3 lines
Use configured source and target resolution for foreign objects in RTF output.
Fixed intrinsic size calculation for SVG images when source resolution is not 72 dpi.
Fixed calculation of px2mm values in the SVG to G2D converter (used by RTF output).
........
r673750 | adelmelle | 2008-07-03 20:25:01 +0200 (Do, 03 Jul 2008) | 1 line
Fix for Bugzilla 45295 (already committed to the trunk with r672010, r672495 and r672496)
........
r674304 | jeremias | 2008-07-06 17:09:10 +0200 (So, 06 Jul 2008) | 18 lines
Bugzilla #43606:
column-width accepts percent values (proportional-column-width and % working)
Table width accepts percent values (100% of the page width as standard)
Nested tables are working
It is also possible to make nested tables with a higher depth than 3 without causing word to crash
Submitted by: Maximilan Aster <maximilian.aster.at.boc-eu.com>
Changes to the patch by Jeremias:
- Patch simplified (reuse of ColumnSetup from the layoutmgr package)
- Percentages and proportional-column-width didn't work properly in my tests -> fixed
- Adjustments for FOP code conventions
Bugzilla #43824:
page-number-citation working but has to be refreshed inside word to show the correct values
Submitted by: Maximilan Aster <maximilian.aster.at.boc-eu.com>
Changes to the patch by Jeremias:
- Adjustments for FOP code conventions
........
r674314 | jeremias | 2008-07-06 18:40:08 +0200 (So, 06 Jul 2008) | 7 lines
Bugzilla #43825:
leader supports fixed percent values for leader-length, most other properties
use-content, leader-pattern-width not implemented
Submitted by: Maximilan Aster <maximilian.aster.at.boc-eu.com>
Changes to the patch by Jeremias:
- Adjustments for FOP code conventions
........
r674317 | jeremias | 2008-07-06 18:44:43 +0200 (So, 06 Jul 2008) | 1 line
Doc update after RTF changes.
........
r675106 | jeremias | 2008-07-09 09:03:46 +0200 (Mi, 09 Jul 2008) | 2 lines
Bugzilla #45366:
Document missing feature.
........
r675150 | jeremias | 2008-07-09 14:56:41 +0200 (Mi, 09 Jul 2008) | 2 lines
Bugzilla #39980:
Fixed image scaling for RTF output.
........
r675151 | jeremias | 2008-07-09 14:57:06 +0200 (Mi, 09 Jul 2008) | 1 line
Removed unused code.
........
r675152 | jeremias | 2008-07-09 14:58:18 +0200 (Mi, 09 Jul 2008) | 1 line
Don't generate commands for default values.
........
r675707 | jeremias | 2008-07-10 21:58:27 +0200 (Do, 10 Jul 2008) | 1 line
Bugfix: -imagein didn't work because the stylesheet didn't get copied into fop.jar.
........
r680715 | jeremias | 2008-07-29 16:37:10 +0200 (Di, 29 Jul 2008) | 1 line
Found a surplus "pop state" which somehow causes a regression (fill color doesn't get properly reset) between 0.94 and 0.95. Shows in Barcode4J's fop-extension-demo.fo. The line has already been there in 0.94 but only shows in 0.95 probably due to an additional save/restore state pair added in PDFRenderer for reference areas after the block-container area refactoring.
........
r680820 | jeremias | 2008-07-29 22:02:14 +0200 (Di, 29 Jul 2008) | 2 lines
Bugzilla #41306:
The AWT Renderer is really not out-of-order capable.
........
r681284 | jeremias | 2008-07-31 08:47:49 +0200 (Do, 31 Jul 2008) | 1 line
Some updates to status.xml (I was not the only one working on the final release).
........
r681290 | jeremias | 2008-07-31 09:44:51 +0200 (Do, 31 Jul 2008) | 2 lines
Website updates for the 0.95 release.
The projectInfo plug-in of Forrest is not ideal for doing a bugfix release. It's not possible to combine the changes for two releases.
........
r681292 | jeremias | 2008-07-31 09:47:13 +0200 (Do, 31 Jul 2008) | 1 line
Disabling the ApacheCon ad for the release build.
........
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@681307 13f79535-47bb-0310-9956-ffa450edef68
преди 16 години Merged revisions 636407-637074,637076-637118,637120-637790,637792-637856,637858-637992,637994-638047,638049-638307,638309-638315,638318-638936,638938-640888,640890-642905,642907-647402,647404-647536,647538-648983,648985-649005,649007-649013,649015-650549,650551-651301,651303-653536,653538-654452,654454-656285,656287-656523,656525-657519,657521-661579,661581-663481,663483-664691,664693-681285,681287-681290,681292-681298 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_95
........
r666635 | jeremias | 2008-06-11 14:18:53 +0200 (Mi, 11 Jun 2008) | 1 line
Fixed resolution handling inside AWT preview dialog.
........
r666662 | jeremias | 2008-06-11 15:33:20 +0200 (Mi, 11 Jun 2008) | 1 line
Some notes on RTF and print output.
........
r668533 | jeremias | 2008-06-17 09:57:55 +0200 (Di, 17 Jun 2008) | 2 lines
Bugzilla #45151:
Note on the "compiling" page that Ant 1.7 is required. The README file already points to this page.
........
r668534 | jeremias | 2008-06-17 09:58:40 +0200 (Di, 17 Jun 2008) | 2 lines
Update known issues.
Remove ApacheConEU logo.
........
r668550 | jeremias | 2008-06-17 10:05:22 +0200 (Di, 17 Jun 2008) | 2 lines
Bugzilla #45146:
Removed duplicate LICENSE.txt and Notice.txt from the JAR.
........
r668570 | jeremias | 2008-06-17 10:54:07 +0200 (Di, 17 Jun 2008) | 1 line
Wrong line number reported in the case of a line overflow.
........
r668641 | jeremias | 2008-06-17 14:59:25 +0200 (Di, 17 Jun 2008) | 1 line
Fixed potential NPE.
........
r669118 | jeremias | 2008-06-18 11:02:45 +0200 (Mi, 18 Jun 2008) | 4 lines
Bugzilla #44412:
Regression fix for empty pages caused by multiple collapsible breaks.
No more empty block areas if a break-before occurs on the first child of an FO to match the behaviour of tables and other FO implementations (clarification by XSL WG pending).
Added an accessor interface for break-before/-after to avoid long if..else lists in BlockStackingLayoutManager.
........
r669173 | jeremias | 2008-06-18 16:07:27 +0200 (Mi, 18 Jun 2008) | 7 lines
Bugzilla #44887:
Fixed potential multi-threading problem concerning the use of DecimalFormat.
Results from performance measurements in a separate test (operation repeated 100'000 times, exemplary):
shared static variable: ~220ms (old choice, problematic!)
always create new instance: ~480ms
ThreadLocal: ~220ms (new choice)
........
r669478 | jeremias | 2008-06-19 15:03:57 +0200 (Do, 19 Jun 2008) | 4 lines
Bugzilla #44412:
Improvements after Vincent's feedback:
Removal of the somewhat ugly Reference.
getBreakBefore() reduced to private visibility.
........
r670551 | jeremias | 2008-06-23 14:54:27 +0200 (Mo, 23 Jun 2008) | 3 lines
Use configured source and target resolution for foreign objects in RTF output.
Fixed intrinsic size calculation for SVG images when source resolution is not 72 dpi.
Fixed calculation of px2mm values in the SVG to G2D converter (used by RTF output).
........
r673750 | adelmelle | 2008-07-03 20:25:01 +0200 (Do, 03 Jul 2008) | 1 line
Fix for Bugzilla 45295 (already committed to the trunk with r672010, r672495 and r672496)
........
r674304 | jeremias | 2008-07-06 17:09:10 +0200 (So, 06 Jul 2008) | 18 lines
Bugzilla #43606:
column-width accepts percent values (proportional-column-width and % working)
Table width accepts percent values (100% of the page width as standard)
Nested tables are working
It is also possible to make nested tables with a higher depth than 3 without causing word to crash
Submitted by: Maximilan Aster <maximilian.aster.at.boc-eu.com>
Changes to the patch by Jeremias:
- Patch simplified (reuse of ColumnSetup from the layoutmgr package)
- Percentages and proportional-column-width didn't work properly in my tests -> fixed
- Adjustments for FOP code conventions
Bugzilla #43824:
page-number-citation working but has to be refreshed inside word to show the correct values
Submitted by: Maximilan Aster <maximilian.aster.at.boc-eu.com>
Changes to the patch by Jeremias:
- Adjustments for FOP code conventions
........
r674314 | jeremias | 2008-07-06 18:40:08 +0200 (So, 06 Jul 2008) | 7 lines
Bugzilla #43825:
leader supports fixed percent values for leader-length, most other properties
use-content, leader-pattern-width not implemented
Submitted by: Maximilan Aster <maximilian.aster.at.boc-eu.com>
Changes to the patch by Jeremias:
- Adjustments for FOP code conventions
........
r674317 | jeremias | 2008-07-06 18:44:43 +0200 (So, 06 Jul 2008) | 1 line
Doc update after RTF changes.
........
r675106 | jeremias | 2008-07-09 09:03:46 +0200 (Mi, 09 Jul 2008) | 2 lines
Bugzilla #45366:
Document missing feature.
........
r675150 | jeremias | 2008-07-09 14:56:41 +0200 (Mi, 09 Jul 2008) | 2 lines
Bugzilla #39980:
Fixed image scaling for RTF output.
........
r675151 | jeremias | 2008-07-09 14:57:06 +0200 (Mi, 09 Jul 2008) | 1 line
Removed unused code.
........
r675152 | jeremias | 2008-07-09 14:58:18 +0200 (Mi, 09 Jul 2008) | 1 line
Don't generate commands for default values.
........
r675707 | jeremias | 2008-07-10 21:58:27 +0200 (Do, 10 Jul 2008) | 1 line
Bugfix: -imagein didn't work because the stylesheet didn't get copied into fop.jar.
........
r680715 | jeremias | 2008-07-29 16:37:10 +0200 (Di, 29 Jul 2008) | 1 line
Found a surplus "pop state" which somehow causes a regression (fill color doesn't get properly reset) between 0.94 and 0.95. Shows in Barcode4J's fop-extension-demo.fo. The line has already been there in 0.94 but only shows in 0.95 probably due to an additional save/restore state pair added in PDFRenderer for reference areas after the block-container area refactoring.
........
r680820 | jeremias | 2008-07-29 22:02:14 +0200 (Di, 29 Jul 2008) | 2 lines
Bugzilla #41306:
The AWT Renderer is really not out-of-order capable.
........
r681284 | jeremias | 2008-07-31 08:47:49 +0200 (Do, 31 Jul 2008) | 1 line
Some updates to status.xml (I was not the only one working on the final release).
........
r681290 | jeremias | 2008-07-31 09:44:51 +0200 (Do, 31 Jul 2008) | 2 lines
Website updates for the 0.95 release.
The projectInfo plug-in of Forrest is not ideal for doing a bugfix release. It's not possible to combine the changes for two releases.
........
r681292 | jeremias | 2008-07-31 09:47:13 +0200 (Do, 31 Jul 2008) | 1 line
Disabling the ApacheCon ad for the release build.
........
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@681307 13f79535-47bb-0310-9956-ffa450edef68
преди 16 години |
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469 |
- /*
- * 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.render.rtf.rtflib.rtfdoc;
-
- // Java
- import java.io.IOException;
- import java.io.Writer;
- import java.util.Iterator;
- import java.util.List;
- import java.util.ListIterator;
-
- // FOP
- import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfExternalGraphic;
-
- /**
- * Class which contains a linear text run. It has methods to add attributes,
- * text, paragraph breaks....
- * @author Peter Herweg, pherweg@web.de
- */
- public class RtfTextrun extends RtfContainer {
- private boolean bSuppressLastPar = false;
- private RtfListItem rtfListItem;
-
- /** Manager for handling space-* property. */
- private RtfSpaceManager rtfSpaceManager = new RtfSpaceManager();
-
- /** Class which represents the opening of a RTF group mark.*/
- private class RtfOpenGroupMark extends RtfElement {
-
- RtfOpenGroupMark(RtfContainer parent, Writer w, RtfAttributes attr)
- throws IOException {
- super(parent, w, attr);
- }
-
- /**
- * @return true if this element would generate no "useful" RTF content
- */
- public boolean isEmpty() {
- return false;
- }
-
- /**
- * write RTF code of all our children
- * @throws IOException for I/O problems
- */
- protected void writeRtfContent() throws IOException {
- writeGroupMark(true);
- writeAttributes(getRtfAttributes(), null);
- }
- }
-
- /** Class which represents the closing of a RTF group mark.*/
- private class RtfCloseGroupMark extends RtfElement {
-
- RtfCloseGroupMark(RtfContainer parent, Writer w)
- throws IOException {
- super(parent, w);
- }
-
- /**
- * @return true if this element would generate no "useful" RTF content
- */
- public boolean isEmpty() {
- return false;
- }
-
- /**
- * write RTF code of all our children
- * @throws IOException for I/O problems
- */
- protected void writeRtfContent() throws IOException {
- writeGroupMark(false);
- }
- }
-
- /** Class which represents a paragraph break.*/
- private class RtfParagraphBreak extends RtfElement {
-
- RtfParagraphBreak(RtfContainer parent, Writer w)
- throws IOException {
- super(parent, w);
- }
-
- /**
- * @return true if this element would generate no "useful" RTF content
- */
- public boolean isEmpty() {
- return false;
- }
-
- /**
- * write RTF code of all our children
- * @throws IOException for I/O problems
- */
- protected void writeRtfContent() throws IOException {
- writeControlWord("par");
- }
- }
-
- /** Create an RTF container as a child of given container */
- RtfTextrun(RtfContainer parent, Writer w, RtfAttributes attrs) throws IOException {
- super(parent, w, attrs);
- }
-
-
- /**
- * Adds instance of <code>OpenGroupMark</code> as a child with attributes.
- *
- * @param attrs attributes to add
- * @throws IOException for I/O problems
- */
- private void addOpenGroupMark(RtfAttributes attrs) throws IOException {
- RtfOpenGroupMark r = new RtfOpenGroupMark(this, writer, attrs);
- }
-
- /**
- * Adds instance of <code>CloseGroupMark</code> as a child.
- *
- * @throws IOException for I/O problems
- */
- private void addCloseGroupMark() throws IOException {
- RtfCloseGroupMark r = new RtfCloseGroupMark(this, writer);
- }
-
- /**
- * Pushes block attributes, notifies all opened blocks about pushing block
- * attributes, adds <code>OpenGroupMark</code> as a child.
- *
- * @param attrs the block attributes to push
- * @throws IOException for I/O problems
- */
- public void pushBlockAttributes(RtfAttributes attrs) throws IOException {
- rtfSpaceManager.stopUpdatingSpaceBefore();
- RtfSpaceSplitter splitter = rtfSpaceManager.pushRtfSpaceSplitter(attrs);
- addOpenGroupMark(splitter.getCommonAttributes());
- }
-
- /**
- * Pops block attributes, notifies all opened blocks about pushing block
- * attributes, adds <code>CloseGroupMark</code> as a child.
- *
- * @throws IOException for I/O problems
- */
- public void popBlockAttributes() throws IOException {
- rtfSpaceManager.popRtfSpaceSplitter();
- rtfSpaceManager.stopUpdatingSpaceBefore();
- addCloseGroupMark();
- }
-
- /**
- * Pushes inline attributes.
- *
- * @param attrs the inline attributes to push
- * @throws IOException for I/O problems
- */
- public void pushInlineAttributes(RtfAttributes attrs) throws IOException {
- rtfSpaceManager.pushInlineAttributes(attrs);
- addOpenGroupMark(attrs);
- }
-
- /**
- * Inserts a page number citation.
- * @param refId the identifier being referenced
- * @throws IOException for I/O problems
- */
- public void addPageNumberCitation(String refId) throws IOException {
- RtfPageNumberCitation r = new RtfPageNumberCitation(this, writer, refId);
- }
-
- /**
- * Pop inline attributes.
- *
- * @throws IOException for I/O problems
- */
- public void popInlineAttributes() throws IOException {
- rtfSpaceManager.popInlineAttributes();
- addCloseGroupMark();
- }
-
- /**
- * Add string to children list.
- *
- * @param s string to add
- * @throws IOException for I/O problems
- */
- public void addString(String s) throws IOException {
- if (s.equals("")) {
- return;
- }
- RtfAttributes attrs = rtfSpaceManager.getLastInlineAttribute();
- //add RtfSpaceSplitter to inherit accumulated space
- rtfSpaceManager.pushRtfSpaceSplitter(attrs);
- rtfSpaceManager.setCandidate(attrs);
- RtfString r = new RtfString(this, writer, s);
- rtfSpaceManager.popRtfSpaceSplitter();
- }
-
- /**
- * Inserts a footnote.
- *
- * @return inserted footnote
- * @throws IOException for I/O problems
- */
- public RtfFootnote addFootnote() throws IOException {
- return new RtfFootnote(this, writer);
- }
-
- /**
- * Inserts paragraph break before all close group marks.
- *
- * @throws IOException for I/O problems
- */
- public void addParagraphBreak() throws IOException {
- // get copy of children list
- List children = getChildren();
-
- // delete all previous CloseGroupMark
- int deletedCloseGroupCount = 0;
-
- ListIterator lit = children.listIterator(children.size());
- while (lit.hasPrevious()
- && (lit.previous() instanceof RtfCloseGroupMark)) {
- lit.remove();
- deletedCloseGroupCount++;
- }
-
- if (children.size() != 0) {
- // add paragraph break and restore all deleted close group marks
- setChildren(children);
- new RtfParagraphBreak(this, writer);
- for (int i = 0; i < deletedCloseGroupCount; i++) {
- addCloseGroupMark();
- }
- }
- }
-
- /**
- * Inserts a leader.
- * @param attrs Attributes for the leader
- * @throws IOException for I/O problems
- */
- public void addLeader(RtfAttributes attrs) throws IOException {
- new RtfLeader(this, writer, attrs);
- }
-
- /**
- * Inserts a page number.
- * @param attr Attributes for the page number to insert.
- * @throws IOException for I/O problems
- */
- public void addPageNumber(RtfAttributes attr) throws IOException {
- RtfPageNumber r = new RtfPageNumber(this, writer, attr);
- }
-
- /**
- * Inserts a hyperlink.
- * @param attr Attributes for the hyperlink to insert.
- * @return inserted hyperlink
- * @throws IOException for I/O problems
- */
- public RtfHyperLink addHyperlink(RtfAttributes attr) throws IOException {
- return new RtfHyperLink(this, writer, attr);
- }
-
- /**
- * Inserts a bookmark.
- * @param id Id for the inserted bookmark
- * @throws IOException for I/O problems
- */
- public void addBookmark(String id) throws IOException {
- if (id != "") {
- // if id is not empty, add boormark
- new RtfBookmark(this, writer, id);
- }
- }
-
- /**
- * Inserts an image.
- * @return inserted image
- * @throws IOException for I/O problems
- */
- public RtfExternalGraphic newImage() throws IOException {
- return new RtfExternalGraphic(this, writer);
- }
-
- /**
- * Adds a new RtfTextrun to the given container if necessary, and returns it.
- * @param container RtfContainer, which is the parent of the returned RtfTextrun
- * @param writer Writer of the given RtfContainer
- * @param attrs RtfAttributes which are to write at the beginning of the RtfTextrun
- * @return new or existing RtfTextrun object.
- * @throws IOException for I/O problems
- */
- public static RtfTextrun getTextrun(RtfContainer container, Writer writer, RtfAttributes attrs)
- throws IOException {
-
- List list = container.getChildren();
-
- if (list.size() == 0) {
- //add a new RtfTextrun
- RtfTextrun textrun = new RtfTextrun(container, writer, attrs);
- list.add(textrun);
-
- return textrun;
- }
-
- Object obj = list.get(list.size() - 1);
-
- if (obj instanceof RtfTextrun) {
- //if the last child is a RtfTextrun, return it
- return (RtfTextrun) obj;
- }
-
- //add a new RtfTextrun as the last child
- RtfTextrun textrun = new RtfTextrun(container, writer, attrs);
- list.add(textrun);
-
- return textrun;
- }
-
- /**
- * specify, if the last paragraph control word (\par) should be suppressed.
- * @param bSuppress true, if the last \par should be suppressed
- */
- public void setSuppressLastPar(boolean bSuppress) {
- bSuppressLastPar = bSuppress;
- }
-
- /**
- * write RTF code of all our children
- * @throws IOException for I/O problems
- */
- protected void writeRtfContent() throws IOException {
- /**
- *TODO: The textrun's children are iterated twice:
- * 1. To determine the last RtfParagraphBreak
- * 2. To write the children
- * Maybe this can be done more efficient.
- */
-
- boolean bHasTableCellParent =
- this.getParentOfClass(RtfTableCell.class) != null;
- RtfAttributes attrBlockLevel = new RtfAttributes();
-
- //determine, if this RtfTextrun is the last child of its parent
- boolean bLast = false;
- for (Iterator it = parent.getChildren().iterator(); it.hasNext();) {
- if (it.next() == this) {
- bLast = !it.hasNext();
- break;
- }
- }
-
- //get last RtfParagraphBreak, which is not followed by any visible child
- RtfParagraphBreak lastParagraphBreak = null;
- if (bLast) {
- for (Iterator it = getChildren().iterator(); it.hasNext();) {
- final RtfElement e = (RtfElement)it.next();
- if (e instanceof RtfParagraphBreak) {
- lastParagraphBreak = (RtfParagraphBreak)e;
- } else {
- if (!(e instanceof RtfOpenGroupMark)
- && !(e instanceof RtfCloseGroupMark)
- && e.isEmpty()) {
- lastParagraphBreak = null;
- }
- }
- }
- }
-
- //may contain for example \intbl
- writeAttributes(attrib, null);
-
- if (rtfListItem != null) {
- rtfListItem.getRtfListStyle().writeParagraphPrefix(this);
- }
-
- //write all children
- boolean bPrevPar = false;
- boolean bFirst = true;
- for (Iterator it = getChildren().iterator(); it.hasNext();) {
- final RtfElement e = (RtfElement)it.next();
- final boolean bRtfParagraphBreak = (e instanceof RtfParagraphBreak);
-
- if (bHasTableCellParent) {
- attrBlockLevel.set(e.getRtfAttributes());
- }
-
-
- /**
- * -Write RtfParagraphBreak only, if the previous visible child
- * was't also a RtfParagraphBreak.
- * -Write RtfParagraphBreak only, if it is not the first visible
- * child.
- * -If the RtfTextrun is the last child of its parent, write a
- * RtfParagraphBreak only, if it is not the last child.
- */
- boolean bHide = false;
- bHide = bRtfParagraphBreak;
- bHide = bHide
- && (bPrevPar
- || bFirst
- || (bSuppressLastPar && bLast && lastParagraphBreak != null
- && e == lastParagraphBreak));
-
- if (!bHide) {
- newLine();
- e.writeRtf();
-
- if (rtfListItem != null && e instanceof RtfParagraphBreak) {
- rtfListItem.getRtfListStyle().writeParagraphPrefix(this);
- }
- }
-
- if (e instanceof RtfParagraphBreak) {
- bPrevPar = true;
- } else if (e instanceof RtfCloseGroupMark) {
- //do nothing
- } else if (e instanceof RtfOpenGroupMark) {
- //do nothing
- } else {
- bPrevPar = bPrevPar && e.isEmpty();
- bFirst = bFirst && e.isEmpty();
- }
- } //for (Iterator it = ...)
-
- //
- if (bHasTableCellParent) {
- writeAttributes(attrBlockLevel, null);
- }
-
- }
-
- /**
- * Set the parent list-item of the textrun.
- *
- * @param listItem parent list-item of the textrun
- */
- public void setRtfListItem(RtfListItem listItem) {
- rtfListItem = listItem;
- }
-
- /**
- * Gets the parent list-item of the textrun.
- *
- * @return parent list-item of the textrun
- */
- public RtfListItem getRtfListItem() {
- return rtfListItem;
- }
- }
-
|