From 199616dde6ec6a2717c8b3dec4011e6c6c75e653 Mon Sep 17 00:00:00 2001
From: henrikjust <henrikjust@f0f2a975-2e09-46c8-9428-3b39399b9f3c>
Date: Sun, 5 Apr 2015 13:47:15 +0000
Subject: [PATCH] w2x toolbar configuration dialog

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@235 f0f2a975-2e09-46c8-9428-3b39399b9f3c
---
 source/distro/changelog.txt                   |   9 +-
 .../comp/w2lcommon/filter/UNOPublisher.java   |   9 +-
 .../helper}/StreamGobbler.java                |  10 +-
 .../comp/writer2latex/ApplicationsDialog.java | 106 ++-----
 .../da/comp/writer2latex/ExternalApps.java    |   1 +
 .../comp/writer2latex/LaTeXUNOPublisher.java  |   4 +-
 .../writer2xhtml/ToolbarSettingsDialog.java   | 262 ++++++++++++++++++
 .../da/comp/writer2xhtml/W2XRegistration.java |  14 +-
 .../da/comp/writer2xhtml/Writer2xhtml.java    |  46 ++-
 .../comp/writer2xhtml/XhtmlUNOPublisher.java  | 111 ++++++--
 .../applications.xhp                          |   2 +-
 .../bibliography.xhp                          |  86 +++---
 source/oxt/writer2xhtml/META-INF/manifest.xml |  12 +
 .../oxt/writer2xhtml/ToolbarOptionPages.xcu   |  57 ++++
 source/oxt/writer2xhtml/ToolbarOptions.xcs    |  18 ++
 source/oxt/writer2xhtml/ToolbarOptions.xcu    |  27 ++
 .../W2XDialogs2/ToolbarConfigurationRoot.xdl  |  15 +
 .../W2XDialogs2/ToolbarSettings.xdl           |  58 ++++
 .../oxt/writer2xhtml/W2XDialogs2/dialog.xlb   |   2 +
 source/oxt/writer2xhtml/help/en/help.tree     |  21 +-
 .../menu.xhp                                  |   7 +-
 .../settings.xhp                              |  95 +++++++
 22 files changed, 794 insertions(+), 178 deletions(-)
 rename source/java/org/openoffice/da/comp/{writer2latex => w2lcommon/helper}/StreamGobbler.java (86%)
 create mode 100644 source/java/org/openoffice/da/comp/writer2xhtml/ToolbarSettingsDialog.java
 create mode 100644 source/oxt/writer2xhtml/ToolbarOptionPages.xcu
 create mode 100644 source/oxt/writer2xhtml/ToolbarOptions.xcs
 create mode 100644 source/oxt/writer2xhtml/ToolbarOptions.xcu
 create mode 100644 source/oxt/writer2xhtml/W2XDialogs2/ToolbarConfigurationRoot.xdl
 create mode 100644 source/oxt/writer2xhtml/W2XDialogs2/ToolbarSettings.xdl
 create mode 100644 source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/settings.xhp

diff --git a/source/distro/changelog.txt b/source/distro/changelog.txt
index 4d152c2..f39408b 100644
--- a/source/distro/changelog.txt
+++ b/source/distro/changelog.txt
@@ -4,12 +4,15 @@ Changelog for Writer2LaTeX version 1.4 -> 1.6
 
 Items marked with * are work in progress
 
+[w2x] Added toolbar configuration dialog: Select XHTML and EPUB export format and behavior after export (do nothing,
+  display in default viewer or display with custom application) 
+
+[w2x] *Added EPUB 3 as export format and changed default export format for toolbar to EPUB 3
+
 [all] Implementation detail: Moved descriptions to a separate folder within the extensions
 
 [all] *Document the use of soffice --headless --convert-to
 
