EPUB meta data editor final draft (dates and other refinements)

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@95 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2011-03-05 12:39:48 +00:00
parent e147126315
commit 029d82e2eb
12 changed files with 410 additions and 183 deletions

View file

@ -1,7 +1,11 @@
Changelog for Writer2LaTeX version 1.0 -> 1.2 Changelog for Writer2LaTeX version 1.0 -> 1.2
---------- version 1.1.7 ---------- ---------- version 1.1.7 ----------
[w2x] The option use_dublin_core no longer has effect on EPUB export (instead identifier, author, date and title are always
exported, and other properties are exported if they exist and are non-empty)
[w2x] Added opf:file-as attribute to EPUB metadata (creators and contributors) [w2x] Added opf:file-as attribute to EPUB metadata (creators and contributors)
[w2x] EPUB meta data can now be edited directly from the export dialog [w2x] EPUB meta data can now be edited directly from the export dialog

Binary file not shown.

View file

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA * MA 02111-1307 USA
* *
* Copyright: 2002-2009 by Henrik Just * Copyright: 2002-2011 by Henrik Just
* *
* All Rights Reserved. * All Rights Reserved.
* *
* Version 1.2 (2009-11-08) * Version 1.2 (2011-03-03)
* *
*/ */
@ -276,6 +276,27 @@ public class DialogAccess {
} }
} }
public int getDateFieldValue(String sControlName) {
XPropertySet xPropertySet = getControlProperties(sControlName);
try {
return ((Integer) xPropertySet.getPropertyValue("Date")).intValue();
}
catch (Exception e) {
// Will fail if the control does not exist or is not a date field
return 0;
}
}
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
}
}
public int getNumericFieldValue(String sControlName) { public int getNumericFieldValue(String sControlName) {
XPropertySet xPropertySet = getControlProperties(sControlName); XPropertySet xPropertySet = getControlProperties(sControlName);
try { try {

View file

@ -20,7 +20,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* *
* Version 1.2 (2011-02-23) * Version 1.2 (2011-02-25)
* *
*/ */

View file

@ -20,15 +20,19 @@
* *
* All Rights Reserved. * All Rights Reserved.
* *
* Version 1.2 (2011-02-24) * Version 1.2 (2011-03-05)
* *
*/ */
package org.openoffice.da.comp.writer2xhtml; package org.openoffice.da.comp.writer2xhtml;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Vector; import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.openoffice.da.comp.w2lcommon.helper.DialogBase; import org.openoffice.da.comp.w2lcommon.helper.DialogBase;
import org.openoffice.da.comp.w2lcommon.helper.SimpleDialog; import org.openoffice.da.comp.w2lcommon.helper.SimpleDialog;
@ -56,6 +60,9 @@ import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Exception; import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext; import com.sun.star.uno.XComponentContext;
import com.sun.star.util.DateTime;
// TODO: Create the UNO helper class DocumentPropertiesAccess
/** This class provides a UNO component which implements a custom metadata editor UI for the EPUB export /** This class provides a UNO component which implements a custom metadata editor UI for the EPUB export
*/ */
@ -67,6 +74,12 @@ public class EpubMetadataDialog extends DialogBase {
String sRole = ""; String sRole = "";
} }
// Date data
private class DateInfo {
int nDate = 0;
String sEvent = "";
}
// All the user defined properties we handle // All the user defined properties we handle
private static final String IDENTIFIER="Identifier"; private static final String IDENTIFIER="Identifier";
private static final String CREATOR="Creator"; private static final String CREATOR="Creator";
@ -98,6 +111,13 @@ public class EpubMetadataDialog extends DialogBase {
// Author and date bookkeeping // Author and date bookkeeping
private Vector<AuthorInfo> authors = new Vector<AuthorInfo>(); private Vector<AuthorInfo> authors = new Vector<AuthorInfo>();
private Vector<DateInfo> dates = new Vector<DateInfo>();
// Number formatter
private NumberFormat formatter = new DecimalFormat("00");
// Pattern matcher for dates
Pattern datePattern = Pattern.compile("(\\d{4})-(\\d{2})-(\\d{2})");
public EpubMetadataDialog(XComponentContext xContext) { public EpubMetadataDialog(XComponentContext xContext) {
super(xContext); super(xContext);
@ -151,13 +171,19 @@ public class EpubMetadataDialog extends DialogBase {
else if (sMethod.equals("DateDeleteClick")) { else if (sMethod.equals("DateDeleteClick")) {
return dateDeleteClick(); return dateDeleteClick();
} }
else if (sMethod.equals("DateUpClick")) {
return dateUpClick();
}
else if (sMethod.equals("DateDownClick")) {
return dateDownClick();
}
return false; return false;
} }
@Override public String[] getSupportedMethodNames() { @Override public String[] getSupportedMethodNames() {
String[] sNames = { "UseCustomIdentifierChange", String[] sNames = { "UseCustomIdentifierChange",
"AuthorAddClick", "AuthorModifyClick", "AuthorDeleteClick", "AuthorUpClick", "AuthorDownClick", "AuthorAddClick", "AuthorModifyClick", "AuthorDeleteClick", "AuthorUpClick", "AuthorDownClick",
"DataAddClick", "DateModifyClick", "DateDeleteClick"}; "DataAddClick", "DateModifyClick", "DateDeleteClick", "DateUpClick", "DateDownClick"};
return sNames; return sNames;
} }
@ -247,17 +273,74 @@ public class EpubMetadataDialog extends DialogBase {
} }
private boolean dateAddClick() { private boolean dateAddClick() {
System.out.println("DateAddClick"); SimpleDialog dialog = new SimpleDialog(xContext,"W2XDialogs2.DateDialog");
if (dialog.getDialog()!=null) {
dialog.getControls().setDateFieldValue("Date", datetime2int(xDocumentProperties.getModificationDate()));
if (dialog.getDialog().execute()==ExecutableDialogResults.OK) {
DateInfo date = new DateInfo();
date.nDate = dialog.getControls().getDateFieldValue("Date");
date.sEvent = dialog.getControls().getTextFieldText("Event").trim();
dates.add(date);
updateDateList((short) (dates.size()-1));
}
dialog.getDialog().endExecute();
}
return true; return true;
} }
private boolean dateModifyClick() { private boolean dateModifyClick() {
System.out.println("DateModifyClick"); short nIndex = getListBoxSelectedItem("Dates");
DateInfo date = dates.get(nIndex);
SimpleDialog dialog = new SimpleDialog(xContext,"W2XDialogs2.DateDialog");
if (dialog.getDialog()!=null) {
dialog.getControls().setDateFieldValue("Date", date.nDate);
dialog.getControls().setTextFieldText("Event", date.sEvent);
if (dialog.getDialog().execute()==ExecutableDialogResults.OK) {
date.nDate = dialog.getControls().getDateFieldValue("Date");
date.sEvent = dialog.getControls().getTextFieldText("Event").trim();
updateDateList(nIndex);
}
dialog.getDialog().endExecute();
}
return true; return true;
} }
private boolean dateDeleteClick() { private boolean dateDeleteClick() {
System.out.println("DateDeleteClick"); if (dates.size()>0) {
SimpleDialog dialog = new SimpleDialog(xContext,"W2XDialogs2.DeleteDialog");
if (dialog.getDialog()!=null) {
short nIndex = getListBoxSelectedItem("Dates");
String sLabel = dialog.getControls().getLabelText("DeleteLabel");
sLabel = sLabel.replaceAll("%s", formatDate(dates.get(nIndex).nDate));
dialog.getControls().setLabelText("DeleteLabel", sLabel);
if (dialog.getDialog().execute()==ExecutableDialogResults.OK) {
dates.remove(nIndex);
updateDateList(nIndex<dates.size() ? (short) nIndex : (short) (nIndex-1));
}
}
}
return true;
}
private boolean dateUpClick() {
short nIndex = getListBoxSelectedItem("Dates");
if (nIndex>0) {
DateInfo date = dates.get(nIndex);
dates.set(nIndex, dates.get(nIndex-1));
dates.set(nIndex-1, date);
updateDateList((short) (nIndex-1));
}
return true;
}
private boolean dateDownClick() {
short nIndex = getListBoxSelectedItem("Dates");
if (nIndex+1<dates.size()) {
DateInfo date = dates.get(nIndex);
dates.set(nIndex, dates.get(nIndex+1));
dates.set(nIndex+1, date);
updateDateList((short) (nIndex+1));
}
return true; return true;
} }
@ -288,7 +371,7 @@ public class EpubMetadataDialog extends DialogBase {
setCheckBoxStateAsBoolean("UseCustomIdentifier",sIdentifiers.length>0); setCheckBoxStateAsBoolean("UseCustomIdentifier",sIdentifiers.length>0);
useCustomIdentifierChange(); useCustomIdentifierChange();
if (sIdentifiers.length>0) { // Use the first if we have several... if (sIdentifiers.length>0) { // Use the first if we have several...
setTextFieldText("Identifier",getValue(sIdentifiers[0])); setTextFieldText("Identifier",getStringValue(sIdentifiers[0]));
setTextFieldText("IdentifierType",getSuffix(sIdentifiers[0])); setTextFieldText("IdentifierType",getSuffix(sIdentifiers[0]));
} }
@ -296,7 +379,7 @@ public class EpubMetadataDialog extends DialogBase {
String[] sCreators = getProperties(CREATOR,false); String[] sCreators = getProperties(CREATOR,false);
for (String sCreator : sCreators) { for (String sCreator : sCreators) {
AuthorInfo creator = new AuthorInfo(); AuthorInfo creator = new AuthorInfo();
creator.sName = getValue(sCreator); creator.sName = getStringValue(sCreator);
creator.sRole = getSuffix(sCreator); creator.sRole = getSuffix(sCreator);
creator.isCreator = true; creator.isCreator = true;
authors.add(creator); authors.add(creator);
@ -304,7 +387,7 @@ public class EpubMetadataDialog extends DialogBase {
String[] sContributors = getProperties(CONTRIBUTOR,false); String[] sContributors = getProperties(CONTRIBUTOR,false);
for (String sContributor : sContributors) { for (String sContributor : sContributors) {
AuthorInfo contributor = new AuthorInfo(); AuthorInfo contributor = new AuthorInfo();
contributor.sName = getValue(sContributor); contributor.sName = getStringValue(sContributor);
contributor.sRole = getSuffix(sContributor); contributor.sRole = getSuffix(sContributor);
contributor.isCreator = false; contributor.isCreator = false;
authors.add(contributor); authors.add(contributor);
@ -312,7 +395,19 @@ public class EpubMetadataDialog extends DialogBase {
updateAuthorList((short) 0); updateAuthorList((short) 0);
// Get the dates and set the list box // Get the dates and set the list box
// TODO String[] sDates = getProperties(DATE,false);
for (String sDate : sDates) {
DateInfo date = new DateInfo();
DateTime dt = getDateValue(sDate);
if (dt!=null) { // We accept either a date
date.nDate = datetime2int(dt);
}
else { // Or a string in the form yyyy-mm-dd
date.nDate = parseDate(getStringValue(sDate));
}
date.sEvent = getSuffix(sDate);
dates.add(date);
}
updateDateList((short) 0); updateDateList((short) 0);
// Get the standard properties and set the text fields // Get the standard properties and set the text fields
@ -363,7 +458,7 @@ public class EpubMetadataDialog extends DialogBase {
} }
int i=0; int i=0;
for (AuthorInfo author : authors) { for (AuthorInfo author : authors) {
String sName = (author.isCreator ? CREATOR : CONTRIBUTOR)+(++i); String sName = (author.isCreator ? CREATOR : CONTRIBUTOR)+formatter.format(++i);
if (author.sRole.length()>0) { if (author.sRole.length()>0) {
sName+="."+author.sRole; sName+="."+author.sRole;
} }
@ -372,7 +467,21 @@ public class EpubMetadataDialog extends DialogBase {
} }
// Set the dates from the list box // Set the dates from the list box
// TODO String[] sDates = getProperties(DATE,false);
for (String sDate : sDates) { // remove old dates
removeProperty(sDate);
}
i=0;
for (DateInfo date : dates) {
String sName = DATE+formatter.format(++i);
if (date.sEvent.length()>0) {
sName+="."+date.sEvent;
}
addProperty(sName);
setValue(sName,formatDate(date.nDate));
// Doesn't work (why not?)
//setValue(sName,int2datetime(date.nDate));
}
// Set the standard properties from the text fields // Set the standard properties from the text fields
xDocumentProperties.setTitle(getTextFieldText("Title")); xDocumentProperties.setTitle(getTextFieldText("Title"));
@ -435,9 +544,9 @@ public class EpubMetadataDialog extends DialogBase {
} }
// Set the value of a user property (failing silently if the property does not exist) // Set the value of a user property (failing silently if the property does not exist)
private void setValue(String sName, String sValue) { private void setValue(String sName, Object value) {
try { try {
xUserPropertySet.setPropertyValue(sName, sValue); xUserPropertySet.setPropertyValue(sName, value);
} catch (UnknownPropertyException e) { } catch (UnknownPropertyException e) {
} catch (PropertyVetoException e) { } catch (PropertyVetoException e) {
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
@ -445,18 +554,11 @@ public class EpubMetadataDialog extends DialogBase {
} }
} }
// Get the value of a user property (returning null if the property does not exist) // Get the string value of a user property (returning null if the property does not exist)
private String getValue(String sName) { private String getStringValue(String sName) {
Object value; Object value = getValue(sName);
try {
value = xUserPropertySet.getPropertyValue(sName);
} catch (UnknownPropertyException e) {
return null;
} catch (WrappedTargetException e) {
return null;
}
if (AnyConverter.isString(value)) { if (value!=null && AnyConverter.isString(value)) {
try { try {
return AnyConverter.toString(value); return AnyConverter.toString(value);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
@ -466,19 +568,48 @@ public class EpubMetadataDialog extends DialogBase {
return null; return null;
} }
private DateTime getDateValue(String sName) {
Object value = getValue(sName);
if (value!=null && value instanceof DateTime) {
return (DateTime) value;
}
return null;
}
// Get the value of a user property (returning null if the property does not exist)
private Object getValue(String sName) {
try {
return xUserPropertySet.getPropertyValue(sName);
} catch (UnknownPropertyException e) {
return null;
} catch (WrappedTargetException e) {
return null;
}
}
private void updateAuthorList(short nItem) { private void updateAuthorList(short nItem) {
int nCount = authors.size(); int nCount = authors.size();
String[] sAuthors = new String[nCount]; if (nCount>0) {
for (int i=0; i<nCount; i++) { String[] sAuthors = new String[nCount];
AuthorInfo author = authors.get(i); for (int i=0; i<nCount; i++) {
sAuthors[i] = author.sName AuthorInfo author = authors.get(i);
sAuthors[i] = author.sName
+" (" +" ("
+(author.isCreator ? "creator":"contributor") +(author.isCreator ? "creator":"contributor")
+(author.sRole.length()>0 ? ", "+author.sRole : "") +(author.sRole.length()>0 ? ", "+author.sRole : "")
+")"; +")";
}
setListBoxStringItemList("Authors", sAuthors);
setListBoxSelectedItem("Authors",nItem);
setControlEnabled("Authors", true);
}
else { // Display the fall-back author
String[] sAuthors = new String[1];
sAuthors[0] = xDocumentProperties.getAuthor()+" (default creator)";
setListBoxStringItemList("Authors", sAuthors);
setControlEnabled("Authors", false);
} }
setListBoxStringItemList("Authors", sAuthors);
setListBoxSelectedItem("Authors",nItem);
setControlEnabled("ModifyAuthorButton",nCount>0); setControlEnabled("ModifyAuthorButton",nCount>0);
setControlEnabled("DeleteAuthorButton",nCount>0); setControlEnabled("DeleteAuthorButton",nCount>0);
setControlEnabled("AuthorUpButton",nCount>1); setControlEnabled("AuthorUpButton",nCount>1);
@ -486,15 +617,36 @@ public class EpubMetadataDialog extends DialogBase {
} }
private void updateDateList(short nItem) { private void updateDateList(short nItem) {
setControlEnabled("AddDateButton",false); int nCount = dates.size();
setControlEnabled("ModifyDateButton",false); if (nCount>0) {
setControlEnabled("DeleteDateButton",false); String[] sDates = new String[nCount];
for (int i=0; i<nCount; i++) {
DateInfo date = dates.get(i);
sDates[i] = formatDate(date.nDate);
if (date.sEvent.length()>0) {
sDates[i]+=" (" + date.sEvent + ")";
}
}
setListBoxStringItemList("Dates", sDates);
setListBoxSelectedItem("Dates",nItem);
setControlEnabled("Dates", true);
}
else { // Display the fall-back date
String[] sDates = new String[1];
sDates[0] = formatDate(datetime2int(xDocumentProperties.getModificationDate()))+" (default date)";
setListBoxStringItemList("Dates", sDates);
setControlEnabled("Dates", false);
}
setControlEnabled("ModifyDateButton",nCount>0);
setControlEnabled("DeleteDateButton",nCount>0);
setControlEnabled("DateUpButton",nCount>1);
setControlEnabled("DateDownButton",nCount>1);
} }
private void readSimpleProperty(String sName) { private void readSimpleProperty(String sName) {
String[] sNames = getProperties(sName,true); String[] sNames = getProperties(sName,true);
if (sNames.length>0) { if (sNames.length>0) {
String sValue = getValue(sNames[0]); String sValue = getStringValue(sNames[0]);
if (sValue!=null) { if (sValue!=null) {
setTextFieldText(sName, sValue); setTextFieldText(sName, sValue);
} }
@ -513,5 +665,44 @@ public class EpubMetadataDialog extends DialogBase {
} }
} }
// Date fields uses integers for dates (format yyyymmdd)
// Document properties uses com.sun.star.util.DateTime
// Also dates should be formatted as yyyy-mm-dd as strings
// Thus we need a few conversion methods
// Format a integer date as yyyy-mm-dd
private String formatDate(int nDate) {
String sDate = Integer.toString(nDate);
if (sDate.length()==8) {
return sDate.substring(0,4)+"-"+sDate.substring(4, 6)+"-"+sDate.substring(6);
}
else {
return "???";
}
}
// Parse a string as a date in the format yyyy-mm-dd (returning 0 on failure)
private int parseDate(String sDate) {
Matcher matcher = datePattern.matcher(sDate);
if (matcher.matches()) {
return Misc.getPosInteger(matcher.group(1)+matcher.group(2)+matcher.group(3),0);
}
return 0;
}
// Convert an integer to com.sun.star.util.DateTime
/*private DateTime int2datetime(int nDate) {
DateTime date = new DateTime();
date.Year = (short) (nDate/10000);
date.Month = (short) ((nDate%10000)/100);
date.Day = (short) (nDate%100);
System.out.println(date.Year+"-"+date.Month+"-"+date.Day);
return date;
}*/
// Convert a com.sun.star.util.DateTime to integer
private int datetime2int(DateTime date) {
return 10000*date.Year+100*date.Month+date.Day;
}
} }

View file

@ -20,7 +20,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* *
* Version 1.2 (2011-02-23) * Version 1.2 (2011-03-04)
* *
*/ */
@ -96,7 +96,6 @@ public class EpubOptionsDialog extends OptionsDialogBase {
// Special content // Special content
loadCheckBoxOption(xProps, "DisplayHiddenText"); loadCheckBoxOption(xProps, "DisplayHiddenText");
loadCheckBoxOption(xProps, "Notes"); loadCheckBoxOption(xProps, "Notes");
loadCheckBoxOption(xProps, "UseDublinCore");
// Document division // Document division
loadCheckBoxOption(xProps, "Split"); loadCheckBoxOption(xProps, "Split");
@ -143,7 +142,6 @@ public class EpubOptionsDialog extends OptionsDialogBase {
// Special content // Special content
saveCheckBoxOption(xProps, helper, "DisplayHiddenText", "display_hidden_text"); saveCheckBoxOption(xProps, helper, "DisplayHiddenText", "display_hidden_text");
saveCheckBoxOption(xProps, helper, "Notes", "notes"); saveCheckBoxOption(xProps, helper, "Notes", "notes");
saveCheckBoxOption(xProps, helper, "UseDublinCore", "use_dublin_core");
// Document division // Document division
boolean bSplit = saveCheckBoxOption(xProps, "Split"); boolean bSplit = saveCheckBoxOption(xProps, "Split");
@ -241,7 +239,6 @@ public class EpubOptionsDialog extends OptionsDialogBase {
setControlEnabled("DefaultFontNameLabel",!isLocked("default_font_name") && bUseDefaultFont); setControlEnabled("DefaultFontNameLabel",!isLocked("default_font_name") && bUseDefaultFont);
setControlEnabled("DefaultFontName",!isLocked("default_font_name") && bUseDefaultFont); setControlEnabled("DefaultFontName",!isLocked("default_font_name") && bUseDefaultFont);
setControlEnabled("DisplayHiddenText",!isLocked("display_hidden_text"));
setControlEnabled("ConvertToPx",!isLocked("convert_to_px")); setControlEnabled("ConvertToPx",!isLocked("convert_to_px"));
setControlEnabled("OriginalImageSize",!isLocked("original_image_size")); setControlEnabled("OriginalImageSize",!isLocked("original_image_size"));
@ -251,8 +248,8 @@ public class EpubOptionsDialog extends OptionsDialogBase {
setControlEnabled("IgnoreDoubleSpaces",!isLocked("ignore_double_spaces")); setControlEnabled("IgnoreDoubleSpaces",!isLocked("ignore_double_spaces"));
// Special content // Special content
setControlEnabled("DisplayHiddenText",!isLocked("display_hidden_text"));
setControlEnabled("Notes",!isLocked("notes")); setControlEnabled("Notes",!isLocked("notes"));
setControlEnabled("UseDublinCore",!isLocked("use_dublin_core"));
// Document division // Document division
boolean bSplit = getCheckBoxStateAsBoolean("Split"); boolean bSplit = getCheckBoxStateAsBoolean("Split");

View file

@ -20,7 +20,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* *
* Version 1.2 (2011-02-24) * Version 1.2 (2011-03-05)
* *
*/ */
@ -33,7 +33,7 @@ public class ConverterFactory {
// Version information // Version information
private static final String VERSION = "1.1.7"; private static final String VERSION = "1.1.7";
private static final String DATE = "2011-02-24"; private static final String DATE = "2011-03-05";
/** Return the Writer2LaTeX version in the form /** Return the Writer2LaTeX version in the form
* (major version).(minor version).(patch level)<br/> * (major version).(minor version).(patch level)<br/>

View file

@ -20,7 +20,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* *
* version 1.2 (2011-02-23) * version 1.2 (2011-03-04)
* *
*/ */
@ -89,7 +89,7 @@ public class EPUBWriter implements OutputFile {
zos.closeEntry(); zos.closeEntry();
// Then manifest // Then manifest
OPFWriter manifest = new OPFWriter(xhtmlResult, config.xhtmlUseDublinCore()); OPFWriter manifest = new OPFWriter(xhtmlResult);
ZipEntry manifestEntry = new ZipEntry("OEBPS/book.opf"); ZipEntry manifestEntry = new ZipEntry("OEBPS/book.opf");
zos.putNextEntry(manifestEntry); zos.putNextEntry(manifestEntry);
writeZipEntry(manifest,zos); writeZipEntry(manifest,zos);

View file

@ -20,7 +20,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* *
* version 1.2 (2011-02-24) * version 1.2 (2011-03-04)
* *
*/ */
@ -51,7 +51,7 @@ import writer2latex.xmerge.NewDOMDocument;
public class OPFWriter extends NewDOMDocument { public class OPFWriter extends NewDOMDocument {
private String sUID=null; private String sUID=null;
public OPFWriter(ConverterResult cr, boolean bUseDublinCore) { public OPFWriter(ConverterResult cr) {
super("book", "opf"); super("book", "opf");
// create DOM // create DOM
@ -79,25 +79,23 @@ public class OPFWriter extends NewDOMDocument {
metadata.setAttribute("xmlns:opf", "http://www.idpf.org/2007/opf"); metadata.setAttribute("xmlns:opf", "http://www.idpf.org/2007/opf");
pack.appendChild(metadata); pack.appendChild(metadata);
// Title and language (required)
appendElement(contentDOM, metadata, "dc:title", cr.getMetaData().getTitle()); appendElement(contentDOM, metadata, "dc:title", cr.getMetaData().getTitle());
appendElement(contentDOM, metadata, "dc:language", cr.getMetaData().getLanguage()); appendElement(contentDOM, metadata, "dc:language", cr.getMetaData().getLanguage());
// Additional meta data // Subject and keywords in ODF both map to Dublin core subjects
if (bUseDublinCore) { if (cr.getMetaData().getSubject().length()>0) {
// Subject and keywords in ODF both map to Dublin core subjects appendElement(contentDOM, metadata, "dc:subject", cr.getMetaData().getSubject());
if (cr.getMetaData().getSubject().length()>0) { }
appendElement(contentDOM, metadata, "dc:subject", cr.getMetaData().getSubject()); if (cr.getMetaData().getKeywords().length()>0) {
} String[] sKeywords = cr.getMetaData().getKeywords().split(",");
if (cr.getMetaData().getKeywords().length()>0) { for (String sKeyword : sKeywords) {
String[] sKeywords = cr.getMetaData().getKeywords().split(","); appendElement(contentDOM, metadata, "dc:subject", sKeyword.trim());
for (String sKeyword : sKeywords) {
appendElement(contentDOM, metadata, "dc:subject", sKeyword.trim());
}
}
if (cr.getMetaData().getDescription().length()>0) {
appendElement(contentDOM, metadata, "dc:description", cr.getMetaData().getDescription());
} }
} }
if (cr.getMetaData().getDescription().length()>0) {
appendElement(contentDOM, metadata, "dc:description", cr.getMetaData().getDescription());
}
// User defined meta data // User defined meta data
// The identifier, creator, contributor and date has an optional attribute and there may be multiple instances of // The identifier, creator, contributor and date has an optional attribute and there may be multiple instances of
@ -108,88 +106,86 @@ public class OPFWriter extends NewDOMDocument {
boolean bHasIdentifier = false; boolean bHasIdentifier = false;
boolean bHasCreator = false; boolean bHasCreator = false;
boolean bHasDate = false; boolean bHasDate = false;
if (bUseDublinCore) { // First rearrange the user-defined meta data
// First rearrange the user-defined meta data Map<String,String> userDefinedMetaData = cr.getMetaData().getUserDefinedMetaData();
Map<String,String> userDefinedMetaData = cr.getMetaData().getUserDefinedMetaData(); Map<String,String[]> dc = new HashMap<String,String[]>();
Map<String,String[]> dc = new HashMap<String,String[]>(); for (String sKey : userDefinedMetaData.keySet()) {
for (String sKey : userDefinedMetaData.keySet()) { if (sKey.length()>0) {
if (sKey.length()>0) { String[] sValue = new String[2];
String[] sValue = new String[2]; sValue[0] = userDefinedMetaData.get(sKey);
sValue[0] = userDefinedMetaData.get(sKey); String sNewKey;
String sNewKey; int nDot = sKey.indexOf(".");
int nDot = sKey.indexOf("."); if (nDot>0) {
if (nDot>0) { sNewKey = sKey.substring(0, nDot).toLowerCase();
sNewKey = sKey.substring(0, nDot).toLowerCase(); sValue[1] = sKey.substring(nDot+1);
sValue[1] = sKey.substring(nDot+1); }
} else {
else { sNewKey = sKey.toLowerCase();
sNewKey = sKey.toLowerCase(); sValue[1] = null;
sValue[1] = null; }
} dc.put(sNewKey, sValue);
dc.put(sNewKey, sValue); }
}
// Then export it
String[] sKeys = Misc.sortStringSet(dc.keySet());
for (String sKey : sKeys) {
String sValue = dc.get(sKey)[0];
String sAttributeValue = dc.get(sKey)[1];
if (sKey.startsWith("identifier")) {
Element identifier = appendElement(contentDOM, metadata, "dc:identifier", sValue);
if (!bHasIdentifier) { // The first identifier is the unique ID
identifier.setAttribute("id", "BookId");
sUID = sValue;
}
if (sAttributeValue!=null) {
identifier.setAttribute("opf:scheme", sAttributeValue);
}
bHasIdentifier = true;
}
else if (sKey.startsWith("creator")) {
Element creator = appendElement(contentDOM, metadata, "dc:creator", sValue);
creator.setAttribute("opf:file-as", fileAs(sValue));
if (sAttributeValue!=null) {
creator.setAttribute("opf:role", sAttributeValue);
}
bHasCreator = true;
}
else if (sKey.startsWith("contributor")) {
Element contributor = appendElement(contentDOM, metadata, "dc:contributor", sValue);
contributor.setAttribute("opf:file-as", fileAs(sValue));
if (sAttributeValue!=null) {
contributor.setAttribute("opf:role", sAttributeValue);
} }
} }
// Then export it else if (sKey.startsWith("date")) {
String[] sKeys = Misc.sortStringSet(dc.keySet()); Element date = appendElement(contentDOM, metadata, "dc:date", sValue);
for (String sKey : sKeys) { if (sAttributeValue!=null) {
String sValue = dc.get(sKey)[0]; date.setAttribute("opf:event", sAttributeValue);
String sAttributeValue = dc.get(sKey)[1];
if (sKey.startsWith("identifier")) {
Element identifier = appendElement(contentDOM, metadata, "dc:identifier", sValue);
if (!bHasIdentifier) { // The first identifier is the unique ID
identifier.setAttribute("id", "BookId");
sUID = sValue;
}
if (sAttributeValue!=null) {
identifier.setAttribute("opf:scheme", sAttributeValue);
}
bHasIdentifier = true;
} }
else if (sKey.startsWith("creator")) { bHasDate = true;
Element creator = appendElement(contentDOM, metadata, "dc:creator", sValue); }
creator.setAttribute("opf:file-as", fileAs(sValue)); // Remaining properties must be unique and has not attributes, hence
if (sAttributeValue!=null) { else if (sAttributeValue==null) {
creator.setAttribute("opf:role", sAttributeValue); if ("publisher".equals(sKey)) {
} appendElement(contentDOM, metadata, "dc:publisher", sValue);
bHasCreator = true;
} }
else if (sKey.startsWith("contributor")) { else if ("type".equals(sKey)) {
Element contributor = appendElement(contentDOM, metadata, "dc:contributor", sValue); appendElement(contentDOM, metadata, "dc:type", sValue);
contributor.setAttribute("opf:file-as", fileAs(sValue));
if (sAttributeValue!=null) {
contributor.setAttribute("opf:role", sAttributeValue);
}
} }
else if (sKey.startsWith("date")) { else if ("format".equals(sKey)) {
Element date = appendElement(contentDOM, metadata, "dc:date", sValue); appendElement(contentDOM, metadata, "dc:format", sValue);
if (sAttributeValue!=null) {
date.setAttribute("opf:event", sAttributeValue);
}
bHasDate = true;
} }
// Remaining properties must be unique and has not attributes, hence else if ("source".equals(sKey)) {
else if (sAttributeValue==null) { appendElement(contentDOM, metadata, "dc:source", sValue);
if ("publisher".equals(sKey)) { }
appendElement(contentDOM, metadata, "dc:publisher", sValue); else if ("relation".equals(sKey)) {
} appendElement(contentDOM, metadata, "dc:relation", sValue);
else if ("type".equals(sKey)) { }
appendElement(contentDOM, metadata, "dc:type", sValue); else if ("coverage".equals(sKey)) {
} appendElement(contentDOM, metadata, "dc:coverage", sValue);
else if ("format".equals(sKey)) { }
appendElement(contentDOM, metadata, "dc:format", sValue); else if ("rights".equals(sKey)) {
} appendElement(contentDOM, metadata, "dc:rights", sValue);
else if ("source".equals(sKey)) {
appendElement(contentDOM, metadata, "dc:source", sValue);
}
else if ("relation".equals(sKey)) {
appendElement(contentDOM, metadata, "dc:relation", sValue);
}
else if ("coverage".equals(sKey)) {
appendElement(contentDOM, metadata, "dc:coverage", sValue);
}
else if ("rights".equals(sKey)) {
appendElement(contentDOM, metadata, "dc:rights", sValue);
}
} }
} }
} }
@ -202,15 +198,14 @@ public class OPFWriter extends NewDOMDocument {
identifier.setAttribute("id", "BookId"); identifier.setAttribute("id", "BookId");
identifier.setAttribute("opf:scheme", "UUID"); identifier.setAttribute("opf:scheme", "UUID");
} }
if (bUseDublinCore) { if (!bHasCreator && cr.getMetaData().getCreator().length()>0) {
if (!bHasCreator && cr.getMetaData().getCreator().length()>0) { appendElement(contentDOM, metadata, "dc:creator", cr.getMetaData().getCreator())
appendElement(contentDOM, metadata, "dc:creator", cr.getMetaData().getCreator()); .setAttribute("opf:file-as", fileAs(cr.getMetaData().getCreator()));
} }
if (!bHasDate && cr.getMetaData().getDate().length()>0) { if (!bHasDate && cr.getMetaData().getDate().length()>0) {
// TODO: Support meta:creation-date? // TODO: Support meta:creation-date?
appendElement(contentDOM, metadata, "dc:date", cr.getMetaData().getDate()); appendElement(contentDOM, metadata, "dc:date", cr.getMetaData().getDate());
} }
}
// Manifest must contain references to all the files in the XHTML converter result // Manifest must contain references to all the files in the XHTML converter result
// Spine should contain references to all the master documents within the converter result // Spine should contain references to all the master documents within the converter result

View file

@ -19,58 +19,64 @@
</dlg:combobox> </dlg:combobox>
<dlg:text dlg:id="AuthorsLabel" dlg:tab-index="5" dlg:left="5" dlg:top="50" dlg:width="165" dlg:height="12" dlg:value="Authors"/> <dlg:text dlg:id="AuthorsLabel" dlg:tab-index="5" dlg:left="5" dlg:top="50" dlg:width="165" dlg:height="12" dlg:value="Authors"/>
<dlg:menulist dlg:id="Authors" dlg:tab-index="6" dlg:left="10" dlg:top="62" dlg:width="130" dlg:height="36"/> <dlg:menulist dlg:id="Authors" dlg:tab-index="6" dlg:left="10" dlg:top="62" dlg:width="130" dlg:height="36"/>
<dlg:button dlg:id="AuthorUpButton" dlg:tab-index="7" dlg:left="145" dlg:top="62" dlg:width="25" dlg:height="12" dlg:value="Up"> <dlg:button dlg:id="AuthorUpButton" dlg:tab-index="10" dlg:left="145" dlg:top="62" dlg:width="25" dlg:height="12" dlg:value="Up">
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:AuthorUpClick" script:language="UNO"/> <script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:AuthorUpClick" script:language="UNO"/>
</dlg:button> </dlg:button>
<dlg:button dlg:id="AuthorDownButton" dlg:tab-index="8" dlg:left="145" dlg:top="86" dlg:width="25" dlg:height="12" dlg:value="Down"> <dlg:button dlg:id="AuthorDownButton" dlg:tab-index="11" dlg:left="145" dlg:top="86" dlg:width="25" dlg:height="12" dlg:value="Down">
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:AuthorDownClick" script:language="UNO"/> <script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:AuthorDownClick" script:language="UNO"/>
</dlg:button> </dlg:button>
<dlg:button dlg:id="AddAuthorButton" dlg:tab-index="9" dlg:left="10" dlg:top="100" dlg:width="40" dlg:height="12" dlg:value="Add..."> <dlg:button dlg:id="AddAuthorButton" dlg:tab-index="7" dlg:left="10" dlg:top="100" dlg:width="40" dlg:height="12" dlg:value="Add...">
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:AuthorAddClick" script:language="UNO"/> <script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:AuthorAddClick" script:language="UNO"/>
</dlg:button> </dlg:button>
<dlg:button dlg:id="ModifyAuthorButton" dlg:tab-index="10" dlg:left="55" dlg:top="100" dlg:width="40" dlg:height="12" dlg:value="Modify..."> <dlg:button dlg:id="ModifyAuthorButton" dlg:tab-index="8" dlg:left="55" dlg:top="100" dlg:width="40" dlg:height="12" dlg:value="Modify...">
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:AuthorModifyClick" script:language="UNO"/> <script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:AuthorModifyClick" script:language="UNO"/>
</dlg:button> </dlg:button>
<dlg:button dlg:id="DeleteAuthorButton" dlg:tab-index="11" dlg:left="100" dlg:top="100" dlg:width="40" dlg:height="12" dlg:value="Delete..."> <dlg:button dlg:id="DeleteAuthorButton" dlg:tab-index="9" dlg:left="100" dlg:top="100" dlg:width="40" dlg:height="12" dlg:value="Delete...">
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:AuthorDeleteClick" script:language="UNO"/> <script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:AuthorDeleteClick" script:language="UNO"/>
</dlg:button> </dlg:button>
<dlg:button dlg:id="CommandButton1" dlg:tab-index="12" dlg:left="149" dlg:top="-11" dlg:width="8" dlg:height="0" dlg:value="CommandButton1"/> <dlg:button dlg:id="CommandButton1" dlg:tab-index="32" dlg:left="149" dlg:top="-11" dlg:width="8" dlg:height="0" dlg:value="CommandButton1"/>
<dlg:text dlg:id="DatesLabel" dlg:tab-index="13" dlg:left="5" dlg:top="116" dlg:width="165" dlg:height="12" dlg:value="Dates"/> <dlg:text dlg:id="DatesLabel" dlg:tab-index="33" dlg:left="5" dlg:top="116" dlg:width="165" dlg:height="12" dlg:value="Dates"/>
<dlg:menulist dlg:id="Dates" dlg:tab-index="14" dlg:left="10" dlg:top="128" dlg:width="130" dlg:height="36"/> <dlg:menulist dlg:id="Dates" dlg:tab-index="12" dlg:left="10" dlg:top="128" dlg:width="130" dlg:height="36"/>
<dlg:button dlg:id="AddDateButton" dlg:tab-index="15" dlg:left="10" dlg:top="166" dlg:width="40" dlg:height="12" dlg:value="Add..."> <dlg:button dlg:id="AddDateButton" dlg:tab-index="13" dlg:left="10" dlg:top="166" dlg:width="40" dlg:height="12" dlg:value="Add...">
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:DateAddClick" script:language="UNO"/> <script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:DateAddClick" script:language="UNO"/>
</dlg:button> </dlg:button>
<dlg:button dlg:id="ModifyDateButton" dlg:tab-index="16" dlg:left="55" dlg:top="166" dlg:width="40" dlg:height="12" dlg:value="Modify..."> <dlg:button dlg:id="ModifyDateButton" dlg:tab-index="14" dlg:left="55" dlg:top="166" dlg:width="40" dlg:height="12" dlg:value="Modify...">
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:DateModifyClick" script:language="UNO"/> <script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:DateModifyClick" script:language="UNO"/>
</dlg:button> </dlg:button>
<dlg:button dlg:id="DeleteDateButton" dlg:tab-index="17" dlg:left="100" dlg:top="166" dlg:width="40" dlg:height="12" dlg:value="Delete..."> <dlg:button dlg:id="DeleteDateButton" dlg:tab-index="15" dlg:left="100" dlg:top="166" dlg:width="40" dlg:height="12" dlg:value="Delete...">
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:DateDeleteClick" script:language="UNO"/> <script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:DateDeleteClick" script:language="UNO"/>
</dlg:button> </dlg:button>
<dlg:text dlg:id="PublisherLabel" dlg:tab-index="29" dlg:left="190" dlg:top="84" dlg:width="50" dlg:height="12" dlg:value="Publisher"/> <dlg:text dlg:id="PublisherLabel" dlg:tab-index="34" dlg:left="190" dlg:top="84" dlg:width="50" dlg:height="12" dlg:value="Publisher"/>
<dlg:textfield dlg:id="Publisher" dlg:tab-index="22" dlg:left="245" dlg:top="82" dlg:width="105" dlg:height="12"/> <dlg:textfield dlg:id="Publisher" dlg:tab-index="22" dlg:left="245" dlg:top="82" dlg:width="105" dlg:height="12"/>
<dlg:text dlg:id="TypeLabel" dlg:tab-index="30" dlg:left="190" dlg:top="98" dlg:width="50" dlg:height="12" dlg:value="Type"/> <dlg:text dlg:id="TypeLabel" dlg:tab-index="35" dlg:left="190" dlg:top="98" dlg:width="50" dlg:height="12" dlg:value="Type"/>
<dlg:textfield dlg:id="Type" dlg:tab-index="23" dlg:left="245" dlg:top="96" dlg:width="105" dlg:height="12"/> <dlg:textfield dlg:id="Type" dlg:tab-index="23" dlg:left="245" dlg:top="96" dlg:width="105" dlg:height="12"/>
<dlg:text dlg:id="FormatLabel" dlg:tab-index="31" dlg:left="190" dlg:top="112" dlg:width="50" dlg:height="12" dlg:value="Format"/> <dlg:text dlg:id="FormatLabel" dlg:tab-index="36" dlg:left="190" dlg:top="112" dlg:width="50" dlg:height="12" dlg:value="Format"/>
<dlg:textfield dlg:id="Format" dlg:tab-index="24" dlg:left="245" dlg:top="110" dlg:width="105" dlg:height="12"/> <dlg:textfield dlg:id="Format" dlg:tab-index="24" dlg:left="245" dlg:top="110" dlg:width="105" dlg:height="12"/>
<dlg:text dlg:id="SourceLabel" dlg:tab-index="32" dlg:left="190" dlg:top="126" dlg:width="50" dlg:height="12" dlg:value="Source"/> <dlg:text dlg:id="SourceLabel" dlg:tab-index="37" dlg:left="190" dlg:top="126" dlg:width="50" dlg:height="12" dlg:value="Source"/>
<dlg:textfield dlg:id="Source" dlg:tab-index="25" dlg:left="245" dlg:top="124" dlg:width="105" dlg:height="12"/> <dlg:textfield dlg:id="Source" dlg:tab-index="25" dlg:left="245" dlg:top="124" dlg:width="105" dlg:height="12"/>
<dlg:text dlg:id="RelationLabel" dlg:tab-index="33" dlg:left="190" dlg:top="140" dlg:width="50" dlg:height="12" dlg:value="Relation"/> <dlg:text dlg:id="RelationLabel" dlg:tab-index="38" dlg:left="190" dlg:top="140" dlg:width="50" dlg:height="12" dlg:value="Relation"/>
<dlg:textfield dlg:id="Relation" dlg:tab-index="26" dlg:left="245" dlg:top="138" dlg:width="105" dlg:height="12"/> <dlg:textfield dlg:id="Relation" dlg:tab-index="26" dlg:left="245" dlg:top="138" dlg:width="105" dlg:height="12"/>
<dlg:text dlg:id="CoverageLabel" dlg:tab-index="34" dlg:left="190" dlg:top="154" dlg:width="50" dlg:height="12" dlg:value="Coverage"/> <dlg:text dlg:id="CoverageLabel" dlg:tab-index="39" dlg:left="190" dlg:top="154" dlg:width="50" dlg:height="12" dlg:value="Coverage"/>
<dlg:textfield dlg:id="Coverage" dlg:tab-index="27" dlg:left="245" dlg:top="152" dlg:width="105" dlg:height="12"/> <dlg:textfield dlg:id="Coverage" dlg:tab-index="27" dlg:left="245" dlg:top="152" dlg:width="105" dlg:height="12"/>
<dlg:text dlg:id="RightsLabel" dlg:tab-index="35" dlg:left="190" dlg:top="168" dlg:width="50" dlg:height="12" dlg:value="Rights"/> <dlg:text dlg:id="RightsLabel" dlg:tab-index="40" dlg:left="190" dlg:top="168" dlg:width="50" dlg:height="12" dlg:value="Rights"/>
<dlg:textfield dlg:id="Rights" dlg:tab-index="28" dlg:left="245" dlg:top="166" dlg:width="105" dlg:height="12"/> <dlg:textfield dlg:id="Rights" dlg:tab-index="28" dlg:left="245" dlg:top="166" dlg:width="105" dlg:height="12"/>
<dlg:button dlg:id="OKButton" dlg:tab-index="36" dlg:left="10" dlg:top="195" dlg:width="50" dlg:height="12" dlg:value="OK" dlg:button-type="ok"/> <dlg:button dlg:id="OKButton" dlg:tab-index="29" dlg:left="10" dlg:top="195" dlg:width="50" dlg:height="12" dlg:value="OK" dlg:button-type="ok"/>
<dlg:button dlg:id="CancelButton" dlg:tab-index="37" dlg:left="65" dlg:top="195" dlg:width="50" dlg:height="12" dlg:value="Cancel" dlg:button-type="cancel"/> <dlg:button dlg:id="CancelButton" dlg:tab-index="30" dlg:left="65" dlg:top="195" dlg:width="50" dlg:height="12" dlg:value="Cancel" dlg:button-type="cancel"/>
<dlg:button dlg:id="HelpButton" dlg:tab-index="38" dlg:left="300" dlg:top="195" dlg:width="50" dlg:height="12" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:EpubMetadata" dlg:value="Help" dlg:button-type="help"/> <dlg:button dlg:id="HelpButton" dlg:tab-index="31" dlg:left="300" dlg:top="195" dlg:width="50" dlg:height="12" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:EpubMetadata" dlg:value="Help" dlg:button-type="help"/>
<dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="39" dlg:left="180" dlg:top="9" dlg:width="1" dlg:height="170" dlg:align="vertical"/> <dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="41" dlg:left="180" dlg:top="9" dlg:width="1" dlg:height="170" dlg:align="vertical"/>
<dlg:text dlg:id="TitleLabel" dlg:tab-index="40" dlg:left="190" dlg:top="8" dlg:width="50" dlg:height="12" dlg:value="Title"/> <dlg:text dlg:id="TitleLabel" dlg:tab-index="42" dlg:left="190" dlg:top="8" dlg:width="50" dlg:height="12" dlg:value="Title"/>
<dlg:textfield dlg:id="Title" dlg:tab-index="18" dlg:left="245" dlg:top="6" dlg:width="105" dlg:height="12"/> <dlg:textfield dlg:id="Title" dlg:tab-index="18" dlg:left="245" dlg:top="6" dlg:width="105" dlg:height="12"/>
<dlg:text dlg:id="SubjectLabel" dlg:tab-index="41" dlg:left="190" dlg:top="22" dlg:width="50" dlg:height="12" dlg:value="Subject"/> <dlg:text dlg:id="SubjectLabel" dlg:tab-index="43" dlg:left="190" dlg:top="22" dlg:width="50" dlg:height="12" dlg:value="Subject"/>
<dlg:textfield dlg:id="Subject" dlg:tab-index="19" dlg:left="245" dlg:top="20" dlg:width="105" dlg:height="12"/> <dlg:textfield dlg:id="Subject" dlg:tab-index="19" dlg:left="245" dlg:top="20" dlg:width="105" dlg:height="12"/>
<dlg:text dlg:id="KeywordsLabel" dlg:tab-index="42" dlg:left="190" dlg:top="36" dlg:width="50" dlg:height="12" dlg:value="Keywords"/> <dlg:text dlg:id="KeywordsLabel" dlg:tab-index="44" dlg:left="190" dlg:top="36" dlg:width="50" dlg:height="12" dlg:value="Keywords"/>
<dlg:textfield dlg:id="Keywords" dlg:tab-index="20" dlg:left="245" dlg:top="34" dlg:width="105" dlg:height="12"/> <dlg:textfield dlg:id="Keywords" dlg:tab-index="20" dlg:left="245" dlg:top="34" dlg:width="105" dlg:height="12"/>
<dlg:text dlg:id="DescriptionLabel" dlg:tab-index="43" dlg:left="190" dlg:top="50" dlg:width="50" dlg:height="12" dlg:value="Description"/> <dlg:text dlg:id="DescriptionLabel" dlg:tab-index="45" dlg:left="190" dlg:top="50" dlg:width="50" dlg:height="12" dlg:value="Description"/>
<dlg:textfield dlg:id="Description" dlg:tab-index="21" dlg:left="245" dlg:top="48" dlg:width="105" dlg:height="32" dlg:vscroll="true" dlg:multiline="true"/> <dlg:textfield dlg:id="Description" dlg:tab-index="21" dlg:left="245" dlg:top="48" dlg:width="105" dlg:height="32" dlg:vscroll="true" dlg:multiline="true"/>
<dlg:button dlg:id="DateUpButton" dlg:tab-index="16" dlg:left="145" dlg:top="128" dlg:width="25" dlg:height="12" dlg:value="Up">
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:DateUpClick" script:language="UNO"/>
</dlg:button>
<dlg:button dlg:id="DateDownButton" dlg:tab-index="17" dlg:left="145" dlg:top="152" dlg:width="25" dlg:height="12" dlg:value="Down">
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:DateDownClick" script:language="UNO"/>
</dlg:button>
</dlg:bulletinboard> </dlg:bulletinboard>
</dlg:window> </dlg:window>

View file

@ -21,7 +21,6 @@
<dlg:checkbox dlg:id="OriginalImageSize" dlg:tab-index="13" dlg:left="10" dlg:top="134" dlg:width="155" dlg:height="12" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:EpubOptionsOriginalImageSize" dlg:value="Use original image size" dlg:checked="false"/> <dlg:checkbox dlg:id="OriginalImageSize" dlg:tab-index="13" dlg:left="10" dlg:top="134" dlg:width="155" dlg:height="12" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:EpubOptionsOriginalImageSize" dlg:value="Use original image size" dlg:checked="false"/>
<dlg:text dlg:id="SpecialContentLabel" dlg:tab-index="30" dlg:left="185" dlg:top="8" dlg:width="160" dlg:height="12" dlg:value="Special content"/> <dlg:text dlg:id="SpecialContentLabel" dlg:tab-index="30" dlg:left="185" dlg:top="8" dlg:width="160" dlg:height="12" dlg:value="Special content"/>
<dlg:checkbox dlg:id="Notes" dlg:tab-index="18" dlg:left="190" dlg:top="36" dlg:width="155" dlg:height="12" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:EpubOptionsNotes" dlg:value="Export notes" dlg:checked="true"/> <dlg:checkbox dlg:id="Notes" dlg:tab-index="18" dlg:left="190" dlg:top="36" dlg:width="155" dlg:height="12" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:EpubOptionsNotes" dlg:value="Export notes" dlg:checked="true"/>
<dlg:checkbox dlg:id="UseDublinCore" dlg:tab-index="19" dlg:left="190" dlg:top="50" dlg:width="110" dlg:height="12" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:EpubOptionsUseDublinCore" dlg:value="Export optional document properties" dlg:checked="true"/>
<dlg:text dlg:id="AutoCorrectLabel" dlg:tab-index="31" dlg:left="5" dlg:top="148" dlg:width="160" dlg:height="12" dlg:value="AutoCorrect"/> <dlg:text dlg:id="AutoCorrectLabel" dlg:tab-index="31" dlg:left="5" dlg:top="148" dlg:width="160" dlg:height="12" dlg:value="AutoCorrect"/>
<dlg:checkbox dlg:id="IgnoreHardLineBreaks" dlg:tab-index="14" dlg:left="10" dlg:top="162" dlg:width="155" dlg:height="12" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:EpubOptionsIgnoreHardLineBreaks" dlg:value="Ignore hard line breaks" dlg:checked="false"/> <dlg:checkbox dlg:id="IgnoreHardLineBreaks" dlg:tab-index="14" dlg:left="10" dlg:top="162" dlg:width="155" dlg:height="12" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:EpubOptionsIgnoreHardLineBreaks" dlg:value="Ignore hard line breaks" dlg:checked="false"/>
<dlg:checkbox dlg:id="IgnoreEmptyParagraphs" dlg:tab-index="15" dlg:left="10" dlg:top="176" dlg:width="155" dlg:height="12" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:EpubOptionsIgnoreEmptyParagraphs" dlg:value="Ignore empty paragraphs" dlg:checked="false"/> <dlg:checkbox dlg:id="IgnoreEmptyParagraphs" dlg:tab-index="15" dlg:left="10" dlg:top="176" dlg:width="155" dlg:height="12" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:EpubOptionsIgnoreEmptyParagraphs" dlg:value="Ignore empty paragraphs" dlg:checked="false"/>
@ -90,7 +89,7 @@
</dlg:menulist> </dlg:menulist>
<dlg:text dlg:id="TocLabel" dlg:tab-index="44" dlg:left="185" dlg:top="162" dlg:width="160" dlg:height="12" dlg:value="Navigation table"/> <dlg:text dlg:id="TocLabel" dlg:tab-index="44" dlg:left="185" dlg:top="162" dlg:width="160" dlg:height="12" dlg:value="Navigation table"/>
<dlg:text dlg:id="DocumentDivisionLabel" dlg:tab-index="32" dlg:left="185" dlg:top="64" dlg:width="160" dlg:height="12" dlg:value="Document division"/> <dlg:text dlg:id="DocumentDivisionLabel" dlg:tab-index="32" dlg:left="185" dlg:top="64" dlg:width="160" dlg:height="12" dlg:value="Document division"/>
<dlg:button dlg:id="EditMetadata" dlg:tab-index="20" dlg:left="305" dlg:top="48" dlg:width="40" dlg:height="12" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:EpubOptionsUseCustomMetadata" dlg:value="Edit"> <dlg:button dlg:id="EditMetadata" dlg:tab-index="20" dlg:left="190" dlg:top="48" dlg:width="100" dlg:height="12" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:EpubOptionsUseCustomMetadata" dlg:value="Edit document properties">
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:EditMetadataClick" script:language="UNO"/> <script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:EditMetadataClick" script:language="UNO"/>
</dlg:button> </dlg:button>
</dlg:bulletinboard> </dlg:bulletinboard>

View file

@ -14,13 +14,14 @@
Choose <emph>File - Export - EPUB, Click Edit in the dialog</emph> Choose <emph>File - Export - EPUB, Click Edit in the dialog</emph>
</section> </section>
<paragraph role="paragraph" xml-lang="en-US">The EPUB standard specifies a large number of document properties. <paragraph role="paragraph" xml-lang="en-US">The EPUB standard specifies a large number of document properties.
Not all of these are supported by the OpenDocument standard. Not all of these are supported by the OpenDocument standard.
Writer2xhtml supports the additional properties using user defined document properties. Writer2xhtml supports the additional properties using user defined document properties.
This dialog provides a convenient interface to edit all EPUB document properties, but you can also access all properties This dialog provides a convenient interface to edit all EPUB document properties, but you can also access all properties
using the standard interface in %PRODUCTNAME Writer, that is <emph>File - Properties</emph>. using the standard interface in %PRODUCTNAME Writer, that is <emph>File - Properties</emph>.
Properties that are not required can be left blank. In this case they will not be included in the EPUB document (except the Writer2xhtml will always include the identifier, author(s), date(s) and the title.
title which is always included).</paragraph> Other fields are optional and can be left blank. In this case they will not be included in the EPUB document.</paragraph>
<paragraph role="heading" level="2" xml-lang="en-US">Custom identifier</paragraph> <paragraph role="heading" level="2" xml-lang="en-US">Custom identifier</paragraph>
@ -45,9 +46,11 @@
An author can be either a <emph>creator</emph>, that is a primary author of the publication, or a <emph>contributor</emph>, An author can be either a <emph>creator</emph>, that is a primary author of the publication, or a <emph>contributor</emph>,
that is a party whose contribution to the publication is secondary to the creator(s). that is a party whose contribution to the publication is secondary to the creator(s).
Furthermore an author may have a special role, e.g. <emph>illustrator</emph>. Both properties are specified when you add Furthermore an author may have a special role, e.g. <emph>illustrator</emph>. Both properties are specified when you add
a new authort to the list.</paragraph> a new author to the list.</paragraph>
<paragraph role="paragraph" xml-lang="en-US">Note that some EPUB readers may only present the first creator, hence <paragraph role="paragraph" xml-lang="en-US">Note that some EPUB readers may only present the first creator, hence
the order may be important</paragraph> you should make sure that the primary creator is at the top of the list.</paragraph>
<paragraph role="paragraph" xml-lang="en-US">If you do not add any authors, Writer2xhtml will display and use a default value
for the author.</paragraph>
<paragraph role="heading" level="3" xml-lang="en-US">Add...</paragraph> <paragraph role="heading" level="3" xml-lang="en-US">Add...</paragraph>
<paragraph role="paragraph" xml-lang="en-US">Click this to add new author to the list.</paragraph> <paragraph role="paragraph" xml-lang="en-US">Click this to add new author to the list.</paragraph>
@ -68,6 +71,10 @@
<paragraph role="heading" level="2" xml-lang="en-US">Dates</paragraph> <paragraph role="heading" level="2" xml-lang="en-US">Dates</paragraph>
<paragraph role="paragraph" xml-lang="en-US">An EPUB document can specify one or more dates relating to the publication. <paragraph role="paragraph" xml-lang="en-US">An EPUB document can specify one or more dates relating to the publication.
Each date can be associated with a special event such as creation, publication or modification.</paragraph> Each date can be associated with a special event such as creation, publication or modification.</paragraph>
<paragraph role="paragraph" xml-lang="en-US">Note that some EPUB readers may only present the first date, hence
you should make sure that the primary date is at the top of the list.</paragraph>
<paragraph role="paragraph" xml-lang="en-US">If you do not add any dates, Writer2xhtml will display and use a default value
for the date (date of last modification).</paragraph>
<paragraph role="heading" level="3" xml-lang="en-US">Add...</paragraph> <paragraph role="heading" level="3" xml-lang="en-US">Add...</paragraph>
<paragraph role="paragraph" xml-lang="en-US">Click this to add new date to the list.</paragraph> <paragraph role="paragraph" xml-lang="en-US">Click this to add new date to the list.</paragraph>
@ -78,9 +85,16 @@
<paragraph role="heading" level="3" xml-lang="en-US">Delete...</paragraph> <paragraph role="heading" level="3" xml-lang="en-US">Delete...</paragraph>
<paragraph role="paragraph" xml-lang="en-US">Click this to delete the currently selected date from the list.</paragraph> <paragraph role="paragraph" xml-lang="en-US">Click this to delete the currently selected date from the list.</paragraph>
<paragraph role="heading" level="3" xml-lang="en-US">Up</paragraph>
<paragraph role="paragraph" xml-lang="en-US">Click this to move the currently selected date up one position in the list.</paragraph>
<paragraph role="heading" level="3" xml-lang="en-US">Down</paragraph>
<paragraph role="paragraph" xml-lang="en-US">Click this to move the currently selected date down one position in the list.</paragraph>
<paragraph role="heading" level="2" xml-lang="en-US">Title</paragraph> <paragraph role="heading" level="2" xml-lang="en-US">Title</paragraph>
<paragraph role="paragraph" xml-lang="en-US">The title of the document. This will always be included in the EPUB document, <paragraph role="paragraph" xml-lang="en-US">The title of the document. This will always be included in the EPUB
even if you have not selected <emph>Export optional document properties.</emph></paragraph> document.</paragraph>
<paragraph role="heading" level="2" xml-lang="en-US">Subject</paragraph> <paragraph role="heading" level="2" xml-lang="en-US">Subject</paragraph>
<paragraph role="paragraph" xml-lang="en-US">The subject of the document</paragraph> <paragraph role="paragraph" xml-lang="en-US">The subject of the document</paragraph>