Is there a reference to this bookmark?
@@ -1020,7 +1059,7 @@ public class OfficeReader {
}
}
- traverseContent(body);
+ traverseContent(body,null,0,-1);
if (sAutoFigureSequenceName!=null) {
addFigureSequenceName(sAutoFigureSequenceName);
@@ -1043,10 +1082,11 @@ public class OfficeReader {
return getParagraph(parent);
}
- private void traverseContent(Element node) {
+ private void traverseContent(Element node, String sListStyleName, int nListLevel, int nParLevel) {
// Handle this node first
String sName = node.getTagName();
if (sName.equals(XMLString.TEXT_P)) {
+ nParLevel=0;
//collectMasterPage(getParStyle(node.getAttribute(XMLString.TEXT_STYLE_NAME)));
}
else if (sName.equals(XMLString.TEXT_H)) {
@@ -1057,6 +1097,7 @@ public class OfficeReader {
else {
nLevel = Misc.getPosInteger(node.getAttribute(XMLString.TEXT_LEVEL),1);
}
+ nParLevel = nLevel;
StyleWithProperties style = getParStyle(node.getAttribute(XMLString.TEXT_STYLE_NAME));
//collectMasterPage(style);
if (1<=nLevel && nLevel<=10 && heading[nLevel]==null) {
@@ -1068,6 +1109,20 @@ public class OfficeReader {
}
}
}
+ else if (sName.equals(XMLString.TEXT_LIST) ||
+ sName.equals(XMLString.TEXT_ORDERED_LIST) || sName.equals(XMLString.TEXT_UNORDERED_LIST)) {
+ nListLevel++;
+ String sStyleName = Misc.getAttribute(node, XMLString.TEXT_STYLE_NAME);
+ if (sStyleName!=null) sListStyleName = sStyleName;
+ }
+ else if (sName.equals(XMLString.TEXT_NOTE) ||
+ sName.equals(XMLString.TEXT_FOOTNOTE) || sName.equals(XMLString.TEXT_ENDNOTE) ||
+ sName.equals(XMLString.TABLE_TABLE)) {
+ // Various block elements; all resetting the list and par level
+ sListStyleName=null;
+ nListLevel=0;
+ nParLevel=-1;
+ }
else if (sName.equals(XMLString.TEXT_SEQUENCE)) {
String sSeqName = Misc.getAttribute(node,XMLString.TEXT_NAME);
String sRefName = Misc.getAttribute(node,XMLString.TEXT_REF_NAME);
@@ -1094,19 +1149,19 @@ public class OfficeReader {
else if ("endnote".equals(sClass)) { collectRefName(endnoteRef,node); }
}
else if (sName.equals(XMLString.TEXT_REFERENCE_MARK)) {
- collectMarkByPosition(referenceHeading,null,node);
+ collectMarkByPosition(referenceHeading,null,null,node,sListStyleName,nListLevel,nParLevel);
}
else if (sName.equals(XMLString.TEXT_REFERENCE_MARK_START)) {
- collectMarkByPosition(referenceHeading,null,node);
+ collectMarkByPosition(referenceHeading,null,null,node,sListStyleName,nListLevel,nParLevel);
}
else if (sName.equals(XMLString.TEXT_REFERENCE_REF)) {
collectRefName(referenceRef,node);
}
else if (sName.equals(XMLString.TEXT_BOOKMARK)) {
- collectMarkByPosition(bookmarkHeading,bookmarkList,node);
+ collectMarkByPosition(bookmarkHeading,bookmarkList,bookmarkListLevel,node,sListStyleName,nListLevel,nParLevel);
}
else if (sName.equals(XMLString.TEXT_BOOKMARK_START)) {
- collectMarkByPosition(bookmarkHeading,bookmarkList,node);
+ collectMarkByPosition(bookmarkHeading,bookmarkList,bookmarkListLevel,node,sListStyleName,nListLevel,nParLevel);
}
else if (sName.equals(XMLString.TEXT_BOOKMARK_REF)) {
collectRefName(bookmarkRef,node);
@@ -1152,7 +1207,7 @@ public class OfficeReader {
Node child = node.getFirstChild();
while (child!=null) {
if (child.getNodeType()==Node.ELEMENT_NODE) {
- traverseContent((Element) child);
+ traverseContent((Element) child, sListStyleName, nListLevel, nParLevel);
}
child = child.getNextSibling();
}
@@ -1175,27 +1230,24 @@ public class OfficeReader {
}
- private void collectRefName(HashSet