diff options
-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> |