use of org.olat.core.util.openxml.OpenXMLDocument.Border in project OpenOLAT by OpenOLAT.
the class HTMLToOpenXMLHandler method getCurrentParagraph.
/**
* Flush the text if a new paragraph is created. Trailing text is flushed
* in the previous paragraph.
* @param create
* @return
*/
protected Element getCurrentParagraph(boolean create) {
if (create || currentParagraph == null) {
// flush the text
if (textBuffer != null) {
flushText();
addContent(currentParagraph);
}
Indent indent = getCurrentIndent();
Border leftBorder = getCurrentLeftBorder();
PredefinedStyle predefinedStyle = getCurrentPredefinedStyle();
currentParagraph = factory.createParagraphEl(indent, leftBorder, startSpacing, predefinedStyle);
// consumed
startSpacing = null;
}
return currentParagraph;
}
use of org.olat.core.util.openxml.OpenXMLDocument.Border in project OpenOLAT by OpenOLAT.
the class HTMLToOpenXMLHandler method getCurrentLeftBorder.
public Border getCurrentLeftBorder() {
if (styleStack.isEmpty())
return null;
int indent = 0;
for (StyleStatus style : styleStack) {
if (style.isQuote()) {
indent++;
}
}
String val;
switch(indent) {
case 1:
val = "single";
break;
case 2:
val = "double";
break;
default:
val = "triple";
}
return indent == 0 ? null : new Border(QUOTE_BORDER, val);
}
use of org.olat.core.util.openxml.OpenXMLDocument.Border in project OpenOLAT by OpenOLAT.
the class HTMLToOpenXMLHandler method getCurrentRun.
/**
* Get or create a run on the current paragraph
* @return
*/
protected Element getCurrentRun() {
Element paragraphEl;
if (currentParagraph == null) {
Indent indent = getCurrentIndent();
Border leftBorder = getCurrentLeftBorder();
PredefinedStyle predefinedStyle = getCurrentPredefinedStyle();
paragraphEl = currentParagraph = factory.createParagraphEl(indent, leftBorder, startSpacing, predefinedStyle);
startSpacing = null;
} else {
paragraphEl = currentParagraph;
}
Node lastChild = paragraphEl.getLastChild();
if (lastChild != null && "w:r".equals(lastChild.getNodeName())) {
return (Element) lastChild;
}
PredefinedStyle runStyle = getCurrentPredefinedStyle();
return (Element) paragraphEl.appendChild(factory.createRunEl(null, runStyle));
}
use of org.olat.core.util.openxml.OpenXMLDocument.Border in project openolat by klemens.
the class HTMLToOpenXMLHandler method getCurrentRun.
/**
* Get or create a run on the current paragraph
* @return
*/
protected Element getCurrentRun() {
Element paragraphEl;
if (currentParagraph == null) {
Indent indent = getCurrentIndent();
Border leftBorder = getCurrentLeftBorder();
PredefinedStyle predefinedStyle = getCurrentPredefinedStyle();
paragraphEl = currentParagraph = factory.createParagraphEl(indent, leftBorder, startSpacing, predefinedStyle);
startSpacing = null;
} else {
paragraphEl = currentParagraph;
}
Node lastChild = paragraphEl.getLastChild();
if (lastChild != null && "w:r".equals(lastChild.getNodeName())) {
return (Element) lastChild;
}
PredefinedStyle runStyle = getCurrentPredefinedStyle();
return (Element) paragraphEl.appendChild(factory.createRunEl(null, runStyle));
}
use of org.olat.core.util.openxml.OpenXMLDocument.Border in project openolat by klemens.
the class HTMLToOpenXMLHandler method getCurrentLeftBorder.
public Border getCurrentLeftBorder() {
if (styleStack.isEmpty())
return null;
int indent = 0;
for (StyleStatus style : styleStack) {
if (style.isQuote()) {
indent++;
}
}
String val;
switch(indent) {
case 1:
val = "single";
break;
case 2:
val = "double";
break;
default:
val = "triple";
}
return indent == 0 ? null : new Border(QUOTE_BORDER, val);
}
Aggregations