diff --git a/source/distro/changelog.txt b/source/distro/changelog.txt index 899d499..69a95ba 100644 --- a/source/distro/changelog.txt +++ b/source/distro/changelog.txt @@ -4,6 +4,12 @@ Changelog for Writer2LaTeX version 1.4 -> 1.6 Items marked with * are work in progress +[all] Using the filters from the command line with soffice --headless --convert-to is now documented in the user manual + +[all] Filter API change: The filters now accepts the FilterOptions property as an alternative to FilterData. + This property accepts a comma separated string of option=value items. In particular this allows to pass option + from the command line (soffice --headless --convert-to). + [all] API change: The interface OutputFile now defines an additional method containsMath() which returns true if the file contains mathematical formulas (only implemented for XHTML, currently always returns true for LaTeX) @@ -18,8 +24,6 @@ Items marked with * are work in progress [all] Implementation detail: Moved descriptions to a separate folder within the extensions -[all] *Document the use of soffice --headless --convert-to - [all] The position of message boxes has changed from (0,0) to (200,100) [w2l] Implementation detail: The dialog library W4LDialogs is now merged into W2LDialogs2. This avoids conflicts with diff --git a/source/distro/doc/user-manual.odt b/source/distro/doc/user-manual.odt index b278569..1c6f212 100644 Binary files a/source/distro/doc/user-manual.odt and b/source/distro/doc/user-manual.odt differ diff --git a/source/java/org/openoffice/da/comp/w2lcommon/filter/FilterDataParser.java b/source/java/org/openoffice/da/comp/w2lcommon/filter/FilterDataParser.java index 94140aa..9dc9621 100644 --- a/source/java/org/openoffice/da/comp/w2lcommon/filter/FilterDataParser.java +++ b/source/java/org/openoffice/da/comp/w2lcommon/filter/FilterDataParser.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-2015 by Henrik Just * * All Rights Reserved. * - * Version 1.2 (2011-06-07) + * Version 1.6 (2015-05-06) * */ @@ -88,8 +88,35 @@ public class FilterDataParser { } } - /** Apply the given FilterData property to the given converter - * @param data an Any containing the FilterData property + /** Apply the given FilterOptions property to the given converter. + * The property must be a comma separated list of name=value items. + * @param options an Any containing the FilterOptions property + * @param converter a writer2latex.api.Converter implementation + */ + public void applyFilterOptions(Object options, Converter converter) { + // Get the string from the data, if possible + if (AnyConverter.isString(options)) { + String sOptions = AnyConverter.toString(options); + if (sOptions!=null) { + // Convert to array + String[] sItems = sOptions.split(","); + int nItemCount = sItems.length; + PropertyValue[] filterData = new PropertyValue[nItemCount]; + for (int i=0; i1 ? sItem[1] : ""; + System.out.println(filterData[i].Name+" "+filterData[i].Value); + } + applyParsedFilterData(filterData,converter); + } + } + } + + /** Apply the given FilterData property to the given converter. + * The property must be an array of PropertyValue objects. + * @param data an Any containing the FilterData property * @param converter a writer2latex.api.Converter implementation */ public void applyFilterData(Object data, Converter converter) { @@ -100,14 +127,18 @@ public class FilterDataParser { Object[] arrayData = (Object[]) AnyConverter.toArray(data); if (arrayData instanceof PropertyValue[]) { filterData = (PropertyValue[]) arrayData; + if (filterData!=null) { + applyParsedFilterData(filterData,converter); + } } } catch (com.sun.star.lang.IllegalArgumentException e) { // Failed to convert to array; should not happen - ignore } } - if (filterData==null) { return; } - + } + + private void applyParsedFilterData(PropertyValue[] filterData, Converter converter) { PropertyHelper props = new PropertyHelper(filterData); // Get the special properties TemplateURL, StyleSheetURL, ResourceURL, Resources, ConfigURL and AutoCreate diff --git a/source/java/org/openoffice/da/comp/w2lcommon/filter/UNOConverter.java b/source/java/org/openoffice/da/comp/w2lcommon/filter/UNOConverter.java index c1c670f..5008476 100644 --- a/source/java/org/openoffice/da/comp/w2lcommon/filter/UNOConverter.java +++ b/source/java/org/openoffice/da/comp/w2lcommon/filter/UNOConverter.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.6 (2015-01-13) + * Version 1.6 (2015-05-06) * */ package org.openoffice.da.comp.w2lcommon.filter; @@ -65,7 +65,8 @@ public class UNOConverter { /** Construct a new UNODocumentConverter from an array of arguments * * @param xComponentContext the component context used to instantiate new UNO services - * @param lArguments arguments providing FilterName, URL, OutputStream (optional) and FilterData (optional) + * @param lArguments arguments providing FilterName, URL, OutputStream (optional), FilterData (optional) + * and FilterOptions (optional, alternative to FilterData) */ public UNOConverter(PropertyValue[] lArguments, XComponentContext xComponentContext) { this.xComponentContext = xComponentContext; @@ -86,6 +87,7 @@ public class UNOConverter { // Get the arguments Object filterData = null; + Object filterOptions = null; PropertyValue[] pValue = lArguments; for (int i = 0 ; i < pValue.length; i++) { try { @@ -107,6 +109,9 @@ public class UNOConverter { if (pValue[i].Name.compareTo("FilterData")==0) { filterData = pValue[i].Value; } + if (pValue[i].Name.compareTo("FilterOptions")==0) { + filterOptions = pValue[i].Value; + } } catch(com.sun.star.lang.IllegalArgumentException AnyExec){ System.err.println("\nIllegalArgumentException "+AnyExec); @@ -125,6 +130,10 @@ public class UNOConverter { FilterDataParser fdp = new FilterDataParser(xComponentContext); fdp.applyFilterData(filterData,converter); } + else if (filterOptions!=null) { + FilterDataParser fdp = new FilterDataParser(xComponentContext); + fdp.applyFilterOptions(filterOptions,converter); + } converter.setGraphicConverter(new GraphicConverterImpl(xComponentContext)); }