diff --git a/source/distro/changelog.txt b/source/distro/changelog.txt
index d63bbb6..b28baa4 100644
--- a/source/distro/changelog.txt
+++ b/source/distro/changelog.txt
@@ -2,6 +2,9 @@ Changelog for Writer2LaTeX version 1.4 -> 1.6
---------- version 1.5.1 ----------
+[w2x] Bugfix: The date field in the EPUB Metadata dialog did not work in LO 4.1 and newer. This was due to and API
+ change in LO (long replaced by com.sun.star.util.Date), and is now fixed.
+
[all] Implementation detail: Replaced Robert Harder's base 64 class with javax.xml.bind.DatatypeConverter
[w2x] Style maps for paragraphs and headings now support the attributes before and after. These define fixed texts
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 dfcae5a..0dc2a51 100644
--- a/source/java/org/openoffice/da/comp/w2lcommon/helper/DialogAccess.java
+++ b/source/java/org/openoffice/da/comp/w2lcommon/helper/DialogAccess.java
@@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
- * Copyright: 2002-2011 by Henrik Just
+ * Copyright: 2002-2014 by Henrik Just
*
* All Rights Reserved.
*
- * Version 1.2 (2011-03-03)
+ * Version 1.6 (2014-10-27)
*
*/
@@ -32,6 +32,7 @@ import com.sun.star.awt.XControlModel;
import com.sun.star.awt.XDialog;
import com.sun.star.beans.XPropertySet;
import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.Date;
/** This class provides some convenient methods to access a uno dialog
@@ -279,7 +280,20 @@ public class DialogAccess {
public int getDateFieldValue(String sControlName) {
XPropertySet xPropertySet = getControlProperties(sControlName);
try {
- return ((Integer) xPropertySet.getPropertyValue("Date")).intValue();
+ Object dateObject = xPropertySet.getPropertyValue("Date");
+ if (dateObject instanceof Date) {
+ // Since LO 4.1
+ Date date = (Date) dateObject;
+ return 10000*date.Year+100*date.Month+date.Day;
+ }
+ else if (dateObject instanceof Integer) {
+ // AOO and older versions of LO
+ return ((Integer) dateObject).intValue();
+ }
+ else {
+ // The date field does not have a value
+ return 0;
+ }
}
catch (Exception e) {
// Will fail if the control does not exist or is not a date field
@@ -289,12 +303,22 @@ public class DialogAccess {
public void setDateFieldValue(String sControlName, int nValue) {
XPropertySet xPropertySet = getControlProperties(sControlName);
- try {
- xPropertySet.setPropertyValue("Date", nValue);
- }
- catch (Exception e) {
- // Will fail if the control does not exist or is not a date field
- }
+ Date date = new Date();
+ date.Year = (short) (nValue/10000);
+ date.Month = (short) ((nValue%10000)/100);
+ date.Day = (short) (nValue%100);
+
+ // TODO: Use reflection to identify the correct type of the property
+ try {
+ // Since LO 4.1
+ xPropertySet.setPropertyValue("Date", date);
+ } catch (Exception e) {
+ // AOO and older versions of LO
+ try {
+ xPropertySet.setPropertyValue("Date", nValue);
+ } catch (Exception e1) {
+ }
+ }
}
public int getNumericFieldValue(String sControlName) {
diff --git a/source/oxt/writer2xhtml/AddonsAOO4.xcu b/source/oxt/writer2xhtml/AddonsAOO4.xcu
new file mode 100644
index 0000000..8b81418
--- /dev/null
+++ b/source/oxt/writer2xhtml/AddonsAOO4.xcu
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+ Writer2xhtml
+
+
+
+
+ com.sun.star.text.TextDocument
+
+
+ Publish as XHTML
+ Publicer som XHTML
+
+
+ _self
+
+
+ org.openoffice.da.writer2xhtml:PublishAsXHTML
+
+
+ %origin%/icons/html5
+
+
+
+
+ com.sun.star.text.TextDocument
+
+
+ Publish as EPUB
+ Publicer som EPUB
+
+
+ _self
+
+
+ org.openoffice.da.writer2xhtml:PublishAsEPUB
+
+
+ %origin%/icons/epub
+
+
+
+
+ com.sun.star.text.TextDocument
+
+
+ Edit EPUB document properties
+ Rediger EPUB-dokumentegenskaber
+
+
+ _self
+
+
+ org.openoffice.da.writer2xhtml:EditEPUBDocumentProperties
+
+
+ %origin%/icons/metadata
+
+
+
+
+ com.sun.star.text.TextDocument
+
+
+ Edit custom style
+ Rediger brugerdefineret typografi
+
+
+ _self
+
+
+ .uno:OptionsTreeDialog?OptionsPageURL:string=%origin%/W2XDialogs2/General.xdl
+
+
+ %origin%/icons/customh
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source/oxt/writer2xhtml/META-INF/manifest.xml b/source/oxt/writer2xhtml/META-INF/manifest.xml
index 7bd4478..dcbb695 100644
--- a/source/oxt/writer2xhtml/META-INF/manifest.xml
+++ b/source/oxt/writer2xhtml/META-INF/manifest.xml
@@ -9,6 +9,10 @@
manifest:full-path="Addons.xcu"
manifest:media-type="application/vnd.sun.star.configuration-data"/>
+
+