Merge spans in LaTeX + add UI for two new options
git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@175 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
parent
2fd6ccd490
commit
51f960d510
36 changed files with 519 additions and 369 deletions
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.4 (2014-08-27)
|
||||
* Version 1.4 (2014-09-19)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -45,8 +45,7 @@ import writer2latex.office.MIMETypes;
|
|||
import writer2latex.office.StyleWithProperties;
|
||||
import writer2latex.office.XMLString;
|
||||
|
||||
/**
|
||||
* <p>This class converts a Writer XML file to a LaTeX file<.</p>
|
||||
/** This class converts a Writer XML file to a LaTeX file
|
||||
*/
|
||||
public final class ConverterPalette extends ConverterBase {
|
||||
|
||||
|
@ -98,7 +97,7 @@ public final class ConverterPalette extends ConverterBase {
|
|||
public void addGlobalOption(String sOption) {
|
||||
globalOptions.addValue(sOption);
|
||||
}
|
||||
|
||||
|
||||
// Accessor methods for helpers
|
||||
public I18n getI18n() { return i18n; }
|
||||
public ColorConverter getColorCv() { return colorCv; }
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.4 (2014-09-16)
|
||||
* Version 1.4 (2014-09-18)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -820,6 +820,16 @@ public class FieldConverter extends ConverterHelper {
|
|||
palette.getInlineCv().traversePCDATA(node,ldp,oc);
|
||||
}
|
||||
}
|
||||
|
||||
/** Do we have any pending reference marks or bookmarks, that may be inserted in this context?
|
||||
*
|
||||
* @param oc the context to verify against
|
||||
* @return true if there are pending marks
|
||||
*/
|
||||
public boolean hasPendingReferenceMarks(Context oc) {
|
||||
return !oc.isInSection() && !oc.isInCaption() && !oc.isVerbatim() &&
|
||||
postponedReferenceMarks.size()+postponedBookmarks.size()>0;
|
||||
}
|
||||
|
||||
/** <p>Process pending reference marks and bookmarks (which may have been
|
||||
* postponed within sections, captions or verbatim text.</p>
|
||||
|
@ -870,7 +880,7 @@ public class FieldConverter extends ConverterHelper {
|
|||
}
|
||||
else {
|
||||
if (bUseHyperref) {
|
||||
if (ofr.getTextContent(node).trim().equals(sHref)) {
|
||||
if (OfficeReader.getTextContent(node).trim().equals(sHref)) {
|
||||
// The link text equals the url
|
||||
ldp.append("\\url{")
|
||||
.append(escapeHref(sHref,oc.isInFootnote()))
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
* Copyright: 2002-2014 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-11-23)
|
||||
* Version 1.4 (2014-09-18)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -194,6 +194,16 @@ public class IndexConverter extends ConverterHelper {
|
|||
postponedIndexMarks.add(node);
|
||||
}
|
||||
}
|
||||
|
||||
/** Do we have any pending index marks, that may be inserted in this context?
|
||||
*
|
||||
* @param oc the context to verify against
|
||||
* @return true if there are pending index marks
|
||||
*/
|
||||
public boolean hasPendingIndexMarks(Context oc) {
|
||||
return !oc.isInSection() && !oc.isInCaption() && !oc.isVerbatim() &&
|
||||
postponedIndexMarks.size()>0;
|
||||
}
|
||||
|
||||
public void flushIndexMarks(LaTeXDocumentPortion ldp, Context oc) {
|
||||
// We may still be in a context with no index marks
|
||||
|
|
|
@ -20,12 +20,14 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.4 (2014-09-08)
|
||||
* Version 1.4 (2014-09-19)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.latex;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
@ -70,16 +72,30 @@ public class InlineConverter extends ConverterHelper {
|
|||
.append("}\\fi}").nl();
|
||||
}
|
||||
}
|
||||
|
||||
/** Handle several text:span elements
|
||||
*
|
||||
*/
|
||||
private void handleTextSpans(Element[] nodes, LaTeXDocumentPortion ldp, Context oc) {
|
||||
if (oc.isMathMode()) {
|
||||
for (Element node : nodes) {
|
||||
handleTextSpanMath(node, ldp, oc);
|
||||
}
|
||||
}
|
||||
else {
|
||||
handleTextSpanText(ldp, oc, nodes);
|
||||
}
|
||||
}
|
||||
|
||||
/** Handle a text:span element
|
||||
*/
|
||||
public void handleTextSpan(Element node, LaTeXDocumentPortion ldp, Context oc) {
|
||||
if (oc.isMathMode()) { handleTextSpanMath(node, ldp, oc); }
|
||||
else { handleTextSpanText(node, ldp, oc); }
|
||||
else { handleTextSpanText(ldp, oc, node); }
|
||||
}
|
||||
|
||||
private void handleTextSpanMath(Element node, LaTeXDocumentPortion ldp, Context oc) {
|
||||
// TODO: Handle a selection of formatting attributes: color, supscript...
|
||||
// TODO: Handle a selection of formatting attributes: color, superscript...
|
||||
String sStyleName = node.getAttribute(XMLString.TEXT_STYLE_NAME);
|
||||
StyleWithProperties style = ofr.getTextStyle(sStyleName);
|
||||
|
||||
|
@ -113,79 +129,86 @@ public class InlineConverter extends ConverterHelper {
|
|||
palette.getI18n().popSpecialTable();
|
||||
}
|
||||
|
||||
private void handleTextSpanText(Element node, LaTeXDocumentPortion ldp, Context oc) {
|
||||
String sStyleName = node.getAttribute(XMLString.TEXT_STYLE_NAME);
|
||||
StyleWithProperties style = ofr.getTextStyle(sStyleName);
|
||||
|
||||
// Check for hidden text
|
||||
if (!bDisplayHiddenText && style!=null && "none".equals(style.getProperty(XMLString.TEXT_DISPLAY))) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for strict handling of styles
|
||||
String sDisplayName = ofr.getTextStyles().getDisplayName(sStyleName);
|
||||
if (config.otherStyles()!=LaTeXConfig.ACCEPT && !config.getTextStyleMap().contains(sDisplayName)) {
|
||||
if (config.otherStyles()==LaTeXConfig.WARNING) {
|
||||
System.err.println("Warning: Text with style "+sDisplayName+" was ignored");
|
||||
}
|
||||
else if (config.otherStyles()==LaTeXConfig.ERROR) {
|
||||
ldp.append("% Error in source document: Text with style ")
|
||||
.append(palette.getI18n().convert(sDisplayName,false,oc.getLang()))
|
||||
.append(" was ignored").nl();
|
||||
}
|
||||
// Ignore this text:
|
||||
return;
|
||||
}
|
||||
|
||||
boolean styled = true;
|
||||
|
||||
// don't style it if a {foot|end}note is the only content
|
||||
if (onlyNote(node) || OfficeReader.getCharacterCount(node)==0) { styled = false; }
|
||||
|
||||
// Also don't style it if we're already within a verbatim environment
|
||||
if (oc.isVerbatim()) { styled = false; }
|
||||
|
||||
boolean bNoFootnotes = false;
|
||||
|
||||
// Always push the font used
|
||||
palette.getI18n().pushSpecialTable(palette.getCharSc().getFontName(ofr.getTextStyle(sStyleName)));
|
||||
|
||||
// Apply the style
|
||||
BeforeAfter ba = new BeforeAfter();
|
||||
Context ic = (Context) oc.clone();
|
||||
if (styled) { palette.getCharSc().applyTextStyle(sStyleName,ba,ic); }
|
||||
|
||||
// Footnote problems:
|
||||
// No footnotes in sub/superscript (will disappear)
|
||||
// No multiparagraph footnotes embedded in text command (eg. \textbf{..})
|
||||
// Simple solution: styled text element is forbidden footnote area
|
||||
if (styled && !ic.isInFootnote()) { bNoFootnotes = true; }
|
||||
|
||||
// Temp solution: Ignore hard formatting in header/footer (name clash problem)
|
||||
// only in package format.
|
||||
if (ofr.isPackageFormat() && (style!=null && style.isAutomatic()) && ic.isInHeaderFooter()) {
|
||||
styled = false;
|
||||
}
|
||||
|
||||
if (styled) {
|
||||
if (bNoFootnotes) { ic.setNoFootnotes(true); }
|
||||
ldp.append(ba.getBefore());
|
||||
}
|
||||
|
||||
traverseInlineText(node,ldp,ic);
|
||||
|
||||
if (styled) {
|
||||
ldp.append(ba.getAfter());
|
||||
ic.setNoFootnotes(false);
|
||||
if (!ic.isInFootnote()) { palette.getNoteCv().flushFootnotes(ldp,oc); }
|
||||
}
|
||||
|
||||
// Flush any pending index marks and reference marks
|
||||
palette.getFieldCv().flushReferenceMarks(ldp,oc);
|
||||
palette.getIndexCv().flushIndexMarks(ldp,oc);
|
||||
|
||||
// finally pop the special table
|
||||
palette.getI18n().popSpecialTable();
|
||||
// Handle several spans.
|
||||
// If the converted formatting happens to be identical (e.g. \textbf{...}), the spans will be merged.
|
||||
private void handleTextSpanText(LaTeXDocumentPortion ldp, Context oc, Element... nodes) {
|
||||
// The current formatting
|
||||
BeforeAfter baCurrent = new BeforeAfter();
|
||||
for (Element node : nodes) {
|
||||
String sStyleName = node.getAttribute(XMLString.TEXT_STYLE_NAME);
|
||||
StyleWithProperties style = ofr.getTextStyle(sStyleName);
|
||||
|
||||
// First check for hidden text
|
||||
if (bDisplayHiddenText || style==null || !"none".equals(style.getProperty(XMLString.TEXT_DISPLAY))) {
|
||||
// Then check for strict handling of styles
|
||||
String sDisplayName = ofr.getTextStyles().getDisplayName(sStyleName);
|
||||
if (config.otherStyles()!=LaTeXConfig.ACCEPT && !config.getTextStyleMap().contains(sDisplayName)) {
|
||||
if (config.otherStyles()==LaTeXConfig.WARNING) {
|
||||
System.err.println("Warning: Text with style "+sDisplayName+" was ignored");
|
||||
}
|
||||
else if (config.otherStyles()==LaTeXConfig.ERROR) {
|
||||
ldp.append("% Error in source document: Text with style ")
|
||||
.append(palette.getI18n().convert(sDisplayName,false,oc.getLang()))
|
||||
.append(" was ignored").nl();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// We do want to convert this span :-)
|
||||
|
||||
// Always push the font used
|
||||
palette.getI18n().pushSpecialTable(palette.getCharSc().getFontName(ofr.getTextStyle(sStyleName)));
|
||||
|
||||
// Apply the style
|
||||
BeforeAfter ba = new BeforeAfter();
|
||||
Context ic = (Context) oc.clone();
|
||||
// Don't style it if
|
||||
// - we're already within a verbatim environment
|
||||
// - a {foot|end}note is the only content
|
||||
// - there is no content
|
||||
// - this is an automatic style in header/footer (name clash problem, only in package format)
|
||||
if (!oc.isVerbatim() && !onlyNote(node) && OfficeReader.getCharacterCount(node)>0
|
||||
&& !(ofr.isPackageFormat() && (style!=null && style.isAutomatic()) && oc.isInHeaderFooter())) {
|
||||
palette.getCharSc().applyTextStyle(sStyleName,ba,ic);
|
||||
}
|
||||
|
||||
// Footnote problems:
|
||||
// No footnotes in sub/superscript (will disappear)
|
||||
// No multiparagraph footnotes embedded in text command (eg. \textbf{..})
|
||||
// Simple solution: styled text element is forbidden area for footnotes
|
||||
if ((ba.getBefore().length()>0 || ba.getAfter().length()>0) && !ic.isInFootnote()) {
|
||||
ic.setNoFootnotes(true);
|
||||
}
|
||||
|
||||
// Merge spans? If the formatting of this span differs from the previous span, we will close the
|
||||
// previous span and start a new one
|
||||
if (!ba.getBefore().equals(baCurrent.getBefore()) || !ba.getAfter().equals(baCurrent.getAfter())) {
|
||||
ldp.append(baCurrent.getAfter());
|
||||
ldp.append(ba.getBefore());
|
||||
baCurrent = ba;
|
||||
}
|
||||
|
||||
traverseInlineText(node,ldp,ic);
|
||||
|
||||
// In the special case of pending footnotes, index marks and reference marks, we will close the span now.
|
||||
// Otherwise we will wait and see
|
||||
if (palette.getNoteCv().hasPendingFootnotes(oc)
|
||||
|| palette.getIndexCv().hasPendingIndexMarks(oc)
|
||||
|| palette.getFieldCv().hasPendingReferenceMarks(oc)) {
|
||||
ldp.append(baCurrent.getAfter());
|
||||
baCurrent = new BeforeAfter();
|
||||
}
|
||||
|
||||
// Flush any pending footnotes, index marks and reference marks
|
||||
if (!ic.isInFootnote()) { palette.getNoteCv().flushFootnotes(ldp,oc); }
|
||||
palette.getFieldCv().flushReferenceMarks(ldp,oc);
|
||||
palette.getIndexCv().flushIndexMarks(ldp,oc);
|
||||
|
||||
// finally pop the special table
|
||||
palette.getI18n().popSpecialTable();
|
||||
}
|
||||
}
|
||||
}
|
||||
ldp.append(baCurrent.getAfter());
|
||||
}
|
||||
|
||||
public void traverseInlineText(Element node, LaTeXDocumentPortion ldp, Context oc) {
|
||||
|
@ -257,122 +280,141 @@ public class InlineConverter extends ConverterHelper {
|
|||
|
||||
ldp.append("$");
|
||||
}
|
||||
else {
|
||||
handleTextSpan(child,ldp,oc);
|
||||
else {
|
||||
// Collect further spans
|
||||
Vector<Element> spans = new Vector<Element>();
|
||||
|
||||
Node remember;
|
||||
boolean bContinue = false;
|
||||
do {
|
||||
spans.add((Element)childNode);
|
||||
remember = childNode;
|
||||
childNode = childNode.getNextSibling();
|
||||
bContinue = false;
|
||||
if (childNode!=null && childNode.getNodeType()==Node.ELEMENT_NODE &&
|
||||
childNode.getNodeName().equals(XMLString.TEXT_SPAN)) {
|
||||
sStyleName = Misc.getAttribute(childNode,XMLString.TEXT_STYLE_NAME);
|
||||
if (!"OOoLaTeX".equals(ofr.getTextStyles().getDisplayName(sStyleName)))
|
||||
bContinue = true;
|
||||
}
|
||||
} while(bContinue);
|
||||
childNode = remember;
|
||||
|
||||
handleTextSpans(spans.toArray(new Element[spans.size()]),ldp,oc);
|
||||
}
|
||||
}
|
||||
else if (child.getNodeName().startsWith("draw:")) {
|
||||
palette.getDrawCv().handleDrawElement(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_S)) {
|
||||
if (config.ignoreDoubleSpaces()) {
|
||||
ldp.append(" ");
|
||||
}
|
||||
else {
|
||||
int count= Misc.getPosInteger(child.getAttribute(XMLString.TEXT_C),1);
|
||||
//String sSpace = config.ignoreDoubleSpaces() ? " " : "\\ ";
|
||||
for ( ; count > 0; count--) { ldp.append("\\ "); }
|
||||
}
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_TAB_STOP) || sName.equals(XMLString.TEXT_TAB)) { // text:tab in oasis
|
||||
// tab stops are not supported by the converter, but the special usage
|
||||
// of tab stops in header and footer can be emulated with \hfill
|
||||
// TODO: Sometimes extra \hfill should be added at end of line
|
||||
if (oc.isInHeaderFooter()) { ldp.append("\\hfill "); }
|
||||
else { ldp.append(sTabstop); }
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_LINE_BREAK)) {
|
||||
if (!oc.isInHeaderFooter() && !config.ignoreHardLineBreaks()) {
|
||||
ldp.append("\\newline").nl();
|
||||
}
|
||||
else { ldp.append(" "); }
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_A)) {
|
||||
palette.getFieldCv().handleAnchor(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.OFFICE_ANNOTATION)) {
|
||||
handleOfficeAnnotation(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_PAGE_NUMBER)) {
|
||||
palette.getFieldCv().handlePageNumber(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_PAGE_COUNT)) {
|
||||
palette.getFieldCv().handlePageCount(child,ldp,oc);
|
||||
}
|
||||
else if (oc.isInHeaderFooter()) {
|
||||
if (sName.equals(XMLString.TEXT_CHAPTER)) {
|
||||
handleChapterField(child,ldp,oc);
|
||||
}
|
||||
else if (sName.startsWith("text:")) {
|
||||
traverseInlineText(child,ldp,oc);
|
||||
}
|
||||
palette.getDrawCv().handleDrawElement(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_S)) {
|
||||
if (config.ignoreDoubleSpaces()) {
|
||||
ldp.append(" ");
|
||||
}
|
||||
else {
|
||||
// These tags are ignored in header and footer
|
||||
if (sName.equals(XMLString.TEXT_FOOTNOTE)) {
|
||||
palette.getNoteCv().handleFootnote(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_ENDNOTE)) {
|
||||
int count= Misc.getPosInteger(child.getAttribute(XMLString.TEXT_C),1);
|
||||
//String sSpace = config.ignoreDoubleSpaces() ? " " : "\\ ";
|
||||
for ( ; count > 0; count--) { ldp.append("\\ "); }
|
||||
}
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_TAB_STOP) || sName.equals(XMLString.TEXT_TAB)) { // text:tab in oasis
|
||||
// tab stops are not supported by the converter, but the special usage
|
||||
// of tab stops in header and footer can be emulated with \hfill
|
||||
// TODO: Sometimes extra \hfill should be added at end of line
|
||||
if (oc.isInHeaderFooter()) { ldp.append("\\hfill "); }
|
||||
else { ldp.append(sTabstop); }
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_LINE_BREAK)) {
|
||||
if (!oc.isInHeaderFooter() && !config.ignoreHardLineBreaks()) {
|
||||
ldp.append("\\newline").nl();
|
||||
}
|
||||
else { ldp.append(" "); }
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_A)) {
|
||||
palette.getFieldCv().handleAnchor(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.OFFICE_ANNOTATION)) {
|
||||
handleOfficeAnnotation(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_PAGE_NUMBER)) {
|
||||
palette.getFieldCv().handlePageNumber(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_PAGE_COUNT)) {
|
||||
palette.getFieldCv().handlePageCount(child,ldp,oc);
|
||||
}
|
||||
else if (oc.isInHeaderFooter()) {
|
||||
if (sName.equals(XMLString.TEXT_CHAPTER)) {
|
||||
handleChapterField(child,ldp,oc);
|
||||
}
|
||||
else if (sName.startsWith("text:")) {
|
||||
traverseInlineText(child,ldp,oc);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// These tags are ignored in header and footer
|
||||
if (sName.equals(XMLString.TEXT_FOOTNOTE)) {
|
||||
palette.getNoteCv().handleFootnote(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_ENDNOTE)) {
|
||||
palette.getNoteCv().handleEndnote(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_NOTE)) {
|
||||
if ("endnote".equals(child.getAttribute(XMLString.TEXT_NOTE_CLASS))) {
|
||||
palette.getNoteCv().handleEndnote(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_NOTE)) {
|
||||
if ("endnote".equals(child.getAttribute(XMLString.TEXT_NOTE_CLASS))) {
|
||||
palette.getNoteCv().handleEndnote(child,ldp,oc);
|
||||
}
|
||||
else {
|
||||
palette.getNoteCv().handleFootnote(child,ldp,oc);
|
||||
}
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_SEQUENCE)) {
|
||||
palette.getFieldCv().handleSequence(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_SEQUENCE_REF)) {
|
||||
palette.getFieldCv().handleSequenceRef(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_FOOTNOTE_REF)) {
|
||||
palette.getNoteCv().handleFootnoteRef(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_ENDNOTE_REF)) {
|
||||
palette.getNoteCv().handleEndnoteRef(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_NOTE_REF)) { // oasis
|
||||
palette.getNoteCv().handleNoteRef(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_REFERENCE_MARK)) {
|
||||
palette.getFieldCv().handleReferenceMark(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_REFERENCE_MARK_START)) {
|
||||
palette.getFieldCv().handleReferenceMark(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_REFERENCE_MARK_END)) {
|
||||
palette.getFieldCv().handleReferenceMarkEnd(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_REFERENCE_REF)) {
|
||||
palette.getFieldCv().handleReferenceRef(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_BOOKMARK)) {
|
||||
palette.getFieldCv().handleBookmark(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_BOOKMARK_START)) {
|
||||
palette.getFieldCv().handleBookmark(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_BOOKMARK_REF)) {
|
||||
palette.getFieldCv().handleBookmarkRef(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_BIBLIOGRAPHY_MARK)) {
|
||||
palette.getBibCv().handleBibliographyMark(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_ALPHABETICAL_INDEX_MARK)) {
|
||||
palette.getIndexCv().handleAlphabeticalIndexMark(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_ALPHABETICAL_INDEX_MARK_START)) {
|
||||
palette.getIndexCv().handleAlphabeticalIndexMark(child,ldp,oc);
|
||||
}
|
||||
else if (sName.startsWith("text:")) {
|
||||
traverseInlineText(child,ldp,oc);
|
||||
else {
|
||||
palette.getNoteCv().handleFootnote(child,ldp,oc);
|
||||
}
|
||||
}
|
||||
break;
|
||||
else if (sName.equals(XMLString.TEXT_SEQUENCE)) {
|
||||
palette.getFieldCv().handleSequence(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_SEQUENCE_REF)) {
|
||||
palette.getFieldCv().handleSequenceRef(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_FOOTNOTE_REF)) {
|
||||
palette.getNoteCv().handleFootnoteRef(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_ENDNOTE_REF)) {
|
||||
palette.getNoteCv().handleEndnoteRef(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_NOTE_REF)) { // oasis
|
||||
palette.getNoteCv().handleNoteRef(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_REFERENCE_MARK)) {
|
||||
palette.getFieldCv().handleReferenceMark(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_REFERENCE_MARK_START)) {
|
||||
palette.getFieldCv().handleReferenceMark(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_REFERENCE_MARK_END)) {
|
||||
palette.getFieldCv().handleReferenceMarkEnd(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_REFERENCE_REF)) {
|
||||
palette.getFieldCv().handleReferenceRef(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_BOOKMARK)) {
|
||||
palette.getFieldCv().handleBookmark(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_BOOKMARK_START)) {
|
||||
palette.getFieldCv().handleBookmark(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_BOOKMARK_REF)) {
|
||||
palette.getFieldCv().handleBookmarkRef(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_BIBLIOGRAPHY_MARK)) {
|
||||
palette.getBibCv().handleBibliographyMark(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_ALPHABETICAL_INDEX_MARK)) {
|
||||
palette.getIndexCv().handleAlphabeticalIndexMark(child,ldp,oc);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_ALPHABETICAL_INDEX_MARK_START)) {
|
||||
palette.getIndexCv().handleAlphabeticalIndexMark(child,ldp,oc);
|
||||
}
|
||||
else if (sName.startsWith("text:")) {
|
||||
traverseInlineText(child,ldp,oc);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Do nothing
|
||||
}
|
||||
|
@ -627,7 +669,7 @@ public class InlineConverter extends ConverterHelper {
|
|||
}
|
||||
if (date!=null) {
|
||||
ldp.append("%")
|
||||
.append(Misc.formatDate(ofr.getTextContent(date), palette.getI18n().getDefaultLanguage(), null))
|
||||
.append(Misc.formatDate(OfficeReader.getTextContent(date), palette.getI18n().getDefaultLanguage(), null))
|
||||
.nl();
|
||||
}
|
||||
return;
|
||||
|
@ -670,7 +712,7 @@ public class InlineConverter extends ConverterHelper {
|
|||
if (date!=null) {
|
||||
if (creator!=null) ldp.append(", ");
|
||||
else if (!bFirst) ldp.append(" ");
|
||||
ldp.append(Misc.formatDate(ofr.getTextContent(date), palette.getI18n().getDefaultLanguage(), null));
|
||||
ldp.append(Misc.formatDate(OfficeReader.getTextContent(date), palette.getI18n().getDefaultLanguage(), null));
|
||||
}
|
||||
|
||||
ldp.append("}");
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.4 (2014-09-16)
|
||||
* Version 1.4 (2014-09-19)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -81,6 +81,17 @@ public class LaTeXDocumentPortion {
|
|||
return this;
|
||||
}
|
||||
|
||||
/** Add an integer to the end of this portion
|
||||
*
|
||||
* @param n the integer to add
|
||||
* @return a reference to this <code>LaTeXDocumentPortion</code>
|
||||
*/
|
||||
public LaTeXDocumentPortion append(int n){
|
||||
curText.append(n);
|
||||
bEmpty = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Add a newline to the end of this portion
|
||||
*
|
||||
* @return a reference to this <code>LaTeXDocumentPortion</code>
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2012 by Henrik Just
|
||||
* Copyright: 2002-2014 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2012-02-22)
|
||||
* Version 1.4 (2014-09-18)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -106,6 +106,15 @@ public class NoteConverter extends ConverterHelper {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Do we have any pending footnotes, that may be inserted in this context?
|
||||
*
|
||||
* @param oc the context to verify against
|
||||
* @return true if there are pending footnotes
|
||||
*/
|
||||
public boolean hasPendingFootnotes(Context oc) {
|
||||
return !oc.isNoFootnotes() && postponedFootnotes.size()>0;
|
||||
}
|
||||
|
||||
/** Flush the queue of postponed footnotes */
|
||||
public void flushFootnotes(LaTeXDocumentPortion ldp, Context oc) {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.4 (2014-08-27)
|
||||
* Version 1.4 (2014-09-19
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -277,7 +277,7 @@ public class PageStyleConverter extends StyleConverter {
|
|||
String sPageNumber = pageLayout.getProperty(XMLString.STYLE_FIRST_PAGE_NUMBER);
|
||||
if (sPageNumber!=null && !sPageNumber.equals("continue")) {
|
||||
ldp.append(" \\setcounter{page}{")
|
||||
.append(Integer.toString(Misc.getPosInteger(sPageNumber,0)))
|
||||
.append(Misc.getPosInteger(sPageNumber,0))
|
||||
.append("}").nl();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*
|
||||
* Copyright: 2002-2014 by Henrik Just
|
||||
*
|
||||
* Version 1.4 (2014-09-16)
|
||||
* Version 1.4 (2014-09-19)
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
@ -843,7 +843,7 @@ public final class StarMathConverter implements writer2latex.api.StarMathConvert
|
|||
}
|
||||
}
|
||||
if (nMaxMatrixCols>10) { // The default for the matrix environment is at most 10 columns
|
||||
decl.append("\\setcounter{MaxMatrixCols}{").append(Integer.toString(nMaxMatrixCols)).append("}").nl();
|
||||
decl.append("\\setcounter{MaxMatrixCols}{").append(nMaxMatrixCols).append("}").nl();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue