Read and apply notes' properties in section configuration

This commit is contained in:
Georgy Litvinov 2020-01-27 15:18:59 +01:00
parent 2c7fb816e6
commit 274f1089c8
3 changed files with 47 additions and 14 deletions

View file

@ -26,6 +26,7 @@
package writer2latex.office;
import org.w3c.dom.Node;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import java.util.Enumeration;
import java.util.Hashtable;
@ -102,5 +103,17 @@ public class PropertySet implements Cloneable {
}
return s;
}
public void loadNoteProperties(Node child) {
Element noteConfiguration = (Element) child;
String noteClass = noteConfiguration.getAttribute(XMLString.TEXT_NOTE_CLASS);
NamedNodeMap attrs = noteConfiguration.getAttributes();
for (int i=0;i<attrs.getLength();i++) {
Node attr = attrs.item(i);
if (attr.getNodeName().equals(XMLString.TEXT_NOTE_CLASS)) {
properties.put(noteClass, "true");
}
properties.put(attr.getNodeName()+":"+noteClass, attr.getNodeValue());
}
}
}

View file

@ -30,6 +30,7 @@ import writer2latex.util.Calc;
//import org.w3c.dom.NamedNodeMap;
//import java.util.Hashtable;
import writer2latex.util.Misc;
import writer2latex.xhtml.Debug;
/** <p> Class representing a style in OOo which contains a style:properties
* element </p>
@ -100,6 +101,7 @@ public class StyleWithProperties extends OfficeStyle {
}
else if (XMLString.STYLE_SECTION_PROPERTIES.equals(sName)) {
loadPropertiesFromDOM(SECTION,child);
}
else if (XMLString.STYLE_TABLE_PROPERTIES.equals(sName)) {
loadPropertiesFromDOM(TABLE,child);
@ -133,18 +135,20 @@ public class StyleWithProperties extends OfficeStyle {
Node child = node.getFirstChild();
while (child!=null) {
if (child.getNodeType()==Node.ELEMENT_NODE) {
String sName = child.getNodeName();
if (XMLString.STYLE_BACKGROUND_IMAGE.equals(sName)) {
String childName = child.getNodeName();
if (XMLString.STYLE_BACKGROUND_IMAGE.equals(childName)) {
backgroundImageProperties.loadFromDOM(child);
}
else if (XMLString.STYLE_COLUMNS.equals(sName)) {
else if (XMLString.STYLE_COLUMNS.equals(childName)) {
nColCount = Misc.getPosInteger(Misc.getAttribute(child, XMLString.FO_COLUMN_COUNT),1);
// TODO: read individual columns
}
else if (XMLString.STYLE_FOOTNOTE_SEP.equals(sName)) {
else if (XMLString.STYLE_FOOTNOTE_SEP.equals(childName)) {
bHasFootnoteSep = true;
footnoteSep.loadFromDOM(child);
} else if (XMLString.TEXT_NOTES_CONFIGURATION.equals(childName)) {
properties[nIndex].loadNoteProperties(child);
}
}
child = child.getNextSibling();