You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by cb...@apache.org on 2011/04/19 15:49:40 UTC
svn commit: r1095086 - in /xmlgraphics/fop/trunk:
src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java status.xml
Author: cbowditch
Date: Tue Apr 19 13:49:40 2011
New Revision: 1095086
URL: http://svn.apache.org/viewvc?rev=1095086&view=rev
Log:
Bugzilla #51010: Bookmarks create useless lines in RTF
Patch submitted by Max Aster
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java
xmlgraphics/fop/trunk/status.xml
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java?rev=1095086&r1=1095085&r2=1095086&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java Tue Apr 19 13:49:40 2011
@@ -437,10 +437,16 @@ public class RtfTextrun extends RtfConta
//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 RtfConta
lastParagraphBreak = null;
}
}
+ aBefore = e;
}
}
@@ -460,6 +467,7 @@ public class RtfTextrun extends RtfConta
//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 RtfConta
&& (bPrevPar
|| bFirst
|| (bSuppressLastPar && bLast && lastParagraphBreak != null
- && e == lastParagraphBreak));
+ && e == lastParagraphBreak)
+ || bBookmark);
if (!bHide) {
newLine();
@@ -497,6 +506,8 @@ public class RtfTextrun extends RtfConta
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 RtfConta
} else {
bPrevPar = bPrevPar && e.isEmpty();
bFirst = bFirst && e.isEmpty();
+ bBookmark = false;
}
} //for (Iterator it = ...)
Modified: xmlgraphics/fop/trunk/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=1095086&r1=1095085&r2=1095086&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Tue Apr 19 13:49:40 2011
@@ -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>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org