From 10159ea46c0a601de39cc920d19db12571bc7a34 Mon Sep 17 00:00:00 2001 From: Finn Bock Date: Fri, 1 Oct 2004 09:30:35 +0000 Subject: [PATCH] Support nested attribute values, for use with border control words. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197993 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/render/rtf/rtflib/rtfdoc/RtfAttributes.java | 11 +++++++++++ .../fop/render/rtf/rtflib/rtfdoc/RtfElement.java | 12 ++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAttributes.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAttributes.java index 225e66eaf..26fcbb71b 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAttributes.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAttributes.java @@ -144,6 +144,17 @@ implements java.lang.Cloneable { return this; } + /** + * Set an attribute that has nested attributes as value + * @param name name of attribute + * @param type value of the nested attributes + * @return this (which now contains the new entry) + */ + public RtfAttributes set(String name, RtfAttributes value) { + values.put(name, value); + return this; + } + /** * @param name String containing attribute name * @return the value of an attribute, null if not found diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfElement.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfElement.java index 4ce4bf41a..03d5697d3 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfElement.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfElement.java @@ -211,7 +211,11 @@ public abstract class RtfElement { cw += value; } else if (value instanceof String) { cw += value; - } + } else if (value instanceof RtfAttributes) { + writeControlWord(cw); + writeAttributes((RtfAttributes) value, null); + return; + } writeControlWord(cw); } @@ -229,7 +233,11 @@ public abstract class RtfElement { cw += value; } else if (value instanceof String) { cw += value; - } + } else if (value instanceof RtfAttributes) { + writeControlWord(cw); + writeAttributes((RtfAttributes) value, null); + return; + } writeControlWordNS(cw); } -- 2.39.5