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.Inline;
import org.apache.fop.fo.flow.InstreamForeignObject;
import org.apache.fop.fo.flow.Leader;
public abstract void foreignObject(InstreamForeignObject ifo);
/**
- * Process a footnote.
+ * Process the start of a footnote.
+ * @param footnote Footnote that is starting
*/
- public abstract void footnote();
+ public abstract void startFootnote(Footnote footnote);
+
+ /**
+ * Process the ending of a footnote.
+ * @param footnote Footnote that is ending
+ */
+ public abstract void endFootnote(Footnote footnote);
+
+ /**
+ * Process the start of a footnote body.
+ * @param body FootnoteBody that is starting
+ */
+ public abstract void startFootnoteBody(FootnoteBody body);
+
+ /**
+ * Process the ending of a footnote body.
+ * @param body FootnoteBody that is ending
+ */
+ public abstract void endFootnoteBody(FootnoteBody body);
/**
* Process a Leader.
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;
}
/**
- * @see org.apache.fop.fo.FOInputHandler#footnote()
+ * @see org.apache.fop.fo.FOInputHandler#startFootnote()
*/
- public void footnote() {
+ public void startFootnote(Footnote footnote) {
}
-
+
+ /**
+ * @see org.apache.fop.fo.FOInputHandler#endFootnote()
+ */
+ public void endFootnote(Footnote footnote) {
+ }
+
+ /**
+ * @see org.apache.fop.fo.FOInputHandler#startFootnoteBody()
+ */
+ public void startFootnoteBody(FootnoteBody body) {
+ }
+
+ /**
+ * @see org.apache.fop.fo.FOInputHandler#endFootnoteBody()
+ */
+ public void endFootnoteBody(FootnoteBody body) {
+ }
+
/**
* @see org.apache.fop.fo.FOInputHandler#leader(Leader)
*/
*/
package org.apache.fop.fo.flow;
+// XML
+import org.xml.sax.Attributes;
+
+// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FOTreeVisitor;
import org.apache.fop.fo.FObj;
public void acceptVisitor(FOTreeVisitor fotv) {
fotv.serveFootnote(this);
}
+
+ /**
+ * @see org.apache.fop.fo.FObj#handleAttrs
+ */
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
+
+ getFOTreeControl().getFOInputHandler().startFootnote(this);
+ }
+ protected void end() {
+ super.end();
+
+ getFOTreeControl().getFOInputHandler().endFootnote(this);
+ }
}
*/
package org.apache.fop.fo.flow;
+// XML
+import org.xml.sax.Attributes;
+
// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FOTreeVisitor;
fotv.serveFootnoteBody(this);
}
+ /**
+ * @see org.apache.fop.fo.FObj#handleAttrs
+ */
+ public void handleAttrs(Attributes attlist) throws FOPException {
+ super.handleAttrs(attlist);
+
+ getFOTreeControl().getFOInputHandler().startFootnoteBody(this);
+ }
+
+ protected void end() {
+ super.end();
+
+ getFOTreeControl().getFOInputHandler().endFootnoteBody(this);
+ }
}
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;
}
/**
- * @see org.apache.fop.fo.FOInputHandler#footnote()
+ * @see org.apache.fop.fo.FOInputHandler#startFootnote()
*/
- public void footnote() {
+ public void startFootnote(Footnote footnote) {
}
-
+
+ /**
+ * @see org.apache.fop.fo.FOInputHandler#endFootnote()
+ */
+ public void endFootnote(Footnote footnote) {
+ }
+
+ /**
+ * @see org.apache.fop.fo.FOInputHandler#startFootnoteBody()
+ */
+ public void startFootnoteBody(FootnoteBody body) {
+ }
+
+ /**
+ * @see org.apache.fop.fo.FOInputHandler#endFootnoteBody()
+ */
+ public void endFootnoteBody(FootnoteBody body) {
+ }
+
/**
* @see org.apache.fop.fo.FOInputHandler#leader(Leader)
*/
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.Inline;
import org.apache.fop.fo.flow.InstreamForeignObject;
import org.apache.fop.fo.flow.Leader;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfExternalGraphic;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfFile;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfFootnote;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfHyperLink;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem;
}
/**
- * @see org.apache.fop.fo.FOInputHandler#footnote()
+ * @see org.apache.fop.fo.FOInputHandler#startFootnote()
*/
- public void footnote() {
+ public void startFootnote(Footnote footnote) {
+ try {
+ RtfAttributes rtfAttr
+ = TextAttributesConverter.convertAttributes(footnote.propertyList, null);
+
+ IRtfTextrunContainer container
+ = (IRtfTextrunContainer)builderContext.getContainer(
+ IRtfTextrunContainer.class,
+ true, this);
+
+ RtfTextrun textrun = container.getTextrun();
+ RtfFootnote rtfFootnote = textrun.addFootnote();
+
+ builderContext.pushContainer(rtfFootnote);
+
+ } catch (IOException ioe) {
+ // TODO could we throw Exception in all FOInputHandler events?
+ log.error("startFootnote: " + ioe.getMessage());
+ throw new Error("IOException: " + ioe);
+ } catch (Exception e) {
+ log.error("startFootnote: " + e.getMessage());
+ throw new Error("Exception: " + e);
+ }
+ }
+
+ /**
+ * @see org.apache.fop.fo.FOInputHandler#endFootnote()
+ */
+ public void endFootnote(Footnote footnote) {
+ builderContext.popContainer();
+ }
+
+ /**
+ * @see org.apache.fop.fo.FOInputHandler#startFootnoteBody()
+ */
+ public void startFootnoteBody(FootnoteBody body) {
+ try {
+ RtfFootnote rtfFootnote
+ = (RtfFootnote)builderContext.getContainer(
+ RtfFootnote.class,
+ true, this);
+
+ rtfFootnote.startBody();
+ } catch (IOException ioe) {
+ // TODO could we throw Exception in all FOInputHandler events?
+ log.error("startFootnoteBody: " + ioe.getMessage());
+ throw new Error("IOException: " + ioe);
+ } catch (Exception e) {
+ log.error("startFootnoteBody: " + e.getMessage());
+ throw new Error("Exception: " + e);
+ }
+ }
+
+ /**
+ * @see org.apache.fop.fo.FOInputHandler#endFootnoteBody()
+ */
+ public void endFootnoteBody(FootnoteBody body) {
+ try {
+ RtfFootnote rtfFootnote
+ = (RtfFootnote)builderContext.getContainer(
+ RtfFootnote.class,
+ true, this);
+
+ rtfFootnote.endBody();
+ } catch (IOException ioe) {
+ // TODO could we throw Exception in all FOInputHandler events?
+ log.error("endFootnoteBody: " + ioe.getMessage());
+ throw new Error("IOException: " + ioe);
+ } catch (Exception e) {
+ log.error("endFootnoteBody: " + e.getMessage());
+ throw new Error("Exception: " + e);
+ }
}
/**
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modifica-
+ * tion, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any, must
+ * include the following acknowledgment: "This product includes software
+ * developed by the Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself, if
+ * and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ * endorse or promote products derived from this software without prior
+ * written permission. For written permission, please contact
+ * apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache", nor may
+ * "Apache" appear in their name, without prior written permission of the
+ * Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ============================================================================
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * on behalf of the Apache Software Foundation and was originally created by
+ * James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ * Software Foundation, please see <http://www.apache.org/>.
+ */
+
+package org.apache.fop.render.rtf.rtflib.rtfdoc;
+
+//Java
+import java.io.Writer;
+import java.io.IOException;
+
+//FOP
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTextrun;
+
+/** Model of an RTF footnote
+ * @author Peter Herweg, pherweg@web.de
+ */
+public class RtfFootnote extends RtfContainer
+ implements IRtfTextrunContainer {
+ RtfTextrun textrunInline = null;
+ RtfTextrun textrunBody = null;
+ boolean bBody = false;
+
+ /** Create an RTF list item as a child of given container with default attributes */
+ RtfFootnote(RtfContainer parent, Writer w) throws IOException {
+ super(parent, w);
+ textrunInline = new RtfTextrun(this, writer, null);
+ textrunBody = new RtfTextrun(this, writer, null);
+ }
+
+ public RtfTextrun getTextrun() throws IOException {
+ if (bBody) {
+ return textrunBody;
+ } else {
+ return textrunInline;
+ }
+ }
+
+ /**
+ * write RTF code of all our children
+ * @throws IOException for I/O problems
+ */
+ protected void writeRtfContent() throws IOException {
+ textrunInline.writeRtfContent();
+
+ writeGroupMark(true);
+ writeControlWord("footnote");
+ writeControlWord("ftnalt");
+ textrunBody.writeRtfContent();
+ writeGroupMark(false);
+ }
+
+ public void startBody() {
+ bBody = true;
+ }
+
+ public void endBody() {
+ bBody = false;
+ }
+}
RtfString r = new RtfString(this, writer, s);
}
+ public RtfFootnote addFootnote() throws IOException {
+ return new RtfFootnote(this, writer);
+ }
+
public void addParagraphBreak() throws IOException {
RtfParagraphBreak r = new RtfParagraphBreak(this, writer);
}