diff --git a/source/distro/changelog.txt b/source/distro/changelog.txt
index 13437f2..4335790 100644
--- a/source/distro/changelog.txt
+++ b/source/distro/changelog.txt
@@ -2,6 +2,15 @@ Changelog for Writer2LaTeX version 1.2 -> 1.4
---------- version 1.3.2 alpha ----------
+[w2l] New option display_hidden_text (default false) to toggle whether or not hidden text should be included in
+ the export (there is currently no user interface for this option)
+
+[w2l] Bugfix (StarMath conversion): The five colors red, green, blue, magenta and yellow is now exported to the
+ correct dark colors rather than the previous bright colors (the colors white, black and yellow are unchanged)
+
+[w2x] If a border has a width which is equivalent to less that 1px, it is now exported with the width 1px.
+ This fixes an issue with some browsers, that would render the border invisible.
+
[w2x] Two or more span elements in a row with identical attributes are now merged
[all] Filters: Appended [Writer2LaTeX] or [Writer2xhtml] to all filter UI names to make them more visible
@@ -12,9 +21,10 @@ Changelog for Writer2LaTeX version 1.2 -> 1.4
[w2x] Bugfix: Text boxes are no longer lost if within a paragraph
-[w2x] SVG support in HTML5 is now finished: Vector graphics is converted to SVG (does not work in older versions of LO).
- The option use_svg has been renamed to inline_svg. If set to true (default) inline SVG is used, if set to false,
- external SVG-files are used.
+[w2x] SVG support in HTML5 is now finished: Images in SVG format are kept in the original format.
+ Other vector images are converted to SVG (filter only). This only works with recent versions of the office
+ (LO 4.2 and AOO 4.1 are known to work). The option use_svg has been renamed to inline_svg. If set to
+ true (default) inline SVG is used, if set to false, external SVG-files (img-elements) are used.
[all] If an image image cannot be converted to an acceptable format, the optional alternative image will now be tried
diff --git a/source/distro/doc/user-manual.odt b/source/distro/doc/user-manual.odt
index facaf65..7013df3 100644
Binary files a/source/distro/doc/user-manual.odt and b/source/distro/doc/user-manual.odt differ
diff --git a/source/java/writer2latex/api/ConverterFactory.java b/source/java/writer2latex/api/ConverterFactory.java
index 907cf60..0e129d6 100644
--- a/source/java/writer2latex/api/ConverterFactory.java
+++ b/source/java/writer2latex/api/ConverterFactory.java
@@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
- * Version 1.4 (2014-09-06)
+ * Version 1.4 (2014-09-08)
*
*/
@@ -33,7 +33,7 @@ public class ConverterFactory {
// Version information
private static final String VERSION = "1.3.2";
- private static final String DATE = "2014-09-06";
+ private static final String DATE = "2014-09-08";
/** Return the Writer2LaTeX version in the form
* (major version).(minor version).(patch level)
diff --git a/source/java/writer2latex/epub/EPUBWriter.java b/source/java/writer2latex/epub/EPUBWriter.java
index d53286b..3f13af9 100644
--- a/source/java/writer2latex/epub/EPUBWriter.java
+++ b/source/java/writer2latex/epub/EPUBWriter.java
@@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
- * version 1.4 (2014-08-27)
+ * version 1.4 (2014-09-07)
*
*/
@@ -116,11 +116,12 @@ public class EPUBWriter implements OutputFile {
}
private void writeZipEntry(OutputFile file, ZipOutputStream zos) throws IOException {
- // TODO: Fix this waste of memory :-)
+ // Unfortunately we cannot simply do file.write(zos) because the write method of OutputFile
+ // closes the OutputStream. Hence this suboptimal solution
ByteArrayOutputStream baos = new ByteArrayOutputStream();
file.write(baos);
byte[] content = baos.toByteArray();
- zos.write(content, 0, content.length);
+ zos.write(content, 0, content.length);
}
}
diff --git a/source/java/writer2latex/latex/HeadingConverter.java b/source/java/writer2latex/latex/HeadingConverter.java
index f1dae81..360e061 100644
--- a/source/java/writer2latex/latex/HeadingConverter.java
+++ b/source/java/writer2latex/latex/HeadingConverter.java
@@ -16,28 +16,28 @@
* 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-03-05)
+ * Version 1.4 (2014-09-08)
*
*/
package writer2latex.latex;
-//import java.util.Hashtable;
-
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import writer2latex.util.*;
-import writer2latex.office.*;
import writer2latex.latex.util.BeforeAfter;
import writer2latex.latex.util.Context;
import writer2latex.latex.util.HeadingMap;
-//import writer2latex.latex.util.StyleMap;
+import writer2latex.office.ListStyle;
+import writer2latex.office.OfficeReader;
+import writer2latex.office.StyleWithProperties;
+import writer2latex.office.XMLString;
+import writer2latex.util.Misc;
/* This class converts OpenDocument headings (text:h
) and
* paragraph styles/formatting into LaTeX
@@ -52,12 +52,15 @@ import writer2latex.latex.util.HeadingMap;
*/
public class HeadingConverter extends ConverterHelper {
private String[] sHeadingStyles = new String[11];
+
+ // Display hidden text?
+ private boolean bDisplayHiddenText = false;
/** Constructs a new HeadingConverter
.
*/
- public HeadingConverter(OfficeReader ofr, LaTeXConfig config,
- ConverterPalette palette) {
+ public HeadingConverter(OfficeReader ofr, LaTeXConfig config, ConverterPalette palette) {
super(ofr,config,palette);
+ this.bDisplayHiddenText = config.displayHiddenText();
}
public void appendDeclarations(LaTeXDocumentPortion pack, LaTeXDocumentPortion decl) {
@@ -70,18 +73,27 @@ public class HeadingConverter extends ConverterHelper {
* @param oc The current context
*/
public void handleHeading(Element node, LaTeXDocumentPortion ldp, Context oc) {
- // Get the level, the heading map and the style name
+ // Get the style
+ String sStyleName = node.getAttribute(XMLString.TEXT_STYLE_NAME);
+ StyleWithProperties style = ofr.getParStyle(sStyleName);
+
+ // Check for hidden text
+ if (!bDisplayHiddenText && style!=null && "none".equals(style.getProperty(XMLString.TEXT_DISPLAY))) {
+ return;
+ }
+
+ // Get the level
int nLevel = ofr.isOpenDocument() ?
Misc.getPosInteger(Misc.getAttribute(node, XMLString.TEXT_OUTLINE_LEVEL),1) :
Misc.getPosInteger(Misc.getAttribute(node, XMLString.TEXT_LEVEL),1);
boolean bUnNumbered = "true".equals(Misc.getAttribute(node,XMLString.TEXT_IS_LIST_HEADER));
+ // Get the heading map
HeadingMap hm = config.getHeadingMap();
- String sStyleName = node.getAttribute(XMLString.TEXT_STYLE_NAME);
if (nLevel<=hm.getMaxLevel()) {
// Always push the font used
- palette.getI18n().pushSpecialTable(palette.getCharSc().getFontName(ofr.getParStyle(sStyleName)));
+ palette.getI18n().pushSpecialTable(palette.getCharSc().getFontName(style));
Context ic = (Context) oc.clone();
ic.setInSection(true);
@@ -126,7 +138,6 @@ public class HeadingConverter extends ConverterHelper {
}
}
-
/** Use a paragraph style on a heading. If hard paragraph formatting
* is applied to a heading, page break and font is converted - other
* hard formatting is ignored.
@@ -416,5 +427,4 @@ public class HeadingConverter extends ConverterHelper {
}
}
-
}
diff --git a/source/java/writer2latex/latex/InlineConverter.java b/source/java/writer2latex/latex/InlineConverter.java
index c9b273e..c36dbbc 100644
--- a/source/java/writer2latex/latex/InlineConverter.java
+++ b/source/java/writer2latex/latex/InlineConverter.java
@@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
- * Copyright: 2002-2011 by Henrik Just
+ * Copyright: 2002-2014 by Henrik Just
*
* All Rights Reserved.
*
- * Version 1.2 (2011-02-01)
+ * Version 1.4 (2014-09-08)
*
*/
@@ -42,6 +42,9 @@ import writer2latex.latex.util.HeadingMap;
*
This class handles basic inline text.
*/ public class InlineConverter extends ConverterHelper { + + // Display hidden text? + private boolean bDisplayHiddenText = false; private boolean bIncludeOriginalCitations = false; private String sTabstop = "\\ \\ "; @@ -54,6 +57,7 @@ public class InlineConverter extends ConverterHelper { if (config.getTabstop().length()>0) { sTabstop = config.getTabstop(); } + this.bDisplayHiddenText = config.displayHiddenText(); } public void appendDeclarations(LaTeXDocumentPortion pack, LaTeXDocumentPortion decl) { @@ -78,6 +82,11 @@ public class InlineConverter extends ConverterHelper { // TODO: Handle a selection of formatting attributes: color, supscript... 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; + } // Always push the font used palette.getI18n().pushSpecialTable(palette.getCharSc().getFontName(style)); @@ -105,10 +114,16 @@ public class InlineConverter extends ConverterHelper { } private void handleTextSpanText(Element node, LaTeXDocumentPortion ldp, Context oc) { - String styleName = node.getAttribute(XMLString.TEXT_STYLE_NAME); + 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(styleName); + 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"); @@ -133,12 +148,12 @@ public class InlineConverter extends ConverterHelper { boolean bNoFootnotes = false; // Always push the font used - palette.getI18n().pushSpecialTable(palette.getCharSc().getFontName(ofr.getTextStyle(styleName))); + 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(styleName,ba,ic); } + if (styled) { palette.getCharSc().applyTextStyle(sStyleName,ba,ic); } // Footnote problems: // No footnotes in sub/superscript (will disappear) @@ -148,7 +163,6 @@ public class InlineConverter extends ConverterHelper { // Temp solution: Ignore hard formatting in header/footer (name clash problem) // only in package format. - StyleWithProperties style = ofr.getTextStyle(styleName); if (ofr.isPackageFormat() && (style!=null && style.isAutomatic()) && ic.isInHeaderFooter()) { styled = false; } diff --git a/source/java/writer2latex/latex/LaTeXConfig.java b/source/java/writer2latex/latex/LaTeXConfig.java index 059a662..3d85d06 100644 --- a/source/java/writer2latex/latex/LaTeXConfig.java +++ b/source/java/writer2latex/latex/LaTeXConfig.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.4 (2014-08-05) + * Version 1.4 (2014-09-08) * */ @@ -49,7 +49,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase { ///////////////////////////////////////////////////////////////////////// // I. Define items needed by ConfigBase - protected int getOptionCount() { return 70; } + protected int getOptionCount() { return 71; } protected String getDefaultConfigPath() { return "/writer2latex/latex/config/"; } ///////////////////////////////////////////////////////////////////////// @@ -163,24 +163,25 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase { private static final int IGNORE_HARD_LINE_BREAKS = 49; private static final int IGNORE_EMPTY_PARAGRAPHS =50; private static final int IGNORE_DOUBLE_SPACES = 51; - private static final int ALIGN_FRAMES = 52; - private static final int FLOAT_FIGURES = 53; - private static final int FLOAT_TABLES = 54; - private static final int FLOAT_OPTIONS = 55; - private static final int FIGURE_SEQUENCE_NAME = 56; - private static final int TABLE_SEQUENCE_NAME = 57; - private static final int IMAGE_OPTIONS = 58; - private static final int REMOVE_GRAPHICS_EXTENSION = 59; - private static final int ORIGINAL_IMAGE_SIZE = 60; - private static final int SIMPLE_TABLE_LIMIT = 61; - private static final int NOTES = 62; - private static final int METADATA = 63; - private static final int TABSTOP = 64; - private static final int WRAP_LINES_AFTER = 65; - private static final int SPLIT_LINKED_SECTIONS = 66; - private static final int SPLIT_TOPLEVEL_SECTIONS = 67; - private static final int SAVE_IMAGES_IN_SUBDIR = 68; - private static final int DEBUG = 69; + private static final int DISPLAY_HIDDEN_TEXT = 52; + private static final int ALIGN_FRAMES = 53; + private static final int FLOAT_FIGURES = 54; + private static final int FLOAT_TABLES = 55; + private static final int FLOAT_OPTIONS = 56; + private static final int FIGURE_SEQUENCE_NAME = 57; + private static final int TABLE_SEQUENCE_NAME = 58; + private static final int IMAGE_OPTIONS = 59; + private static final int REMOVE_GRAPHICS_EXTENSION = 60; + private static final int ORIGINAL_IMAGE_SIZE = 61; + private static final int SIMPLE_TABLE_LIMIT = 62; + private static final int NOTES = 63; + private static final int METADATA = 64; + private static final int TABSTOP = 65; + private static final int WRAP_LINES_AFTER = 66; + private static final int SPLIT_LINKED_SECTIONS = 67; + private static final int SPLIT_TOPLEVEL_SECTIONS = 68; + private static final int SAVE_IMAGES_IN_SUBDIR = 69; + private static final int DEBUG = 70; ///////////////////////////////////////////////////////////////////////// // IV. Our options data @@ -288,6 +289,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase { options[IGNORE_HARD_LINE_BREAKS] = new BooleanOption("ignore_hard_line_breaks","false"); options[IGNORE_EMPTY_PARAGRAPHS] = new BooleanOption("ignore_empty_paragraphs","false"); options[IGNORE_DOUBLE_SPACES] = new BooleanOption("ignore_double_spaces","false"); + options[DISPLAY_HIDDEN_TEXT] = new BooleanOption("display_hidden_text","false"); options[ALIGN_FRAMES] = new BooleanOption("align_frames","true"); options[FLOAT_FIGURES] = new BooleanOption("float_figures","false"); options[FLOAT_TABLES] = new BooleanOption("float_tables","false"); @@ -700,6 +702,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase { public boolean ignoreHardLineBreaks() { return ((BooleanOption) options[IGNORE_HARD_LINE_BREAKS]).getValue(); } public boolean ignoreEmptyParagraphs() { return ((BooleanOption) options[IGNORE_EMPTY_PARAGRAPHS]).getValue(); } public boolean ignoreDoubleSpaces() { return ((BooleanOption) options[IGNORE_DOUBLE_SPACES]).getValue(); } + public boolean displayHiddenText() { return ((BooleanOption) options[DISPLAY_HIDDEN_TEXT]).getValue(); } // Graphics options public boolean alignFrames() { return ((BooleanOption) options[ALIGN_FRAMES]).getValue(); } diff --git a/source/java/writer2latex/latex/ParConverter.java b/source/java/writer2latex/latex/ParConverter.java index e2f9018..5baadac 100644 --- a/source/java/writer2latex/latex/ParConverter.java +++ b/source/java/writer2latex/latex/ParConverter.java @@ -20,25 +20,22 @@ * * All Rights Reserved. * - * Version 1.4 (2014-09-02) + * Version 1.4 (2014-09-08) * */ package writer2latex.latex; -//import java.util.Hashtable; - import org.w3c.dom.Element; -//import org.w3c.dom.Node; -//import org.w3c.dom.NodeList; -import writer2latex.util.*; -import writer2latex.office.*; import writer2latex.latex.util.BeforeAfter; import writer2latex.latex.util.Context; import writer2latex.latex.util.StyleMapItem; -//import writer2latex.latex.util.HeadingMap; import writer2latex.latex.util.StyleMap; +import writer2latex.office.OfficeReader; +import writer2latex.office.StyleWithProperties; +import writer2latex.office.XMLString; +import writer2latex.util.Misc; /*This class converts OpenDocument paragraphs (text:p
) and
* paragraph styles/formatting into LaTeX
Constructs a new ParConverter
.
Process a text:p tag
- * @param node The text:h element node containing the heading + * @param node The text:p element node containing the paragraph * @param ldp TheLaTeXDocumentPortion
to add LaTeX code to
* @param oc The current context
* @param bLastInBlock If this is true, the paragraph is the
@@ -101,9 +101,15 @@ public class ParConverter extends StyleConverter {
// Check for display equation (except in table cells)
if ((!oc.isInTable()) && palette.getMathCv().handleDisplayEquation(node,ldp)) { return; }
- // Get the style name for this paragraph
+ // Get the style for this paragraph
String sStyleName = node.getAttribute(XMLString.TEXT_STYLE_NAME);
+ StyleWithProperties style = ofr.getParStyle(sStyleName);
String sDisplayName = ofr.getParStyles().getDisplayName(sStyleName);
+
+ // Check for hidden text
+ if (!bDisplayHiddenText && style!=null && "none".equals(style.getProperty(XMLString.TEXT_DISPLAY))) {
+ return;
+ }
// Check for strict handling of styles
if (config.otherStyles()!=LaTeXConfig.ACCEPT && !config.getParStyleMap().contains(sDisplayName)) {
@@ -128,7 +134,6 @@ public class ParConverter extends StyleConverter {
if (OfficeReader.isWhitespaceContent(node)) {
// Always add page break; other formatting is ignored
BeforeAfter baPage = new BeforeAfter();
- StyleWithProperties style = ofr.getParStyle(sStyleName);
palette.getPageSc().applyPageBreak(style,true,baPage);
if (!oc.isInTable()) { ldp.append(baPage.getBefore()); }
if (!config.ignoreEmptyParagraphs()) {
diff --git a/source/java/writer2latex/latex/SectionConverter.java b/source/java/writer2latex/latex/SectionConverter.java
index 124a77f..fe2ef68 100644
--- a/source/java/writer2latex/latex/SectionConverter.java
+++ b/source/java/writer2latex/latex/SectionConverter.java
@@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
- * Copyright: 2002-2011 by Henrik Just
+ * Copyright: 2002-2014 by Henrik Just
*
* All Rights Reserved.
*
- * Version 1.2 (2011-01-24)
+ * Version 1.4 (2014-09-08)
*
*/
@@ -45,15 +45,18 @@ public class SectionConverter extends ConverterHelper {
// Do we need multicols.sty?
private boolean bNeedMulticol = false;
+
+ // Display hidden text?
+ private boolean bDisplayHiddenText = false;
// Filenames for external sections
private ExportNameCollection fileNames = new ExportNameCollection(true);
/** Constructs a new SectionStyleConverter
.