+++ /dev/null
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.mif;
-
-// Java
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * The is the basis for MIF document elements.
- * This enables the creation of the element and to write it
- * to an output stream including sub-elements or a single value.
- */
-public class MIFElement {
- protected String name;
- protected String valueStr = null;
- protected List valueElements = null;
-
- protected boolean started = false;
- protected boolean finish = false;
- protected boolean finished = false;
-
- /**
- */
- public MIFElement(String n) {
- name = n;
- }
-
- public void setValue(String str) {
- valueStr = str;
- }
-
- public void addElement(MIFElement el) {
- if (valueElements == null) {
- valueElements = new java.util.ArrayList();
- }
- valueElements.add(el);
- }
-
- /**
- * Output this element to an output stream.
- * This will output only so far as the fisrt unfinished child element.
- * This method can be called again to continue from the previous point.
- * An element that contains child elements will only be finished when
- * the finish method is called.
- */
- public boolean output(OutputStream os, int indent) throws IOException {
- if (finished) {
- return true;
- }
- if (valueElements == null && valueStr == null) {
- return false;
- }
-
- String indentStr = "";
- for (int c = 0; c < indent; c++) {
- indentStr += " ";
- }
- if (!started) {
- os.write((indentStr + "<" + name).getBytes());
- if (valueElements != null) {
- os.write(("\n").getBytes());
- }
- started = true;
- }
- if (valueElements != null) {
- boolean done = true;
- for (Iterator iter = valueElements.iterator(); iter.hasNext();) {
- MIFElement el = (MIFElement)iter.next();
- boolean d = el.output(os, indent + 1);
- if (d) {
- iter.remove();
- } else {
- done = false;
- break;
- }
- }
- if (!finish || !done) {
- return false;
- }
- os.write((indentStr + "> # end of " + name + "\n").getBytes());
- } else {
- os.write((" " + valueStr + ">\n").getBytes());
- }
- finished = true;
- return true;
- }
-
- public void finish(boolean deep) {
- finish = true;
- if (deep && valueElements != null) {
- for (Iterator iter = valueElements.iterator(); iter.hasNext();) {
- MIFElement el = (MIFElement)iter.next();
- el.finish(deep);
- }
- }
- }
-}
-
+++ /dev/null
-/*\r
- * Copyright 2005 The Apache Software Foundation.\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/* $Id$ */\r
-\r
-package org.apache.fop.render.mif;\r
-\r
-import java.io.OutputStream;\r
-\r
-import org.apache.fop.apps.FOUserAgent;\r
-import org.apache.fop.apps.MimeConstants;\r
-import org.apache.fop.fo.FOEventHandler;\r
-import org.apache.fop.render.AbstractFOEventHandlerMaker;\r
-\r
-/**\r
- * Maker class for MIF support.\r
- */\r
-public class MIFFOEventHandlerMaker extends AbstractFOEventHandlerMaker {\r
-\r
- private static final String[] MIMES = new String[] {MimeConstants.MIME_MIF};\r
- \r
- \r
- /** @see org.apache.fop.render.AbstractFOEventHandlerMaker */\r
- public FOEventHandler makeFOEventHandler(FOUserAgent ua, OutputStream out) {\r
- return new MIFHandler(ua, out);\r
- }\r
-\r
- /** @see org.apache.fop.render.AbstractFOEventHandlerMaker#needsOutputStream() */\r
- public boolean needsOutputStream() {\r
- return true;\r
- }\r
-\r
- /** @see org.apache.fop.render.AbstractFOEventHandlerMaker#getSupportedMimeTypes() */\r
- public String[] getSupportedMimeTypes() {\r
- return MIMES;\r
- }\r
-\r
-}\r
+++ /dev/null
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.mif;
-
-// Java
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * The MIF File.
- * This organises the MIF File and the corresponding elements.
- * The catalog elements are used to setup the resources that
- * are referenced.
- */
-public class MIFFile extends MIFElement {
-
- protected MIFElement colorCatalog = null;
- protected PGFElement pgfCatalog = null;
- protected MIFElement fontCatalog = null;
- protected RulingElement rulingCatalog = null;
- protected MIFElement tblCatalog = null;
- protected MIFElement views = null;
- protected MIFElement variableFormats = null;
- protected MIFElement xRefFormats = null;
- protected MIFElement document = null;
- protected MIFElement bookComponent = null;
- protected MIFElement initialAutoNums = null;
- protected MIFElement aFrames = null;
- protected MIFElement tbls = null;
- protected List pages = new java.util.ArrayList();
- protected List textFlows = null;
-
-
- public MIFFile() {
- super("");
- valueElements = new java.util.ArrayList();
- setup();
- }
-
- /**
- * Do some setup.
- * Currently adds some dummy values to the resources.
- */
- protected void setup() {
- MIFElement unit = new MIFElement("Units");
- unit.setValue("Ucm");
- addElement(unit);
-
- colorCatalog = new MIFElement("ColorCatalog");
- MIFElement color = new MIFElement("Color");
- MIFElement prop = new MIFElement("ColorTag");
- prop.setValue("`Black'");
- color.addElement(prop);
- prop = new MIFElement("ColorCyan");
- prop.setValue("0.000000");
- color.addElement(prop);
-
- prop = new MIFElement("ColorMagenta");
- prop.setValue("0.000000");
- color.addElement(prop);
- prop = new MIFElement("ColorYellow");
- prop.setValue("0.000000");
- color.addElement(prop);
- prop = new MIFElement("ColorBlack");
- prop.setValue("100.000000");
- color.addElement(prop);
- prop = new MIFElement("ColorAttribute");
- prop.setValue("ColorIsBlack");
- color.addElement(prop);
- prop = new MIFElement("ColorAttribute");
- prop.setValue("ColorIsReserved");
- color.addElement(prop);
- color.finish(true);
-
- colorCatalog.addElement(color);
- addElement(colorCatalog);
-
- pgfCatalog = new PGFElement();
- pgfCatalog.lookupElement(null);
- addElement(pgfCatalog);
-
- rulingCatalog = new RulingElement();
- rulingCatalog.lookupElement(null);
- addElement(rulingCatalog);
-
- }
-
- public void output(OutputStream os) throws IOException {
- if (finished) {
- return;
- }
-
- if (!started) {
- os.write(("<MIFFile 5.00> # Generated by FOP\n"/* + getVersion()*/).getBytes());
- started = true;
- }
- boolean done = true;
-
- for (Iterator iter = valueElements.iterator(); iter.hasNext();) {
- MIFElement el = (MIFElement)iter.next();
- boolean d = el.output(os, 0);
- if (d) {
- iter.remove();
- } else {
- done = false;
- break;
- }
- }
- if (done && finish) {
- os.write(("# end of MIFFile").getBytes());
- }
- }
-
- public void addPage(MIFElement p) {
- pages.add(p);
- addElement(p);
- }
-}
-
+++ /dev/null
-/*
- * Copyright 1999-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.mif;
-
-// Java
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.fop.apps.FOUserAgent;
-import org.apache.fop.fo.FOEventHandler;
-import org.apache.fop.fo.flow.BasicLink;
-import org.apache.fop.fo.flow.Block;
-import org.apache.fop.fo.flow.ExternalGraphic;
-import org.apache.fop.fo.flow.Footnote;
-import org.apache.fop.fo.flow.FootnoteBody;
-import org.apache.fop.fo.flow.InstreamForeignObject;
-import org.apache.fop.fo.flow.Inline;
-import org.apache.fop.fo.flow.Leader;
-import org.apache.fop.fo.flow.ListBlock;
-import org.apache.fop.fo.flow.ListItem;
-import org.apache.fop.fo.flow.PageNumber;
-import org.apache.fop.fo.flow.Table;
-import org.apache.fop.fo.flow.TableBody;
-import org.apache.fop.fo.flow.TableCell;
-import org.apache.fop.fo.flow.TableColumn;
-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.SimplePageMaster;
-import org.apache.fop.fonts.FontSetup;
-import org.xml.sax.SAXException;
-
-// TODO: do we really want every method throwing a SAXException
-
-/**
- * The MIF Handler.
- * This generates MIF output using the structure events from
- * the FO Tree sent to this structure handler.
- * This builds an MIF file and writes it to the output.
- */
-public class MIFHandler extends FOEventHandler {
-
- /** Logger */
- private static Log log = LogFactory.getLog(MIFHandler.class);
-
- /** the MIFFile instance */
- protected MIFFile mifFile;
-
- /** the OutputStream to write to */
- protected OutputStream outStream;
-
- // current state elements
- private MIFElement textFlow;
- private MIFElement para;
-
- /**
- * Creates a new MIF handler on a given OutputStream.
- * @param ua FOUserAgent instance for this process
- * @param os OutputStream to write to
- */
- public MIFHandler(FOUserAgent ua, OutputStream os) {
- super(ua);
- outStream = os;
- FontSetup.setup(fontInfo, null);
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#startDocument()
- */
- public void startDocument() throws SAXException {
- log.fatal("The MIF Handler is non-functional at this time. Please help resurrect it!");
- mifFile = new MIFFile();
- try {
- mifFile.output(outStream);
- } catch (IOException ioe) {
- throw new SAXException(ioe);
- }
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#endDocument()
- */
- public void endDocument() throws SAXException {
- // finish all open elements
- mifFile.finish(true);
- try {
- mifFile.output(outStream);
- outStream.flush();
- } catch (IOException ioe) {
- throw new SAXException(ioe);
- }
- }
-
- /**
- * Start the page sequence.
- * This creates the pages in the MIF document that will be used
- * by the following flows and static areas.
- * @see org.apache.fop.fo.FOEventHandler
- */
- public void startPageSequence(PageSequence pageSeq) {
- // get the layout master set
- // setup the pages for this sequence
- String name = pageSeq.getMasterReference();
- SimplePageMaster spm = pageSeq.getRoot().getLayoutMasterSet().getSimplePageMaster(name);
- if (spm == null) {
- PageSequenceMaster psm = pageSeq.getRoot().getLayoutMasterSet().getPageSequenceMaster(name);
- } else {
- // create simple master with regions
- MIFElement prop = new MIFElement("PageType");
- prop.setValue("BodyPage");
-
- MIFElement page = new MIFElement("Page");
- page.addElement(prop);
-
- prop = new MIFElement("PageBackground");
- prop.setValue("'Default'");
- page.addElement(prop);
-
- // build regions
- MIFElement textRect = new MIFElement("TextRect");
- prop = new MIFElement("ID");
- prop.setValue("1");
- textRect.addElement(prop);
- prop = new MIFElement("ShapeRect");
- prop.setValue("0.0 841.889 453.543 0.0");
- textRect.addElement(prop);
- page.addElement(textRect);
-
- textRect = new MIFElement("TextRect");
- prop = new MIFElement("ID");
- prop.setValue("2");
- textRect.addElement(prop);
- prop = new MIFElement("ShapeRect");
- prop.setValue("0.0 841.889 453.543 187.65");
- textRect.addElement(prop);
- page.addElement(textRect);
-
- mifFile.addPage(page);
- }
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#endPageSequence(PageSequence)
- */
- public void endPageSequence(PageSequence pageSeq) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#startFlow(Flow)
- */
- public void startFlow(Flow fl) {
- // start text flow in body region
- textFlow = new MIFElement("TextFlow");
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#endFlow(Flow)
- */
- public void endFlow(Flow fl) {
- textFlow.finish(true);
- mifFile.addElement(textFlow);
- textFlow = null;
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#startBlock(Block)
- */
- public void startBlock(Block bl) {
- para = new MIFElement("Para");
- // get font
- textFlow.addElement(para);
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#endBlock(Block)
- */
- public void endBlock(Block bl) {
- para.finish(true);
- para = null;
- }
-
- /**
- *
- * @param inl Inline that is starting.
- */
- public void startInline(Inline inl){
- }
-
- /**
- *
- * @param inl Inline that is ending.
- */
- public void endInline(Inline inl){
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#startTable(Table)
- */
- public void startTable(Table tbl) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#endTable(Table)
- */
- public void endTable(Table tbl) {
- }
-
- /**
- *
- * @param tc TableColumn that is starting;
- */
- public void startColumn(TableColumn tc) {
- }
-
- /**
- *
- * @param tc TableColumn that is ending;
- */
- public void endColumn(TableColumn tc) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#startHeader(TableBody)
- */
- public void startHeader(TableBody th) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#endHeader(TableBody)
- */
- public void endHeader(TableBody th) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#startFooter(TableBody)
- */
- public void startFooter(TableBody tf) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#endFooter(TableBody)
- */
- public void endFooter(TableBody tf) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#startBody(TableBody)
- */
- public void startBody(TableBody tb) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#endBody(TableBody)
- */
- public void endBody(TableBody tb) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#startRow(TableRow)
- */
- public void startRow(TableRow tr) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#endRow(TableRow)
- */
- public void endRow(TableRow tr) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#startCell(TableCell)
- */
- public void startCell(TableCell tc) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#endCell(TableCell)
- */
- public void endCell(TableCell tc) {
- }
-
- // Lists
- /**
- * @see org.apache.fop.fo.FOEventHandler#startList(ListBlock)
- */
- public void startList(ListBlock lb) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#endList(ListBlock)
- */
- public void endList(ListBlock lb) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#startListItem(ListItem)
- */
- public void startListItem(ListItem li) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#endListItem(ListItem)
- */
- public void endListItem(ListItem li) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#startListLabel()
- */
- public void startListLabel() {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#endListLabel()
- */
- public void endListLabel() {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#startListBody()
- */
- public void startListBody() {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#endListBody()
- */
- public void endListBody() {
- }
-
- // Static Regions
- /**
- * @see org.apache.fop.fo.FOEventHandler#startStatic()
- */
- public void startStatic() {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#endStatic()
- */
- public void endStatic() {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#startMarkup()
- */
- public void startMarkup() {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#endMarkup()
- */
- public void endMarkup() {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#startLink(BasicLink basicLink)
- */
- public void startLink(BasicLink basicLink) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#endLink()
- */
- public void endLink() {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#image(ExternalGraphic)
- */
- public void image(ExternalGraphic eg) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#pageRef()
- */
- public void pageRef() {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#foreignObject(InstreamForeignObject)
- */
- public void foreignObject(InstreamForeignObject ifo) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#startFootnote(Footnote)
- */
- public void startFootnote(Footnote footnote) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#endFootnote(Footnote)
- */
- public void endFootnote(Footnote footnote) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#startFootnoteBody(FootnoteBody)
- */
- public void startFootnoteBody(FootnoteBody body) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#endFootnoteBody(FootnoteBody)
- */
- public void endFootnoteBody(FootnoteBody body) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#leader(Leader)
- */
- public void leader(Leader l) {
- }
-
- /**
- * @see org.apache.fop.fo.FOEventHandler#characters(char[], int, int)
- */
- public void characters(char data[], int start, int length) {
- if (para != null) {
- String str = new String(data, start, length);
- str = str.trim();
- // break into nice length chunks
- if (str.length() == 0) {
- return;
- }
-
- MIFElement line = new MIFElement("ParaLine");
- MIFElement prop = new MIFElement("TextRectID");
- prop.setValue("2");
- line.addElement(prop);
- prop = new MIFElement("String");
- prop.setValue("\"" + str + "\"");
- line.addElement(prop);
-
- para.addElement(line);
- }
- }
-
- /**
- *
- * @param pagenum PageNumber that is starting.
- */
- public void startPageNumber(PageNumber pagenum) {
- }
-
- /**
- *
- * @param pagenum PageNumber that is ending.
- */
- public void endPageNumber(PageNumber pagenum) {
- }
-}
-
+++ /dev/null
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.mif;
-
-/**
- * Font Catalog element.
- * This is the reference lookup element for fonts in
- * the MIF document.
- */
-public class PGFElement extends RefElement {
-
- /**
- * Creates a new font catalog element.
- */
- public PGFElement() {
- super("PgfCatalog");
- }
-
- public MIFElement lookupElement(Object key) {
- if (key == null) {
- MIFElement pgf = new MIFElement("Pgf");
- MIFElement prop = new MIFElement("PgfTag");
- prop.setValue("`Body'");
- pgf.addElement(prop);
- addElement(pgf);
- pgf.finish(true);
- return pgf;
- }
- return null;
- }
-}
-
+++ /dev/null
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.mif;
-
-/**
- * Reference MIF Element.
- * This element is a lookup reference set that contains
- * a list of resources used in the MIF Document.
- * When a lookup is performed it will either create a new
- * element or return an existing element that is valid.
- * THe key depends on the type of reference, it should be able
- * to uniquely identify the element.
- */
-public class RefElement extends MIFElement {
-
- /**
- * @see org.apache.fop.render.mif.MIFElement#MIFElement(String)
- */
- public RefElement(String n) {
- super(n);
- }
-
- public MIFElement lookupElement(Object key) {
- return null;
- }
-}
-
+++ /dev/null
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.mif;
-
-public class RulingElement extends RefElement {
-
- public RulingElement() {
- super("RulingCatalog");
- }
-
- public MIFElement lookupElement(Object key) {
- if (key == null) {
- MIFElement rul = new MIFElement("Ruling");
- MIFElement prop = new MIFElement("RulingTag");
- prop.setValue("`Default'");
- rul.addElement(prop);
- prop = new MIFElement("RulingPenWidth");
- prop.setValue("1");
- rul.addElement(prop);
- prop = new MIFElement("RulingPen");
- prop.setValue("0");
- rul.addElement(prop);
- prop = new MIFElement("RulingLines");
- prop.setValue("1");
- rul.addElement(prop);
-
- addElement(rul);
- rul.finish(true);
- return rul;
- }
- return null;
- }
-}
-
+++ /dev/null
-<!--
- Copyright 2005 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!-- $Id$ -->
-<HTML>
-<TITLE>org.apache.fop.render.mif Package</TITLE>
-<BODY>
-<P>MIF Output Support</P>
-</BODY>
-</HTML>
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 1999-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.pcl;
-
-// FOP
-import org.apache.fop.apps.MimeConstants;
-import org.apache.fop.render.PrintRenderer;
-
-// Java
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * Renderer that renders areas to PCL
- * Created by Arthur E Welch III while at M&I EastPoint Technology
- * Donated by EastPoint to the Apache FOP project March 2, 2001.
- */
-public class PCLRenderer extends PrintRenderer {
-
- /** The MIME type for PCL */
- public static final String MIME_TYPE = MimeConstants.MIME_PCL_ALT;
-
- /**
- * the current stream to add PCL commands to
- */
- protected PCLStream currentStream;
-
- private int pageHeight = 7920;
-
- // These variables control the virtual paggination functionality.
- private int curdiv = 0;
- private int divisions = -1;
- private int paperheight = -1; // Paper height in decipoints?
- private int orientation = -1; // -1=default/unknown, 0=portrait, 1=landscape.
- private int topmargin = -1; // Top margin in decipoints?
- private int leftmargin = -1; // Left margin in decipoints?
- private int fullmargin = 0;
- private final boolean debug = false;
-
- private int xoffset = -180; // X Offset to allow for PCL implicit 1/4" left margin.
-
- private java.util.Hashtable options;
-
- /**
- * Create the PCL renderer
- */
- public PCLRenderer() {
- }
-
- public void setFont(String name, float size) {
- int fontcode = 0;
- if (name.length() > 1 && name.charAt(0) == 'F') {
- try {
- fontcode = Integer.parseInt(name.substring(1));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- switch (fontcode) {
- case 1: // F1 = Helvetica
- // currentStream.add("\033(8U\033(s1p" + (size / 1000) + "v0s0b24580T");
- // Arial is more common among PCL5 printers than Helvetica - so use Arial
-
- currentStream.add("\033(0N\033(s1p" + (size / 1000)
- + "v0s0b16602T");
- break;
- case 2: // F2 = Helvetica Oblique
-
- currentStream.add("\033(0N\033(s1p" + (size / 1000)
- + "v1s0b16602T");
- break;
- case 3: // F3 = Helvetica Bold
-
- currentStream.add("\033(0N\033(s1p" + (size / 1000)
- + "v0s3b16602T");
- break;
- case 4: // F4 = Helvetica Bold Oblique
-
- currentStream.add("\033(0N\033(s1p" + (size / 1000)
- + "v1s3b16602T");
- break;
- case 5: // F5 = Times Roman
- // currentStream.add("\033(8U\033(s1p" + (size / 1000) + "v0s0b25093T");
- // Times New is more common among PCL5 printers than Times - so use Times New
-
- currentStream.add("\033(0N\033(s1p" + (size / 1000)
- + "v0s0b16901T");
- break;
- case 6: // F6 = Times Italic
-
- currentStream.add("\033(0N\033(s1p" + (size / 1000)
- + "v1s0b16901T");
- break;
- case 7: // F7 = Times Bold
-
- currentStream.add("\033(0N\033(s1p" + (size / 1000)
- + "v0s3b16901T");
- break;
- case 8: // F8 = Times Bold Italic
-
- currentStream.add("\033(0N\033(s1p" + (size / 1000)
- + "v1s3b16901T");
- break;
- case 9: // F9 = Courier
-
- currentStream.add("\033(0N\033(s0p"
- + (120.01f / (size / 1000.00f)) + "h0s0b4099T");
- break;
- case 10: // F10 = Courier Oblique
-
- currentStream.add("\033(0N\033(s0p"
- + (120.01f / (size / 1000.00f)) + "h1s0b4099T");
- break;
- case 11: // F11 = Courier Bold
-
- currentStream.add("\033(0N\033(s0p"
- + (120.01f / (size / 1000.00f)) + "h0s3b4099T");
- break;
- case 12: // F12 = Courier Bold Oblique
-
- currentStream.add("\033(0N\033(s0p"
- + (120.01f / (size / 1000.00f)) + "h1s3b4099T");
- break;
- case 13: // F13 = Symbol
-
- currentStream.add("\033(19M\033(s1p" + (size / 1000)
- + "v0s0b16686T");
- // ECMA Latin 1 Symbol Set in Times Roman???
- // currentStream.add("\033(9U\033(s1p" + (size / 1000) + "v0s0b25093T");
- break;
- case 14: // F14 = Zapf Dingbats
-
- currentStream.add("\033(14L\033(s1p" + (size / 1000)
- + "v0s0b45101T");
- break;
- default:
- currentStream.add("\033(0N\033(s" + (size / 1000) + "V");
- break;
- }
- }
-
- public void startRenderer(OutputStream outputStream) throws IOException {
- log.info("rendering areas to PCL");
- log.fatal("The PCL Renderer is non-functional at this time. Please help resurrect it!");
- currentStream = new PCLStream(outputStream);
-
- // Set orientation.
- if (orientation > -1) {
- currentStream.add("\033&l" + orientation + "O");
- } else {
- currentStream.add("\033&l0O");
- }
- if (orientation == 1 || orientation == 3) {
- xoffset = -144;
- } else {
- xoffset = -180;
- }
-
- // Reset the margins.
- currentStream.add("\033" + "9\033&l0E");
- }
-
- public void stopRenderer() throws IOException {
- }
-
- /** @see org.apache.fop.render.AbstractRenderer */
- public String getMimeType() {
- return MIME_TYPE;
- }
-
-}
+++ /dev/null
-/*\r
- * Copyright 2005 The Apache Software Foundation.\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/* $Id$ */\r
-\r
-package org.apache.fop.render.pcl;\r
-\r
-import org.apache.fop.apps.FOUserAgent;\r
-import org.apache.fop.apps.MimeConstants;\r
-import org.apache.fop.render.AbstractRendererMaker;\r
-import org.apache.fop.render.Renderer;\r
-\r
-/**\r
- * RendererMaker for the PCL Renderer.\r
- */\r
-public class PCLRendererMaker extends AbstractRendererMaker {\r
-\r
- private static final String[] MIMES = new String[] {\r
- MimeConstants.MIME_PCL,\r
- MimeConstants.MIME_PCL_ALT};\r
- \r
- \r
- /**@see org.apache.fop.render.AbstractRendererMaker */\r
- public Renderer makeRenderer(FOUserAgent ua) {\r
- return new PCLRenderer();\r
- }\r
-\r
- /** @see org.apache.fop.render.AbstractRendererMaker#needsOutputStream() */\r
- public boolean needsOutputStream() {\r
- return true;\r
- }\r
-\r
- /** @see org.apache.fop.render.AbstractRendererMaker#getSupportedMimeTypes() */\r
- public String[] getSupportedMimeTypes() {\r
- return MIMES;\r
- }\r
-\r
-}\r
+++ /dev/null
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.pcl;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-public class PCLStream {
-
- private OutputStream out = null;
- private boolean doOutput = true;
-
- public PCLStream(OutputStream os) {
- out = os;
- }
-
- public void add(String str) {
- if (!doOutput) {
- return;
- }
-
- byte buff[] = new byte[str.length()];
- int countr;
- int len = str.length();
- for (countr = 0; countr < len; countr++) {
- buff[countr] = (byte)str.charAt(countr);
- }
- try {
- out.write(buff);
- } catch (IOException e) {
- // e.printStackTrace();
- // e.printStackTrace(System.out);
- throw new RuntimeException(e.toString());
- }
- }
-
- public void setDoOutput(boolean doout) {
- doOutput = doout;
- }
-
-}
+++ /dev/null
-<!--
- Copyright 2005 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!-- $Id$ -->
-<HTML>
-<TITLE>org.apache.fop.render.pcl Package</TITLE>
-<BODY>
-<P>PCL Renderer</P>
-</BODY>
-</HTML>
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 1999-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.svg;
-
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.area.PageViewport;
-import org.apache.fop.area.LineArea;
-import org.apache.fop.area.inline.ForeignObject;
-import org.apache.fop.area.inline.Leader;
-import org.apache.fop.area.inline.TextArea;
-import org.apache.fop.svg.SVGUtilities;
-import org.apache.fop.fonts.FontInfo;
-import org.apache.fop.apps.FOUserAgent;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.svg.SVGSVGElement;
-import org.w3c.dom.svg.SVGDocument;
-/* org.w3c.dom.Document is not imported to avoid conflict with
- org.apache.fop.control.Document */
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Element;
-import org.w3c.dom.Text;
-import org.apache.batik.dom.svg.SVGDOMImplementation;
-import org.apache.batik.dom.util.XMLSupport;
-import org.apache.batik.transcoder.svg2svg.SVGTranscoder;
-import org.apache.batik.transcoder.TranscoderInput;
-import org.apache.batik.transcoder.TranscoderOutput;
-import org.apache.batik.transcoder.TranscoderException;
-import org.apache.batik.dom.util.DOMUtilities;
-
-import java.awt.Color;
-import java.awt.image.BufferedImage;
-import java.awt.geom.Rectangle2D;
-import java.util.HashMap;
-import java.io.OutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-
-import org.apache.fop.render.AbstractRenderer;
-import org.apache.fop.render.XMLHandler;
-import org.apache.fop.render.RendererContext;
-
-/**
- * This is the SVG renderer.
- */
-public class SVGRenderer extends AbstractRenderer implements XMLHandler {
-
- /** SVG MIME type */
- public static final String SVG_MIME_TYPE = "image/svg+xml";
-
- /** SVG namespace */
- public static final String SVG_NAMESPACE = SVGDOMImplementation.SVG_NAMESPACE_URI;
-
- private org.w3c.dom.Document svgDocument;
- private Element svgRoot;
- private Element currentPageG = null;
- private Element lastLink = null;
- private String lastViewbox = null;
-
- private Element docDefs = null;
- private Element pageDefs = null;
- private Element pagesGroup = null;
-
- // first sequence title
- private LineArea docTitle = null;
-
- private RendererContext context;
-
- private OutputStream ostream;
-
- private float totalWidth = 0;
- private float totalHeight = 0;
- private float sequenceWidth = 0;
- private float sequenceHeight = 0;
-
- private float pageWidth = 0;
- private float pageHeight = 0;
- private int pageNumber = 0;
-
- private HashMap fontNames = new HashMap();
- private HashMap fontStyles = new HashMap();
- private Color saveColor = null;
-
- /**
- * The current (internal) font name
- */
- private String currentFontName;
-
- /**
- * The current font size in millipoints
- */
- private int currentFontSize;
-
- /**
- * The current colour's red, green and blue component
- */
- private float currentRed = 0;
- private float currentGreen = 0;
- private float currentBlue = 0;
-
- /**
- * Creates a new SVG renderer.
- */
- public SVGRenderer() {
- context = new RendererContext(this, SVG_MIME_TYPE);
- }
-
- /**
- * @see org.apache.fop.render.Renderer#setUserAgent(FOUserAgent)
- */
- public void setUserAgent(FOUserAgent agent) {
- super.setUserAgent(agent);
- userAgent.getXMLHandlerRegistry().addXMLHandler(this);
- }
-
- /**
- * @see org.apache.fop.render.Renderer#setupFontInfo(FontInfo)
- */
- public void setupFontInfo(FontInfo fontInfo) {
- // create a temp Image to test font metrics on
- BufferedImage fontImage =
- new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
- org.apache.fop.render.java2d.FontSetup.setup(fontInfo,
- fontImage.createGraphics());
- }
-
- /**
- * @see org.apache.fop.render.Renderer#startRenderer(OutputStream)
- */
- public void startRenderer(OutputStream outputStream)
- throws IOException {
- ostream = outputStream;
- DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
- svgDocument = impl.createDocument(SVG_NAMESPACE, "svg", null);
- svgRoot = svgDocument.getDocumentElement();
- /*
- ProcessingInstruction pi =
- svgDocument.createProcessingInstruction("xml",
- " version=\"1.0\" encoding=\"ISO-8859-1\"");
- svgDocument.insertBefore(pi, svgRoot);
- */
-
- docDefs = svgDocument.createElementNS(SVG_NAMESPACE, "defs");
- svgRoot.appendChild(docDefs);
-
- pagesGroup = svgDocument.createElementNS(SVG_NAMESPACE, "g");
- pageDefs = svgDocument.createElementNS(SVG_NAMESPACE, "defs");
- pagesGroup.appendChild(pageDefs);
- svgRoot.appendChild(pagesGroup);
-
- }
-
- /**
- * @see org.apache.fop.render.Renderer#stopRenderer()
- */
- public void stopRenderer() throws IOException {
- totalWidth += sequenceWidth;
- if (sequenceHeight > totalHeight) {
- totalHeight = sequenceHeight;
- }
-
- svgRoot.setAttributeNS(null, "width", "" + (totalWidth + 1));
- svgRoot.setAttributeNS(null, "height", "" + (totalHeight + 1));
- //svgRoot.setAttributeNS(null, "viewBox", "0 0 " + pageWidth + " " + pageHeight);
- SVGTranscoder svgT = new SVGTranscoder();
- TranscoderInput input = new TranscoderInput(svgDocument);
- TranscoderOutput output =
- new TranscoderOutput(new OutputStreamWriter(ostream));
- try {
- svgT.transcode(input, output);
- } catch (TranscoderException e) {
- log.error("could not write svg file :" + e.getMessage(), e);
- }
- ostream.flush();
- ostream = null;
-
- svgDocument = null;
- svgRoot = null;
- currentPageG = null;
- lastLink = null;
-
- totalWidth = 0;
- totalHeight = 0;
-
- pageNumber = 0;
- }
-
- /**
- * @see org.apache.fop.render.Renderer#startPageSequence(LineArea)
- */
- public void startPageSequence(LineArea seqTitle) {
- totalWidth += sequenceWidth;
- if (sequenceHeight > totalHeight) {
- totalHeight = sequenceHeight;
- }
- sequenceWidth = 0;
- sequenceHeight = 0;
- if (seqTitle != null && docTitle == null) {
- // convert first title to a string and set for svg document title
- docTitle = seqTitle;
- String str = convertTitleToString(seqTitle);
- Element svgTitle = svgDocument.createElementNS(SVG_NAMESPACE, "title");
- Text strNode = svgDocument.createTextNode(str);
- svgTitle.appendChild(strNode);
- svgRoot.insertBefore(svgTitle, svgRoot.getFirstChild());
- }
- }
-
- /**
- * @see org.apache.fop.render.Renderer#renderPage(PageViewport)
- */
- public void renderPage(PageViewport page) throws IOException, FOPException {
- float lastWidth = pageWidth;
- float lastHeight = pageHeight;
-
- Rectangle2D area = page.getViewArea();
- pageWidth = (float) area.getWidth() / 1000f;
- pageHeight = (float) area.getHeight() / 1000f;
-
- // if there is a link from the last page
- if (lastLink != null) {
- lastLink.setAttributeNS(null, "xlink:href", "#svgView(viewBox("
- + totalWidth + ", "
- + sequenceHeight + ", "
- + pageWidth + ", "
- + pageHeight + "))");
- pagesGroup.appendChild(lastLink);
- }
-
- currentPageG = svgDocument.createElementNS(SVG_NAMESPACE, "svg");
- currentPageG.setAttributeNS(null, "viewbox",
- "0 0 " + (int) pageWidth + " " + (int) pageHeight);
- currentPageG.setAttributeNS(null, "width",
- "" + ((int) pageWidth + 1));
- currentPageG.setAttributeNS(null, "height",
- "" + ((int) pageHeight + 1));
- currentPageG.setAttributeNS(null, "id", "Page-" + pageNumber);
- currentPageG.setAttributeNS(null, "style", "font-family:sanserif;font-size:12");
- pageDefs.appendChild(currentPageG);
-
- if (pageWidth > sequenceWidth) {
- sequenceWidth = pageWidth;
- }
- sequenceHeight += pageHeight;
-
- Element border =
- SVGUtilities.createRect(svgDocument, 0, 0, pageWidth,
- pageHeight);
- border.setAttributeNS(null, "style", "fill:none;stroke:black");
- currentPageG.appendChild(border);
-
- // render the page contents
- super.renderPage(page);
-
- Element use = svgDocument.createElementNS(SVG_NAMESPACE, "use");
- use.setAttributeNS(null, "xlink:href", "#Page-" + pageNumber);
- use.setAttributeNS(null, "x", "" + totalWidth);
- use.setAttributeNS(null, "y", "" + (sequenceHeight - pageHeight));
- pagesGroup.appendChild(use);
-
- Element lastPageLink = svgDocument.createElementNS(SVG_NAMESPACE, "a");
- if (lastLink != null) {
- lastPageLink.setAttributeNS(null, "xlink:href", lastViewbox);
- } else {
- lastPageLink.setAttributeNS(null, "xlink:href",
- "#svgView(viewBox("
- + totalWidth + ", "
- + (sequenceHeight - pageHeight) + ", "
- + pageWidth + ", "
- + pageHeight + "))");
- }
- pagesGroup.appendChild(lastPageLink);
-
- // setup a link to the next page, only added when the
- // next page is rendered
- Element rect = SVGUtilities.createRect(svgDocument, totalWidth,
- (sequenceHeight - pageHeight), pageWidth / 2, pageHeight);
- rect.setAttributeNS(null, "style", "fill:blue;visibility:hidden");
- lastPageLink.appendChild(rect);
-
- lastLink = svgDocument.createElementNS(SVG_NAMESPACE, "a");
- rect = SVGUtilities.createRect(svgDocument,
- totalWidth + pageWidth / 2,
- (sequenceHeight - pageHeight), pageWidth / 2, pageHeight);
- rect.setAttributeNS(null, "style", "fill:blue;visibility:hidden");
- lastLink.appendChild(rect);
-
- lastViewbox = "#svgView(viewBox("
- + totalWidth + ", "
- + (sequenceHeight - pageHeight) + ", "
- + pageWidth + ", "
- + pageHeight + "))";
-
- pageNumber++;
-
- }
-
- /**
- * Method renderForeignObject.
- * @param fo the foreign object
- */
- public void renderForeignObject(ForeignObject fo, Rectangle2D pos) {
- org.w3c.dom.Document doc = fo.getDocument();
- String ns = fo.getNameSpace();
- renderXML(context, doc, ns);
- }
-
- /** @see org.apache.fop.render.XMLHandler */
- public void handleXML(RendererContext context,
- org.w3c.dom.Document doc, String ns) throws Exception {
- if (SVG_NAMESPACE.equals(ns)) {
- if (!(doc instanceof SVGDocument)) {
- DOMImplementation impl =
- SVGDOMImplementation.getDOMImplementation();
- doc = DOMUtilities.deepCloneDocument(doc, impl);
- }
- SVGSVGElement svg = ((SVGDocument) doc).getRootElement();
- Element view = svgDocument.createElementNS(SVG_NAMESPACE, "svg");
- Node newsvg = svgDocument.importNode(svg, true);
- //view.setAttributeNS(null, "viewBox", "0 0 ");
- view.setAttributeNS(null, "x", "" + currentIPPosition / 1000f);
- view.setAttributeNS(null, "y", "" + currentBPPosition / 1000f);
-
- // this fixes a problem where the xmlns is repeated sometimes
- Element ele = (Element) newsvg;
- ele.setAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, "xmlns",
- SVG_NAMESPACE);
- if (ele.hasAttributeNS(null, "xmlns")) {
- ele.removeAttributeNS(null, "xmlns");
- }
-
- view.appendChild(newsvg);
- currentPageG.appendChild(view);
- }
- }
-
- /**
- * @see org.apache.fop.render.AbstractRenderer#renderLeader(Leader)
- */
- public void renderLeader(Leader area) {
- String style = "stroke:black;stroke-width:"
- + (area.getRuleThickness() / 1000) + ";";
- switch (area.getRuleStyle()) {
- case EN_DOTTED:
- style += "stroke-dasharray:1,1";
- break;
- case EN_DASHED:
- style += "stroke-dasharray:5,1";
- break;
- case EN_SOLID:
- break;
- case EN_DOUBLE:
- break;
- case EN_GROOVE:
- break;
- case EN_RIDGE:
- break;
- }
- Element line = SVGUtilities.createLine(svgDocument,
- currentIPPosition / 1000,
- (currentBPPosition + area.getOffset()
- - area.getRuleThickness() / 2) / 1000,
- (currentIPPosition + area.getIPD()) / 1000,
- (currentBPPosition + area.getOffset()
- - area.getRuleThickness() / 2) / 1000);
- line.setAttributeNS(null, "style", style);
- currentPageG.appendChild(line);
-
- super.renderLeader(area);
- }
-
- /**
- * @see org.apache.fop.render.AbstractRenderer#renderText(TextArea)
- */
- public void renderText(TextArea text) {
- Element textElement = SVGUtilities.createText(svgDocument,
- currentIPPosition / 1000,
- (currentBPPosition + text.getOffset()
- + text.getBaselineOffset()) / 1000,
- text.getText());
- currentPageG.appendChild(textElement);
-
- super.renderText(text);
- }
-
- /**
- * @see org.apache.fop.render.AbstractRenderer#renderCharacter(Character)
- */
- public void renderCharacter(org.apache.fop.area.inline.Character ch) {
- Element text = SVGUtilities.createText(svgDocument,
- currentIPPosition / 1000,
- (currentBPPosition + ch.getOffset()
- + ch.getBaselineOffset()) / 1000,
- "" + ch.getChar());
- currentPageG.appendChild(text);
-
- super.renderCharacter(ch);
- }
-
- /** @see org.apache.fop.render.AbstractRenderer */
- public String getMimeType() {
- return SVG_MIME_TYPE;
- }
-
- /** @see org.apache.fop.render.XMLHandler#getNamespace() */
- public String getNamespace() {
- return SVG_NAMESPACE;
- }
-
-}
-
+++ /dev/null
-/*\r
- * Copyright 2005 The Apache Software Foundation.\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/* $Id$ */\r
-\r
-package org.apache.fop.render.svg;\r
-\r
-import org.apache.fop.apps.FOUserAgent;\r
-import org.apache.fop.apps.MimeConstants;\r
-import org.apache.fop.render.AbstractRendererMaker;\r
-import org.apache.fop.render.Renderer;\r
-\r
-/**\r
- * RendererMaker for the SVG Renderer.\r
- */\r
-public class SVGRendererMaker extends AbstractRendererMaker {\r
-\r
- private static final String[] MIMES = new String[] {MimeConstants.MIME_SVG};\r
- \r
- \r
- /**@see org.apache.fop.render.AbstractRendererMaker */\r
- public Renderer makeRenderer(FOUserAgent ua) {\r
- return new SVGRenderer();\r
- }\r
-\r
- /** @see org.apache.fop.render.AbstractRendererMaker#needsOutputStream() */\r
- public boolean needsOutputStream() {\r
- return true;\r
- }\r
-\r
- /** @see org.apache.fop.render.AbstractRendererMaker#getSupportedMimeTypes() */\r
- public String[] getSupportedMimeTypes() {\r
- return MIMES;\r
- }\r
-\r
-}\r
+++ /dev/null
-<!--
- Copyright 2005 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!-- $Id$ -->
-<HTML>
-<TITLE>org.apache.fop.render.svg Package</TITLE>
-<BODY>
-<P>SVG (Structured Vector Graphics) Renderer</P>
-</BODY>
-</HTML>
\ No newline at end of file