pherweg 2004/01/01 13:19:55 Modified: src/java/org/apache/fop/fo/flow BasicLink.java src/java/org/apache/fop/fo FOInputHandler.java FOTreeHandler.java src/java/org/apache/fop/render/mif MIFHandler.java src/java/org/apache/fop/render/rtf RTFHandler.java src/java/org/apache/fop/render/rtf/rtflib/rtfdoc RtfHyperLink.java RtfTextrun.java Log: added support for fo:basic-link Revision Changes Path 1.9 +21 -0 xml-fop/src/java/org/apache/fop/fo/flow/BasicLink.java Index: BasicLink.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/BasicLink.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- BasicLink.java 28 Dec 2003 17:10:16 -0000 1.8 +++ BasicLink.java 1 Jan 2004 21:19:54 -0000 1.9 @@ -50,7 +50,11 @@ */ 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.properties.CommonAccessibility; @@ -157,4 +161,21 @@ fotv.serveBasicLink(this); } + /** + * @see org.apache.fop.fo.FObj#handleAttrs + */ + public void handleAttrs(Attributes attlist) throws FOPException { + super.handleAttrs(attlist); + + getFOTreeControl().getFOInputHandler().startLink(this); + } + + /** + * @see org.apache.fop.fo.FONode#end + */ + public void end() { + super.end(); + + getFOTreeControl().getFOInputHandler().endLink(); + } } 1.12 +4 -2 xml-fop/src/java/org/apache/fop/fo/FOInputHandler.java Index: FOInputHandler.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOInputHandler.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- FOInputHandler.java 1 Nov 2003 14:23:49 -0000 1.11 +++ FOInputHandler.java 1 Jan 2004 21:19:55 -0000 1.12 @@ -55,6 +55,7 @@ // FOP import org.apache.fop.apps.FOPException; +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.Inline; @@ -337,8 +338,9 @@ /** * Process start of a Link. + * @param basicLink BasicLink that is ending */ - public abstract void startLink(); + public abstract void startLink(BasicLink basicLink); /** * Process end of a Link. 1.11 +4 -3 xml-fop/src/java/org/apache/fop/fo/FOTreeHandler.java Index: FOTreeHandler.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOTreeHandler.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- FOTreeHandler.java 1 Nov 2003 14:23:49 -0000 1.10 +++ FOTreeHandler.java 1 Jan 2004 21:19:55 -0000 1.11 @@ -59,6 +59,7 @@ // FOP import org.apache.fop.apps.FOPException; +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.InstreamForeignObject; @@ -415,9 +416,9 @@ } /** - * @see org.apache.fop.fo.FOInputHandler#startLink() + * @see org.apache.fop.fo.FOInputHandler#startLink(BasicLink basicLink) */ - public void startLink() { + public void startLink(BasicLink basicLink) { } /** 1.3 +4 -3 xml-fop/src/java/org/apache/fop/render/mif/MIFHandler.java Index: MIFHandler.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/mif/MIFHandler.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MIFHandler.java 12 Dec 2003 22:37:39 -0000 1.2 +++ MIFHandler.java 1 Jan 2004 21:19:55 -0000 1.3 @@ -57,6 +57,7 @@ import org.apache.fop.apps.Document; import org.apache.fop.apps.FOPException; import org.apache.fop.fo.FOInputHandler; +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.InstreamForeignObject; @@ -398,9 +399,9 @@ } /** - * @see org.apache.fop.fo.FOInputHandler#startLink() + * @see org.apache.fop.fo.FOInputHandler#startLink(BasicLink basicLink) */ - public void startLink() { + public void startLink(BasicLink basicLink) { } /** 1.12 +36 -3 xml-fop/src/java/org/apache/fop/render/rtf/RTFHandler.java Index: RTFHandler.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/RTFHandler.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- RTFHandler.java 29 Dec 2003 23:28:47 -0000 1.11 +++ RTFHandler.java 1 Jan 2004 21:19:55 -0000 1.12 @@ -61,6 +61,7 @@ import org.apache.fop.fo.EnumProperty; import org.apache.fop.fo.FOInputHandler; import org.apache.fop.datatypes.FixedLength; +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.Inline; @@ -81,6 +82,7 @@ import org.apache.fop.fo.Constants; import org.apache.fop.fo.Property; import org.apache.fop.fo.LengthProperty; +import org.apache.fop.fo.StringProperty; import org.apache.fop.apps.Document; import org.apache.fop.render.rtf.rtflib.rtfdoc.ITableAttributes; import org.apache.fop.render.rtf.rtflib.rtfdoc.IRtfAfterContainer; @@ -94,6 +96,7 @@ 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.RtfHyperLink; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem.RtfListItemLabel; @@ -730,15 +733,45 @@ } /** - * @see org.apache.fop.fo.FOInputHandler#startLink() + * @see org.apache.fop.fo.FOInputHandler#startLink(BasicLink basicLink) */ - public void startLink() { + public void startLink(BasicLink basicLink) { + try { + IRtfTextrunContainer container + = (IRtfTextrunContainer)builderContext.getContainer( + IRtfTextrunContainer.class, true, this); + + RtfTextrun textrun=container.getTextrun(); + + RtfHyperLink link=textrun.addHyperlink(new RtfAttributes()); + + StringProperty internal + = (StringProperty)basicLink.propertyList.get(Constants.PR_INTERNAL_DESTINATION); + StringProperty external + = (StringProperty)basicLink.propertyList.get(Constants.PR_EXTERNAL_DESTINATION); + + if(external != null) { + link.setExternalURL(external.getString()); + } else if(internal != null) { + link.setInternalURL(internal.getString()); + } + + builderContext.pushContainer(link); + + } catch (IOException ioe) { + log.error("startLink:" + ioe.getMessage()); + throw new Error(ioe.getMessage()); + } catch (Exception e) { + log.error("startLink: " + e.getMessage()); + throw new Error(e.getMessage()); + } } /** * @see org.apache.fop.fo.FOInputHandler#endLink() */ public void endLink() { + builderContext.popContainer(); } /** 1.2 +16 -2 xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHyperLink.java Index: RtfHyperLink.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHyperLink.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- RtfHyperLink.java 4 Nov 2003 23:59:11 -0000 1.1 +++ RtfHyperLink.java 1 Jan 2004 21:19:55 -0000 1.2 @@ -68,7 +68,10 @@ * * {\field {\*\fldinst HYPERLINK "http://www.test.de" }{\fldrslt Joe Smith}} */ -public class RtfHyperLink extends RtfContainer implements IRtfTextContainer { +public class RtfHyperLink +extends RtfContainer +implements IRtfTextContainer, + IRtfTextrunContainer { ////////////////////////////////////////////////// // @@ Members @@ -99,6 +102,11 @@ super ((RtfContainer) parent, writer, attr); new RtfText (this, writer, str, attr); } + + public RtfHyperLink (RtfTextrun parent, Writer writer, RtfAttributes attr) + throws IOException { + super ((RtfContainer) parent, writer, attr); + } ////////////////////////////////////////////////// @@ -239,5 +247,11 @@ */ public boolean isEmpty () { return false; + } + + public RtfTextrun getTextrun() + throws IOException { + RtfTextrun textrun = RtfTextrun.getTextrun(this, writer, null); + return textrun; } } 1.7 +4 -0 xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java Index: RtfTextrun.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- RtfTextrun.java 22 Nov 2003 17:40:13 -0000 1.6 +++ RtfTextrun.java 1 Jan 2004 21:19:55 -0000 1.7 @@ -172,6 +172,10 @@ RtfPageNumber r = new RtfPageNumber(this, writer, attr); } + public RtfHyperLink addHyperlink(RtfAttributes attr) throws IOException { + return new RtfHyperLink(this, writer, attr); + } + public RtfExternalGraphic newImage() throws IOException { return new RtfExternalGraphic(this, writer); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]