diff --git a/source/distro/changelog.txt b/source/distro/changelog.txt index 155ee40..b096c6f 100644 --- a/source/distro/changelog.txt +++ b/source/distro/changelog.txt @@ -4,8 +4,6 @@ Changelog for Writer2LaTeX version 1.0 -> 1.2 [w2x] Standard meta data as well as custom meta data can now be edited directly from the EPUB export dialog -[w2x] New option use_custom_metadata (default true) making the inclusion of custom meta data in EPUB export optional - [w2x] Revised the internal structure of EPUB files: Text files are named chapter.xhtml, images are placed in the subdirectory images and name image, styles are placed in the subdirectory styles and names styles.css (custom style sheet) and styles1.css (generated style sheet) diff --git a/source/distro/doc/user-manual.odt b/source/distro/doc/user-manual.odt index 73dba4e..84e3772 100644 Binary files a/source/distro/doc/user-manual.odt and b/source/distro/doc/user-manual.odt differ diff --git a/source/java/org/openoffice/da/comp/w2lcommon/filter/OptionsDialogBase.java b/source/java/org/openoffice/da/comp/w2lcommon/filter/OptionsDialogBase.java index 0a587c4..57199a8 100644 --- a/source/java/org/openoffice/da/comp/w2lcommon/filter/OptionsDialogBase.java +++ b/source/java/org/openoffice/da/comp/w2lcommon/filter/OptionsDialogBase.java @@ -16,11 +16,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * - * Copyright: 2002-2010 by Henrik Just + * Copyright: 2002-2011 by Henrik Just * * All Rights Reserved. * - * Version 1.2 (2010-04-12) + * Version 1.2 (2011-02-23) * */ @@ -115,7 +115,7 @@ public abstract class OptionsDialogBase extends DialogBase implements /** Finalize the dialog after execution (eg. save settings to the registry) */ - public void finalize() { + public void endDialog() { try { // Prepare registry view Object rwview = getRegistryView(true); diff --git a/source/java/org/openoffice/da/comp/w2lcommon/helper/DialogBase.java b/source/java/org/openoffice/da/comp/w2lcommon/helper/DialogBase.java index 96c59b5..2f1268a 100644 --- a/source/java/org/openoffice/da/comp/w2lcommon/helper/DialogBase.java +++ b/source/java/org/openoffice/da/comp/w2lcommon/helper/DialogBase.java @@ -16,11 +16,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * - * Copyright: 2002-2008 by Henrik Just + * Copyright: 2002-2011 by Henrik Just * * All Rights Reserved. * - * Version 1.0 (2008-09-11) + * Version 1.2 (2011-02-23) * */ @@ -87,10 +87,10 @@ public abstract class DialogBase implements */ protected abstract void initialize(); - /** Finalize the dialog after execution (eg. save settings to the registry) + /** End the dialog after execution (eg. save settings to the registry) * The subclass must implement this */ - protected abstract void finalize(); + protected abstract void endDialog(); ////////////////////////////////////////////////////////////////////////// // Some constants @@ -195,15 +195,12 @@ public abstract class DialogBase implements if (nResult == ExecutableDialogResults.OK) { // Finalize after execution of dialog using method from subclass - finalize(); + endDialog(); } xDialog.endExecute(); return nResult; } catch (Exception e) { -MessageBox msgBox = new MessageBox(xContext); -msgBox.showMessage("Error",e.toString()+" "+e.getStackTrace()[0].toString()); - // continue as if the dialog was executed OK return ExecutableDialogResults.OK; } diff --git a/source/java/org/openoffice/da/comp/writer2xhtml/EpubMetadataDialog.java b/source/java/org/openoffice/da/comp/writer2xhtml/EpubMetadataDialog.java index 5619f13..00350d9 100644 --- a/source/java/org/openoffice/da/comp/writer2xhtml/EpubMetadataDialog.java +++ b/source/java/org/openoffice/da/comp/writer2xhtml/EpubMetadataDialog.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.2 (2011-02-22) + * Version 1.2 (2011-02-23) * */ @@ -30,6 +30,9 @@ import java.util.HashSet; import org.openoffice.da.comp.w2lcommon.helper.DialogBase; +import writer2latex.util.CSVList; + +import com.sun.star.awt.XDialog; import com.sun.star.beans.IllegalTypeException; import com.sun.star.beans.NotRemoveableException; import com.sun.star.beans.Property; @@ -65,7 +68,8 @@ public class EpubMetadataDialog extends DialogBase { private static final String COVERAGE="Coverage"; private static final String RIGHTS="Rights"; - // Access to the user defined properties + // Access to the document properties + private XDocumentProperties xDocumentProperties=null; private XPropertyContainer xUserProperties=null; private XPropertySet xUserPropertySet=null; @@ -81,15 +85,193 @@ public class EpubMetadataDialog extends DialogBase { */ public static String __implementationName = "org.openoffice.da.comp.writer2xhtml.EpubMetadataDialog"; - @Override - public String getDialogLibraryName() { + // -------------------------------------------------- + // Ensure that the super can find us :-) + @Override public String getDialogLibraryName() { return "W2XDialogs2"; } - @Override - public String getDialogName() { + @Override public String getDialogName() { return "EpubMetadata"; } + + // -------------------------------------------------- + // Implement the interface XDialogEventHandler + @Override public boolean callHandlerMethod(XDialog xDialog, Object event, String sMethod) { + if (sMethod.equals("UseCustomIdentifierChange")) { + return useCustomIdentifierChange(); + } + else if (sMethod.equals("AuthorAddClick")) { + return authorAddclick(); + } + else if (sMethod.equals("AuthorModifyClick")) { + return authorModifyclick(); + } + else if (sMethod.equals("AuthorDeleteClick")) { + return authorDeleteclick(); + } + else if (sMethod.equals("AuthorUpClick")) { + return authorUpclick(); + } + else if (sMethod.equals("AuthorDownClick")) { + return authorDownclick(); + } + else if (sMethod.equals("DateAddClick")) { + return dateAddClick(); + } + else if (sMethod.equals("DateModifyClick")) { + return dateModifyClick(); + } + else if (sMethod.equals("DateDeleteClick")) { + return dateDeleteClick(); + } + return false; + } + + @Override public String[] getSupportedMethodNames() { + String[] sNames = { "UseCustomIdentifierChange", + "AuthorAddClick", "AuthorModifyClick", "AuthorDeleteClick", "AuthorUpClick", "AuthorDownClick", + "DataAddClick", "DateModifyClick", "DateDeleteClick"}; + return sNames; + } + + private boolean useCustomIdentifierChange() { + boolean bEnabled = getCheckBoxStateAsBoolean("UseCustomIdentifier"); + setControlEnabled("IdentifierLabel",bEnabled); + setControlEnabled("Identifier",bEnabled); + setControlEnabled("IdentifierTypeLabel",bEnabled); + setControlEnabled("IdentifierType",bEnabled); + return true; + } + + private boolean authorAddclick() { + System.out.println("AuthorAddClick"); + return true; + } + + private boolean authorModifyclick() { + System.out.println("AuthorModifyClick"); + return true; + } + + private boolean authorDeleteclick() { + System.out.println("AuthorDeleteClick"); + return true; + } + + private boolean authorUpclick() { + System.out.println("AuthorUpClick"); + return true; + } + + private boolean authorDownclick() { + System.out.println("AuthorDownClick"); + return true; + } + + private boolean dateAddClick() { + System.out.println("DateAddClick"); + return true; + } + + private boolean dateModifyClick() { + System.out.println("DateModifyClick"); + return true; + } + + private boolean dateDeleteClick() { + System.out.println("DateDeleteClick"); + return true; + } + + // -------------------------------------------------- + // Get and set properties from and to current document + + @Override protected void initialize() { + // Get the document properties + XDesktop xDesktop; + Object desktop; + try { + desktop = xContext.getServiceManager().createInstanceWithContext("com.sun.star.frame.Desktop", xContext); + } catch (Exception e) { + // Failed to get desktop + return; + } + xDesktop = (XDesktop) UnoRuntime.queryInterface(com.sun.star.frame.XDesktop.class, desktop); + XComponent xComponent = xDesktop.getCurrentComponent(); + XDocumentPropertiesSupplier xSupplier = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xComponent); + + // Get the document properties (we need several interfaces) + xDocumentProperties = xSupplier.getDocumentProperties(); + xUserProperties= xDocumentProperties.getUserDefinedProperties(); + xUserPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xUserProperties); + + // Get the custom identifier and set the text fields + String[] sIdentifiers = getProperties(IDENTIFIER,false); + setCheckBoxStateAsBoolean("UseCustomIdentifier",sIdentifiers.length>0); + useCustomIdentifierChange(); + if (sIdentifiers.length>0) { // Use the first if we have several... + setTextFieldText("Identifier",getValue(sIdentifiers[0])); + int nDot = sIdentifiers[0].indexOf("."); + setTextFieldText("IdentifierType",nDot>-1 ? sIdentifiers[0].substring(nDot+1) : ""); + } + + // Get the standard properties and set the text fields + setTextFieldText("Title",xDocumentProperties.getTitle()); + setTextFieldText("Subject",xDocumentProperties.getSubject()); + String[] sKeywords = xDocumentProperties.getKeywords(); + CSVList keywords = new CSVList(", "); + for (String sKeyword : sKeywords) { + keywords.addValue(sKeyword); + } + setTextFieldText("Keywords",keywords.toString()); + setTextFieldText("Description",xDocumentProperties.getDescription()); + + // Get the simple user properties and set the text fields + readSimpleProperty(PUBLISHER); + readSimpleProperty(TYPE); + readSimpleProperty(FORMAT); + readSimpleProperty(SOURCE); + readSimpleProperty(RELATION); + readSimpleProperty(COVERAGE); + readSimpleProperty(RIGHTS); + + } + + @Override protected void endDialog() { + // Set the custom identifier from the text fields + String[] sIdentifiers = getProperties(IDENTIFIER,false); + for (String sIdentifier : sIdentifiers) { // Remove old identifier(s) + removeProperty(sIdentifier); + } + if (getCheckBoxStateAsBoolean("UseCustomIdentifier")) { + String sName = IDENTIFIER; + if (getTextFieldText("IdentifierType").trim().length()>0) { + sName+="."+getTextFieldText("IdentifierType").trim(); + } + addProperty(sName); + setValue(sName,getTextFieldText("Identifier")); + } + + // Set the standard properties from the text fields + xDocumentProperties.setTitle(getTextFieldText("Title")); + xDocumentProperties.setSubject(getTextFieldText("Subject")); + String[] sKeywords = getTextFieldText("Keywords").split(","); + for (int i=0; i diff --git a/source/java/writer2latex/epub/EPUBWriter.java b/source/java/writer2latex/epub/EPUBWriter.java index e520533..1d6bfa2 100644 --- a/source/java/writer2latex/epub/EPUBWriter.java +++ b/source/java/writer2latex/epub/EPUBWriter.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * version 1.2 (2011-02-17) + * version 1.2 (2011-02-23) * */ @@ -89,7 +89,7 @@ public class EPUBWriter implements OutputFile { zos.closeEntry(); // Then manifest - OPFWriter manifest = new OPFWriter(xhtmlResult, config.xhtmlUseDublinCore(), config.useCustomMetadata()); + OPFWriter manifest = new OPFWriter(xhtmlResult, config.xhtmlUseDublinCore()); ZipEntry manifestEntry = new ZipEntry("OEBPS/book.opf"); zos.putNextEntry(manifestEntry); writeZipEntry(manifest,zos); diff --git a/source/java/writer2latex/epub/OPFWriter.java b/source/java/writer2latex/epub/OPFWriter.java index 4a82361..a7ac822 100644 --- a/source/java/writer2latex/epub/OPFWriter.java +++ b/source/java/writer2latex/epub/OPFWriter.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * version 1.2 (2011-02-17) + * version 1.2 (2011-02-23) * */ @@ -51,7 +51,7 @@ import writer2latex.xmerge.NewDOMDocument; public class OPFWriter extends NewDOMDocument { private String sUID=null; - public OPFWriter(ConverterResult cr, boolean bUseDublinCore, boolean bUseCustomMetadata) { + public OPFWriter(ConverterResult cr, boolean bUseDublinCore) { super("book", "opf"); // create DOM @@ -108,7 +108,7 @@ public class OPFWriter extends NewDOMDocument { boolean bHasIdentifier = false; boolean bHasCreator = false; boolean bHasDate = false; - if (bUseCustomMetadata) { + if (bUseDublinCore) { // First rearrange the user-defined meta data Map userDefinedMetaData = cr.getMetaData().getUserDefinedMetaData(); Map dc = new HashMap(); diff --git a/source/java/writer2latex/xhtml/XhtmlConfig.java b/source/java/writer2latex/xhtml/XhtmlConfig.java index f7ce56a..633e75a 100644 --- a/source/java/writer2latex/xhtml/XhtmlConfig.java +++ b/source/java/writer2latex/xhtml/XhtmlConfig.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.2 (2011-02-17) + * Version 1.2 (2011-02-23) * */ @@ -41,7 +41,7 @@ import writer2latex.util.Misc; public class XhtmlConfig extends writer2latex.base.ConfigBase { // Implement configuration methods - protected int getOptionCount() { return 54; } + protected int getOptionCount() { return 53; } protected String getDefaultConfigPath() { return "/writer2latex/xhtml/config/"; } // Override setOption: To be backwards compatible, we must accept options @@ -106,37 +106,36 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase { private static final int USE_DEFAULT_FONT = 20; private static final int DEFAULT_FONT_NAME = 21; private static final int USE_DUBLIN_CORE = 22; - private static final int USE_CUSTOM_METADATA = 23; - private static final int NOTES = 24; - private static final int DISPLAY_HIDDEN_TEXT = 25; - private static final int CONVERT_TO_PX = 26; - private static final int SCALING = 27; - private static final int COLUMN_SCALING = 28; - private static final int RELATIVE_FONT_SIZE = 29; - private static final int FONT_SCALING = 30; - private static final int FLOAT_OBJECTS = 31; - private static final int TABSTOP_STYLE = 32; - private static final int FORMULAS = 33; - private static final int ENDNOTES_HEADING = 34; - private static final int EXTERNAL_TOC_DEPTH = 35; - private static final int INCLUDE_TOC = 36; - private static final int SPLIT_LEVEL = 37; - private static final int REPEAT_LEVELS = 38; - private static final int PAGE_BREAK_SPLIT = 39; - private static final int SPLIT_AFTER = 40; - private static final int CALC_SPLIT = 41; - private static final int DISPLAY_HIDDEN_SHEETS = 42; - private static final int DISPLAY_HIDDEN_ROWS_COLS = 43; - private static final int DISPLAY_FILTERED_ROWS_COLS = 44; - private static final int APPLY_PRINT_RANGES = 45; - private static final int USE_TITLE_AS_HEADING = 46; - private static final int USE_SHEET_NAMES_AS_HEADINGS = 47; - private static final int XSLT_PATH = 48; - private static final int SAVE_IMAGES_IN_SUBDIR = 49; - private static final int UPLINK = 50; - private static final int DIRECTORY_ICON = 51; - private static final int DOCUMENT_ICON = 52; - private static final int ZEN_HACK = 53; // temporary hack for ePub Zen Garden styles + private static final int NOTES = 23; + private static final int DISPLAY_HIDDEN_TEXT = 24; + private static final int CONVERT_TO_PX = 25; + private static final int SCALING = 26; + private static final int COLUMN_SCALING = 27; + private static final int RELATIVE_FONT_SIZE = 28; + private static final int FONT_SCALING = 29; + private static final int FLOAT_OBJECTS = 30; + private static final int TABSTOP_STYLE = 31; + private static final int FORMULAS = 32; + private static final int ENDNOTES_HEADING = 33; + private static final int EXTERNAL_TOC_DEPTH = 34; + private static final int INCLUDE_TOC = 35; + private static final int SPLIT_LEVEL = 36; + private static final int REPEAT_LEVELS = 37; + private static final int PAGE_BREAK_SPLIT = 38; + private static final int SPLIT_AFTER = 39; + private static final int CALC_SPLIT = 40; + private static final int DISPLAY_HIDDEN_SHEETS = 41; + private static final int DISPLAY_HIDDEN_ROWS_COLS = 42; + private static final int DISPLAY_FILTERED_ROWS_COLS = 43; + private static final int APPLY_PRINT_RANGES = 44; + private static final int USE_TITLE_AS_HEADING = 45; + private static final int USE_SHEET_NAMES_AS_HEADINGS = 46; + private static final int XSLT_PATH = 47; + private static final int SAVE_IMAGES_IN_SUBDIR = 48; + private static final int UPLINK = 49; + private static final int DIRECTORY_ICON = 50; + private static final int DOCUMENT_ICON = 51; + private static final int ZEN_HACK = 52; // temporary hack for ePub Zen Garden styles protected ComplexOption xheading = addComplexOption("heading-map"); protected ComplexOption xpar = addComplexOption("paragraph-map"); @@ -178,7 +177,6 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase { options[USE_DEFAULT_FONT] = new BooleanOption("use_default_font","false"); options[DEFAULT_FONT_NAME] = new BooleanOption("default_font_name",""); options[USE_DUBLIN_CORE] = new BooleanOption("use_dublin_core","true"); - options[USE_CUSTOM_METADATA] = new BooleanOption("use_custom_metadata","true"); options[NOTES] = new BooleanOption("notes","true"); options[DISPLAY_HIDDEN_TEXT] = new BooleanOption("display_hidden_text", "false"); options[CONVERT_TO_PX] = new BooleanOption("convert_to_px","true"); @@ -343,7 +341,6 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase { public boolean useDefaultFont() { return ((BooleanOption) options[USE_DEFAULT_FONT]).getValue(); } public String defaultFontName() { return options[DEFAULT_FONT_NAME].getString(); } public boolean xhtmlUseDublinCore() { return ((BooleanOption) options[USE_DUBLIN_CORE]).getValue(); } - public boolean useCustomMetadata() { return ((BooleanOption) options[USE_CUSTOM_METADATA]).getValue(); } public boolean xhtmlNotes() { return ((BooleanOption) options[NOTES]).getValue(); } public boolean displayHiddenText() { return ((BooleanOption) options[DISPLAY_HIDDEN_TEXT]).getValue(); } public boolean xhtmlConvertToPx() { return ((BooleanOption) options[CONVERT_TO_PX]).getValue(); } diff --git a/source/oxt/writer2xhtml/Options.xcs b/source/oxt/writer2xhtml/Options.xcs index f8bb42a..df918a5 100644 --- a/source/oxt/writer2xhtml/Options.xcs +++ b/source/oxt/writer2xhtml/Options.xcs @@ -70,7 +70,6 @@ - diff --git a/source/oxt/writer2xhtml/Options.xcu b/source/oxt/writer2xhtml/Options.xcu index c2748f3..003ef84 100644 --- a/source/oxt/writer2xhtml/Options.xcu +++ b/source/oxt/writer2xhtml/Options.xcu @@ -103,9 +103,6 @@ true - - true - false diff --git a/source/oxt/writer2xhtml/W2XDialogs2/EpubMetadata.xdl b/source/oxt/writer2xhtml/W2XDialogs2/EpubMetadata.xdl index d7ccad0..0853ba0 100644 --- a/source/oxt/writer2xhtml/W2XDialogs2/EpubMetadata.xdl +++ b/source/oxt/writer2xhtml/W2XDialogs2/EpubMetadata.xdl @@ -1,12 +1,14 @@ - + - - - - - + + + + + + + @@ -15,35 +17,60 @@ - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/oxt/writer2xhtml/W2XDialogs2/EpubOptions.xdl b/source/oxt/writer2xhtml/W2XDialogs2/EpubOptions.xdl index efd7497..890deae 100755 --- a/source/oxt/writer2xhtml/W2XDialogs2/EpubOptions.xdl +++ b/source/oxt/writer2xhtml/W2XDialogs2/EpubOptions.xdl @@ -1,6 +1,6 @@ - + @@ -16,21 +16,21 @@ - + - + - + - + - - + + @@ -40,41 +40,41 @@ - - - - + + + + - + - + - + - + - - + + - - + + - - - - + + + + @@ -88,14 +88,10 @@ - - - - + + + - - - \ No newline at end of file diff --git a/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/epub_export.xhp b/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/epub_export.xhp index 9323567..a65129e 100644 --- a/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/epub_export.xhp +++ b/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/epub_export.xhp @@ -124,14 +124,6 @@ are exported, otherwise only the title is exported. Click Edit to open the dialog to edit the document properties. - - Check this if you want to export custom document properties - Export custom document properties - The EPUB format supports a number of additional document properties, which can be - defined using custom document properties in %PRODUCTNAME Writer. - If you select this option, these properties will be exported. - Click Edit to edit the custom document properties. - Document division Technically an EPUB document consists of several document parts in XHTML format. In principle you can have only one part, but this is not recommended. For performance reasons and because some EPUB readers have