// 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;
/**
* 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.
// 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;
}
/**
- * @see org.apache.fop.fo.FOInputHandler#startLink()
+ * @see org.apache.fop.fo.FOInputHandler#startLink(BasicLink basicLink)
*/
- public void startLink() {
+ public void startLink(BasicLink basicLink) {
}
/**
*/
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;
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();
+ }
}
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;
}
/**
- * @see org.apache.fop.fo.FOInputHandler#startLink()
+ * @see org.apache.fop.fo.FOInputHandler#startLink(BasicLink basicLink)
*/
- public void startLink() {
+ public void startLink(BasicLink basicLink) {
}
/**
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;
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;
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;
}
/**
- * @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();
}
/**
*
* {\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
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);
+ }
//////////////////////////////////////////////////
public boolean isEmpty () {
return false;
}
+
+ public RtfTextrun getTextrun()
+ throws IOException {
+ RtfTextrun textrun = RtfTextrun.getTextrun(this, writer, null);
+ return textrun;
+ }
}
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);
}