From a9e146d26d42f1af36e16b95bb32acc781bc7d5a Mon Sep 17 00:00:00 2001 From: henrikjust Date: Sun, 9 Nov 2014 12:33:12 +0000 Subject: [PATCH] w2x: Make toolbar visible in Calc and update help files git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@213 f0f2a975-2e09-46c8-9428-3b39399b9f3c --- source/distro/changelog.txt | 1 + .../comp/w2lcommon/filter/UNOPublisher.java | 82 +++++++++------- .../writer2latex/api/ConverterFactory.java | 4 +- .../menu.xhp | 9 +- source/oxt/writer2xhtml/Addons.xcu | 4 +- source/oxt/writer2xhtml/META-INF/manifest.xml | 4 + .../Office/UI/CalcWindowState.xcu | 15 +++ source/oxt/writer2xhtml/help/en/help.tree | 3 +- .../export_calc.xhp | 2 +- .../introduction.xhp | 32 ++++++ .../menu.xhp | 98 +++++++++++++++++++ 11 files changed, 208 insertions(+), 46 deletions(-) create mode 100644 source/oxt/writer2xhtml/Office/UI/CalcWindowState.xcu create mode 100644 source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/introduction.xhp create mode 100644 source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/menu.xhp diff --git a/source/distro/changelog.txt b/source/distro/changelog.txt index efa2ed3..3488249 100644 --- a/source/distro/changelog.txt +++ b/source/distro/changelog.txt @@ -20,6 +20,7 @@ Changelog for Writer2LaTeX version 1.4 -> 1.6 [w2x] Added toolbar with four buttons: Publish directly to XHTML, publish directly to EPUB, edit EPUB metadata and edit custom configuration. Publishing directly implies that the file picker is not displayed. Instead the document will be exported to the same directory as the currently open document and with the same name. + The EPUB buttons are only visible in Writer, the other buttons are also visible in Calc. This feature bypasses the filter logic, which gives a significant performance gain for large documents. [all] Filter: Refactored filter code, the actual conversion has been separated from the XExportFilter implementation \ No newline at end of file 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 17ccfa4..a9c0412 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 (2014-11-03) + * Version 1.6 (2014-11-08) * */ package org.openoffice.da.comp.w2lcommon.filter; @@ -176,7 +176,7 @@ public class UNOPublisher { msgBox.showMessage(sAppName,"Please save the document before publishing the file"); return false; } - else if (!".odt".equals(Misc.getFileExtension(sDocumentUrl)) && !".fodt".equals(Misc.getFileExtension(sDocumentUrl))) { + else if (!".odt".equals(Misc.getFileExtension(sDocumentUrl)) && !".fodt".equals(Misc.getFileExtension(sDocumentUrl)) && !".ods".equals(Misc.getFileExtension(sDocumentUrl)) && !".fods".equals(Misc.getFileExtension(sDocumentUrl))) { MessageBox msgBox = new MessageBox(xContext, xFrame); msgBox.showMessage(sAppName,"Please save the document in OpenDocument format (.odt)"); return false; @@ -256,37 +256,35 @@ public class UNOPublisher { private boolean updateMediaProperties(TargetFormat format) { prepareMediaProperties(format); - try { - // Display options dialog - Object dialog = xContext.getServiceManager() - .createInstanceWithContext(getDialogName(format), xContext); - - XPropertyAccess xPropertyAccess = (XPropertyAccess) - UnoRuntime.queryInterface(XPropertyAccess.class, dialog); - xPropertyAccess.setPropertyValues(mediaProps); - - XExecutableDialog xDialog = (XExecutableDialog) - UnoRuntime.queryInterface(XExecutableDialog.class, dialog); - if (xDialog.execute()==ExecutableDialogResults.OK) { - mediaProps = postProcessMediaProps(xPropertyAccess.getPropertyValues()); - - return true; - } - else { - mediaProps = null; - return false; - } - } - catch (com.sun.star.beans.UnknownPropertyException e) { - // setPropertyValues will not fail.. - mediaProps = null; - return false; - } - catch (com.sun.star.uno.Exception e) { - // getServiceManager will not fail.. - mediaProps = null; - return false; - } + String sDialogName = xModel.getURL().endsWith(".odt") || xModel.getURL().endsWith(".fodt") ? + getDialogName(format) : getDialogNameCalc(format); + if (sDialogName!=null) { + try { + // Display options dialog + Object dialog = xContext.getServiceManager() + .createInstanceWithContext(sDialogName, xContext); + + XPropertyAccess xPropertyAccess = (XPropertyAccess) + UnoRuntime.queryInterface(XPropertyAccess.class, dialog); + xPropertyAccess.setPropertyValues(mediaProps); + + XExecutableDialog xDialog = (XExecutableDialog) + UnoRuntime.queryInterface(XExecutableDialog.class, dialog); + if (xDialog.execute()==ExecutableDialogResults.OK) { + mediaProps = postProcessMediaProps(xPropertyAccess.getPropertyValues()); + return true; + } + } + catch (com.sun.star.beans.UnknownPropertyException e) { + // setPropertyValues will not fail.. + } + catch (com.sun.star.uno.Exception e) { + // getServiceManager will not fail.. + } + } + // No dialog exists, or the dialog was cancelled + mediaProps = null; + return false; } private static String getTargetExtension(TargetFormat format) { @@ -303,15 +301,27 @@ public class UNOPublisher { private static String getDialogName(TargetFormat format) { switch (format) { - case xhtml: return "org.openoffice.da.comp.writer2xhtml.XhtmlOptionsDialog"; + case xhtml: case xhtml11: return "org.openoffice.da.comp.writer2xhtml.XhtmlOptionsDialog"; - case xhtml_mathml: return "org.openoffice.da.comp.writer2xhtml.XhtmlOptionsDialogMath"; + case xhtml_mathml: case html5: return "org.openoffice.da.comp.writer2xhtml.XhtmlOptionsDialogMath"; case epub: return "org.openoffice.da.comp.writer2xhtml.EpubOptionsDialog"; case latex: return "org.openoffice.da.comp.writer2latex.LaTeXOptionsDialog"; - default: return ""; + default: return null; } } + + private static String getDialogNameCalc(TargetFormat format) { + switch (format) { + case xhtml: + case xhtml11: + case xhtml_mathml: + case html5: return "org.openoffice.da.comp.writer2xhtml.XhtmlOptionsDialogCalc"; + case epub: + case latex: + default: return null; + } + } private static String getFilterName(TargetFormat format) { switch (format) { diff --git a/source/java/writer2latex/api/ConverterFactory.java b/source/java/writer2latex/api/ConverterFactory.java index 3505f38..b8dc1cb 100644 --- a/source/java/writer2latex/api/ConverterFactory.java +++ b/source/java/writer2latex/api/ConverterFactory.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.6 (2014-11-06) + * Version 1.6 (2014-11-08) * */ @@ -33,7 +33,7 @@ public class ConverterFactory { // Version information private static final String VERSION = "1.5.1"; - private static final String DATE = "2014-11-06"; + private static final String DATE = "2014-11-08"; /** Return the Writer2LaTeX version in the form * (major version).(minor version).(patch level)
diff --git a/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/menu.xhp b/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/menu.xhp index 8f1a1b8..bb6ac68 100644 --- a/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/menu.xhp +++ b/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/menu.xhp @@ -2,7 +2,7 @@ - The LaTeX menu + Menu and toolbar org.openoffice.da.writer2latex.oxt/menu.xhp @@ -14,7 +14,7 @@ File - Export - Writer2xhtml adds two entries to the File - Export + Writer2LaTeX adds two entries to the File - Export menu in Writer @@ -29,7 +29,8 @@ Using the Writer2LaTeX toolbar - The Writer2LaTeX toolbar office the following commands. + Writer2LaTeX adds a toolbar in Writer, + providing the following commands. Insert BibTeX reference @@ -57,7 +58,7 @@ LaTeX, MakeIndex and BibTeX here View log files created by LaTeX, MakeIndex and BibTeX - Edit custom format diff --git a/source/oxt/writer2xhtml/Addons.xcu b/source/oxt/writer2xhtml/Addons.xcu index 169d50e..407e558 100644 --- a/source/oxt/writer2xhtml/Addons.xcu +++ b/source/oxt/writer2xhtml/Addons.xcu @@ -6,7 +6,7 @@ - com.sun.star.text.TextDocument + com.sun.star.text.TextDocument,com.sun.star.sheet.SpreadsheetDocument Publish as XHTML @@ -60,7 +60,7 @@ - com.sun.star.text.TextDocument + com.sun.star.text.TextDocument,com.sun.star.sheet.SpreadsheetDocument Edit custom style diff --git a/source/oxt/writer2xhtml/META-INF/manifest.xml b/source/oxt/writer2xhtml/META-INF/manifest.xml index dcbb695..2d1b667 100644 --- a/source/oxt/writer2xhtml/META-INF/manifest.xml +++ b/source/oxt/writer2xhtml/META-INF/manifest.xml @@ -17,6 +17,10 @@ manifest:full-path="Office/UI/WriterWindowState.xcu" manifest:media-type="application/vnd.sun.star.configuration-data"/> + + diff --git a/source/oxt/writer2xhtml/Office/UI/CalcWindowState.xcu b/source/oxt/writer2xhtml/Office/UI/CalcWindowState.xcu new file mode 100644 index 0000000..4162b1a --- /dev/null +++ b/source/oxt/writer2xhtml/Office/UI/CalcWindowState.xcu @@ -0,0 +1,15 @@ + + + + + + + Writer2xhtml + + + + + \ 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 228f456..4568379 100644 --- a/source/oxt/writer2xhtml/help/en/help.tree +++ b/source/oxt/writer2xhtml/help/en/help.tree @@ -1,7 +1,8 @@ - + Introduction + Menu and toolbar XHTML Export (Writer) XHTML Export (Calc) EPUB Export (Writer) diff --git a/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/export_calc.xhp b/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/export_calc.xhp index 45ebf09..6b9dd8f 100644 --- a/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/export_calc.xhp +++ b/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/export_calc.xhp @@ -12,7 +12,7 @@ Exports the current document to XHTML format.
Choose File - Export - XHTML 1.0 strict
- or File - Export - XHTML 1.1 + or File - Export - XHTML 1.1
or File - Export - HTML5
diff --git a/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/introduction.xhp b/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/introduction.xhp new file mode 100644 index 0000000..58a89ff --- /dev/null +++ b/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/introduction.xhp @@ -0,0 +1,32 @@ + + + + + Introduction + org.openoffice.da.writer2xhtml.oxt/introduction.xhp + + + + Introduction to Writer2xhtml + + The Writer2xhtml is a tool for publishing web content + and electronic books from %PRODUCTNAME Writer. + Using Writer2xhtml you will be able to author well-structured XHTML and EPUB documents using (almost) + the full power of %PRODUCTNAME Writer. + Writer2xhtml has two modes of operation + + + You can use Writer2xhtml as an export filter. + It adds XHTML and EPUB formats to the File - Export + menu. + + + + You can publish directly to XHTML or EPUB + and view the result using the provided + toolbar. + + + + + \ No newline at end of file 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 new file mode 100644 index 0000000..5758aa3 --- /dev/null +++ b/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/menu.xhp @@ -0,0 +1,98 @@ + + + + + Menu and toolbar + org.openoffice.da.writer2xhtml.oxt/menu.xhp + + + + Menu and toolbar + + Using Writer2xhtml as an export filter + + File - Export + + Writer2xhtml adds a number of entries to the File - Export + menu in Writer + + + XHTML 1.0 strict [Writer2xhtml] + + + XHTML 1.1 [Writer2xhtml] + + + XHTML 1.1 + MathML 2.0 [Writer2xhtml] + + + HTML5 [Writer2xhtml] + + + EPUB [Writer2xhtml] + + + + It further adds a number of entries to the File - Export + menu in Calc + + + XHTML 1.0 strict [Writer2xhtml] + + + XHTML 1.1 [Writer2xhtml] + + + HTML5 [Writer2xhtml] + + + + Using the Writer2xhtml toolbar + + Writer2xhtml adds a toolbar in Writer and Calc, + providing the following commands. + + Publish to XHTML + + + Convert the document to a web page in XHTML format + and display the result in the default browser. + + Publish the current document as an XHTML file + + Publish to EPUB (Writer only) + + + Convert the document to and electronic book in EPUB format + and display the result in the default EPUB viewer. + + + Publish the current document as an EPUB file + + Edit EPUB document properties (Writer only) + + + Electronic books in EPUB format supports a complex set of + document properties. This function brings up a dialog to edit the properties. + + Edit the EPUB document properties of the current document + + Edit custom style + + + Edit the custom export style. This style is used if you select + Custom as style in the export dialog. + + \ No newline at end of file