aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2006-01-25 14:08:37 +0000
committerJeremias Maerki <jeremias@apache.org>2006-01-25 14:08:37 +0000
commit24e4b22e766a2c70dd85ff133e05c1529b399bc6 (patch)
treed0b095566f569c0700f362ff072e5ad3c4774eb4 /src
parent3d1baf5455c62ebca26b523176690d304b637bec (diff)
downloadxmlgraphics-fop-24e4b22e766a2c70dd85ff133e05c1529b399bc6.tar.gz
xmlgraphics-fop-24e4b22e766a2c70dd85ff133e05c1529b399bc6.zip
To avoid NPEs due to my latest fix, use the default simple-page-master from the page-sequence-master if one is used.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@372220 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/render/rtf/RTFHandler.java28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/java/org/apache/fop/render/rtf/RTFHandler.java b/src/java/org/apache/fop/render/rtf/RTFHandler.java
index 3161c0ce1..7e558bab3 100644
--- a/src/java/org/apache/fop/render/rtf/RTFHandler.java
+++ b/src/java/org/apache/fop/render/rtf/RTFHandler.java
@@ -60,6 +60,7 @@ import org.apache.fop.fo.flow.TableHeader;
import org.apache.fop.fo.flow.TableRow;
import org.apache.fop.fo.pagination.Flow;
import org.apache.fop.fo.pagination.PageSequence;
+import org.apache.fop.fo.pagination.PageSequenceMaster;
import org.apache.fop.fo.pagination.Region;
import org.apache.fop.fo.pagination.SimplePageMaster;
import org.apache.fop.fo.pagination.StaticContent;
@@ -174,6 +175,20 @@ public class RTFHandler extends FOEventHandler {
*/
public void startPageSequence(PageSequence pageSeq) {
try {
+ //This is needed for region handling
+ if (this.pagemaster == null) {
+ String reference = pageSeq.getMasterReference();
+ this.pagemaster
+ = pageSeq.getRoot().getLayoutMasterSet().getSimplePageMaster(reference);
+ if (this.pagemaster == null) {
+ log.warn("Only simple-page-masters are supported on page-sequences: " + reference);
+ log.warn("Using default simple-page-master from page-sequence-master...");
+ PageSequenceMaster master
+ = pageSeq.getRoot().getLayoutMasterSet().getPageSequenceMaster(reference);
+ this.pagemaster = master.getNextSimplePageMaster(false, false, false);
+ }
+ }
+
if (bDefer) {
return;
}
@@ -181,19 +196,13 @@ public class RTFHandler extends FOEventHandler {
sect = docArea.newSection();
//read page size and margins, if specified
-
- String reference = pageSeq.getMasterReference();
-
- this.pagemaster
- = pageSeq.getRoot().getLayoutMasterSet().getSimplePageMaster(reference);
-
//only simple-page-master supported, so pagemaster may be null
if (pagemaster != null) {
sect.getRtfAttributes().set(
PageAttributesConverter.convertPageAttributes(
pagemaster));
} else {
- log.warn("Only simple-page-masters are supported on page-sequences: " + reference);
+ log.warn("No simple-page-master could be determined!");
}
builderContext.pushContainer(sect);
@@ -204,6 +213,9 @@ public class RTFHandler extends FOEventHandler {
// TODO could we throw Exception in all FOEventHandler events?
log.error("startPageSequence: " + ioe.getMessage());
//TODO throw new FOPException(ioe);
+ } catch (FOPException fope) {
+ // TODO could we throw Exception in all FOEventHandler events?
+ log.error("startPageSequence: " + fope.getMessage());
}
}
@@ -218,11 +230,13 @@ public class RTFHandler extends FOEventHandler {
//Now process all deferred FOs.
bDefer = false;
recurseFONode(pageSeq);
+ this.pagemaster = null;
bDefer = true;
return;
} else {
builderContext.popContainer();
+ this.pagemaster = null;
}
}