if (xService.supportsService(
"com.sun.star.text.textfield.MetadataField"))
{
XMetadatable xMeta = (XMetadatable)
UnoRuntime.queryInterface(XMetadatable.class, xField);
StringPair xmlid = xMeta.getMetadataReference();
node = new MetaFieldNode(xmlid);
m_Stack.push(node);
XEnumerationAccess xEA = (XEnumerationAccess)
UnoRuntime.queryInterface(XEnumerationAccess.class,
xMeta);
XEnumeration xEnumChildren = xEA.createEnumeration();
TreeNode node2 = convertChildren(xEnumChildren);
m_T.assure("stack error: meta-field", node == node2);
} else {
XPropertySet xFieldPropSet = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, xField);
String content = (String)
xFieldPropSet.getPropertyValue("Content");
boolean isFixed = (Boolean)
xFieldPropSet.getPropertyValue("IsFixed");
m_T.assure("field not fixed?", isFixed);
node = new TextFieldNode(content);
}
} else if (type.equals("Footnote")) {
Object xNote = xPropSet.getPropertyValue("Footnote");
XFootnote xFootnote = (XFootnote)
UnoRuntime.queryInterface(XFootnote.class, xNote);
String label = xFootnote.getLabel();
node = new FootnoteNode(label);
} else if (type.equals("Frame")) {
XContentEnumerationAccess xCEA = (XContentEnumerationAccess)
UnoRuntime.queryInterface(XContentEnumerationAccess.class,
xPortion);
XEnumeration xContentEnum = xCEA.createContentEnumeration("");
while (xContentEnum.hasMoreElements()) {
Object xFrame = xContentEnum.nextElement();
XPropertySet xFramePropSet = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, xFrame);
TextContentAnchorType anchor = (TextContentAnchorType)
xFramePropSet.getPropertyValue("AnchorType");
XNamed xNamed = (XNamed)
UnoRuntime.queryInterface(XNamed.class, xFrame);
String name = xNamed.getName();
node = new FrameNode(name, anchor);
m_Stack.peek().appendChild(node);
}
continue;
} else if (type.equals("ControlCharacter")) {
short c = (Short)
xPropSet.getPropertyValue("ControlCharacter");
node = new ControlCharacterNode(c);
} else if (type.equals("Bookmark")) {
Object xMark = xPropSet.getPropertyValue("Bookmark");
XNamed xNamed = (XNamed)
UnoRuntime.queryInterface(XNamed.class, xMark);
String name = xNamed.getName();
XMetadatable xMetadatable = (XMetadatable)
UnoRuntime.queryInterface(XMetadatable.class, xMark);
StringPair xmlid = xMetadatable.getMetadataReference();
boolean isCollapsed = (Boolean)
xPropSet.getPropertyValue("IsCollapsed");
if (isCollapsed) {
node = new BookmarkNode(name, xmlid);
} else {
boolean isStart = (Boolean)
xPropSet.getPropertyValue("IsStart");
if (isStart) {
node = new BookmarkStartNode(name, xmlid);
} else {
node = new BookmarkEndNode(name, xmlid);
}
}
} else if (type.equals("ReferenceMark")) {
Object xMark = xPropSet.getPropertyValue("ReferenceMark");
XNamed xNamed = (XNamed)
UnoRuntime.queryInterface(XNamed.class, xMark);
String name = xNamed.getName();
boolean isCollapsed = (Boolean)
xPropSet.getPropertyValue("IsCollapsed");
if (isCollapsed) {
node = new ReferenceMarkNode(name);
} else {
boolean isStart = (Boolean)
xPropSet.getPropertyValue("IsStart");
if (isStart) {
node = new ReferenceMarkStartNode(name);
} else {
node = new ReferenceMarkEndNode(name);
}
}
} else if (type.equals("DocumentIndexMark")) {
Object xMark = xPropSet.getPropertyValue("DocumentIndexMark");
XPropertySet xMarkSet = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, xMark);
String name = (String) xMarkSet.getPropertyValue("PrimaryKey");
boolean isCollapsed = (Boolean)
xPropSet.getPropertyValue("IsCollapsed");
if (isCollapsed) {
node = new DocumentIndexMarkNode(name);
} else {
boolean isStart = (Boolean)
xPropSet.getPropertyValue("IsStart");
if (isStart) {
node = new DocumentIndexMarkStartNode(name);
} else {
node = new DocumentIndexMarkEndNode(name);
}
}
} else if (type.equals("SoftPageBreak")) {
node = new SoftPageBreakNode();
} else if (type.equals("Ruby")) {
boolean isStart = (Boolean)
xPropSet.getPropertyValue("IsStart");
if (isStart) {
// ARRGH!!! stupid api...
// the text is ONLY at the start!
String ruby = (String)
xPropSet.getPropertyValue("RubyText");
node = new RubyNode(ruby);
m_Stack.push(node);
continue;
} else {
node = m_Stack.pop();
m_T.assure("stack error: Ruby expected; is: " +
node.toString(), node instanceof RubyNode);
// m_T.assure("stack error: ruby",
// ruby.equals(((RubyNode)node).getRubyText()));
}
} else if (type.equals("InContentMetadata")) {
Object xMeta = xPropSet.getPropertyValue("InContentMetadata");
XMetadatable xMetadatable = (XMetadatable)
UnoRuntime.queryInterface(XMetadatable.class, xMeta);
StringPair xmlid = xMetadatable.getMetadataReference();
node = new MetaNode(xmlid);
m_Stack.push(node);
XEnumerationAccess xEA = (XEnumerationAccess)
UnoRuntime.queryInterface(XEnumerationAccess.class, xMeta);
XEnumeration xEnumChildren = xEA.createEnumeration();