diff --git a/source/distro/changelog.txt b/source/distro/changelog.txt
index 49157b4..15fdc2c 100644
--- a/source/distro/changelog.txt
+++ b/source/distro/changelog.txt
@@ -2,17 +2,20 @@ Changelog for Writer2LaTeX version 1.0 -> 1.2
---------- version 1.1.2 ----------
+[w2x] The custom configuration now supports an optional xhtml template (writer2xhtml-template.xhtml)
+ in the same directory as writer2xhtml.xml
+
+[w2x] The xhtml configuration now also supports complex options in the API
+
[w2x] Bugfix: Corrected problem with relative links (this affected package format only)
[w2x] Added EPUB export
-[all] API change: The interface ConverterResult supports an additional method
- to access the meta data of the source document. A new interface MetaData has
- been introduced to support this
+[all] API change: The interface ConverterResult supports an additional method to access the
+ meta data of the source document. A new interface MetaData has been introduced to support this
-[all] API change: The interface ConverterResult supports additional methods
- providing pointers to headings and index tables in the document.
- A new interface TocEntry has been introduced to support this
+[all] API change: The interface ConverterResult supports additional methods providing pointers to
+ headings and index tables in the document. A new interface TocEntry has been introduced to support this
[all] API change: New methods getMIMEType() and isMasterDocument() added to the OutputFile
interface. The latter is used to identify files that are part of the main document flow
diff --git a/source/distro/doc/user-manual.odt b/source/distro/doc/user-manual.odt
index f7ca5d6..a990554 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/ConfigurationDialogBase.java b/source/java/org/openoffice/da/comp/w2lcommon/filter/ConfigurationDialogBase.java
index 43e59e1..c811ad0 100644
--- a/source/java/org/openoffice/da/comp/w2lcommon/filter/ConfigurationDialogBase.java
+++ b/source/java/org/openoffice/da/comp/w2lcommon/filter/ConfigurationDialogBase.java
@@ -20,15 +20,18 @@
*
* All Rights Reserved.
*
-* Version 1.2 (2010-03-26)
+* Version 1.2 (2010-04-12)
*
*/
package org.openoffice.da.comp.w2lcommon.filter;
+import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.OutputStream;
+import java.io.OutputStreamWriter;
import java.text.Collator;
import java.util.Arrays;
import java.util.HashMap;
@@ -39,6 +42,7 @@ import com.sun.star.awt.XContainerWindowEventHandler;
import com.sun.star.awt.XDialog;
import com.sun.star.awt.XDialogProvider2;
import com.sun.star.awt.XWindow;
+import com.sun.star.container.NoSuchElementException;
import com.sun.star.io.NotConnectedException;
import com.sun.star.io.XInputStream;
import com.sun.star.io.XOutputStream;
@@ -55,10 +59,12 @@ import com.sun.star.lib.uno.helper.WeakBase;
import com.sun.star.lib.uno.adapter.XInputStreamToInputStreamAdapter;
import com.sun.star.lib.uno.adapter.XOutputStreamToOutputStreamAdapter;
+import writer2latex.api.ComplexOption;
import writer2latex.api.Config;
import writer2latex.api.ConverterFactory;
import org.openoffice.da.comp.w2lcommon.helper.DialogAccess;
+import org.openoffice.da.comp.w2lcommon.helper.FilePicker;
import org.openoffice.da.comp.w2lcommon.helper.StyleNameProvider;
/** This is a base implementation of a uno component which supports several option pages
@@ -73,11 +79,14 @@ public abstract class ConfigurationDialogBase extends WeakBase implements XConta
// The component context
protected XComponentContext xContext;
+ // File picker wrapper
+ private FilePicker filePicker = null;
+
// UNO simple file access service
protected XSimpleFileAccess2 sfa2 = null;
-
- // Access to display names of the styles in the current document
- protected StyleNameProvider styleNameProvider = null;
+
+ // UNO path substitution
+ private XStringSubstitution xPathSub = null;
// The configuration implementation
protected Config config;
@@ -99,6 +108,9 @@ public abstract class ConfigurationDialogBase extends WeakBase implements XConta
/** Create a new ConfigurationDialogBase
*/
public ConfigurationDialogBase(XComponentContext xContext) {
this.xContext = xContext;
+
+ // Get the file picker
+ filePicker = new FilePicker(xContext);
// Get the SimpleFileAccess service
try {
@@ -111,7 +123,6 @@ public abstract class ConfigurationDialogBase extends WeakBase implements XConta
}
// Create the config file name
- XStringSubstitution xPathSub = null;
try {
Object psObject = xContext.getServiceManager().createInstanceWithContext(
"com.sun.star.util.PathSubstitution", xContext);
@@ -125,8 +136,6 @@ public abstract class ConfigurationDialogBase extends WeakBase implements XConta
// Create the configuration
config = ConverterFactory.createConverter(getMIMEType()).getConfig();
- // Get the style name provider
- styleNameProvider = new StyleNameProvider(xContext);
}
// Implement XContainerWindowEventHandler
@@ -134,7 +143,7 @@ public abstract class ConfigurationDialogBase extends WeakBase implements XConta
throws com.sun.star.lang.WrappedTargetException {
XDialog xDialog = (XDialog)UnoRuntime.queryInterface(XDialog.class, xWindow);
String sTitle = xDialog.getTitle();
-
+
if (!pageHandlers.containsKey(sTitle)) {
throw new com.sun.star.lang.WrappedTargetException("Unknown dialog "+sTitle);
}
@@ -245,6 +254,205 @@ public abstract class ConfigurationDialogBase extends WeakBase implements XConta
protected abstract boolean handleEvent(DialogAccess dlg, String sMethodName);
+
+ // Methods to set and get controls based on config
+ protected void checkBoxFromConfig(DialogAccess dlg, String sCheckBoxName, String sConfigName) {
+ dlg.setCheckBoxStateAsBoolean(sCheckBoxName, "true".equals(config.getOption(sConfigName)));
+ }
+
+ protected void checkBoxToConfig(DialogAccess dlg, String sCheckBoxName, String sConfigName) {
+ config.setOption(sConfigName, Boolean.toString(dlg.getCheckBoxStateAsBoolean(sCheckBoxName)));
+ }
+
+ protected void textFieldFromConfig(DialogAccess dlg, String sTextBoxName, String sConfigName) {
+ dlg.setTextFieldText(sTextBoxName, config.getOption(sConfigName));
+ }
+
+ protected void textFieldToConfig(DialogAccess dlg, String sTextBoxName, String sConfigName) {
+ config.setOption(sConfigName, dlg.getTextFieldText(sTextBoxName));
+ }
+
+ protected void listBoxFromConfig(DialogAccess dlg, String sListBoxName, String sConfigName, String[] sConfigValues, short nDefault) {
+ String sCurrentValue = config.getOption(sConfigName);
+ int nCount = sConfigValues.length;
+ for (short i=0; i=0 && deleteItem(sItems[nSelected])) {
@@ -318,7 +526,7 @@ public abstract class ConfigurationDialogBase extends WeakBase implements XConta
return null;
}
- private String appendItem(DialogAccess dlg, String sListName, Set suggestions) {
+ protected String appendItem(DialogAccess dlg, String sListName, Set suggestions) {
String[] sItems = dlg.getListBoxStringItemList(sListName);
String sNewItem = newItem(suggestions);
if (sNewItem!=null) {
@@ -339,46 +547,339 @@ public abstract class ConfigurationDialogBase extends WeakBase implements XConta
return sNewItem;
}
+ // Utilities
+ protected String[] sortStringSet(Set theSet) {
+ String[] theArray = new String[theSet.size()];
+ int i=0;
+ for (String s : theSet) {
+ theArray[i++] = s;
+ }
+ sortStringArray(theArray);
+ return theArray;
+ }
+
protected void sortStringArray(String[] theArray) {
// TODO: Get locale from OOo rather than the system
Collator collator = Collator.getInstance();
Arrays.sort(theArray, collator);
}
-
- // Methods to set and get controls based on config
- protected void checkBoxFromConfig(DialogAccess dlg, String sCheckBoxName, String sConfigName) {
- dlg.setCheckBoxStateAsBoolean(sCheckBoxName, "true".equals(config.getOption(sConfigName)));
- }
-
- protected void checkBoxToConfig(DialogAccess dlg, String sCheckBoxName, String sConfigName) {
- config.setOption(sConfigName, Boolean.toString(dlg.getCheckBoxStateAsBoolean(sCheckBoxName)));
- }
-
- protected void textFieldFromConfig(DialogAccess dlg, String sTextBoxName, String sConfigName) {
- dlg.setTextFieldText(sTextBoxName, config.getOption(sConfigName));
- }
-
- protected void textFieldToConfig(DialogAccess dlg, String sTextBoxName, String sConfigName) {
- config.setOption(sConfigName, dlg.getTextFieldText(sTextBoxName));
- }
-
- protected void listBoxFromConfig(DialogAccess dlg, String sListBoxName, String sConfigName, String[] sConfigValues, short nDefault) {
- String sCurrentValue = config.getOption(sConfigName);
- int nCount = sConfigValues.length;
- for (short i=0; i attr);
+
+ protected abstract void setControls(DialogAccess dlg, Map attr);
+
+ protected abstract void clearControls(DialogAccess dlg);
+
+ protected abstract void prepareControls(DialogAccess dlg);
+
+ // Constructor
+ protected StylesPageHandler(int nCount) {
+ // Get the style name provider
+ styleNameProvider = new StyleNameProvider(xContext);
+
+ // Reset the options
+ styleMap = new ComplexOption[nCount];
+ for (int i=0; i displayNames = styleNameProvider.getDisplayNames(sOOoFamilyNames[i]);
+ copyStyles(configMap, styleMap[i], displayNames);
+ }
+
+ // Display paragraph maps first
+ nCurrentFamily = -1;
+ sCurrentStyleName = null;
+ dlg.setListBoxSelectedItem("StyleFamily", (short)1);
+ styleFamilyChange(dlg);
+ }
+
+ protected void getControls(DialogAccess dlg) {
+ updateStyleMaps(dlg);
+
+ // Save style maps to config (translating keys back to internal names)
+ int nCount = sFamilyNames.length;
+ for (int i=0; i internalNames = styleNameProvider.getInternalNames(sOOoFamilyNames[i]);
+ copyStyles(styleMap[i], configMap, internalNames);
+ }
+ }
+
+ protected boolean handleEvent(DialogAccess dlg, String sMethod) {
+ if (sMethod.equals("StyleFamilyChange")) {
+ styleFamilyChange(dlg);
+ return true;
+ }
+ else if (sMethod.equals("StyleNameChange")) {
+ styleNameChange(dlg);
+ return true;
+ }
+ else if (sMethod.equals("NewStyleClick")) {
+ newStyleClick(dlg);
+ return true;
+ }
+ else if (sMethod.equals("DeleteStyleClick")) {
+ deleteStyleClick(dlg);
+ return true;
+ }
+ else if (sMethod.equals("LoadDefaultsClick")) {
+ loadDefaultsClick(dlg);
+ return true;
+ }
+ return false;
+ }
+
+ // Internal methods
+ private void updateStyleMaps(DialogAccess dlg) {
+ // Save the current style map, if any
+ if (nCurrentFamily>-1 && sCurrentStyleName!=null) {
+ getControls(dlg,styleMap[nCurrentFamily].get(sCurrentStyleName));
+ }
+ }
+
+ private void styleFamilyChange(DialogAccess dlg) {
+ short nNewFamily = dlg.getListBoxSelectedItem("StyleFamily");
+ if (nNewFamily>-1 && nNewFamily!=nCurrentFamily) {
+ // The user has changed the family; load and display the corresponding style names
+ updateStyleMaps(dlg);
+ nCurrentFamily = nNewFamily;
+ sCurrentStyleName = null;
+
+ String[] sStyleNames = sortStringSet(styleMap[nNewFamily].keySet());
+ dlg.setListBoxStringItemList("StyleName", sStyleNames);
+ if (sStyleNames.length>0) {
+ dlg.setListBoxSelectedItem("StyleName", (short)0);
+ }
+ else {
+ dlg.setListBoxSelectedItem("StyleName", (short)-1);
+ }
+
+ updateDeleteButton(dlg);
+ prepareControls(dlg);
+ styleNameChange(dlg);
+ }
+ }
+
+ private void styleNameChange(DialogAccess dlg) {
+ if (nCurrentFamily>-1) {
+ updateStyleMaps(dlg);
+ short nStyleNameItem = dlg.getListBoxSelectedItem("StyleName");
+ if (nStyleNameItem>=0) {
+ sCurrentStyleName = dlg.getListBoxStringItemList("StyleName")[nStyleNameItem];
+ setControls(dlg,styleMap[nCurrentFamily].get(sCurrentStyleName));
+ }
+ else {
+ sCurrentStyleName = null;
+ clearControls(dlg);
+ }
+ }
+ }
+
+ private void newStyleClick(DialogAccess dlg) {
+ if (nCurrentFamily>-1) {
+ updateStyleMaps(dlg);
+ String sNewName = appendItem(dlg, "StyleName",styleNameProvider.getInternalNames(sOOoFamilyNames[nCurrentFamily]).keySet());
+ if (sNewName!=null) {
+ styleMap[nCurrentFamily].put(sNewName, new HashMap());
+ clearControls(dlg);
+ }
+ updateDeleteButton(dlg);
+ }
+ }
+
+ private void deleteStyleClick(DialogAccess dlg) {
+ if (nCurrentFamily>-1 && sCurrentStyleName!=null) {
+ String sStyleName = sCurrentStyleName;
+ if (deleteCurrentItem(dlg,"StyleName")) {
+ styleMap[nCurrentFamily].remove(sStyleName);
+ styleNameChange(dlg);
+ }
+ updateDeleteButton(dlg);
+ }
+ }
+
+ private void loadDefaultsClick(DialogAccess dlg) {
+ updateStyleMaps(dlg);
+
+ // Count styles that we will overwrite
+ Config clean = ConverterFactory.createConverter(getMIMEType()).getConfig();
+ clean.readDefaultConfig(getDefaultConfigName());
+
+ int nCount = 0;
+ int nFamilyCount = sFamilyNames.length;
+ for (int i=0; i displayNames = styleNameProvider.getDisplayNames(sOOoFamilyNames[i]);
+ for (String sName : cleanMap.keySet()) {
+ String sDisplayName = (displayNames!=null && displayNames.containsKey(sName)) ? displayNames.get(sName) : "";
+ if (styleMap[i].containsKey(sDisplayName)) { nCount++; }
+ }
+ }
+
+ // Display confirmation dialog
+ boolean bConfirm = false;
+ XDialog xDialog=getDialog(getDialogLibraryName()+".LoadDefaults");
+ if (xDialog!=null) {
+ DialogAccess ldlg = new DialogAccess(xDialog);
+ if (nCount>0) {
+ String sLabel = ldlg.getLabelText("OverwriteLabel");
+ sLabel = sLabel.replaceAll("%s", Integer.toString(nCount));
+ ldlg.setLabelText("OverwriteLabel", sLabel);
+ }
+ else {
+ ldlg.setLabelText("OverwriteLabel", "");
+ }
+ bConfirm = xDialog.execute()==ExecutableDialogResults.OK;
+ xDialog.endExecute();
+ }
+
+ // Do the replacement
+ if (bConfirm) {
+ for (int i=0; i displayNames = styleNameProvider.getDisplayNames(sOOoFamilyNames[i]);
+ copyStyles(cleanMap, styleMap[i], displayNames);
+ }
+ }
+
+ // Force update of the user interface
+ nCurrentFamily = -1;
+ sCurrentStyleName = null;
+ styleFamilyChange(dlg);
+ }
+
+ private void updateDeleteButton(DialogAccess dlg) {
+ dlg.setControlEnabled("DeleteStyleButton", dlg.getListBoxStringItemList("StyleName").length>0);
+ }
+
+ private void copyStyles(ComplexOption source, ComplexOption target, Map nameTranslation) {
+ for (String sName : source.keySet()) {
+ String sNewName = sName;
+ if (nameTranslation!=null && nameTranslation.containsKey(sName)) {
+ sNewName = nameTranslation.get(sName);
+ }
+ target.copy(sNewName, source.get(sName));
+ }
+ }
+ }
+
+ protected abstract class AttributePageHandler extends PageHandler {
+ // The subclass must define this
+ protected String[] sAttributeNames;
+
+ // Our data
+ private ComplexOption attributeMap = new ComplexOption();
+ private int nCurrentAttribute = -1;
+
+ // Some methods to be implemented by subclass
+ protected abstract void getControls(DialogAccess dlg, Map attr);
+
+ protected abstract void setControls(DialogAccess dlg, Map attr);
+
+ protected abstract void prepareControls(DialogAccess dlg, boolean bEnable);
+
+ // Implement abstract methods from our super
+ protected void setControls(DialogAccess dlg) {
+ // Load attribute maps from config
+ attributeMap.clear();
+ attributeMap.copyAll(config.getComplexOption("text-attribute-map"));
+
+ // Update the dialog
+ nCurrentAttribute = -1;
+ dlg.setListBoxSelectedItem("FormattingAttribute", (short)0);
+ formattingAttributeChange(dlg);
+ }
+
+ protected void getControls(DialogAccess dlg) {
+ updateAttributeMaps(dlg);
+
+ // Save attribute maps to config
+ ComplexOption configMap = config.getComplexOption("text-attribute-map");
+ configMap.clear();
+ for (String s: attributeMap.keySet()) {
+ Map attr = attributeMap.get(s);
+ if (!attr.containsKey("deleted") || attr.get("deleted").equals("false")) {
+ configMap.copy(s, attr);
+ }
+ }
+ }
+
+ protected boolean handleEvent(DialogAccess dlg, String sMethod) {
+ if (sMethod.equals("FormattingAttributeChange")) {
+ formattingAttributeChange(dlg);
+ return true;
+ }
+ else if (sMethod.equals("CustomAttributeChange")) {
+ customAttributeChange(dlg);
+ return true;
+ }
+ return false;
+ }
+
+ // Internal methods
+ private void updateAttributeMaps(DialogAccess dlg) {
+ // Save the current attribute map, if any
+ if (nCurrentAttribute>-1) {
+ String sName = sAttributeNames[nCurrentAttribute];
+ if (!attributeMap.containsKey(sName)) {
+ attributeMap.put(sName, new HashMap());
+ }
+ Map attr = attributeMap.get(sName);
+ attr.put("deleted", Boolean.toString(!dlg.getCheckBoxStateAsBoolean("CustomAttribute")));
+ getControls(dlg,attr);
+ attributeMap.put(sName, attr);
+ }
+ }
+
+ private void formattingAttributeChange(DialogAccess dlg) {
+ updateAttributeMaps(dlg);
+ short nNewAttribute = dlg.getListBoxSelectedItem("FormattingAttribute");
+ if (nNewAttribute>-1 && nNewAttribute!=nCurrentAttribute) {
+ nCurrentAttribute = nNewAttribute;
+ String sName = sAttributeNames[nCurrentAttribute];
+ if (!attributeMap.containsKey(sName)) {
+ attributeMap.put(sName, new HashMap());
+ attributeMap.get(sName).put("deleted", "true");
+ }
+ Map attr = attributeMap.get(sName);
+ dlg.setCheckBoxStateAsBoolean("CustomAttribute", !attr.containsKey("deleted") || attr.get("deleted").equals("false"));
+ customAttributeChange(dlg);
+ setControls(dlg,attr);
+ }
+ }
+
+ private void customAttributeChange(DialogAccess dlg) {
+ prepareControls(dlg,dlg.getCheckBoxStateAsBoolean("CustomAttribute"));
+ }
+ }
+
}
diff --git a/source/java/org/openoffice/da/comp/w2lcommon/helper/DialogAccess.java b/source/java/org/openoffice/da/comp/w2lcommon/helper/DialogAccess.java
index 2a0c678..0cf0019 100644
--- a/source/java/org/openoffice/da/comp/w2lcommon/helper/DialogAccess.java
+++ b/source/java/org/openoffice/da/comp/w2lcommon/helper/DialogAccess.java
@@ -169,7 +169,6 @@ public class DialogAccess {
}
public short getListBoxLineCount(String sControlName) {
- // Returns the first selected element in case of a multiselection
XPropertySet xPropertySet = getControlProperties(sControlName);
try {
return ((Short) xPropertySet.getPropertyValue("LineCount")).shortValue();
diff --git a/source/java/org/openoffice/da/comp/w2lcommon/helper/FilePicker.java b/source/java/org/openoffice/da/comp/w2lcommon/helper/FilePicker.java
new file mode 100644
index 0000000..febe45b
--- /dev/null
+++ b/source/java/org/openoffice/da/comp/w2lcommon/helper/FilePicker.java
@@ -0,0 +1,83 @@
+/************************************************************************
+ *
+ * FilePicker.java
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ * Copyright: 2002-2010 by Henrik Just
+ *
+ * All Rights Reserved.
+ *
+ * Version 1.2 (2010-04-12)
+ *
+ */
+
+package org.openoffice.da.comp.w2lcommon.helper;
+
+import com.sun.star.lang.XComponent;
+import com.sun.star.ui.dialogs.ExecutableDialogResults;
+import com.sun.star.ui.dialogs.XExecutableDialog;
+import com.sun.star.ui.dialogs.XFilePicker;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+
+public class FilePicker {
+
+ private XComponentContext xContext;
+
+ /** Convenience wrapper class for the UNO file picker service
+ *
+ * @param xContext the UNO component context from which the file picker can be created
+ */
+ public FilePicker(XComponentContext xContext) {
+ this.xContext = xContext;
+ }
+
+ /** Get a user selected path with a file picker
+ *
+ * @return the path or null if the dialog is canceled
+ */
+ public String getPath() {
+ // Create FilePicker
+ Object filePicker = null;
+ try {
+ filePicker = xContext.getServiceManager().createInstanceWithContext("com.sun.star.ui.dialogs.FilePicker", xContext);
+ }
+ catch (com.sun.star.uno.Exception e) {
+ return null;
+ }
+
+ // Display the FilePicker
+ XFilePicker xFilePicker = (XFilePicker) UnoRuntime.queryInterface(XFilePicker.class, filePicker);
+ XExecutableDialog xExecutable = (XExecutableDialog) UnoRuntime.queryInterface(XExecutableDialog.class, xFilePicker);
+
+ // Get the path
+ String sPath = null;
+
+ if (xExecutable.execute() == ExecutableDialogResults.OK) {
+ String[] sPathList = xFilePicker.getFiles();
+ if (sPathList.length > 0) {
+ sPath = sPathList[0];
+ }
+ }
+
+ // Dispose the file picker
+ XComponent xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xFilePicker);
+ xComponent.dispose();
+
+ return sPath;
+ }
+
+}
diff --git a/source/java/org/openoffice/da/comp/w2lcommon/helper/MacroExpander.java b/source/java/org/openoffice/da/comp/w2lcommon/helper/MacroExpander.java
index 184df94..88db93b 100644
--- a/source/java/org/openoffice/da/comp/w2lcommon/helper/MacroExpander.java
+++ b/source/java/org/openoffice/da/comp/w2lcommon/helper/MacroExpander.java
@@ -1,6 +1,6 @@
/************************************************************************
*
- * OptionsDialogBase.java
+ * MacroExpander.java
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/source/java/org/openoffice/da/comp/writer2xhtml/ConfigurationDialog.java b/source/java/org/openoffice/da/comp/writer2xhtml/ConfigurationDialog.java
index bcb7d36..a8bed12 100644
--- a/source/java/org/openoffice/da/comp/writer2xhtml/ConfigurationDialog.java
+++ b/source/java/org/openoffice/da/comp/writer2xhtml/ConfigurationDialog.java
@@ -20,11 +20,14 @@
*
* All Rights Reserved.
*
-* Version 1.2 (2010-03-26)
+* Version 1.2 (2010-04-09)
*
*/
+
package org.openoffice.da.comp.writer2xhtml;
+import java.util.Map;
+
import org.openoffice.da.comp.w2lcommon.filter.ConfigurationDialogBase;
import org.openoffice.da.comp.w2lcommon.helper.DialogAccess;
@@ -68,22 +71,28 @@ public class ConfigurationDialog extends ConfigurationDialogBase implements XSer
super(xContext);
pageHandlers.put("General", new GeneralHandler());
- //pageHandlers.put("Template", new TemplateHandler());
+ pageHandlers.put("Template", new TemplateHandler());
pageHandlers.put("Stylesheets", new StylesheetsHandler());
pageHandlers.put("Formatting", new FormattingHandler());
- //pageHandlers.put("Styles1", new StylesPartIHandler());
- //pageHandlers.put("Styles2", new StylesPartIIHandler());
+ pageHandlers.put("Styles1", new Styles1Handler());
+ pageHandlers.put("Styles2", new Styles2Handler());
pageHandlers.put("Formatting", new FormattingHandler());
pageHandlers.put("Content", new ContentHandler());
}
// Implement remaining method from XContainerWindowEventHandler
public String[] getSupportedMethodNames() {
- String[] sNames = { "EncodingChange" };
+ String[] sNames = { "EncodingChange", // General
+ "CustomTemplateChange", "LoadTemplateClick", // Template
+ "UseCustomStylesheetChange", "IncludeCustomStylesheetClick", "LoadStylesheetClick", // Stylesheet
+ "StyleFamilyChange", "StyleNameChange", "NewStyleClick", "DeleteStyleClick", "LoadDefaultsClick" // Styles1
+ };
return sNames;
}
// the page handlers
+ private final String[] sCharElements = { "span", "abbr", "acronym", "b", "big", "cite", "code", "del", "dfn", "em", "i",
+ "ins", "kbd", "samp", "small", "strong", "sub", "sup", "tt", "var", "q" };
private class GeneralHandler extends PageHandler {
private final String[] sEncodingValues = { "UTF-8", "UTF-16", "ISO-8859-1", "US-ASCII" };
@@ -134,20 +143,74 @@ public class ConfigurationDialog extends ConfigurationDialogBase implements XSer
}
}
+
+ private class TemplateHandler extends CustomFileHandler {
+
+ protected String getSuffix() {
+ return "Template";
+ }
+
+ protected String getFileName() {
+ return "writer2xhtml-template.xhtml";
+ }
+
+ protected void useCustomInner(DialogAccess dlg, boolean bEnable) {
+ dlg.setControlEnabled("ContentIdLabel", bEnable);
+ dlg.setControlEnabled("ContentId", bEnable);
+ dlg.setControlEnabled("HeaderIdLabel", bEnable);
+ dlg.setControlEnabled("HeaderId", bEnable);
+ dlg.setControlEnabled("FooterIdLabel", bEnable);
+ dlg.setControlEnabled("FooterId", bEnable);
+ dlg.setControlEnabled("PanelIdLabel", bEnable);
+ dlg.setControlEnabled("PanelId", bEnable);
+ }
+
+ @Override protected void setControls(DialogAccess dlg) {
+ super.setControls(dlg);
+ String[] sCustomIds = config.getOption("template_ids").split(",");
+ if (sCustomIds.length>0) { dlg.setComboBoxText("ContentId", sCustomIds[0]); }
+ if (sCustomIds.length>1) { dlg.setComboBoxText("HeaderId", sCustomIds[1]); }
+ if (sCustomIds.length>2) { dlg.setComboBoxText("FooterId", sCustomIds[2]); }
+ if (sCustomIds.length>3) { dlg.setComboBoxText("PanelId", sCustomIds[3]); }
+ }
+
+ @Override protected void getControls(DialogAccess dlg) {
+ super.getControls(dlg);
+ config.setOption("template_ids",
+ dlg.getComboBoxText("ContentId").trim()+","+
+ dlg.getComboBoxText("HeaderId").trim()+","+
+ dlg.getComboBoxText("FooterId").trim()+","+
+ dlg.getComboBoxText("PanelId").trim());
+ }
+
+ }
+
+ private class StylesheetsHandler extends CustomFileHandler {
+
+ protected String getSuffix() {
+ return "Stylesheet";
+ }
+
+ protected String getFileName() {
+ return "writer2xhtml-styles.css";
+ }
+
+ protected void useCustomInner(DialogAccess dlg, boolean bEnable) {
+ }
- private class StylesheetsHandler extends PageHandler {
@Override protected void setControls(DialogAccess dlg) {
- dlg.setCheckBoxStateAsBoolean("UseCustomStylesheet", config.getOption("custom_stylesheet").length()>0);
- textFieldFromConfig(dlg, "CustomStylesheet", "custom_stylesheet");
+ super.setControls(dlg);
+ dlg.setCheckBoxStateAsBoolean("LinkCustomStylesheet", config.getOption("custom_stylesheet").length()>0);
+ textFieldFromConfig(dlg, "CustomStylesheetURL", "custom_stylesheet");
- useCustomStylesheetChange(dlg);
- includeCustomStylesheetChange(dlg);
+ linkCustomStylesheetChange(dlg);
}
@Override protected void getControls(DialogAccess dlg) {
- if (dlg.getCheckBoxStateAsBoolean("UseCustomStylesheet")) {
- textFieldToConfig(dlg, "CustomStylesheet", "custom_stylesheet");
+ super.getControls(dlg);
+ if (dlg.getCheckBoxStateAsBoolean("LinkCustomStylesheet")) {
+ textFieldToConfig(dlg, "CustomStylesheetURL", "custom_stylesheet");
}
else {
config.setOption("custom_stylesheet", "");
@@ -155,35 +218,133 @@ public class ConfigurationDialog extends ConfigurationDialogBase implements XSer
}
@Override protected boolean handleEvent(DialogAccess dlg, String sMethod) {
- if (sMethod.equals("UseCustomStylesheetChange")) {
- useCustomStylesheetChange(dlg);
+ if (super.handleEvent(dlg, sMethod)) {
return true;
}
- else if (sMethod.equals("IncludeCustomStylesheetChange")) {
- includeCustomStylesheetChange(dlg);
- return true;
- }
- else if (sMethod.equals("LoadButtonClick")) {
- loadButtonClick(dlg);
+ if (sMethod.equals("LinkCustomStylesheetChange")) {
+ linkCustomStylesheetChange(dlg);
return true;
}
return false;
}
- private void useCustomStylesheetChange(DialogAccess dlg) {
- boolean bUseCustomStylesheet = dlg.getCheckBoxStateAsBoolean("UseCustomStylesheet");
- dlg.setControlEnabled("CustomStylesheetLabel", bUseCustomStylesheet);
- dlg.setControlEnabled("CustomStylesheet", bUseCustomStylesheet);
+ private void linkCustomStylesheetChange(DialogAccess dlg) {
+ boolean bLinkCustomStylesheet = dlg.getCheckBoxStateAsBoolean("LinkCustomStylesheet");
+ dlg.setControlEnabled("CustomStylesheetURLLabel", bLinkCustomStylesheet);
+ dlg.setControlEnabled("CustomStylesheetURL", bLinkCustomStylesheet);
}
- private void includeCustomStylesheetChange(DialogAccess dlg) {
- dlg.setControlEnabled("IncludedCustomStylesheet", dlg.getCheckBoxStateAsBoolean("IncludeCustomStylesheet"));
+ }
+
+ private class Styles1Handler extends StylesPageHandler {
+ private final String[] sXhtmlFamilyNames = { "text", "paragraph", "list", "frame" };
+ private final String[] sXhtmlOOoFamilyNames = { "CharacterStyles", "ParagraphStyles", "NumberingStyles", "FrameStyles" };
+
+ private final String[] sParElements = { "p", "h1", "h2", "h3", "h4", "h5", "h6", "address", "dd", "dt", "pre" };
+ private final String[] sParBlockElements = { "div", "blockquote", "dl" };
+ private final String[] sEmpty = { };
+
+ private String[][] sElements = new String[4][];
+ private String[][] sBlockElements = new String[4][];
+
+ protected Styles1Handler() {
+ super(4);
+ sFamilyNames = sXhtmlFamilyNames;
+ sOOoFamilyNames = sXhtmlOOoFamilyNames;
+
+ sElements[0] = sCharElements;
+ sElements[1] = sParElements;
+ sElements[2] = sEmpty;
+ sElements[3] = sEmpty;
+
+ sBlockElements[0] = sEmpty;
+ sBlockElements[1] = sParBlockElements;
+ sBlockElements[2] = sEmpty;
+ sBlockElements[3] = sEmpty;
}
- private void loadButtonClick(DialogAccess dlg) {
- // TODO
+ protected String getDefaultConfigName() {
+ return "cleanxhtml.xml";
+ }
+
+ protected void setControls(DialogAccess dlg, Map attr) {
+ if (!attr.containsKey("element")) { attr.put("element", ""); }
+ if (!attr.containsKey("css")) { attr.put("css", ""); }
+ dlg.setComboBoxText("Element", attr.get("element"));
+ dlg.setTextFieldText("Css", none2empty(attr.get("css")));
+ if (nCurrentFamily==1) {
+ if (!attr.containsKey("block-element")) { attr.put("block-element", ""); }
+ if (!attr.containsKey("block-css")) { attr.put("block-css", ""); }
+ dlg.setComboBoxText("BlockElement", attr.get("block-element"));
+ dlg.setTextFieldText("BlockCss", none2empty(attr.get("block-css")));
+ }
+ else {
+ dlg.setComboBoxText("BlockElement", "");
+ dlg.setTextFieldText("BlockCss", "");
+ }
+ }
+
+ protected void getControls(DialogAccess dlg, Map attr) {
+ attr.put("element", dlg.getComboBoxText("Element"));
+ attr.put("css", empty2none(dlg.getTextFieldText("Css")));
+ if (nCurrentFamily==1) {
+ attr.put("block-element", dlg.getComboBoxText("BlockElement"));
+ attr.put("block-css", empty2none(dlg.getTextFieldText("BlockCss")));
+ }
+ }
+
+ protected void clearControls(DialogAccess dlg) {
+ dlg.setComboBoxText("Element", "");
+ dlg.setTextFieldText("Css", "");
+ dlg.setComboBoxText("BlockElement", "");
+ dlg.setTextFieldText("BlockCss", "");
+ }
+
+ protected void prepareControls(DialogAccess dlg) {
+ dlg.setListBoxStringItemList("Element", sElements[nCurrentFamily]);
+ dlg.setListBoxStringItemList("BlockElement", sBlockElements[nCurrentFamily]);
+ dlg.setControlEnabled("Element", nCurrentFamily<=1);
+ dlg.setControlEnabled("BlockElement", nCurrentFamily==1);
+ dlg.setControlEnabled("BlockCss", nCurrentFamily==1);
+ }
+ }
+
+ private class Styles2Handler extends AttributePageHandler {
+ private String[] sXhtmlAttributeNames = { "bold", "italics", "fixed", "superscript", "subscript", "underline", "overstrike" };
+
+ public Styles2Handler() {
+ sAttributeNames = sXhtmlAttributeNames;
}
+ @Override public void setControls(DialogAccess dlg) {
+ super.setControls(dlg);
+ textFieldFromConfig(dlg,"TabstopStyle","tabstop_style");
+ }
+
+ @Override public void getControls(DialogAccess dlg) {
+ super.getControls(dlg);
+ textFieldToConfig(dlg,"TabstopStyle","tabstop_style");
+ }
+
+ protected void setControls(DialogAccess dlg, Map attr) {
+ if (!attr.containsKey("element")) { attr.put("element", ""); }
+ if (!attr.containsKey("css")) { attr.put("css", ""); }
+ dlg.setListBoxStringItemList("Element", sCharElements);
+ dlg.setComboBoxText("Element", attr.get("element"));
+ dlg.setTextFieldText("Css", none2empty(attr.get("css")));
+ }
+
+ protected void getControls(DialogAccess dlg, Map attr) {
+ attr.put("element", dlg.getComboBoxText("Element"));
+ attr.put("css", empty2none(dlg.getTextFieldText("Css")));
+ }
+
+ protected void prepareControls(DialogAccess dlg, boolean bEnable) {
+ dlg.setControlEnabled("ElementLabel", bEnable);
+ dlg.setControlEnabled("Element", bEnable);
+ dlg.setControlEnabled("CssLabel", bEnable);
+ dlg.setControlEnabled("Css", bEnable);
+ }
}
private class FormattingHandler extends PageHandler {
@@ -203,8 +364,9 @@ public class ConfigurationDialog extends ConfigurationDialogBase implements XSer
checkBoxFromConfig(dlg, "IgnoreTableDimensions", "ignore_table_dimensions");
checkBoxFromConfig(dlg, "UseListHack", "use_list_hack");
- checkBoxFromConfig(dlg, "ConvertToPx", "convert_to_px");
- checkBoxFromConfig(dlg, "SeparateStylesheet", "separate_stylesheet");
+ //TODO: These have been postponed
+ //checkBoxFromConfig(dlg, "ConvertToPx", "convert_to_px");
+ //checkBoxFromConfig(dlg, "SeparateStylesheet", "separate_stylesheet");
}
@Override protected void getControls(DialogAccess dlg) {
@@ -216,8 +378,9 @@ public class ConfigurationDialog extends ConfigurationDialogBase implements XSer
checkBoxToConfig(dlg, "IgnoreTableDimensions", "ignore_table_dimensions");
checkBoxToConfig(dlg, "UseListHack", "use_list_hack");
- checkBoxToConfig(dlg, "ConvertToPx", "convert_to_px");
- checkBoxToConfig(dlg, "SeparateStylesheet", "separate_stylesheet");
+ //TODO: These have been postponed
+ //checkBoxToConfig(dlg, "ConvertToPx", "convert_to_px");
+ //checkBoxToConfig(dlg, "SeparateStylesheet", "separate_stylesheet");
}
@Override protected boolean handleEvent(DialogAccess dlg, String sMethod) {
@@ -242,6 +405,15 @@ public class ConfigurationDialog extends ConfigurationDialogBase implements XSer
}
}
+
+ private String none2empty(String s) {
+ return s.equals("(none)") ? "" : s;
+ }
+
+ private String empty2none(String s) {
+ String t = s.trim();
+ return t.length()==0 ? "(none)" : t;
+ }
}
diff --git a/source/java/org/openoffice/da/comp/writer2xhtml/XhtmlOptionsDialog.java b/source/java/org/openoffice/da/comp/writer2xhtml/XhtmlOptionsDialog.java
index ea982d0..8adf009 100644
--- a/source/java/org/openoffice/da/comp/writer2xhtml/XhtmlOptionsDialog.java
+++ b/source/java/org/openoffice/da/comp/writer2xhtml/XhtmlOptionsDialog.java
@@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
- * Copyright: 2002-2008 by Henrik Just
+ * Copyright: 2002-2010 by Henrik Just
*
* All Rights Reserved.
*
- * Version 1.0 (2008-11-16)
+ * Version 1.2 (2010-04-11)
*
*/
@@ -113,6 +113,8 @@ public class XhtmlOptionsDialog extends OptionsDialogBase {
"http://www.w3.org/StyleSheets/Core/"+sCoreStyles[nConfig-1]);
break;
case 9: helper.put("ConfigURL","$(user)/writer2xhtml.xml");
+ helper.put("TemplateURL", "$(user)/writer2xhtml-template.xhtml");
+ //helper.put("StyleSheetURL", "$(user)/writer2xhtml-style.css");
helper.put("AutoCreate","true");
}
diff --git a/source/java/org/openoffice/da/comp/writer4latex/ConfigurationDialog.java b/source/java/org/openoffice/da/comp/writer4latex/ConfigurationDialog.java
index 1174e83..b68f528 100644
--- a/source/java/org/openoffice/da/comp/writer4latex/ConfigurationDialog.java
+++ b/source/java/org/openoffice/da/comp/writer4latex/ConfigurationDialog.java
@@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
- * Version 1.2 (2010-03-05)
+ * Version 1.2 (2010-04-12)
*
*/
@@ -29,6 +29,7 @@ package org.openoffice.da.comp.writer4latex;
import java.io.File;
import java.io.IOException;
import java.net.URI;
+import java.net.URISyntaxException;
import java.util.Vector;
import com.sun.star.awt.XControl;
@@ -52,6 +53,7 @@ import com.sun.star.uno.XComponentContext;
import com.sun.star.lib.uno.helper.WeakBase;
import org.openoffice.da.comp.w2lcommon.helper.DialogAccess;
+import org.openoffice.da.comp.w2lcommon.helper.FilePicker;
/** This class provides a uno component which implements the configuration
* of Writer4LaTeX
@@ -61,6 +63,7 @@ public final class ConfigurationDialog
implements XServiceInfo, XContainerWindowEventHandler {
private XComponentContext xContext;
+ private FilePicker filePicker;
private ExternalApps externalApps;
@@ -76,6 +79,7 @@ public final class ConfigurationDialog
public ConfigurationDialog(XComponentContext xContext) {
this.xContext = xContext;
externalApps = new ExternalApps(xContext);
+ filePicker = new FilePicker(xContext);
}
// Implement XContainerWindowEventHandler
@@ -161,42 +165,18 @@ public final class ConfigurationDialog
}
private boolean browseForExecutable(XWindow xWindow) {
- XComponent xComponent = null;
- try {
- // Create FilePicker
- Object filePicker = xContext.getServiceManager()
- .createInstanceWithContext("com.sun.star.ui.dialogs.FilePicker", xContext);
- XFilePicker xFilePicker = (XFilePicker)
- UnoRuntime.queryInterface(XFilePicker.class, filePicker);
- xComponent = (XComponent)
- UnoRuntime.queryInterface(XComponent.class, xFilePicker);
-
- // Display the FilePicker
- XExecutableDialog xExecutable = (XExecutableDialog)
- UnoRuntime.queryInterface(XExecutableDialog.class, xFilePicker);
-
- // Get the path
- if (xExecutable.execute() == ExecutableDialogResults.OK) {
- String[] sPathList = xFilePicker.getFiles();
- if (sPathList.length > 0) {
- setComboBoxText(xWindow, "Executable", new File(new URI(sPathList[0])).getCanonicalPath());
- updateApplication(xWindow);
- }
- }
- }
- catch (com.sun.star.uno.Exception e) {
- }
- catch (java.net.URISyntaxException e) {
- }
- catch (java.io.IOException e) {
- }
- finally{
- // Always dispose the FilePicker component
- if (xComponent!=null) {
- xComponent.dispose();
- }
- }
- return true;
+ String sPath = filePicker.getPath();
+ if (sPath!=null) {
+ try {
+ setComboBoxText(xWindow, "Executable", new File(new URI(sPath)).getCanonicalPath());
+ }
+ catch (IOException e) {
+ }
+ catch (URISyntaxException e) {
+ }
+ updateApplication(xWindow);
+ }
+ return true;
}
private boolean updateApplication(XWindow xWindow) {
diff --git a/source/java/writer2latex/api/ConverterFactory.java b/source/java/writer2latex/api/ConverterFactory.java
index e50e843..b93a40d 100644
--- a/source/java/writer2latex/api/ConverterFactory.java
+++ b/source/java/writer2latex/api/ConverterFactory.java
@@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
- * Version 1.2 (2010-03-31)
+ * Version 1.2 (2010-04-12)
*
*/
@@ -33,7 +33,7 @@ public class ConverterFactory {
// Version information
private static final String VERSION = "1.1.2";
- private static final String DATE = "2010-03-31";
+ private static final String DATE = "2010-04-12";
/** Return the Writer2LaTeX version in the form
* (major version).(minor version).(patch level)
diff --git a/source/java/writer2latex/xhtml/XhtmlConfig.java b/source/java/writer2latex/xhtml/XhtmlConfig.java
index d453478..12ff410 100644
--- a/source/java/writer2latex/xhtml/XhtmlConfig.java
+++ b/source/java/writer2latex/xhtml/XhtmlConfig.java
@@ -20,17 +20,20 @@
*
* All Rights Reserved.
*
- * Version 1.2 (2010-03-04)
+ * Version 1.2 (2010-04-09)
*
*/
package writer2latex.xhtml;
-import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import writer2latex.api.ComplexOption;
import writer2latex.base.BooleanOption;
import writer2latex.base.IntegerOption;
import writer2latex.base.Option;
@@ -106,11 +109,11 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
private static final int DIRECTORY_ICON = 40;
private static final int DOCUMENT_ICON = 41;
- protected XhtmlStyleMap xpar = new XhtmlStyleMap();
- protected XhtmlStyleMap xtext = new XhtmlStyleMap();
- protected XhtmlStyleMap xframe = new XhtmlStyleMap();
- protected XhtmlStyleMap xlist = new XhtmlStyleMap();
- protected XhtmlStyleMap xattr = new XhtmlStyleMap();
+ protected ComplexOption xpar = addComplexOption("paragraph-map");
+ protected ComplexOption xtext = addComplexOption("text-map");
+ protected ComplexOption xframe = addComplexOption("frame-map");
+ protected ComplexOption xlist = addComplexOption("list-map");
+ protected ComplexOption xattr = addComplexOption("text-attribute-map");
public XhtmlConfig() {
super();
@@ -184,26 +187,31 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
if (sFamily.length()==0) { // try old name
sFamily = elm.getAttribute("class");
}
- String sBlockElement = elm.getAttribute("block-element");
- String sBlockCss = elm.getAttribute("block-css");
- if (sBlockCss.length()==0) { sBlockCss="(none)"; }
String sElement = elm.getAttribute("element");
String sCss = elm.getAttribute("css");
if (sCss.length()==0) { sCss="(none)"; }
+ Map attr = new HashMap();
+ attr.put("element", sElement);
+ attr.put("css", sCss);
if ("paragraph".equals(sFamily)) {
- xpar.put(sName,sBlockElement,sBlockCss,sElement,sCss);
+ String sBlockElement = elm.getAttribute("block-element");
+ String sBlockCss = elm.getAttribute("block-css");
+ if (sBlockCss.length()==0) { sBlockCss="(none)"; }
+ attr.put("block-element", sBlockElement);
+ attr.put("block-css", sBlockCss);
+ xpar.put(sName,attr);
}
else if ("text".equals(sFamily)) {
- xtext.put(sName,sBlockElement,sBlockCss,sElement,sCss);
+ xtext.put(sName,attr);
}
else if ("frame".equals(sFamily)) {
- xframe.put(sName,sBlockElement,sBlockCss,sElement,sCss);
+ xframe.put(sName,attr);
}
else if ("list".equals(sFamily)) {
- xlist.put(sName,sBlockElement,sBlockCss,sElement,sCss);
+ xlist.put(sName,attr);
}
else if ("attribute".equals(sFamily)) {
- xattr.put(sName,sBlockElement,sBlockCss,sElement,sCss);
+ xattr.put(sName,attr);
}
}
}
@@ -213,22 +221,21 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
writeXStyleMap(dom,xtext,"text");
writeXStyleMap(dom,xlist,"list");
writeXStyleMap(dom,xframe,"frame");
- writeXStyleMap(dom,xframe,"attribute");
+ writeXStyleMap(dom,xattr,"attribute");
}
- private void writeXStyleMap(Document dom, XhtmlStyleMap sm, String sFamily) {
- Enumeration smEnum = sm.getNames();
- while (smEnum.hasMoreElements()) {
- String sName = smEnum.nextElement();
+ private void writeXStyleMap(Document dom, ComplexOption option, String sFamily) {
+ Iterator iter = option.keySet().iterator();
+ while (iter.hasNext()) {
+ String sName = iter.next();
Element smNode = dom.createElement("xhtml-style-map");
smNode.setAttribute("name",sName);
smNode.setAttribute("family",sFamily);
- smNode.setAttribute("element",sm.getElement(sName));
- smNode.setAttribute("css",sm.getCss(sName));
- String sBlockElement = sm.getBlockElement(sName);
- if (sBlockElement!=null) { smNode.setAttribute("block-element",sm.getCss(sBlockElement)); }
- String sBlockCss = sm.getBlockCss(sName);
- if (sBlockCss!=null) { smNode.setAttribute("block-css",sm.getCss(sBlockCss)); }
+ Map attr = option.get(sName);
+ smNode.setAttribute("element",attr.get("element"));
+ smNode.setAttribute("css",attr.get("css"));
+ if (attr.containsKey("block-element")) smNode.setAttribute("block-element",attr.get("block-element"));
+ if (attr.containsKey("block-css")) smNode.setAttribute("block-css",attr.get("block-css"));
dom.getDocumentElement().appendChild(smNode);
}
}
@@ -277,11 +284,24 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
public String getXhtmlDirectoryIcon() { return options[DIRECTORY_ICON].getString(); }
public String getXhtmlDocumentIcon() { return options[DOCUMENT_ICON].getString(); }
- public XhtmlStyleMap getXParStyleMap() { return xpar; }
- public XhtmlStyleMap getXTextStyleMap() { return xtext; }
- public XhtmlStyleMap getXFrameStyleMap() { return xframe; }
- public XhtmlStyleMap getXListStyleMap() { return xlist; }
- public XhtmlStyleMap getXAttrStyleMap() { return xattr; }
+ public XhtmlStyleMap getXParStyleMap() { return getStyleMap(xpar); }
+ public XhtmlStyleMap getXTextStyleMap() { return getStyleMap(xtext); }
+ public XhtmlStyleMap getXFrameStyleMap() { return getStyleMap(xframe); }
+ public XhtmlStyleMap getXListStyleMap() { return getStyleMap(xlist); }
+ public XhtmlStyleMap getXAttrStyleMap() { return getStyleMap(xattr); }
+ private XhtmlStyleMap getStyleMap(ComplexOption co) {
+ XhtmlStyleMap map = new XhtmlStyleMap();
+ for (String sName : co.keySet()) {
+ Map attr = co.get(sName);
+ String sElement = attr.containsKey("element") ? attr.get("element") : "";
+ String sCss = attr.containsKey("css") ? attr.get("css") : "";
+ String sBlockElement = attr.containsKey("block-element") ? attr.get("block-element") : "";
+ String sBlockCss = attr.containsKey("block-css") ? attr.get("block-css") : "";
+ map.put(sName, sBlockElement, sBlockCss, sElement, sCss);
+ }
+ return map;
+
+ }
}
diff --git a/source/oxt/writer2xhtml/OptionPages.xcu b/source/oxt/writer2xhtml/OptionPages.xcu
index 8471a7b..b2623e7 100644
--- a/source/oxt/writer2xhtml/OptionPages.xcu
+++ b/source/oxt/writer2xhtml/OptionPages.xcu
@@ -77,7 +77,7 @@
%origin%/W2XDialogs2/Template.xdl
-
+ org.openoffice.da.writer2xhtml.ConfigurationDialog
@@ -115,13 +115,13 @@
3
- Styles part 1
+ Master styles
%origin%/W2XDialogs2/Styles1.xdl
-
+ org.openoffice.da.writer2xhtml.ConfigurationDialog
@@ -137,13 +137,13 @@
4
- Styles part 2
+ Other styles
%origin%/W2XDialogs2/Styles2.xdl
-
+ org.openoffice.da.writer2xhtml.ConfigurationDialog
diff --git a/source/oxt/writer2xhtml/W2XDialogs2/ConfigurationRoot.xdl b/source/oxt/writer2xhtml/W2XDialogs2/ConfigurationRoot.xdl
index ce21cc8..fa4cf1d 100644
--- a/source/oxt/writer2xhtml/W2XDialogs2/ConfigurationRoot.xdl
+++ b/source/oxt/writer2xhtml/W2XDialogs2/ConfigurationRoot.xdl
@@ -7,7 +7,7 @@
-
+
diff --git a/source/oxt/writer2xhtml/W2XDialogs2/DeleteDialog.xdl b/source/oxt/writer2xhtml/W2XDialogs2/DeleteDialog.xdl
new file mode 100644
index 0000000..a0d3536
--- /dev/null
+++ b/source/oxt/writer2xhtml/W2XDialogs2/DeleteDialog.xdl
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source/oxt/writer2xhtml/W2XDialogs2/Formatting.xdl b/source/oxt/writer2xhtml/W2XDialogs2/Formatting.xdl
index a366760..cf6015a 100644
--- a/source/oxt/writer2xhtml/W2XDialogs2/Formatting.xdl
+++ b/source/oxt/writer2xhtml/W2XDialogs2/Formatting.xdl
@@ -24,7 +24,7 @@
-
+
\ No newline at end of file
diff --git a/source/oxt/writer2xhtml/W2XDialogs2/LoadDefaults.xdl b/source/oxt/writer2xhtml/W2XDialogs2/LoadDefaults.xdl
new file mode 100644
index 0000000..836ba5d
--- /dev/null
+++ b/source/oxt/writer2xhtml/W2XDialogs2/LoadDefaults.xdl
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source/oxt/writer2xhtml/W2XDialogs2/NewDialog.xdl b/source/oxt/writer2xhtml/W2XDialogs2/NewDialog.xdl
new file mode 100644
index 0000000..2d0a0ba
--- /dev/null
+++ b/source/oxt/writer2xhtml/W2XDialogs2/NewDialog.xdl
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source/oxt/writer2xhtml/W2XDialogs2/Styles1.xdl b/source/oxt/writer2xhtml/W2XDialogs2/Styles1.xdl
index 85bf430..79435eb 100644
--- a/source/oxt/writer2xhtml/W2XDialogs2/Styles1.xdl
+++ b/source/oxt/writer2xhtml/W2XDialogs2/Styles1.xdl
@@ -4,7 +4,7 @@
-
+
@@ -14,7 +14,7 @@
-
+
@@ -23,15 +23,15 @@
-
-
+
+
-
-
+
+
-
+
diff --git a/source/oxt/writer2xhtml/W2XDialogs2/Styles2.xdl b/source/oxt/writer2xhtml/W2XDialogs2/Styles2.xdl
index 8867b2f..11451e4 100644
--- a/source/oxt/writer2xhtml/W2XDialogs2/Styles2.xdl
+++ b/source/oxt/writer2xhtml/W2XDialogs2/Styles2.xdl
@@ -14,13 +14,17 @@
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source/oxt/writer2xhtml/W2XDialogs2/Stylesheets.xdl b/source/oxt/writer2xhtml/W2XDialogs2/Stylesheets.xdl
index 8b69bcf..9bb1a4c 100644
--- a/source/oxt/writer2xhtml/W2XDialogs2/Stylesheets.xdl
+++ b/source/oxt/writer2xhtml/W2XDialogs2/Stylesheets.xdl
@@ -2,18 +2,20 @@
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/source/oxt/writer2xhtml/W2XDialogs2/Template.xdl b/source/oxt/writer2xhtml/W2XDialogs2/Template.xdl
index 3a234eb..34eebb7 100644
--- a/source/oxt/writer2xhtml/W2XDialogs2/Template.xdl
+++ b/source/oxt/writer2xhtml/W2XDialogs2/Template.xdl
@@ -2,15 +2,12 @@
-
-
+
+
-
-
-
-
-
-
+
+
+
diff --git a/source/oxt/writer2xhtml/W2XDialogs2/dialog.xlb b/source/oxt/writer2xhtml/W2XDialogs2/dialog.xlb
index e6b49d4..b0d250e 100644
--- a/source/oxt/writer2xhtml/W2XDialogs2/dialog.xlb
+++ b/source/oxt/writer2xhtml/W2XDialogs2/dialog.xlb
@@ -9,4 +9,7 @@
+
+
+
\ No newline at end of file