-[w2x] *Added EPUB 3 as export format and changed the toolbar to export to EPUB 3
-
 [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
@@ -29,7 +32,7 @@ Items marked with * are work in progress
 [w2l] Various improvements to the log viewer dialog: Reduced height to better accommodate small screen resolutions.
   Added checkbox to filter the LaTeX log to display only errors. Added help page and long tips.
 
-[w2x] Changed export format for toolbar from XHTML+MathML to HTML5
+[w2x] Changed default export format for toolbar from XHTML+MathML to HTML5
 
 [w2l] *Added new option font to load font packages. It accepts a large number of standard font packages such as
   cmbright or fourier. Only packages with math support are included. Unknown packages defaults to Computer Modern.
diff --git a/source/java/org/openoffice/da/comp/w2lcommon/filter/UNOPublisher.java b/source/java/org/openoffice/da/comp/w2lcommon/filter/UNOPublisher.java
index eaf5f4a..636d8ed 100644
--- a/source/java/org/openoffice/da/comp/w2lcommon/filter/UNOPublisher.java
+++ b/source/java/org/openoffice/da/comp/w2lcommon/filter/UNOPublisher.java
@@ -20,7 +20,7 @@
  *
  *  All Rights Reserved.
  *  
- *  Version 1.6 (2015-01-09)
+ *  Version 1.6 (2015-04-05)
  *  
  */
 package org.openoffice.da.comp.w2lcommon.filter;
@@ -85,7 +85,7 @@ public class UNOPublisher {
      *  (5) Post process the document, e.g. displaying the result
      * 
      * @param format the target format
-     * @return true if the publishing was succesful
+     * @return true if the publishing was successful
      */
     public boolean publish(TargetFormat format) {
         if (documentSaved() && updateMediaProperties(format)) {
@@ -131,7 +131,7 @@ public class UNOPublisher {
 			}
 	        xStatus.setValue(7); // Document is converted, that's 70%
 	        
-	        postProcess(getTargetURL(format));
+	        postProcess(getTargetURL(format),format);
 	        
 	        xStatus.setValue(10); // Export is finished (The user will usually not see this...)
 	        xStatus.end();
@@ -161,8 +161,9 @@ public class UNOPublisher {
     /** Post process the document after conversion.
      * 
      *  @param format URL of the converted document
+     *  @param format the target format
      */
-    protected void postProcess(String sTargetURL) {
+    protected void postProcess(String sTargetURL, TargetFormat format) {
     }
     
     /** Check that the document is saved in a location, we can use
diff --git a/source/java/org/openoffice/da/comp/writer2latex/StreamGobbler.java b/source/java/org/openoffice/da/comp/w2lcommon/helper/StreamGobbler.java
similarity index 86%
rename from source/java/org/openoffice/da/comp/writer2latex/StreamGobbler.java
rename to source/java/org/openoffice/da/comp/w2lcommon/helper/StreamGobbler.java
index fecefec..5fde8aa 100644
--- a/source/java/org/openoffice/da/comp/writer2latex/StreamGobbler.java
+++ b/source/java/org/openoffice/da/comp/w2lcommon/helper/StreamGobbler.java
@@ -16,23 +16,23 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  *  MA  02111-1307  USA
  *
- *  Copyright: 2002-2009 by Henrik Just
+ *  Copyright: 2002-2015 by Henrik Just
  *
  *  All Rights Reserved.
  * 
- *  Version 1.2 (2009-03-30)
+ *  Version 1.6 (2015-04-05)
  *
  */ 
  
-package org.openoffice.da.comp.writer2latex;
+package org.openoffice.da.comp.w2lcommon.helper;
 
 import java.io.*;
 
-class StreamGobbler extends Thread {
+public class StreamGobbler extends Thread {
     InputStream is;
     String type;
     
-    StreamGobbler(InputStream is, String type) {
+    public StreamGobbler(InputStream is, String type) {
         this.is = is;
         this.type = type;
     }
diff --git a/source/java/org/openoffice/da/comp/writer2latex/ApplicationsDialog.java b/source/java/org/openoffice/da/comp/writer2latex/ApplicationsDialog.java
index 1391e73..5b4b3c2 100644
--- a/source/java/org/openoffice/da/comp/writer2latex/ApplicationsDialog.java
+++ b/source/java/org/openoffice/da/comp/writer2latex/ApplicationsDialog.java
@@ -20,7 +20,7 @@
  *
  *  All Rights Reserved.
  * 
- *  Version 1.6 (2015-02-10)
+ *  Version 1.6 (2015-04-05)
  *
  */ 
  
@@ -32,14 +32,10 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.Vector;
 
-import com.sun.star.awt.XControl;
-import com.sun.star.awt.XControlContainer;
-import com.sun.star.awt.XControlModel;
 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.beans.XPropertySet;
 import com.sun.star.lang.XMultiComponentFactory;
 import com.sun.star.lang.XServiceInfo;
 import com.sun.star.uno.AnyConverter;
@@ -50,6 +46,7 @@ import com.sun.star.lib.uno.helper.WeakBase;
 
 import org.openoffice.da.comp.w2lcommon.helper.DialogAccess;
 import org.openoffice.da.comp.w2lcommon.helper.FilePicker;
+import org.openoffice.da.comp.w2lcommon.helper.StreamGobbler;
 
 /** This class provides a uno component which implements the configuration
  *  of applications for the Writer2LaTeX toolbar
@@ -81,24 +78,27 @@ public final class ApplicationsDialog
     // Implement XContainerWindowEventHandler
     public boolean callHandlerMethod(XWindow xWindow, Object event, String sMethod)
         throws com.sun.star.lang.WrappedTargetException {
+		XDialog xDialog = (XDialog)UnoRuntime.queryInterface(XDialog.class, xWindow);
+		DialogAccess dlg = new DialogAccess(xDialog);
+
         try {
             if (sMethod.equals("external_event") ){
-                return handleExternalEvent(xWindow, event);
+                return handleExternalEvent(dlg, event);
             }
             else if (sMethod.equals("ApplicationChange")) {
-                return changeApplication(xWindow);
+                return changeApplication(dlg);
             }
             else if (sMethod.equals("BrowseClick")) {
-                return browseForExecutable(xWindow);
+                return browseForExecutable(dlg);
             }
             else if (sMethod.equals("ExecutableUnfocus")) {
-                return updateApplication(xWindow);
+                return updateApplication(dlg);
             }
             else if (sMethod.equals("OptionsUnfocus")) {
-                return updateApplication(xWindow);
+                return updateApplication(dlg);
             }
             else if (sMethod.equals("AutomaticClick")) {
-                return autoConfigure(xWindow);
+                return autoConfigure(dlg);
             }
         }
         catch (com.sun.star.uno.RuntimeException e) {
@@ -131,7 +131,7 @@ public final class ApplicationsDialog
 	
     // Private stuff
     
-    private boolean handleExternalEvent(com.sun.star.awt.XWindow xWindow, Object aEventObject)
+    private boolean handleExternalEvent(DialogAccess dlg, Object aEventObject)
         throws com.sun.star.uno.Exception {
         try {
             String sMethod = AnyConverter.toString(aEventObject);
@@ -140,7 +140,7 @@ public final class ApplicationsDialog
                 return true;
             } else if (sMethod.equals("back") || sMethod.equals("initialize")) {
                 externalApps.load();
-                return changeApplication(xWindow);
+                return changeApplication(dlg);
             }
         }
         catch (com.sun.star.lang.IllegalArgumentException e) {
@@ -150,35 +150,35 @@ public final class ApplicationsDialog
         return false;
     }
 	
-    private boolean changeApplication(XWindow xWindow) {
-        String sAppName = getSelectedAppName(xWindow);
+    private boolean changeApplication(DialogAccess dlg) {
+        String sAppName = getSelectedAppName(dlg);
         if (sAppName!=null) {
             String[] s = externalApps.getApplication(sAppName);
-            setComboBoxText(xWindow, "Executable", s[0]);
-            setComboBoxText(xWindow, "Options", s[1]);
+            dlg.setComboBoxText("Executable", s[0]);
+            dlg.setComboBoxText("Options", s[1]);
         }
         return true;
     }
 	
-    private boolean browseForExecutable(XWindow xWindow) {
+    private boolean browseForExecutable(DialogAccess dlg) {
     	String sPath = filePicker.getPath();
     	if (sPath!=null) {
     		try {
-				setComboBoxText(xWindow, "Executable", new File(new URI(sPath)).getCanonicalPath());
+				dlg.setComboBoxText("Executable", new File(new URI(sPath)).getCanonicalPath());
 			}
     		catch (IOException e) {
 			}
     		catch (URISyntaxException e) {
 			}
-    		updateApplication(xWindow);
+    		updateApplication(dlg);
     	}     
     	return true;
     }
 	
-    private boolean updateApplication(XWindow xWindow) {
-        String sAppName = getSelectedAppName(xWindow);
+    private boolean updateApplication(DialogAccess dlg) {
+        String sAppName = getSelectedAppName(dlg);
         if (sAppName!=null) {
-            externalApps.setApplication(sAppName, getComboBoxText(xWindow, "Executable"), getComboBoxText(xWindow, "Options"));
+            externalApps.setApplication(sAppName, dlg.getComboBoxText("Executable"), dlg.getComboBoxText("Options"));
         }
         return true;
     }
@@ -281,7 +281,7 @@ public final class ApplicationsDialog
     }
 
     // Configure the applications automatically (OS dependent)
-    private boolean autoConfigure(XWindow xWindow) {
+    private boolean autoConfigure(DialogAccess dlg) {
 		String sOsName = System.getProperty("os.name");
 		String sOsVersion = System.getProperty("os.version");
 		String sOsArch = System.getProperty("os.arch");
@@ -380,12 +380,12 @@ public final class ApplicationsDialog
     	// sudo apt-get install texlive-latex-extra
     	// sudo apt-get install tex4ht
 		displayAutoConfigInfo(info.toString());
-    	changeApplication(xWindow);
+    	changeApplication(dlg);
         return true;
     }
 	
-    private String getSelectedAppName(XWindow xWindow) {
-        short nItem = getListBoxSelectedItem(xWindow, "Application");
+    private String getSelectedAppName(DialogAccess dlg) {
+        short nItem = dlg.getListBoxSelectedItem("Application");
         //String sAppName = null;
         switch (nItem) {
             case 0: return ExternalApps.LATEX;
@@ -417,7 +417,6 @@ public final class ApplicationsDialog
     	}
      }
 
-    
     private void displayAutoConfigInfo(String sText) {
     	XDialog xDialog = getDialog("W2LDialogs2.AutoConfigInfo");
     	if (xDialog!=null) {
@@ -428,57 +427,6 @@ public final class ApplicationsDialog
     	}
     }
     
-    // Some helpers copied from DialogBase
-    private XPropertySet getControlProperties(XWindow xWindow, String sControlName) {
-        XControlContainer xContainer = (XControlContainer)
-            UnoRuntime.queryInterface(XControlContainer.class, xWindow);
-        XControl xControl = xContainer.getControl(sControlName);
-        XControlModel xModel = xControl.getModel();
-        XPropertySet xPropertySet = (XPropertySet)
-            UnoRuntime.queryInterface(XPropertySet.class, xModel);
-        return xPropertySet;
-    }
-
-    private String getComboBoxText(XWindow xWindow, String sControlName) {
-        // Returns the text of a combobox
-        XPropertySet xPropertySet = getControlProperties(xWindow, sControlName);
-        try {
-            return (String) xPropertySet.getPropertyValue("Text");
-        }
-        catch (Exception e) {
-            // Will fail if the control does not exist or is not a combo
-            return "";
-        }
-    }
-	
-    private void setComboBoxText(XWindow xWindow, String sControlName, String sText) {
-        XPropertySet xPropertySet = getControlProperties(xWindow, sControlName);
-        try {
-            xPropertySet.setPropertyValue("Text", sText);
-        }
-        catch (Exception e) {
-            // Will fail if the control does not exist or is not a combo box or
-            // nText is an illegal value
-        }
-    }
-    
-    private short getListBoxSelectedItem(XWindow xWindow, String sControlName) {
-        // Returns the first selected element in case of a multiselection
-        XPropertySet xPropertySet = getControlProperties(xWindow, sControlName);
-        try {
-            short[] selection = (short[]) xPropertySet.getPropertyValue("SelectedItems");
-            return selection[0];
-        }
-        catch (Exception e) {
-            // Will fail if the control does not exist or is not a list box
-            return -1;
-        }
-    }
-	
-
-	
-
-	
 }
 
 
diff --git a/source/java/org/openoffice/da/comp/writer2latex/ExternalApps.java b/source/java/org/openoffice/da/comp/writer2latex/ExternalApps.java
index c086e7b..d345d13 100644
--- a/source/java/org/openoffice/da/comp/writer2latex/ExternalApps.java
+++ b/source/java/org/openoffice/da/comp/writer2latex/ExternalApps.java
@@ -35,6 +35,7 @@ import java.util.Map;
 import java.util.Vector;
 
 import org.openoffice.da.comp.w2lcommon.helper.RegistryHelper;
+import org.openoffice.da.comp.w2lcommon.helper.StreamGobbler;
 //import java.util.Map;
 
 import com.sun.star.beans.XMultiHierarchicalPropertySet;
diff --git a/source/java/org/openoffice/da/comp/writer2latex/LaTeXUNOPublisher.java b/source/java/org/openoffice/da/comp/writer2latex/LaTeXUNOPublisher.java
index c7b8059..634de3e 100644
--- a/source/java/org/openoffice/da/comp/writer2latex/LaTeXUNOPublisher.java
+++ b/source/java/org/openoffice/da/comp/writer2latex/LaTeXUNOPublisher.java
@@ -20,7 +20,7 @@
  *
  *  All Rights Reserved.
  *  
- *  Version 1.6 (2015-02-18)
+ *  Version 1.6 (2015-04-05)
  *  
  */
 package org.openoffice.da.comp.writer2latex;
@@ -140,7 +140,7 @@ public class LaTeXUNOPublisher extends UNOPublisher {
     
 	/** Postprocess the converted document with LaTeX and display the result
 	 */
-    @Override protected void postProcess(String sURL) {
+    @Override protected void postProcess(String sURL, TargetFormat format) {
         if (texify==null) { texify = new TeXify(xContext); }
         File file = new File(Misc.urlToFile(getTargetPath()),getTargetFileName());
         
diff --git a/source/java/org/openoffice/da/comp/writer2xhtml/ToolbarSettingsDialog.java b/source/java/org/openoffice/da/comp/writer2xhtml/ToolbarSettingsDialog.java
new file mode 100644
index 0000000..d5b5af1
--- /dev/null
+++ b/source/java/org/openoffice/da/comp/writer2xhtml/ToolbarSettingsDialog.java
@@ -0,0 +1,262 @@
+/************************************************************************
+ *
+ *  ToolbarSettingsDialog.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-2015 by Henrik Just
+ *
+ *  All Rights Reserved.
+ * 
+ *  Version 1.6 (2015-04-05)
+ *
+ */ 
+ 
+package org.openoffice.da.comp.writer2xhtml;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import com.sun.star.awt.XContainerWindowEventHandler;
+import com.sun.star.awt.XDialog;
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.util.XChangesBatch;
+
+import com.sun.star.lib.uno.helper.WeakBase;
+
+import org.openoffice.da.comp.w2lcommon.helper.DialogAccess;
+import org.openoffice.da.comp.w2lcommon.helper.FilePicker;
+import org.openoffice.da.comp.w2lcommon.helper.RegistryHelper;
+import org.openoffice.da.comp.w2lcommon.helper.XPropertySetHelper;
+
+/** This class provides a uno component which implements the configuration
+ *  of the writer2xhtml toolbar
+ */
+public final class ToolbarSettingsDialog
+    extends WeakBase
+    implements XServiceInfo, XContainerWindowEventHandler {
+	
+	public static final String REGISTRY_PATH = "/org.openoffice.da.Writer2xhtml.toolbar.ToolbarOptions/Settings";
+
+    private XComponentContext xContext;
+    private FilePicker filePicker;
+    
+    /** The component will be registered under this name.
+     */
+    public static String __serviceName = "org.openoffice.da.writer2xhtml.ToolbarSettingsDialog";
+
+    /** The component should also have an implementation name.
+     */
+    public static String __implementationName = "org.openoffice.da.comp.writer2xhtml.ToolbarSettingsDialog";
+
+    /** Create a new ToolbarSettingsDialog */
+    public ToolbarSettingsDialog(XComponentContext xContext) {
+        this.xContext = xContext;
+        filePicker = new FilePicker(xContext);
+    }
+	
+    // Implement XContainerWindowEventHandler
+    public boolean callHandlerMethod(XWindow xWindow, Object event, String sMethod)
+        throws com.sun.star.lang.WrappedTargetException {
+		XDialog xDialog = (XDialog)UnoRuntime.queryInterface(XDialog.class, xWindow);
+		DialogAccess dlg = new DialogAccess(xDialog);
+
+        try {
+            if (sMethod.equals("external_event") ){
+                return handleExternalEvent(dlg, event);
+            }
+            else if (sMethod.equals("XhtmlFormatChange")) {
+            	return true;
+            }
+            else if (sMethod.equals("XhtmlViewChange")) {
+            	return xhtmlViewChange(dlg);
+            }
+            else if (sMethod.equals("XhtmlBrowseClick")) {
+            	return xhtmlBrowseClick(dlg);
+            }
+            else if (sMethod.equals("EpubFormatChange")) {
+            	return true;
+            }
+            else if (sMethod.equals("EpubViewChange")) {
+            	return epubViewChange(dlg);
+            }
+            else if (sMethod.equals("EpubBrowseClick")) {
+            	return epubBrowseClick(dlg);
+            }
+        }
+        catch (com.sun.star.uno.RuntimeException e) {
+            throw e;
+        }
+        catch (com.sun.star.uno.Exception e) {
+            throw new com.sun.star.lang.WrappedTargetException(sMethod, this, e);
+        }
+        return false;
+    }
+	
+    public String[] getSupportedMethodNames() {
+        String[] sNames = { "external_event", "XhtmlFormatChange", "XhtmlViewChange", "XhtmlBrowseClick",
+        		"EpupFormatChange", "EpubViewChange", "EpubBrowseClick" };
+        return sNames;
+    }
+    
+    // Implement the interface XServiceInfo
+    public boolean supportsService(String sServiceName) {
+        return sServiceName.equals(__serviceName);
+    }
+
+    public String getImplementationName() {
+        return __implementationName;
+    }
+    
+    public String[] getSupportedServiceNames() {
+        String[] sSupportedServiceNames = { __serviceName };
+        return sSupportedServiceNames;
+    }
+	
+    // Private stuff
+    
+    private boolean handleExternalEvent(DialogAccess dlg, Object aEventObject)
+        throws com.sun.star.uno.Exception {
+        try {
+            String sMethod = AnyConverter.toString(aEventObject);
+            if (sMethod.equals("ok")) {
+                saveConfiguration(dlg);
+                return true;
+            } else if (sMethod.equals("back") || sMethod.equals("initialize")) {
+                loadConfiguration(dlg);
+                enableXhtmlExecutable(dlg);
+                enableEpubExecutable(dlg);
+                return true;
+            }
+        }
+        catch (com.sun.star.lang.IllegalArgumentException e) {
+            throw new com.sun.star.lang.IllegalArgumentException(
+            "Method external_event requires a string in the event object argument.", this,(short) -1);
+        }
+        return false;
+    }
+    
+    private void loadConfiguration(DialogAccess dlg) {
+    	RegistryHelper registry = new RegistryHelper(xContext);
+    	
+		try {
+			Object view = registry.getRegistryView(REGISTRY_PATH, false);
+			XPropertySet xProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,view);
+			
+        	dlg.setListBoxSelectedItem("XhtmlFormat",
+        			XPropertySetHelper.getPropertyValueAsShort(xProps, "XhtmlFormat"));
+        	dlg.setListBoxSelectedItem("XhtmlView",
+        			XPropertySetHelper.getPropertyValueAsShort(xProps, "XhtmlView"));
+        	dlg.setTextFieldText("XhtmlExecutable",
+        			XPropertySetHelper.getPropertyValueAsString(xProps, "XhtmlExecutable"));
+        	dlg.setListBoxSelectedItem("EpubFormat",
+        			XPropertySetHelper.getPropertyValueAsShort(xProps, "EpubFormat"));
+        	dlg.setListBoxSelectedItem("EpubView",
+        			XPropertySetHelper.getPropertyValueAsShort(xProps, "EpubView"));
+        	dlg.setTextFieldText("EpubExecutable",
+        			XPropertySetHelper.getPropertyValueAsString(xProps, "EpubExecutable"));
+		} catch (Exception e) {
+    		// Failed to get registry view
+		}
+    }
+    
+    private void saveConfiguration(DialogAccess dlg) {
+		RegistryHelper registry = new RegistryHelper(xContext);
+    	try {
+    		Object view = registry.getRegistryView(REGISTRY_PATH, true);
+    		XPropertySet xProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,view);
+   			XPropertySetHelper.setPropertyValue(xProps, "XhtmlFormat", dlg.getListBoxSelectedItem("XhtmlFormat"));
+   			XPropertySetHelper.setPropertyValue(xProps, "XhtmlView", dlg.getListBoxSelectedItem("XhtmlView"));
+   			XPropertySetHelper.setPropertyValue(xProps, "XhtmlExecutable", dlg.getTextFieldText("XhtmlExecutable"));
+   			XPropertySetHelper.setPropertyValue(xProps, "EpubFormat", dlg.getListBoxSelectedItem("EpubFormat"));
+   			XPropertySetHelper.setPropertyValue(xProps, "EpubView", dlg.getListBoxSelectedItem("EpubView"));
+   			XPropertySetHelper.setPropertyValue(xProps, "EpubExecutable", dlg.getTextFieldText("EpubExecutable"));
+   			
+            // Commit registry changes
+            XChangesBatch  xUpdateContext = (XChangesBatch)
+                UnoRuntime.queryInterface(XChangesBatch.class,view);
+            try {
+                xUpdateContext.commitChanges();
+            }
+            catch (Exception e) {
+                // ignore
+            }
+                        
+        	registry.disposeRegistryView(view);
+    	}
+    	catch (Exception e) {
+    		// Failed to get registry view
+    	}		    	
+    }
+    
+    private boolean xhtmlViewChange(DialogAccess dlg) {
+    	enableXhtmlExecutable(dlg);
+    	return true;
+    }
+
+    private void enableXhtmlExecutable(DialogAccess dlg) {
+    	int nItem = dlg.getListBoxSelectedItem("XhtmlView");
+    	dlg.setControlEnabled("XhtmlExecutable", nItem==2);
+    	dlg.setControlEnabled("XhtmlBrowseButton", nItem==2);
+    }
+    
+    private boolean xhtmlBrowseClick(DialogAccess dlg) {
+    	browseForExecutable(dlg,"XhtmlExecutable");
+    	return true;
+    }
+	
+    private boolean epubViewChange(DialogAccess dlg) {
+    	enableEpubExecutable(dlg);
+    	return true;
+    }
+	
+    private void enableEpubExecutable(DialogAccess dlg) {
+    	int nItem = dlg.getListBoxSelectedItem("EpubView");
+    	dlg.setControlEnabled("EpubExecutable", nItem==2);
+    	dlg.setControlEnabled("EpubBrowseButton", nItem==2);
+    }
+    
+    private boolean epubBrowseClick(DialogAccess dlg) {
+    	browseForExecutable(dlg,"EpubExecutable");
+    	return true;
+    }
+    
+    private boolean browseForExecutable(DialogAccess dlg, String sControlName) {
+    	String sPath = filePicker.getPath();
+    	if (sPath!=null) {
+    		try {
+				dlg.setComboBoxText(sControlName, new File(new URI(sPath)).getCanonicalPath());
+			}
+    		catch (IOException e) {
+			}
+    		catch (URISyntaxException e) {
+			}
+    	}     
+    	return true;
+    }
+
+	
+}
+
+
+
diff --git a/source/java/org/openoffice/da/comp/writer2xhtml/W2XRegistration.java b/source/java/org/openoffice/da/comp/writer2xhtml/W2XRegistration.java
index cbc4ce6..34e66d2 100644
--- a/source/java/org/openoffice/da/comp/writer2xhtml/W2XRegistration.java
+++ b/source/java/org/openoffice/da/comp/writer2xhtml/W2XRegistration.java
@@ -16,11 +16,11 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  *  MA  02111-1307  USA
  *
- *  Copyright: 2002-2014 by Henrik Just
+ *  Copyright: 2002-2015 by Henrik Just
  *
  *  All Rights Reserved.
  * 
- *  Version 1.6 (2014-10-06) 
+ *  Version 1.6 (2015-04-03) 
  *
  */ 
  
@@ -114,6 +114,12 @@ public class W2XRegistration {
             multiFactory,						    
             regKey);
         }
+        else if (implName.equals(ToolbarSettingsDialog.__implementationName)) {
+            xSingleServiceFactory = FactoryHelper.getServiceFactory(ToolbarSettingsDialog.class,
+            ToolbarSettingsDialog.__serviceName,
+            multiFactory,						    
+            regKey);
+        }
         
         return xSingleServiceFactory;
     }
@@ -145,7 +151,9 @@ public class W2XRegistration {
             FactoryHelper.writeRegistryServiceInfo(EpubMetadataDialog.__implementationName,
                         EpubMetadataDialog.__serviceName, regKey) &
             FactoryHelper.writeRegistryServiceInfo(ConfigurationDialog.__implementationName,
-                ConfigurationDialog.__serviceName, regKey);
+                ConfigurationDialog.__serviceName, regKey) &
+            FactoryHelper.writeRegistryServiceInfo(ToolbarSettingsDialog.__implementationName,
+                ToolbarSettingsDialog.__serviceName, regKey);
     }
 }
 
diff --git a/source/java/org/openoffice/da/comp/writer2xhtml/Writer2xhtml.java b/source/java/org/openoffice/da/comp/writer2xhtml/Writer2xhtml.java
index baf374a..cb988f2 100644
--- a/source/java/org/openoffice/da/comp/writer2xhtml/Writer2xhtml.java
+++ b/source/java/org/openoffice/da/comp/writer2xhtml/Writer2xhtml.java
@@ -20,7 +20,7 @@
  *
  *  All Rights Reserved.
  * 
- *  Version 1.6 (2015-01-09)
+ *  Version 1.6 (2015-04-05)
  *
  */ 
  
@@ -28,6 +28,7 @@ package org.openoffice.da.comp.writer2xhtml;
 
 // TODO: Create common base for dispatcher classes
 
+import com.sun.star.beans.XPropertySet;
 import com.sun.star.frame.XFrame;
 import com.sun.star.lang.XComponent;
 import com.sun.star.lib.uno.helper.WeakBase;
@@ -36,6 +37,8 @@ import com.sun.star.uno.Exception;
 import com.sun.star.uno.UnoRuntime;
 import com.sun.star.uno.XComponentContext;
 import org.openoffice.da.comp.w2lcommon.filter.UNOPublisher.TargetFormat;
+import org.openoffice.da.comp.w2lcommon.helper.RegistryHelper;
+import org.openoffice.da.comp.w2lcommon.helper.XPropertySetHelper;
        
 /** This class implements the ui (dispatch) commands provided by Writer2xhtml.
  */
@@ -57,10 +60,6 @@ public final class Writer2xhtml extends WeakBase
     public static final String __serviceName = "com.sun.star.frame.ProtocolHandler"; 
     private static final String[] m_serviceNames = { __serviceName };
     
-    // TODO: These should be configurable
-    private TargetFormat xhtmlFormat = TargetFormat.html5;
-    private TargetFormat epubFormat = TargetFormat.epub3;    
-      
     public Writer2xhtml(XComponentContext xContext) {
         m_xContext = xContext;
     }
@@ -129,11 +128,11 @@ public final class Writer2xhtml extends WeakBase
         com.sun.star.beans.PropertyValue[] aArguments ) {
         if ( aURL.Protocol.compareTo(PROTOCOL) == 0 ) {
             if ( aURL.Path.compareTo("PublishAsXHTML") == 0 ) {
-               	publish(xhtmlFormat);
+               	publishAsXhtml();
                 return;
             }
             else if ( aURL.Path.compareTo("PublishAsEPUB") == 0 ) {
-                publish(epubFormat);
+                publishAsEpub();
                 return;
             }
             else if ( aURL.Path.compareTo("EditEPUBDocumentProperties") == 0 ) {
@@ -168,6 +167,39 @@ public final class Writer2xhtml extends WeakBase
 		}
     }
     
+    private void publishAsXhtml() {
+    	RegistryHelper registry = new RegistryHelper(m_xContext);
+		try {
+			Object view = registry.getRegistryView(ToolbarSettingsDialog.REGISTRY_PATH, false);
+			XPropertySet xProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,view);			
+			short nXhtmlFormat = XPropertySetHelper.getPropertyValueAsShort(xProps, "XhtmlFormat");
+			switch (nXhtmlFormat) {
+			case 0: publish(TargetFormat.xhtml); break; 
+			case 1: publish(TargetFormat.xhtml11); break;
+			case 2: publish(TargetFormat.xhtml_mathml); break;
+			case 3: publish(TargetFormat.html5);
+			}
+		} catch (Exception e) {
+    		// Failed to get registry view
+		}
+    }
+    
+    private void publishAsEpub() {
+    	RegistryHelper registry = new RegistryHelper(m_xContext);
+		try {
+			Object view = registry.getRegistryView(ToolbarSettingsDialog.REGISTRY_PATH, false);
+			XPropertySet xProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,view);			
+			short nEpubFormat = XPropertySetHelper.getPropertyValueAsShort(xProps, "EpubFormat");
+			switch (nEpubFormat) {
+			case 0: publish(TargetFormat.epub); break;
+			case 1: publish(TargetFormat.epub3);
+			}
+		} catch (Exception e) {
+    		// Failed to get registry view
+		}
+    	
+    }
+    
     private void publish(TargetFormat format) {
     	if (unoPublisher==null) { 
     		unoPublisher = new XhtmlUNOPublisher(m_xContext,m_xFrame,"Writer2xhtml");
diff --git a/source/java/org/openoffice/da/comp/writer2xhtml/XhtmlUNOPublisher.java b/source/java/org/openoffice/da/comp/writer2xhtml/XhtmlUNOPublisher.java
index 0f65403..6e86f99 100644
--- a/source/java/org/openoffice/da/comp/writer2xhtml/XhtmlUNOPublisher.java
+++ b/source/java/org/openoffice/da/comp/writer2xhtml/XhtmlUNOPublisher.java
@@ -16,11 +16,11 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  *  MA  02111-1307  USA
  *
- *  Copyright: 2002-2014 by Henrik Just
+ *  Copyright: 2002-2015 by Henrik Just
  *
  *  All Rights Reserved.
  *  
- *  Version 1.6 (2014-11-03)
+ *  Version 1.6 (2015-04-05)
  *  
  */
 package org.openoffice.da.comp.writer2xhtml;
@@ -28,13 +28,20 @@ package org.openoffice.da.comp.writer2xhtml;
 import java.awt.Desktop;
 import java.io.File;
 import java.io.IOException;
+import java.util.Vector;
 
 import org.openoffice.da.comp.w2lcommon.filter.UNOPublisher;
 import org.openoffice.da.comp.w2lcommon.helper.MessageBox;
+import org.openoffice.da.comp.w2lcommon.helper.RegistryHelper;
+import org.openoffice.da.comp.w2lcommon.helper.StreamGobbler;
+import org.openoffice.da.comp.w2lcommon.helper.XPropertySetHelper;
 
 import writer2latex.util.Misc;
 
+import com.sun.star.beans.XPropertySet;
 import com.sun.star.frame.XFrame;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
 import com.sun.star.uno.XComponentContext;
 
 public class XhtmlUNOPublisher extends UNOPublisher {
@@ -44,27 +51,97 @@ public class XhtmlUNOPublisher extends UNOPublisher {
     }
     
     
-	/** Display the converted document in the default application
+	/** Display the converted document depending on user settings
 	 * 
 	 *  @param sURL the URL of the converted document
+	 *  @param format the target format
 	 */
-    @Override protected void postProcess(String sURL) {
+    @Override protected void postProcess(String sURL, TargetFormat format) {
+    	RegistryHelper registry = new RegistryHelper(xContext);
+    	
+    	short nView = 1;
+    	String sExecutable = null;
+    	
+		try {
+			Object view = registry.getRegistryView(ToolbarSettingsDialog.REGISTRY_PATH, false);
+			XPropertySet xProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,view);
+			
+			if (format==TargetFormat.xhtml || format==TargetFormat.xhtml11 || format==TargetFormat.xhtml_mathml || format==TargetFormat.html5) {
+				nView = XPropertySetHelper.getPropertyValueAsShort(xProps, "XhtmlView");
+				sExecutable = XPropertySetHelper.getPropertyValueAsString(xProps, "XhtmlExecutable");				
+			}
+			else { // EPUB				
+				nView = XPropertySetHelper.getPropertyValueAsShort(xProps, "EpubView");
+				sExecutable = XPropertySetHelper.getPropertyValueAsString(xProps, "EpubExecutable");
+			}
+		} catch (Exception e) {
+    		// Failed to get registry view
+		}
+		
         File file = Misc.urlToFile(sURL);
         if (file.exists()) {
-	        // Open the file in the default application on this system (if any)
-	        if (Desktop.isDesktopSupported()) {
-	            Desktop desktop = Desktop.getDesktop();
-	            try {
-					desktop.open(file);
-				} catch (IOException e) {
-					System.err.println(e.getMessage());
-				}
-	        }        
-	    }
-        else {        	
-            MessageBox msgBox = new MessageBox(xContext, xFrame);
-            msgBox.showMessage("Writer2xhtml","Error: Failed to open exported document");
+    		if (nView==0) {
+    			return;
+    		}
+    		 else if (nView==1) {
+            	if (openWithDefaultApplication(file)) {
+            		return;
+            	}
+    		}
+    		else if (nView==2) {
+    			if (openWithCustomApplication(file, sExecutable)) {
+    				return;
+    			}
+    		}
         }
+        MessageBox msgBox = new MessageBox(xContext, xFrame);
+        msgBox.showMessage("Writer2xhtml","Error: Failed to open exported document");
     }
     
+    // Open the file in the default application on this system (if any)
+    private boolean openWithDefaultApplication(File file) {
+        if (Desktop.isDesktopSupported()) {
+            Desktop desktop = Desktop.getDesktop();
+            try {
+				desktop.open(file);
+				return true;
+			} catch (IOException e) {
+				System.err.println(e.getMessage());
+			}
+        }
+        return false;
+    }
+    
+    // Open the file with the user defined application
+    private boolean openWithCustomApplication(File file, String sExecutable) {
+        try {
+			Vector<String> command = new Vector<String>();
+			command.add(sExecutable);
+			command.add(file.getPath());
+			
+            ProcessBuilder pb = new ProcessBuilder(command);
+            Process proc = pb.start();        
+
+            // Gobble the error stream of the application
+            StreamGobbler errorGobbler = new 
+                StreamGobbler(proc.getErrorStream(), "ERROR");            
+            
+            // Gobble the output stream of the application
+            StreamGobbler outputGobbler = new 
+                StreamGobbler(proc.getInputStream(), "OUTPUT");
+                
+            errorGobbler.start();
+            outputGobbler.start();
+                                    
+            // The application exists if the process exits with 0
+            return proc.waitFor()==0;
+        }
+        catch (InterruptedException e) {
+            return false;
+        }
+        catch (IOException e) {
+            return false;
+        }
+	}
+    
 }
diff --git a/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/applications.xhp b/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/applications.xhp
index faceda0..d8f10f4 100644
--- a/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/applications.xhp
+++ b/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/applications.xhp
@@ -12,7 +12,7 @@
         <paragraph role="paragraph" xml-lang="en-US">Before you can use Writer2LaTeX you must configure it to use your LaTeX
         distribution as well as viewers for the different output formats.</paragraph>
         <section id="howtoget" xml-lang="en-US">
-        	Select <emph>Tools - Options - %PRODUCTNAME Writer - Writer2LaTeX toolbar - Applications</emph>
+        	Select <emph>Tools - Options - Writer2LaTeX toolbar - Applications</emph>
         </section>
 
         <paragraph role="heading" level="2" xml-lang="en-US">Prerequisites</paragraph>
diff --git a/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/bibliography.xhp b/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/bibliography.xhp
index 7b9e207..ce4be01 100644
--- a/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/bibliography.xhp
+++ b/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/bibliography.xhp
@@ -12,56 +12,36 @@
         <paragraph role="paragraph" xml-lang="en-US">On this page you can configure the use of BibTeX as bibliography
         database in %PRODUCTNAME Writer.</paragraph>
         <section id="howtoget" xml-lang="en-US">
-        	Select <emph>Tools - Options - %PRODUCTNAME Writer - Writer2LaTeX toolbar - Bibliography</emph>
+        	Select <emph>Tools - Options - Writer2LaTeX toolbar - Bibliography</emph>
         </section>
 
-		<paragraph role="heading" level="2" xml-lang="en-US">Bibliography database</paragraph>
+		<paragraph role="heading" level="2" xml-lang="en-US">Using BibTeX as bibliography database</paragraph>
 		<paragraph role="paragraph" xml-lang="en-US">%PRODUCTNAME Writer comes with a standard bibliography database.
-		Citations can be created from the content of the database.
-		The Writer2LaTeX toolbar provides an alternative solution: On this page you can configure the use of BibTeX
-		as bibliography database.</paragraph>
-
-
-
-
-		<list type="unordered">
-        	<listitem>
-				<paragraph role="paragraph" xml-lang="en-US">The standard bibliographic tool in Writer can
-				be used to insert citations from the bibliography database</paragraph>
-        	</listitem>
-        	<listitem>
-				<paragraph role="paragraph" xml-lang="en-US">The Writer2LaTeX toolbar can be used to insert
-				citations from BibTeX files</paragraph>
-        	</listitem>
-        	<listitem>
-				<paragraph role="paragraph" xml-lang="en-US"><link href="http://jabref.sourceforge.net/" name="Link to the JabRef Website">JabRef</link>
-					is an open source bibliography reference manager using BibTeX as native file format.
-					
-					You can use JabRef to edit your BibTeX files.
-					In addition JabRef provides a <link href="http://jabref.sourceforge.net/OOPlugin-jabref.php" name="JabRef OOo plugin">plugin</link>
-					which permits you to insert citations from JabRef in your %PRODUCTNAME Writer document
-					using a selection of citation schemes. You should use version 0.8.999 beta or later of the plugin.</paragraph>
-        	</listitem>
-        	<listitem>
-				<paragraph role="paragraph" xml-lang="en-US"><link href="http://www.zotero.org" name="Link to the Zotero Website">Zotero</link>
-					is a free, easy-to-use tool to help you collect, organize, cite, and share your research sources.
-					Zotero provides a plugin for %PRODUCTNAME which permits you to insert citations from Zotero in your
-					%PRODUCTNAME Writer document using a selection of citation schemes.</paragraph>
-        	</listitem>
-		</list>
-		<paragraph role="paragraph" xml-lang="en-US">In the first case, you should not make any settings to this page.
-		Writer2LaTeX can optionally convert to and format your citations with BibTeX if you choose so in the export
-		dialog.
+		Citations can be created from the content of the database.</paragraph>
+		<paragraph role="paragraph" xml-lang="en-US">On the other hand, LaTeX traditionally stores bibliographic
+		information in the BibTeX database format.
+		The Writer2LaTeX toolbar enables you to use BibTeX databases directly in %PRODUCTNAME Writer.
+		With this feature you can create citations from a BibTeX file rather than from the standard bibliography database.
 		</paragraph>
-		<paragraph role="paragraph" xml-lang="en-US">In the other cases it makes sense to use the original BibTeX files
-		in the LaTeX document. 
+		<paragraph role="paragraph" xml-lang="en-US">The following sections describe four different
+		ways to handle bibliograhic citations.</paragraph>
+
+		<paragraph role="heading" level="2" xml-lang="en-US">Using the standard bibliography database</paragraph>
+		<paragraph role="paragraph" xml-lang="en-US">If you want to use the standard tools in %PRODUCTNAME Writer
+		to manage and create citations, you should not make any settings to this page.
+		Upon export, Writer2LaTeX can convert to and format your citations with BibTeX.
+		You can enable this in the export dialog.
 		</paragraph>
 		
 		<bookmark xml-lang="en-US" branch="hid/org.openoffice.da.writer2latex.oxt:BibliographyUseExternalBibTeXFiles" id="bm_useexternalbibtexfiles"/>
-		<paragraph role="heading" level="3" xml-lang="en-US">Use BibTeX as bibliography database</paragraph>
-		<paragraph role="paragraph" xml-lang="en-US">Check this to use the original BibTeX files in the LaTeX document rather than converting the
-		inserted references back into BibTeX.</paragraph>
-		<paragraph role="paragraph" xml-lang="en-US"><ahelp hid="org.openoffice.da.writer2latex.oxt:BibliographyUseExternalBibTeXFiles" visibility="hidden">Check this if your citatations are inserted from BibTeX file(s)</ahelp></paragraph>
+		<paragraph role="heading" level="2" xml-lang="en-US">Use BibTeX as bibliography database</paragraph>
+		<paragraph role="paragraph" xml-lang="en-US"><ahelp hid="org.openoffice.da.writer2latex.oxt:BibliographyUseExternalBibTeXFiles" visibility="hidden">Check this to enable the insertion of citations from BibTeX file(s)</ahelp></paragraph>
+		<paragraph role="paragraph" xml-lang="en-US">Check this to enable the use of BibTeX as bibliograhy database.</paragraph>
+		<paragraph role="paragraph" xml-lang="en-US">You can then use the 
+		<link href="org.openoffice.da.writer2latex.oxt/bibtex.xhp"
+          name="Writer2LaTeX toolbar">Writer2LaTeX toolbar</link> to insert citations from BibTeX files.
+		Upon export, Writer2LaTeX can format your citations with BibTeX using the original BibTeX files.
+		You can enable this in the export dialog.</paragraph>
 
 		<bookmark xml-lang="en-US" branch="hid/org.openoffice.da.writer2latex.oxt:BibliographyBibTeXLocation" id="bm_bibtexlocation"/>
 		<paragraph role="heading" level="3" xml-lang="en-US">BibTeX location</paragraph>
@@ -73,7 +53,7 @@
         	</listitem>
         	<listitem>
 				<paragraph role="paragraph" xml-lang="en-US"><emph>In subfolder of document folder</emph>: Select this option if you
-				want to use project-specific BibTeX files. For example using a folder named "bibliopgraphy" relative to the document
+				want to use project-specific BibTeX files. For example using a folder named "bibliography" relative to the document
 				folder.</paragraph>
         	</listitem>
         	<listitem>
@@ -94,13 +74,18 @@
 		<paragraph role="paragraph" xml-lang="en-US"><ahelp hid="org.openoffice.da.writer2latex.oxt:BibliographyBibTeXDirButton" visibility="hidden">Click to select the path to the folder containing the BibTeX files</ahelp></paragraph>
 
 		<bookmark xml-lang="en-US" branch="hid/org.openoffice.da.writer2latex.oxt:BibliographyConvertZoteroCitations" id="bm_convertzoterocitations"/>
-		<paragraph role="heading" level="3" xml-lang="en-US">Convert Zotero citations</paragraph>
+		<paragraph role="heading" level="2" xml-lang="en-US">Convert Zotero citations</paragraph>
+		<paragraph role="paragraph" xml-lang="en-US"><link href="http://www.zotero.org" name="Link to the Zotero Website">Zotero</link>
+			is a free, easy-to-use tool to help you collect, organize, cite, and share your research sources.
+			Zotero provides a plugin for %PRODUCTNAME which permits you to insert citations from Zotero in your
+			%PRODUCTNAME Writer document using a selection of citation schemes.</paragraph>
 		<paragraph role="paragraph" xml-lang="en-US">Check this if you want to convert Zotero citations to LaTeX.
 		This enables you to format the citations using a BibTeX style of your choice.
 		Also, the bibliography created by Zotero will be replaced with a BibTeX-generated bibliography.
 		If you do not check this option, the original
 		citation text inserted by Zotero will be used.</paragraph>
-		<paragraph role="heading" level="4" xml-lang="en-US">Exporting your Zotero database to BibTeX</paragraph>
+
+		<paragraph role="heading" level="3" xml-lang="en-US">Exporting your Zotero database to BibTeX</paragraph>
 		<paragraph role="paragraph" xml-lang="en-US">To use this feature you must export your Zotero database to the specified
 		folder.</paragraph>
 		<paragraph role="paragraph" xml-lang="en-US">The Writer2LaTeX distribution contains a folder named <emph>Zotero</emph>,
@@ -114,7 +99,14 @@
 		<paragraph role="paragraph" xml-lang="en-US"><ahelp hid="org.openoffice.da.writer2latex.oxt:BibliographyConvertZoteroCitations" visibility="hidden">Check this to convert Zotero citations to LaTeX</ahelp></paragraph>
 
 		<bookmark xml-lang="en-US" branch="hid/org.openoffice.da.writer2latex.oxt:BibliographyConvertJabRefCitations" id="bm_convertjabrefcitations"/>
-		<paragraph role="heading" level="3" xml-lang="en-US">Convert JabRef citations</paragraph>
+		<paragraph role="heading" level="2" xml-lang="en-US">Convert JabRef citations</paragraph>
+		<paragraph role="paragraph" xml-lang="en-US"><link href="http://jabref.sourceforge.net/" name="Link to the JabRef Website">JabRef</link>
+			is an open source bibliography reference manager using BibTeX as native file format.
+			
+			You can use JabRef to edit your BibTeX files.
+			In addition JabRef provides a <link href="http://jabref.sourceforge.net/OOPlugin-jabref.php" name="JabRef OOo plugin">plugin</link>
+			which permits you to insert citations from JabRef in your %PRODUCTNAME Writer document
+			using a selection of citation schemes. You should use version 0.8.999 beta or later of the plugin.</paragraph>
 		<paragraph role="paragraph" xml-lang="en-US">Check this if you want to convert JabRef citations to LaTeX.
 		This enables you to format the citations using a BibTeX style of your choice.
 		Also, the bibliography created by JabRef will be replaced with a BibTeX-generated bibliography.
diff --git a/source/oxt/writer2xhtml/META-INF/manifest.xml b/source/oxt/writer2xhtml/META-INF/manifest.xml
index 2d1b667..9f566e2 100644
--- a/source/oxt/writer2xhtml/META-INF/manifest.xml
+++ b/source/oxt/writer2xhtml/META-INF/manifest.xml
@@ -41,10 +41,22 @@
      manifest:full-path="Options.xcu"
      manifest:media-type="application/vnd.sun.star.configuration-data"/>
 
+    <manifest:file-entry
+     manifest:full-path="ToolbarOptions.xcs"
+     manifest:media-type="application/vnd.sun.star.configuration-schema"/>
+
+    <manifest:file-entry
+     manifest:full-path="ToolbarOptions.xcu"
+     manifest:media-type="application/vnd.sun.star.configuration-data"/>
+  
     <manifest:file-entry
      manifest:full-path="OptionPages.xcu"
      manifest:media-type="application/vnd.sun.star.configuration-data"/>
 
+    <manifest:file-entry
+     manifest:full-path="ToolbarOptionPages.xcu"
+     manifest:media-type="application/vnd.sun.star.configuration-data"/>
+
     <manifest:file-entry
      manifest:full-path="W2XDialogs/"
      manifest:media-type="application/vnd.sun.star.basic-library"/>
diff --git a/source/oxt/writer2xhtml/ToolbarOptionPages.xcu b/source/oxt/writer2xhtml/ToolbarOptionPages.xcu
new file mode 100644
index 0000000..7f478dd
--- /dev/null
+++ b/source/oxt/writer2xhtml/ToolbarOptionPages.xcu
@@ -0,0 +1,57 @@
+<?xml version='1.0' encoding='UTF-8'?>
+ 
+<oor:component-data oor:name="OptionsDialog" oor:package="org.openoffice.Office" 
+  xmlns:oor="http://openoffice.org/2001/registry" 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ 
+  <node oor:name="Modules">
+    <!-- This node should appear in the Writer module -->
+    <node oor:name="com.sun.star.text.TextDocument" oor:op="fuse">
+      <node oor:name="Nodes">
+        <node oor:name="org.openoffice.da.writer2xhtml.toolbar.configuration" 
+          oor:op="fuse">
+        </node>
+      </node>
+    </node>
+  </node>
+  
+  <node oor:name="Nodes">
+  
+	<!-- We define a single root node -->
+    <node oor:name="org.openoffice.da.writer2xhtml.toolbar.configuration" 
+      oor:op="fuse"> 
+      <prop oor:name="Id">
+        <value>org.openoffice.da.writer2xhtml.toolbar.configuration</value>
+      </prop>
+      <prop oor:name="Label">
+        <value xml:lang="en-US">Writer2xhtml toolbar</value>
+      </prop>
+      <prop oor:name="OptionsPage">
+        <value>%origin%/W2XDialogs2/ToolbarConfigurationRoot.xdl</value>
+      </prop>
+      <prop oor:name="EventHandlerService">
+        <value></value>
+      </prop>
+
+      <node oor:name="Leaves">
+      	<!-- and the root node has several leaves -->
+        <node oor:name="org.openoffice.da.writer2xhtml.toolbar.settings" 
+          oor:op="fuse">
+          <prop oor:name="Id">
+            <value>org.openoffice.da.writer2xhtml.toolbar.settings</value>
+          </prop>
+          <prop oor:name="Label">
+            <value xml:lang="en-US">Settings</value>
+          </prop>
+          <prop oor:name="OptionsPage">
+            <value>%origin%/W2XDialogs2/ToolbarSettings.xdl</value>
+          </prop>
+          <prop oor:name="EventHandlerService">
+            <value>org.openoffice.da.writer2xhtml.ToolbarSettingsDialog</value>
+          </prop>
+        </node>
+      </node>
+    </node>
+  </node>
+</oor:component-data>
\ No newline at end of file
diff --git a/source/oxt/writer2xhtml/ToolbarOptions.xcs b/source/oxt/writer2xhtml/ToolbarOptions.xcs
new file mode 100644
index 0000000..e77265b
--- /dev/null
+++ b/source/oxt/writer2xhtml/ToolbarOptions.xcs
@@ -0,0 +1,18 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<oor:component-schema oor:name="ToolbarOptions"
+  oor:package="org.openoffice.da.Writer2xhtml.toolbar"
+  xml:lang="en-US"
+  xmlns:oor="http://openoffice.org/2001/registry"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <component>
+        <group oor:name="Settings">
+            <prop oor:name="XhtmlFormat" oor:type="xs:short" />
+            <prop oor:name="XhtmlView" oor:type="xs:short" />
+            <prop oor:name="XhtmlExecutable" oor:type="xs:string" />
+            <prop oor:name="EpubFormat" oor:type="xs:short" />
+            <prop oor:name="EpubView" oor:type="xs:short" />
+            <prop oor:name="EpubExecutable" oor:type="xs:string" />
+        </group>
+    </component>
+</oor:component-schema>		
\ No newline at end of file
diff --git a/source/oxt/writer2xhtml/ToolbarOptions.xcu b/source/oxt/writer2xhtml/ToolbarOptions.xcu
new file mode 100644
index 0000000..1181c26
--- /dev/null
+++ b/source/oxt/writer2xhtml/ToolbarOptions.xcu
@@ -0,0 +1,27 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<oor:component-data oor:name="ToolbarOptions"
+  oor:package="org.openoffice.da.Writer2xhtml.toolbar"
+  xml:lang="en-US"
+  xmlns:oor="http://openoffice.org/2001/registry"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema">
+    <node oor:name="Settings">
+        <prop oor:name="XhtmlFormat" oor:type="xs:short">
+            <value>3</value><!-- HTML5 -->
+        </prop>
+        <prop oor:name="XhtmlView" oor:type="xs:short">
+            <value>1</value><!-- Default application -->
+        </prop>
+        <prop oor:name="XhtmlExecutable" oor:type="xs:string">
+            <value></value>
+        </prop>
+        <prop oor:name="EpubFormat" oor:type="xs:short">
+            <value>1</value><!-- EPUB3 -->
+        </prop>
+        <prop oor:name="EpubView" oor:type="xs:short">
+            <value>1</value><!-- Default application -->
+        </prop>
+        <prop oor:name="EpubExecutable" oor:type="xs:string">
+            <value></value>
+        </prop>
+    </node>
+</oor:component-data>
\ No newline at end of file
diff --git a/source/oxt/writer2xhtml/W2XDialogs2/ToolbarConfigurationRoot.xdl b/source/oxt/writer2xhtml/W2XDialogs2/ToolbarConfigurationRoot.xdl
new file mode 100644
index 0000000..1a80f27
--- /dev/null
+++ b/source/oxt/writer2xhtml/W2XDialogs2/ToolbarConfigurationRoot.xdl
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Configuration1" dlg:left="139" dlg:top="84" dlg:width="260" dlg:height="185" dlg:closeable="true" dlg:moveable="true" dlg:title="ConfigurationRoot" dlg:withtitlebar="false">
+ <dlg:styles>
+  <dlg:style dlg:style-id="0" dlg:border="none"/>
+  <dlg:style dlg:style-id="1" dlg:font-height="14"/>
+ </dlg:styles>
+ <dlg:bulletinboard>
+  <dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="0" dlg:left="6" dlg:top="32" dlg:width="248" dlg:height="2"/>
+  <dlg:img dlg:style-id="0" dlg:id="ImageControl1" dlg:tab-index="1" dlg:left="8" dlg:top="6" dlg:width="21" dlg:height="21" dlg:scale-image="false" dlg:src="../images/w2licon.png"/>
+  <dlg:text dlg:style-id="1" dlg:id="Label1" dlg:tab-index="2" dlg:left="34" dlg:top="10" dlg:width="193" dlg:height="16" dlg:value="Writer2xhtml Toolbar Configuration"/>
+  <dlg:text dlg:id="Label2" dlg:tab-index="3" dlg:left="34" dlg:top="43" dlg:width="194" dlg:height="78" dlg:value="This is where you configure the Writer2xhtml toolbar." dlg:multiline="true"/>
+  
+ </dlg:bulletinboard>
+</dlg:window>
\ No newline at end of file
diff --git a/source/oxt/writer2xhtml/W2XDialogs2/ToolbarSettings.xdl b/source/oxt/writer2xhtml/W2XDialogs2/ToolbarSettings.xdl
new file mode 100644
index 0000000..ecaebe7
--- /dev/null
+++ b/source/oxt/writer2xhtml/W2XDialogs2/ToolbarSettings.xdl
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Configuration" dlg:left="139" dlg:top="84" dlg:width="260" dlg:height="185" dlg:closeable="true" dlg:moveable="true" dlg:title="Writer2xhtml Toolbar Configuration" dlg:withtitlebar="false" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:SettingsDialog">
+ <dlg:bulletinboard>
+  <dlg:text dlg:id="XhtmlLabel" dlg:tab-index="0" dlg:left="6" dlg:top="4" dlg:width="210" dlg:height="12" dlg:value="XHTML Export"/>
+  <dlg:text dlg:id="XhtmlFormatLabel" dlg:tab-index="1" dlg:left="12" dlg:top="18" dlg:width="55" dlg:height="12" dlg:value="Format"/>
+  <dlg:menulist dlg:id="XhtmlFormat" dlg:tab-index="2" dlg:left="72" dlg:top="16" dlg:width="120" dlg:height="12" dlg:spin="true" dlg:linecount="4" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:SettingsXhtmlFormat">
+   <dlg:menupopup>
+    <dlg:menuitem dlg:value="XHTML 1.0 strict"/>
+    <dlg:menuitem dlg:value="XHTML 1.1"/>
+    <dlg:menuitem dlg:value="XHTML 1.1 + MathML 2.0"/>
+    <dlg:menuitem dlg:value="HTML5" dlg:selected="true"/>
+   </dlg:menupopup>
+   <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:XhtmlFormatChange" script:language="UNO"/>
+  </dlg:menulist>
+  <dlg:text dlg:id="XhtmlViewLabel" dlg:tab-index="3" dlg:left="12" dlg:top="32" dlg:width="55" dlg:height="12" dlg:value="After export"/>
+  <dlg:menulist dlg:id="XhtmlView" dlg:tab-index="4" dlg:left="72" dlg:top="30" dlg:width="120" dlg:height="12" dlg:spin="true" dlg:linecount="3" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:SettingsXhtmlView">
+   <dlg:menupopup>
+    <dlg:menuitem dlg:value="Do nothing"/>
+    <dlg:menuitem dlg:value="open with default web browser" dlg:selected="true"/>
+    <dlg:menuitem dlg:value="open with custom application"/>
+   </dlg:menupopup>
+   <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:XhtmlViewChange" script:language="UNO"/>
+  </dlg:menulist>
+  
+  <dlg:text dlg:id="XhtmlExecutableLabel" dlg:tab-index="5" dlg:left="12" dlg:top="44" dlg:width="55" dlg:height="12" dlg:value="Application"/>
+  <dlg:textfield dlg:id="XhtmlExecutable" dlg:tab-index="6" dlg:left="72" dlg:top="44" dlg:width="120" dlg:height="12" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:SettingsXhtmlExecutable"/>
+  <dlg:button dlg:id="XhtmlBrowseButton" dlg:tab-index="7" dlg:left="200" dlg:top="43" dlg:width="55" dlg:height="14" dlg:value="Browse..." dlg:help-url="org.openoffice.da.writer2xhtml.oxt:SettingsXhtmlBrowse">
+   <script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:XhtmlBrowseClick" script:language="UNO"/>
+  </dlg:button>
+  
+  <dlg:text dlg:id="EpubLabel" dlg:tab-index="8" dlg:left="6" dlg:top="58" dlg:width="210" dlg:height="12" dlg:value="EPUB Export"/>
+  <dlg:text dlg:id="EpubFormatLabel" dlg:tab-index="9" dlg:left="12" dlg:top="72" dlg:width="55" dlg:height="12" dlg:value="Format"/>
+  <dlg:menulist dlg:id="EpubFormat" dlg:tab-index="10" dlg:left="72" dlg:top="70" dlg:width="120" dlg:height="12" dlg:spin="true" dlg:linecount="2" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:SettingsEpubFormat">
+   <dlg:menupopup>
+    <dlg:menuitem dlg:value="EPUB 2"/>
+    <dlg:menuitem dlg:value="EPUB 3" dlg:selected="true"/>
+   </dlg:menupopup>
+   <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:EpubFormatChange" script:language="UNO"/>
+  </dlg:menulist>
+  <dlg:text dlg:id="EpubViewLabel" dlg:tab-index="11" dlg:left="12" dlg:top="86" dlg:width="55" dlg:height="12" dlg:value="After export"/>
+  <dlg:menulist dlg:id="EpubView" dlg:tab-index="12" dlg:left="72" dlg:top="84" dlg:width="120" dlg:height="12" dlg:spin="true" dlg:linecount="3" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:SettingsEpubView">
+   <dlg:menupopup>
+    <dlg:menuitem dlg:value="Do nothing"/>
+    <dlg:menuitem dlg:value="open with default viewer" dlg:selected="true"/>
+    <dlg:menuitem dlg:value="open with custom application"/>
+   </dlg:menupopup>
+   <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:EpubViewChange" script:language="UNO"/>
+  </dlg:menulist>
+  
+  <dlg:text dlg:id="EpubExecutableLabel" dlg:tab-index="13" dlg:left="12" dlg:top="98" dlg:width="55" dlg:height="12" dlg:value="Application"/>
+  <dlg:textfield dlg:id="EpubExecutable" dlg:tab-index="14" dlg:left="72" dlg:top="98" dlg:width="120" dlg:height="12" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:SettingsEpubExecutable"/>
+  <dlg:button dlg:id="EpubBrowseButton" dlg:tab-index="15" dlg:left="200" dlg:top="97" dlg:width="55" dlg:height="14" dlg:value="Browse..." dlg:help-url="org.openoffice.da.writer2xhtml.oxt:SettingsEpubBrowse">
+   <script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:EpubBrowseClick" script:language="UNO"/>
+  </dlg:button>
+    
+ </dlg:bulletinboard>
+</dlg:window>
\ No newline at end of file
diff --git a/source/oxt/writer2xhtml/W2XDialogs2/dialog.xlb b/source/oxt/writer2xhtml/W2XDialogs2/dialog.xlb
index 41ea3e1..98aeee4 100644
--- a/source/oxt/writer2xhtml/W2XDialogs2/dialog.xlb
+++ b/source/oxt/writer2xhtml/W2XDialogs2/dialog.xlb
@@ -16,4 +16,6 @@
  <library:element library:name="EpubMetadata"/>
  <library:element library:name="AuthorDialog"/>
  <library:element library:name="DateDialog"/>
+ <library:element library:name="ToolbarConfigurationRoot"/>
+ <library:element library:name="ToolbarSettings"/>
 </library:library>
\ No newline at end of file
diff --git a/source/oxt/writer2xhtml/help/en/help.tree b/source/oxt/writer2xhtml/help/en/help.tree
index 4568379..9c06320 100644
--- a/source/oxt/writer2xhtml/help/en/help.tree
+++ b/source/oxt/writer2xhtml/help/en/help.tree
@@ -7,15 +7,18 @@
       <topic id="writer2xhtml/org.openoffice.da.writer2xhtml.oxt/export_calc.xhp">XHTML Export (Calc)</topic>
       <topic id="writer2xhtml/org.openoffice.da.writer2xhtml.oxt/epub_export.xhp">EPUB Export (Writer)</topic>
       <topic id="writer2xhtml/org.openoffice.da.writer2xhtml.oxt/epub_metadata.xhp">EPUB document properties (Writer)</topic>
-      <node id="w2l0x_configuration" title="Custom style">
-      	<topic id="writer2latex/org.openoffice.da.writer2xhtml.oxt/Configuration/Introduction.xhp">Introduction</topic>
-      	<topic id="writer2latex/org.openoffice.da.writer2xhtml.oxt/Configuration/General.xhp">General</topic>
-      	<topic id="writer2latex/org.openoffice.da.writer2xhtml.oxt/Configuration/Template.xhp">Template</topic>
-      	<topic id="writer2latex/org.openoffice.da.writer2xhtml.oxt/Configuration/Stylesheets.xhp">Style sheets</topic>
-      	<topic id="writer2latex/org.openoffice.da.writer2xhtml.oxt/Configuration/Masterstyles.xhp">Master styles</topic>
-      	<topic id="writer2latex/org.openoffice.da.writer2xhtml.oxt/Configuration/Otherstyles.xhp">Other styles</topic>
-      	<topic id="writer2latex/org.openoffice.da.writer2xhtml.oxt/Configuration/Formatting.xhp">Formatting</topic>
-      	<topic id="writer2latex/org.openoffice.da.writer2xhtml.oxt/Configuration/Content.xhp">Content</topic>
+      <node id="w2x01_toolbar_configuration" title="Toolbar configuration">
+	      <topic id="writer2xhtml/org.openoffice.da.writer2xhtml.oxt/settings.xhp">Settings</topic>
+      </node>      
+      <node id="w2x01_configuration" title="Custom style">
+      	<topic id="writer2xhtml/org.openoffice.da.writer2xhtml.oxt/Configuration/Introduction.xhp">Introduction</topic>
+      	<topic id="writer2xhtml/org.openoffice.da.writer2xhtml.oxt/Configuration/General.xhp">General</topic>
+      	<topic id="writer2xhtml/org.openoffice.da.writer2xhtml.oxt/Configuration/Template.xhp">Template</topic>
+      	<topic id="writer2xhtml/org.openoffice.da.writer2xhtml.oxt/Configuration/Stylesheets.xhp">Style sheets</topic>
+      	<topic id="writer2xhtml/org.openoffice.da.writer2xhtml.oxt/Configuration/Masterstyles.xhp">Master styles</topic>
+      	<topic id="writer2xhtml/org.openoffice.da.writer2xhtml.oxt/Configuration/Otherstyles.xhp">Other styles</topic>
+      	<topic id="writer2xhtml/org.openoffice.da.writer2xhtml.oxt/Configuration/Formatting.xhp">Formatting</topic>
+      	<topic id="writer2xhtml/org.openoffice.da.writer2xhtml.oxt/Configuration/Content.xhp">Content</topic>
       </node>      
   </help_section>
 </tree_view>
diff --git a/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/menu.xhp b/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/menu.xhp
index 5758aa3..ae985cd 100644
--- a/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/menu.xhp
+++ b/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/menu.xhp
@@ -36,6 +36,10 @@
 		        <paragraph role="paragraph" xml-lang="en-US"><link href="org.openoffice.da.writer2xhtml.oxt/epub_export.xhp"
           name="Export XHTML or EPUB files">EPUB [Writer2xhtml]</link></paragraph>
 			</listitem>
+			<listitem>
+		        <paragraph role="paragraph" xml-lang="en-US"><link href="org.openoffice.da.writer2xhtml.oxt/epub_export.xhp"
+          name="Export XHTML or EPUB files">EPUB 3 [Writer2xhtml]</link></paragraph>
+			</listitem>
 		</list>
         
         <paragraph role="paragraph" xml-lang="en-US">It further adds a number of entries to the <emph>File - Export</emph> 
@@ -58,7 +62,8 @@
         <paragraph role="heading" level="2" xml-lang="en-US">Using the Writer2xhtml toolbar</paragraph>
 
         <paragraph role="paragraph" xml-lang="en-US">Writer2xhtml adds a toolbar in Writer and Calc,
-        providing the following commands.</paragraph>
+        providing the following commands. You can <link href="org.openoffice.da.writer2xhtml.oxt/settings.xhp"
+          name="Writer2xhtml toolbar settings">configure</link> the behavior of the toolbar.</paragraph>
 
         <paragraph role="heading" level="3" xml-lang="en-US"><link href="org.openoffice.da.writer2xhtml.oxt/export.xhp"
           name="Export XHTML files">Publish to XHTML</link></paragraph>
diff --git a/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/settings.xhp b/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/settings.xhp
new file mode 100644
index 0000000..943a68a
--- /dev/null
+++ b/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/settings.xhp
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<helpdocument version="1.0">
+	<meta>
+        <topic id="writer2xhtml-settings" indexer="include">
+            <title xml-lang="en-US">Toolbar Settings</title>
+            <filename>org.openoffice.da.writer2xhtml.oxt/settings.xhp</filename>
+        </topic>
+    </meta>
+    <body>
+		<bookmark xml-lang="en-US" branch="hid/org.openoffice.da.writer2xhtml.oxt:SettingsDialog" id="bm_settingsdialog"/>
+        <paragraph role="heading" level="1" xml-lang="en-US">Writer2xhtml Toolbar Settings</paragraph>
+        
+        <section id="howtoget" xml-lang="en-US">
+        	Select <emph>Tools - Options - Writer2xhtml toolbar - Settings</emph>
+        </section>
+    
+        <paragraph role="heading" level="2" xml-lang="en-US">XHTML Export</paragraph>
+        <paragraph role="paragraph" xml-lang="en-US">Use these settings to configure the behavior of the XHTML export button in the toolbar.</paragraph>
+
+		<bookmark xml-lang="en-US" branch="hid/org.openoffice.da.writer2xhtml.oxt:SettingsXhtmlFormat" id="bm_settingsxhtmlformat"/>
+		<paragraph role="paragraph" xml-lang="en-US"><ahelp hid="org.openoffice.da.writer2latex.oxt:SettingsXhtmlFormat" visibility="hidden">Select the XHTML format to use when clicking the XHTML export button in the toolbar</ahelp></paragraph>
+        <paragraph role="heading" level="3" xml-lang="en-US">Format</paragraph>
+        <paragraph role="paragraph" xml-lang="en-US">Select an XHTML format in the list. This format will be used when you click the XHTML
+        export button in the toolbar. The default format is HTML5.</paragraph>
+		
+		<bookmark xml-lang="en-US" branch="hid/org.openoffice.da.writer2xhtml.oxt:SettingsXhtmlView" id="bm_settingsxhtmlview"/>
+		<paragraph role="paragraph" xml-lang="en-US"><ahelp hid="org.openoffice.da.writer2latex.oxt:SettingsXhtmlView" visibility="hidden">Choose the desired behavior after export</ahelp></paragraph>
+        <paragraph role="heading" level="3" xml-lang="en-US">After export</paragraph>
+        <paragraph role="paragraph" xml-lang="en-US">After export, Writer2xhtml can display the result in a web browser.
+        Choose the desired behavior in the list.</paragraph>
+        <list type="unordered">
+			<listitem>
+				<paragraph role="paragraph" xml-lang="en-US"><emph>Do nothing</emph> if you do not want to view the result after export</paragraph>
+			</listitem>
+			<listitem>
+				<paragraph role="paragraph" xml-lang="en-US"><emph>Open with default web browser</emph> if you view the result using your 
+				system's default web browser
+				</paragraph>
+			</listitem>
+			<listitem>
+				<paragraph role="paragraph" xml-lang="en-US"><emph>Open with custom application</emph> if you want to view the result using an application
+				of your choice.</paragraph>
+			</listitem>
+        </list>
+		
+		<bookmark xml-lang="en-US" branch="hid/org.openoffice.da.writer2xhtml.oxt:SettingsXhtmlExecutable" id="bm_settingsxhtmlexecutable"/>
+		<paragraph role="paragraph" xml-lang="en-US"><ahelp hid="org.openoffice.da.writer2latex.oxt:SettingsXhtmlExecutable" visibility="hidden">Enter the full path to the application you wish to use</ahelp></paragraph>
+        <paragraph role="heading" level="3" xml-lang="en-US">Application</paragraph>
+        <paragraph role="paragraph" xml-lang="en-US">Enter the full path to the application you wish to use.</paragraph>
+		
+		<bookmark xml-lang="en-US" branch="hid/org.openoffice.da.writer2xhtml.oxt:SettingsXhtmlBrowse" id="bm_settingsxhtmlbrowse"/>
+		<paragraph role="paragraph" xml-lang="en-US"><ahelp hid="org.openoffice.da.writer2latex.oxt:SettingsXhtmlBrowse" visibility="hidden">Browse for the application</ahelp></paragraph>
+        <paragraph role="heading" level="3" xml-lang="en-US">Browse...</paragraph>
+        <paragraph role="paragraph" xml-lang="en-US">Click this to open a file dialog, where you can browse for the application.</paragraph>
+		
+        <paragraph role="heading" level="2" xml-lang="en-US">EPUB Export</paragraph>
+        <paragraph role="paragraph" xml-lang="en-US">Use these settings to configure the behavior of the EPUB export button in the toolbar.</paragraph>
+
+		<bookmark xml-lang="en-US" branch="hid/org.openoffice.da.writer2xhtml.oxt:SettingsEpubFormat" id="bm_settingsepubformat"/>
+		<paragraph role="paragraph" xml-lang="en-US"><ahelp hid="org.openoffice.da.writer2latex.oxt:SettingsEpubFormat" visibility="hidden">Select the EPUB format to use when clicking the EPUB export button in the toolbar</ahelp></paragraph>
+        <paragraph role="heading" level="3" xml-lang="en-US">Format</paragraph>
+        <paragraph role="paragraph" xml-lang="en-US">Select an EPUB format in the list. This format will be used when you click the EPUB
+        export button in the toolbar. The default format is EPUB 3.</paragraph>
+
+		<bookmark xml-lang="en-US" branch="hid/org.openoffice.da.writer2xhtml.oxt:SettingsEpubView" id="bm_settingsepubview"/>
+		<paragraph role="paragraph" xml-lang="en-US"><ahelp hid="org.openoffice.da.writer2latex.oxt:SettingsEpubView" visibility="hidden">Choose the desired behavior after export</ahelp></paragraph>
+        <paragraph role="heading" level="3" xml-lang="en-US">After export</paragraph>
+        <paragraph role="paragraph" xml-lang="en-US">After export, Writer2xhtml can display the result in an EPUB reader.
+        Choose the desired behavior in the list.</paragraph>
+        <list type="unordered">
+			<listitem>
+				<paragraph role="paragraph" xml-lang="en-US"><emph>Do nothing</emph> if you do not want to view the result after export</paragraph>
+			</listitem>
+			<listitem>
+				<paragraph role="paragraph" xml-lang="en-US"><emph>Open with default web browser</emph> if you view the result using your 
+				system's default EPUB reader.
+				</paragraph>
+			</listitem>
+			<listitem>
+				<paragraph role="paragraph" xml-lang="en-US"><emph>Open with custom application</emph> if you want to view the result using an application
+				of your choice.</paragraph>
+			</listitem>
+        </list>
+
+		<bookmark xml-lang="en-US" branch="hid/org.openoffice.da.writer2xhtml.oxt:SettingsEpubExecutable" id="bm_settingsepubexecutable"/>
+		<paragraph role="paragraph" xml-lang="en-US"><ahelp hid="org.openoffice.da.writer2latex.oxt:SettingsEpubExecutable" visibility="hidden">Enter the full path to the application you wish to use</ahelp></paragraph>
+        <paragraph role="heading" level="3" xml-lang="en-US">Application</paragraph>
+        <paragraph role="paragraph" xml-lang="en-US">Enter the full path to the application you wish to use.</paragraph>
+		
+		<bookmark xml-lang="en-US" branch="hid/org.openoffice.da.writer2xhtml.oxt:SettingsEpubBrowse" id="bm_settingsepubbrowse"/>
+		<paragraph role="paragraph" xml-lang="en-US"><ahelp hid="org.openoffice.da.writer2latex.oxt:SettingsEpubBrowse" visibility="hidden">Browse for the application</ahelp></paragraph>
+        <paragraph role="heading" level="3" xml-lang="en-US">Browse...</paragraph>
+        <paragraph role="paragraph" xml-lang="en-US">Click this to open a file dialog, where you can browse for the application.</paragraph>
+    </body>
+</helpdocument>
\ No newline at end of file