diff options
author | Chris Bowditch <cbowditch@apache.org> | 2011-04-19 13:49:40 +0000 |
---|---|---|
committer | Chris Bowditch <cbowditch@apache.org> | 2011-04-19 13:49:40 +0000 |
commit | c98714481006753bd1add759440b5c9a2e875b14 (patch) | |
tree | b83ec3891520c9c6cee10c1ae90d409d45b577f5 | |
parent | 81125d40f04e276caa3f57e3be31da78981f2c2a (diff) | |
download | xmlgraphics-fop-c98714481006753bd1add759440b5c9a2e875b14.tar.gz xmlgraphics-fop-c98714481006753bd1add759440b5c9a2e875b14.zip |
Bugzilla #51010: Bookmarks create useless lines in RTF
Patch submitted by Max Aster
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1095086 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java | 16 | ||||
-rw-r--r-- | status.xml | 3 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java index 7a9245dd5..0cbd1f686 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java @@ -437,10 +437,16 @@ public class RtfTextrun extends RtfContainer { //get last RtfParagraphBreak, which is not followed by any visible child RtfParagraphBreak lastParagraphBreak = null; if (bLast) { + RtfElement aBefore = null; for (Iterator it = getChildren().iterator(); it.hasNext();) { final RtfElement e = (RtfElement)it.next(); if (e instanceof RtfParagraphBreak) { - lastParagraphBreak = (RtfParagraphBreak)e; + //If the element before was a paragraph break or a bookmark + //they will be hidden and are therefore not considered as visible + if (!(aBefore instanceof RtfParagraphBreak) + && !(aBefore instanceof RtfBookmark)) { + lastParagraphBreak = (RtfParagraphBreak)e; + } } else { if (!(e instanceof RtfOpenGroupMark) && !(e instanceof RtfCloseGroupMark) @@ -448,6 +454,7 @@ public class RtfTextrun extends RtfContainer { lastParagraphBreak = null; } } + aBefore = e; } } @@ -460,6 +467,7 @@ public class RtfTextrun extends RtfContainer { //write all children boolean bPrevPar = false; + boolean bBookmark = false; boolean bFirst = true; for (Iterator it = getChildren().iterator(); it.hasNext();) { final RtfElement e = (RtfElement)it.next(); @@ -484,7 +492,8 @@ public class RtfTextrun extends RtfContainer { && (bPrevPar || bFirst || (bSuppressLastPar && bLast && lastParagraphBreak != null - && e == lastParagraphBreak)); + && e == lastParagraphBreak) + || bBookmark); if (!bHide) { newLine(); @@ -497,6 +506,8 @@ public class RtfTextrun extends RtfContainer { if (e instanceof RtfParagraphBreak) { bPrevPar = true; + } else if (e instanceof RtfBookmark) { + bBookmark = true; } else if (e instanceof RtfCloseGroupMark) { //do nothing } else if (e instanceof RtfOpenGroupMark) { @@ -504,6 +515,7 @@ public class RtfTextrun extends RtfContainer { } else { bPrevPar = bPrevPar && e.isEmpty(); bFirst = bFirst && e.isEmpty(); + bBookmark = false; } } //for (Iterator it = ...) diff --git a/status.xml b/status.xml index 12aade2fc..23dedd018 100644 --- a/status.xml +++ b/status.xml @@ -59,6 +59,9 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> <release version="FOP Trunk" date="TBD"> + <action context="Renderers" dev="CB" type="fix" fixes-bug="51010" due-to="Max Aster"> + Bugzilla 51010: Bookmarks create useless lines in RTF + </action> <action context="Renderers" dev="CB" type="fix" fixes-bug="51008" due-to="Max Aster"> Bugzilla 51008: page-number-citation-last does not work in RTF </action> |