diff options
Diffstat (limited to 'src/sandbox/org')
8 files changed, 29 insertions, 46 deletions
diff --git a/src/sandbox/org/apache/fop/render/mif/MIFHandler.java b/src/sandbox/org/apache/fop/render/mif/MIFHandler.java index 5ef4c0940..008c090e4 100644 --- a/src/sandbox/org/apache/fop/render/mif/MIFHandler.java +++ b/src/sandbox/org/apache/fop/render/mif/MIFHandler.java @@ -57,7 +57,6 @@ import org.apache.fop.fo.pagination.PageSequenceMaster; import org.apache.fop.fo.pagination.SimplePageMaster; import org.apache.fop.fo.pagination.StaticContent; import org.apache.fop.fonts.FontSetup; -import org.apache.fop.render.DefaultFontResolver; // TODO: do we really want every method throwing a SAXException @@ -91,7 +90,7 @@ public class MIFHandler extends FOEventHandler { super(ua); outStream = os; boolean base14Kerning = false; //TODO - FIXME - FontSetup.setup(fontInfo, null, new DefaultFontResolver(ua), base14Kerning); + FontSetup.setup(fontInfo, null, ua.getResourceResolver(), base14Kerning); } /** {@inheritDoc} */ diff --git a/src/sandbox/org/apache/fop/render/svg/AbstractSVGDocumentHandler.java b/src/sandbox/org/apache/fop/render/svg/AbstractSVGDocumentHandler.java index fbb6728ca..091d904e5 100644 --- a/src/sandbox/org/apache/fop/render/svg/AbstractSVGDocumentHandler.java +++ b/src/sandbox/org/apache/fop/render/svg/AbstractSVGDocumentHandler.java @@ -28,6 +28,7 @@ import org.apache.xmlgraphics.xmp.Metadata; import org.apache.fop.fonts.FontInfo; import org.apache.fop.render.intermediate.AbstractXMLWritingIFDocumentHandler; +import org.apache.fop.render.intermediate.IFContext; import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator; import org.apache.fop.render.intermediate.IFException; import org.apache.fop.render.intermediate.IFState; @@ -53,6 +54,10 @@ public abstract class AbstractSVGDocumentHandler extends AbstractXMLWritingIFDoc private int mode = MODE_NORMAL; + public AbstractSVGDocumentHandler(IFContext context) { + super(context); + } + /** {@inheritDoc} */ protected String getMainNamespace() { return NAMESPACE; diff --git a/src/sandbox/org/apache/fop/render/svg/SVGDocumentHandler.java b/src/sandbox/org/apache/fop/render/svg/SVGDocumentHandler.java index 6fd4d3618..12dd948e5 100644 --- a/src/sandbox/org/apache/fop/render/svg/SVGDocumentHandler.java +++ b/src/sandbox/org/apache/fop/render/svg/SVGDocumentHandler.java @@ -38,7 +38,6 @@ import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; import org.w3c.dom.Document; - import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; @@ -48,6 +47,7 @@ import org.apache.commons.io.IOUtils; import org.apache.fop.render.bitmap.BitmapRendererEventProducer; import org.apache.fop.render.bitmap.MultiFileRenderingUtil; import org.apache.fop.render.intermediate.DelegatingFragmentContentHandler; +import org.apache.fop.render.intermediate.IFContext; import org.apache.fop.render.intermediate.IFException; import org.apache.fop.render.intermediate.IFPainter; import org.apache.fop.util.GenerationHelperContentHandler; @@ -73,8 +73,8 @@ public class SVGDocumentHandler extends AbstractSVGDocumentHandler { /** * Default constructor. */ - public SVGDocumentHandler() { - //nop + public SVGDocumentHandler(IFContext context) { + super(context); } /** {@inheritDoc} */ diff --git a/src/sandbox/org/apache/fop/render/svg/SVGDocumentHandlerMaker.java b/src/sandbox/org/apache/fop/render/svg/SVGDocumentHandlerMaker.java index 1f2120234..75fc8b70e 100644 --- a/src/sandbox/org/apache/fop/render/svg/SVGDocumentHandlerMaker.java +++ b/src/sandbox/org/apache/fop/render/svg/SVGDocumentHandlerMaker.java @@ -19,7 +19,6 @@ package org.apache.fop.render.svg; -import org.apache.fop.apps.FOUserAgent; import org.apache.fop.render.intermediate.AbstractIFDocumentHandlerMaker; import org.apache.fop.render.intermediate.IFContext; import org.apache.fop.render.intermediate.IFDocumentHandler; @@ -32,10 +31,8 @@ public class SVGDocumentHandlerMaker extends AbstractIFDocumentHandlerMaker { private static final String[] MIMES = new String[] {SVGConstants.MIME_TYPE}; /** {@inheritDoc} */ - public IFDocumentHandler makeIFDocumentHandler(FOUserAgent ua) { - SVGDocumentHandler handler = new SVGDocumentHandler(); - handler.setContext(new IFContext(ua)); - return handler; + public IFDocumentHandler makeIFDocumentHandler(IFContext ifContext) { + return new SVGDocumentHandler(ifContext); } /** {@inheritDoc} */ diff --git a/src/sandbox/org/apache/fop/render/svg/SVGPainter.java b/src/sandbox/org/apache/fop/render/svg/SVGPainter.java index 147536ccb..ebd143a69 100644 --- a/src/sandbox/org/apache/fop/render/svg/SVGPainter.java +++ b/src/sandbox/org/apache/fop/render/svg/SVGPainter.java @@ -45,7 +45,6 @@ import org.apache.fop.render.ImageHandlerUtil; import org.apache.fop.render.RenderingContext; import org.apache.fop.render.intermediate.AbstractIFPainter; import org.apache.fop.render.intermediate.IFConstants; -import org.apache.fop.render.intermediate.IFContext; import org.apache.fop.render.intermediate.IFException; import org.apache.fop.render.intermediate.IFState; import org.apache.fop.render.intermediate.IFUtil; @@ -59,12 +58,11 @@ import org.apache.fop.util.XMLUtil; /** * IFPainter implementation that writes SVG. */ -public class SVGPainter extends AbstractIFPainter implements SVGConstants { - - private AbstractSVGDocumentHandler parent; +public class SVGPainter extends AbstractIFPainter<AbstractSVGDocumentHandler> + implements SVGConstants { /** The SAX content handler that receives the generated XML events. */ - protected GenerationHelperContentHandler handler; + private GenerationHelperContentHandler handler; private static final int MODE_NORMAL = 0; private static final int MODE_TEXT = 1; @@ -78,18 +76,12 @@ public class SVGPainter extends AbstractIFPainter implements SVGConstants { */ public SVGPainter(AbstractSVGDocumentHandler parent, GenerationHelperContentHandler contentHandler) { - super(); - this.parent = parent; + super(parent); this.handler = contentHandler; this.state = IFState.create(); } /** {@inheritDoc} */ - protected IFContext getContext() { - return parent.getContext(); - } - - /** {@inheritDoc} */ public void startViewport(AffineTransform transform, Dimension size, Rectangle clipRect) throws IFException { startViewport(SVGUtil.formatAffineTransformMptToPt(transform), size, clipRect); @@ -190,7 +182,7 @@ public class SVGPainter extends AbstractIFPainter implements SVGConstants { try { establish(MODE_NORMAL); - ImageManager manager = getUserAgent().getFactory().getImageManager(); + ImageManager manager = getUserAgent().getImageManager(); ImageInfo info = null; try { ImageSessionContext sessionContext = getUserAgent().getImageSessionContext(); diff --git a/src/sandbox/org/apache/fop/render/svg/SVGPrintDocumentHandler.java b/src/sandbox/org/apache/fop/render/svg/SVGPrintDocumentHandler.java index 8ec374731..b97d3d261 100644 --- a/src/sandbox/org/apache/fop/render/svg/SVGPrintDocumentHandler.java +++ b/src/sandbox/org/apache/fop/render/svg/SVGPrintDocumentHandler.java @@ -21,12 +21,11 @@ package org.apache.fop.render.svg; import java.awt.Dimension; -import javax.xml.transform.Result; - import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; import org.apache.fop.render.intermediate.IFConstants; +import org.apache.fop.render.intermediate.IFContext; import org.apache.fop.render.intermediate.IFException; import org.apache.fop.render.intermediate.IFPainter; import org.apache.fop.util.XMLUtil; @@ -40,18 +39,8 @@ public class SVGPrintDocumentHandler extends AbstractSVGDocumentHandler { /** * Default constructor. */ - public SVGPrintDocumentHandler() { - //nop - } - - /** - * Creates a new SVGPrintPainter that sends the XML content it generates to the given - * SAX ContentHandler. - * @param result the JAXP Result object to receive the generated content - * @throws IFException if an error occurs setting up the output - */ - public SVGPrintDocumentHandler(Result result) throws IFException { - setResult(result); + public SVGPrintDocumentHandler(IFContext context) { + super(context); } /** {@inheritDoc} */ diff --git a/src/sandbox/org/apache/fop/render/svg/SVGPrintDocumentHandlerMaker.java b/src/sandbox/org/apache/fop/render/svg/SVGPrintDocumentHandlerMaker.java index 8e212dfde..0a0e599ff 100644 --- a/src/sandbox/org/apache/fop/render/svg/SVGPrintDocumentHandlerMaker.java +++ b/src/sandbox/org/apache/fop/render/svg/SVGPrintDocumentHandlerMaker.java @@ -19,7 +19,6 @@ package org.apache.fop.render.svg; -import org.apache.fop.apps.FOUserAgent; import org.apache.fop.render.intermediate.AbstractIFDocumentHandlerMaker; import org.apache.fop.render.intermediate.IFContext; import org.apache.fop.render.intermediate.IFDocumentHandler; @@ -32,10 +31,8 @@ public class SVGPrintDocumentHandlerMaker extends AbstractIFDocumentHandlerMaker private static final String[] MIMES = new String[] {SVGConstants.MIME_SVG_PRINT}; /** {@inheritDoc} */ - public IFDocumentHandler makeIFDocumentHandler(FOUserAgent ua) { - SVGPrintDocumentHandler handler = new SVGPrintDocumentHandler(); - handler.setContext(new IFContext(ua)); - return handler; + public IFDocumentHandler makeIFDocumentHandler(IFContext ifContext) { + return new SVGPrintDocumentHandler(ifContext); } /** {@inheritDoc} */ diff --git a/src/sandbox/org/apache/fop/render/svg/SVGRendererMaker.java b/src/sandbox/org/apache/fop/render/svg/SVGRendererMaker.java index 892d01711..95c4effbb 100644 --- a/src/sandbox/org/apache/fop/render/svg/SVGRendererMaker.java +++ b/src/sandbox/org/apache/fop/render/svg/SVGRendererMaker.java @@ -19,6 +19,7 @@ package org.apache.fop.render.svg; +import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.MimeConstants; import org.apache.fop.render.AbstractRendererMaker; @@ -31,20 +32,23 @@ public class SVGRendererMaker extends AbstractRendererMaker { private static final String[] MIMES = new String[] {MimeConstants.MIME_SVG}; - - /** {@inheritDoc} */ + @Override public Renderer makeRenderer(FOUserAgent ua) { return new SVGRenderer(ua); } - /** {@inheritDoc} */ + @Override public boolean needsOutputStream() { return true; } - /** {@inheritDoc} */ + @Override public String[] getSupportedMimeTypes() { return MIMES; } + @Override + public void configureRenderer(FOUserAgent userAgent, Renderer renderer) throws FOPException { + // No-Op + } } |