Optimized reading of package format

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@164 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2014-08-25 06:25:05 +00:00
parent f79960ee86
commit 8a6e654344
5 changed files with 55 additions and 106 deletions

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.4 (2014-08-11)
* Version 1.4 (2014-08-25)
*
*/
@ -145,13 +145,12 @@ public class DrawConverter extends ConverterHelper {
if (object!=null) {
if (MIMETypes.MATH.equals(object.getType()) || MIMETypes.ODF.equals(object.getType())) { // Formula!
try {
Element settings = ((EmbeddedXMLObject) object).getSettingsDOM().getDocumentElement();
Document formuladoc = ((EmbeddedXMLObject) object).getContentDOM();
Element formula = Misc.getChildByTagName(formuladoc,XMLString.MATH); // Since OOo3.2
if (formula==null) {
formula = Misc.getChildByTagName(formuladoc,XMLString.MATH_MATH);
}
String sLaTeX = palette.getMathCv().convert(settings,formula);
String sLaTeX = palette.getMathCv().convert(formula);
if (!" ".equals(sLaTeX)) { // ignore empty formulas
ldp.append(" $")
.append(sLaTeX)
@ -190,7 +189,7 @@ public class DrawConverter extends ConverterHelper {
}
if (formula!=null) {
ldp.append(" $")
.append(palette.getMathCv().convert(null,formula))
.append(palette.getMathCv().convert(formula))
.append("$");
if (Character.isLetterOrDigit(OfficeReader.getNextChar(node))) { ldp.append(" "); }
}

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.4 (2014-08-18)
* Version 1.4 (2014-08-25)
*
*/
@ -102,7 +102,7 @@ public final class MathConverter extends ConverterHelper {
// TODO: Replace with a method "handleEquation"
public String convert(Element settings, Element formula) {
public String convert(Element formula) {
// TODO: Use settings to determine display mode/text mode
// formula must be a math:math node
// First try to find a StarMath annotation
@ -242,7 +242,7 @@ public final class MathConverter extends ConverterHelper {
}
else {
// MathML equation
sLaTeX = convert(null,equation);
sLaTeX = convert(equation);
}
if (sLaTeX!=null && !" ".equals(sLaTeX)) { // ignore empty formulas
if (!bTexMaths || style!=TexMathsStyle.latex) {