diff --git a/build.xml b/build.xml index 7ff5dca..2a9a04d 100644 --- a/build.xml +++ b/build.xml @@ -2,7 +2,7 @@ ############################################################################ # This is the Ant build file for writer2latex # Original: Sep 2004 (mgn) - # version 1.6 (2014-11-10) + # version 1.6 (2014-11-24) ############################################################################ --> @@ -49,6 +49,7 @@ + @@ -58,7 +59,7 @@ files="unoil.jar"/> + files="${org.json},${org.jbibtex}"/> @@ -78,7 +79,7 @@ encoding="us-ascii" source="1.6" target="1.6" - classpath="${source.lib}/${org.json}" + classpath="${source.lib}/${org.json}:${source.lib}/${org.jbibtex}" bootclasspath="${JAVA6_RT_JAR}" includeantruntime="false" debug="on"> @@ -142,7 +143,7 @@ - + diff --git a/source/distro/changelog.txt b/source/distro/changelog.txt index e667895..82e6d63 100644 --- a/source/distro/changelog.txt +++ b/source/distro/changelog.txt @@ -2,7 +2,8 @@ Changelog for Writer2LaTeX version 1.4 -> 1.6 ---------- version 1.5.2 ---------- -[w2x] Bugfix: No longer include xmlns attribute on math nodes in HTML5 +[w2l] New BibTeX dialog to insert a bibliographic reference to a BibTeX file. The BibTeX files are located as defined + in the configuration, and the reference is inserted as an ordinary reference mark. [w2l] Various improvements to the log viewer dialog: Reduced height to better accommodate small screen resolutions. Added checkbox to filter the LaTeX log to display only errors. Added help page and long tips. diff --git a/source/java/org/openoffice/da/comp/writer2latex/BibTeXDialog.java b/source/java/org/openoffice/da/comp/writer2latex/BibTeXDialog.java new file mode 100644 index 0000000..696bf54 --- /dev/null +++ b/source/java/org/openoffice/da/comp/writer2latex/BibTeXDialog.java @@ -0,0 +1,86 @@ +/************************************************************************ + * + * BibTeXDialog.java + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * Copyright: 2002-2014 by Henrik Just + * + * All Rights Reserved. + * + * Version 1.6 (2014-12-11) + * + */ + +package org.openoffice.da.comp.writer2latex; + +import com.sun.star.awt.XDialog; +import com.sun.star.uno.XComponentContext; + +import org.openoffice.da.comp.w2lcommon.helper.DialogBase; + +/** This class provides a UNO dialog to insert a BibTeX bibliographic reference + */ +public class BibTeXDialog extends DialogBase { + //implements com.sun.star.lang.XInitialization { + + /** The component will be registered under this name. + */ + public static String __serviceName = "org.openoffice.da.writer2latex.BibTeXDialog"; + + /** The component should also have an implementation name. + */ + public static String __implementationName = "org.openoffice.da.comp.writer2latex.BibTeXDialog"; + + /** Return the name of the library containing the dialog + */ + public String getDialogLibraryName() { + return "W4LDialogs"; + } + + /** Return the name of the dialog within the library + */ + public String getDialogName() { + return "BibTeXEntry"; + } + + public void initialize() { + } + + public void endDialog() { + } + + /** Create a new BibTeXDialog */ + public BibTeXDialog(XComponentContext xContext) { + super(xContext); + } + + // Implement com.sun.star.lang.XInitialization + /*public void initialize( Object[] object ) + throws com.sun.star.uno.Exception { + }*/ + + // Implement XDialogEventHandler + public boolean callHandlerMethod(XDialog xDialog, Object event, String sMethod) { + return true; + } + + public String[] getSupportedMethodNames() { + String[] sNames = { }; + return sNames; + } + + +} \ No newline at end of file diff --git a/source/java/org/openoffice/da/comp/writer2latex/BibTeXReader.java b/source/java/org/openoffice/da/comp/writer2latex/BibTeXReader.java new file mode 100644 index 0000000..d9141a4 --- /dev/null +++ b/source/java/org/openoffice/da/comp/writer2latex/BibTeXReader.java @@ -0,0 +1,141 @@ +/************************************************************************ + * + * BibTeXReader.java + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * Copyright: 2002-2014 by Henrik Just + * + * All Rights Reserved. + * + * Version 1.6 (2014-11-24) + * + */ + +package org.openoffice.da.comp.writer2latex; + +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.jbibtex.BibTeXDatabase; +import org.jbibtex.BibTeXEntry; +import org.jbibtex.BibTeXParser; +import org.jbibtex.BibTeXString; +import org.jbibtex.Key; +import org.jbibtex.LaTeXParser; +import org.jbibtex.LaTeXPrinter; +import org.jbibtex.ParseException; +import org.jbibtex.Value; + +import writer2latex.bibtex.BibTeXEntryMap; +import writer2latex.office.BibMark; +import writer2latex.office.BibMark.EntryType; + +/** + * The class reads the contents of a BibTeX file and makes it available as a map + * of ODF BibMark objects + */ +public class BibTeXReader { + + private Map entries; + + /** + * Construct a new BibTeXReader based on a file + * + * @param file the file to read + * @throws IOException if any error occurs reading the file + * @throws ParseException if any error occurs interpreting the contents of the file + */ + public BibTeXReader(File file) throws IOException, ParseException { + BibTeXDatabase database = parseBibTeX(file); + readEntries(database); + } + + /** Get the entries of this BibTeX file + * + * @return the entries + */ + public Map getEntries() { + return entries; + } + + private static BibTeXDatabase parseBibTeX(File file) throws IOException, ParseException { + Reader reader = new FileReader(file); + try { + BibTeXParser parser = new BibTeXParser() { + @Override + public void checkStringResolution(Key key, BibTeXString string) { + if (string == null) { + System.err.println("Unresolved string: \"" + key.getValue() + "\""); + } + } + + @Override + public void checkCrossReferenceResolution(Key key, + BibTeXEntry entry) { + if (entry == null) { + System.err.println("Unresolved cross-reference: \"" + key.getValue() + "\""); + } + } + }; + return parser.parse(reader); + } finally { + reader.close(); + } + } + + private void readEntries(BibTeXDatabase database) throws IOException { + entries = new HashMap(); + Map entryMap = database.getEntries(); + + Collection bibentries = entryMap.values(); + for (BibTeXEntry bibentry : bibentries) { + String sKey = bibentry.getKey().toString(); + String sType = bibentry.getType().toString(); + BibMark entry = new BibMark(sKey,sType); + entries.put(sKey, entry); + + Map fields = bibentry.getFields(); + for (Key key : fields.keySet()) { + Value value = fields.get(key); + EntryType entryType = BibTeXEntryMap.getEntryType(key.getValue()); + if (entryType!=null) { + entry.setField(entryType, parseLaTeX(value.toUserString())); + } + } + } + } + + private static String parseLaTeX(String string) throws IOException { + Reader reader = new StringReader(string); + try { + LaTeXParser parser = new LaTeXParser(); + LaTeXPrinter printer = new LaTeXPrinter(); + return printer.print(parser.parse(reader)); + } catch (ParseException e) { + // If parsing fails, return the original string + return string; + } finally { + reader.close(); + } + } + +} \ No newline at end of file diff --git a/source/java/org/openoffice/da/comp/writer2latex/W2LRegistration.java b/source/java/org/openoffice/da/comp/writer2latex/W2LRegistration.java index dc4198e..de678a3 100644 --- a/source/java/org/openoffice/da/comp/writer2latex/W2LRegistration.java +++ b/source/java/org/openoffice/da/comp/writer2latex/W2LRegistration.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.4 (2014-10-29) + * Version 1.6 (2014-12-11) * */ @@ -120,6 +120,12 @@ public class W2LRegistration { multiFactory, regKey); } + else if (implName.equals(BibTeXDialog.__implementationName) ) { + xSingleServiceFactory = FactoryHelper.getServiceFactory(BibTeXDialog.class, + BibTeXDialog.__serviceName, + multiFactory, + regKey); + } return xSingleServiceFactory; } @@ -153,7 +159,8 @@ public class W2LRegistration { FactoryHelper.writeRegistryServiceInfo(BibliographyDialog.__implementationName, BibliographyDialog.__serviceName, regKey) & FactoryHelper.writeRegistryServiceInfo(LogViewerDialog.__implementationName, - LogViewerDialog.__serviceName, regKey); + LogViewerDialog.__serviceName, regKey) & + FactoryHelper.writeRegistryServiceInfo(BibTeXDialog.__implementationName, + BibTeXDialog.__serviceName, regKey); } } - diff --git a/source/java/org/openoffice/da/comp/writer2latex/Writer2LaTeX.java b/source/java/org/openoffice/da/comp/writer2latex/Writer2LaTeX.java index 8718d9e..97e1b45 100644 --- a/source/java/org/openoffice/da/comp/writer2latex/Writer2LaTeX.java +++ b/source/java/org/openoffice/da/comp/writer2latex/Writer2LaTeX.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.6 (2014-11-03) + * Version 1.6 (2014-12-11) * */ @@ -34,7 +34,6 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; import org.openoffice.da.comp.w2lcommon.filter.UNOPublisher.TargetFormat; -import org.openoffice.da.comp.w2lcommon.helper.MessageBox; /** This class implements the ui (dispatch) commands provided by the Writer2LaTeX toolbar. * The actual processing is done by the core classes UNOPublisher, @@ -176,8 +175,19 @@ public final class Writer2LaTeX extends WeakBase } private void insertBibTeX() { - MessageBox msgBox = new MessageBox(m_xContext, m_xFrame); - msgBox.showMessage("Writer2LaTeX","This feature is not implemented yet"); + // Execute the BibTeX dialog + try { + Object dialog = m_xContext.getServiceManager() + .createInstanceWithContext( + "org.openoffice.da.writer2latex.BibTeXDialog", m_xContext); + XExecutableDialog xDialog = (XExecutableDialog) + UnoRuntime.queryInterface(XExecutableDialog.class, dialog); + if (xDialog.execute()==ExecutableDialogResults.OK) { + // Closed with the close button + } + } + catch (com.sun.star.uno.Exception e) { + } } private void createUNOPublisher() { diff --git a/source/java/writer2latex/bibtex/BibTeXDocument.java b/source/java/writer2latex/bibtex/BibTeXDocument.java index 101e49d..89affd9 100644 --- a/source/java/writer2latex/bibtex/BibTeXDocument.java +++ b/source/java/writer2latex/bibtex/BibTeXDocument.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.4 (2014-08-26) + * Version 1.6 (2014-11-28) * */ @@ -39,8 +39,8 @@ import writer2latex.latex.LaTeXConfig; import writer2latex.latex.i18n.ClassicI18n; import writer2latex.latex.i18n.I18n; import writer2latex.util.ExportNameCollection; -//import writer2latex.util.Misc; import writer2latex.office.BibMark; +import writer2latex.office.BibMark.EntryType;; /** *

Class representing a BibTeX document.

@@ -126,15 +126,15 @@ public class BibTeXDocument implements OutputFile { osw.write("{"); osw.write(exportNames.getExportName(entry.getIdentifier())); osw.write(",\n"); - for (int i=0; i Return BibTeX name of field

- */ - public static final String getFieldName(int nField) { - switch (nField) { - case BibMark.ADDRESS: return "address"; - case BibMark.ANNOTE: return "annote"; - case BibMark.AUTHOR: return "author"; - case BibMark.BOOKTITLE: return "booktitle"; - case BibMark.CHAPTER: return "chapter"; - // case BibMark.CROSSREF: return "croosref"; // not in OOo - case BibMark.EDITION: return "edition"; - case BibMark.EDITOR: return "editor"; - case BibMark.HOWPUBLISHED: return "howpublished"; - case BibMark.INSTITUTION: return "institution"; - case BibMark.JOURNAL: return "journal"; - // case BibMark.KEY: return "key"; // not in OOo - case BibMark.MONTH: return "month"; - case BibMark.NOTE: return "note"; - case BibMark.NUMBER: return "number"; - case BibMark.ORGANIZATIONS: return "organization"; - case BibMark.PAGES: return "pages"; - case BibMark.PUBLISHER: return "publisher"; - case BibMark.SCHOOL: return "school"; - case BibMark.SERIES: return "series"; - case BibMark.TITLE: return "title"; - case BibMark.REPORT_TYPE: return "type"; - case BibMark.VOLUME: return "volume"; - case BibMark.YEAR: return "year"; - case BibMark.URL: return "url"; - case BibMark.CUSTOM1: return "custom1"; - case BibMark.CUSTOM2: return "custom2"; - case BibMark.CUSTOM3: return "custom3"; - case BibMark.CUSTOM4: return "custom4"; - case BibMark.CUSTOM5: return "custom5"; - case BibMark.ISBN: return "isbn"; - default: return null; - } - } - - /* *

Check if this entry exists

*/ diff --git a/source/java/writer2latex/bibtex/BibTeXEntryMap.java b/source/java/writer2latex/bibtex/BibTeXEntryMap.java new file mode 100644 index 0000000..e3ebf28 --- /dev/null +++ b/source/java/writer2latex/bibtex/BibTeXEntryMap.java @@ -0,0 +1,109 @@ +/************************************************************************ + * + * BibTeXEntryMap.java + * + * This library is free software); you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY); without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * Copyright: 2002-2014 by Henrik Just + * + * All Rights Reserved. + * + * Version 1.6 (2014-11-28) + * + */ +package writer2latex.bibtex; + +import java.util.HashMap; +import java.util.Map; + +import writer2latex.office.BibMark.EntryType; + +/** + * This class provides static methods to map the the entry types of an ODF + * bibliography mark to and from BibTeX field names + * + */ +public class BibTeXEntryMap { + private static Map bibTeXFields = null; + private static Map entryTypes = null; + + private static void createMaps() { + // Note the BibTeX fileds key and crossref are not supported in ODF + bibTeXFields = new HashMap(); + bibTeXFields.put(EntryType.address, "address"); + bibTeXFields.put(EntryType.annote, "annote"); + bibTeXFields.put(EntryType.author, "author"); + bibTeXFields.put(EntryType.booktitle, "booktitle"); + bibTeXFields.put(EntryType.chapter, "chapter"); + bibTeXFields.put(EntryType.edition, "edition"); + bibTeXFields.put(EntryType.editor, "editor"); + bibTeXFields.put(EntryType.howpublished, "howpublished"); + bibTeXFields.put(EntryType.institution, "institution"); + bibTeXFields.put(EntryType.journal, "journal"); + bibTeXFields.put(EntryType.month, "month"); + bibTeXFields.put(EntryType.note, "note"); + bibTeXFields.put(EntryType.number, "number"); + bibTeXFields.put(EntryType.organizations, "organization"); + bibTeXFields.put(EntryType.pages, "pages"); + bibTeXFields.put(EntryType.publisher, "publisher"); + bibTeXFields.put(EntryType.school, "school"); + bibTeXFields.put(EntryType.series, "series"); + bibTeXFields.put(EntryType.title, "title"); + bibTeXFields.put(EntryType.report_type, "type"); + bibTeXFields.put(EntryType.volume, "volume"); + bibTeXFields.put(EntryType.year, "year"); + bibTeXFields.put(EntryType.url, "url"); + bibTeXFields.put(EntryType.custom1, "custom1"); + bibTeXFields.put(EntryType.custom2, "custom2"); + bibTeXFields.put(EntryType.custom3, "custom3"); + bibTeXFields.put(EntryType.custom4, "custom4"); + bibTeXFields.put(EntryType.custom5, "custom5"); + bibTeXFields.put(EntryType.isbn, "isbn"); + + entryTypes = new HashMap(); + for (EntryType entryType : bibTeXFields.keySet()) { + entryTypes.put(bibTeXFields.get(entryType), entryType); + } + } + + /** + * Return BibTeX field name corresponding to and entry type + * + * @param entryType + * the entry type + * @return the BibTeX field name, or null if there is no corresponding + * BibTeX field + */ + public static final String getFieldName(EntryType entryType) { + if (bibTeXFields == null) { + createMaps(); + } + return bibTeXFields.containsKey(entryType) ? bibTeXFields.get(entryType) : null; + } + + /** + * Return entry type corresponding to a BibTeX field + * + * @param sFieldName + * the BibTeX field name + * @return the entry type, or null if there is no corresponding entry type + */ + public static final EntryType getEntryType(String sFieldName) { + if (bibTeXFields == null) { + createMaps(); + } + return entryTypes.containsKey(sFieldName) ? entryTypes.get(sFieldName) : null; + } +} diff --git a/source/java/writer2latex/office/BibMark.java b/source/java/writer2latex/office/BibMark.java index ce3426f..dfdc51e 100644 --- a/source/java/writer2latex/office/BibMark.java +++ b/source/java/writer2latex/office/BibMark.java @@ -16,76 +16,54 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * - * Copyright: 2002-2008 by Henrik Just + * Copyright: 2002-2014 by Henrik Just * * All Rights Reserved. * - * Version 1.0 (2008-11-22) + * Version 1.6 (2014-11-24) * */ package writer2latex.office; +import java.util.HashMap; +import java.util.Map; + import org.w3c.dom.Node; +import writer2latex.util.Misc; -import writer2latex.util.*; -//import writer2latex.office.*; - -/** - *

This class represents a single bibliography-mark.

+/** This class represents a single bibliography-mark in an ODF document */ public final class BibMark { - // Available fields - public static final int ADDRESS = 0; - public static final int ANNOTE = 1; - public static final int AUTHOR = 2; - public static final int BOOKTITLE = 3; - public static final int CHAPTER = 4; - // public static final int CROSSREF = 5; // BibTeX, missing in OOo - public static final int EDITION = 6; - public static final int EDITOR = 7; - public static final int HOWPUBLISHED = 8; - public static final int INSTITUTION = 9; - public static final int JOURNAL = 10; - // public static final int KEY = 11; // BibTeX, missing in OOo - public static final int MONTH = 12; - public static final int NOTE = 13; - public static final int NUMBER = 14; - public static final int ORGANIZATIONS = 15; // BibTeX: organization - public static final int PAGES = 16; - public static final int PUBLISHER = 17; - public static final int SCHOOL = 18; - public static final int SERIES = 19; - public static final int TITLE = 20 ; - public static final int REPORT_TYPE = 21; // BibTeX: report - public static final int VOLUME = 22; - public static final int YEAR = 23; - // remaining fields are not standard in BibTeX - public static final int URL = 24; - public static final int CUSTOM1 = 25; - public static final int CUSTOM2 = 26; - public static final int CUSTOM3 = 27; - public static final int CUSTOM4 = 28; - public static final int CUSTOM5 = 29; - public static final int ISBN = 30; - public static final int FIELD_COUNT = 31; + /** Entry types in an ODF bibliography marks. These are more or less modeled on BibTeX with + * the following exceptions: organizations is organization in BibTeX, report_type is report in BibTeX, + * the BibTeX fields crossref and key are missing in ODF, the ODF fields + * url, custom1, custom2, custom3, custom4, custom5, isbn are not standard in BibTeX + * + */ + public enum EntryType { address, annote, author, booktitle, chapter, + edition, editor, howpublished, institution, journal, month, + note, number, organizations, pages, publisher, school, series, + title, report_type, volume, year, + url, custom1, custom2, custom3, custom4, custom5, isbn + } - // Private data + // The data of the bibliography mark private String sIdentifier; private String sEntryType; - private String[] fields = new String[FIELD_COUNT]; + private Map fields = new HashMap(); - /** - *

Create a new BibMark from scratch.

+ /** Create a new BibMark from scratch. + * @param sIdentifier the unique identifier for this BibMark + * @param sEntryType the type of entry such as book or article */ public BibMark(String sIdentifier, String sEntryType) { this.sIdentifier = sIdentifier; this.sEntryType = sEntryType; } - /** - *

Create a new BibMark from a text:bibliography-mark node.

+ /** Create a new BibMark from a text:bibliography-mark node. */ public BibMark(Node node) { sIdentifier = Misc.getAttribute(node,XMLString.TEXT_IDENTIFIER); @@ -93,54 +71,62 @@ public final class BibMark { if (sEntryType==null) { // bug in OOo 1.0! sEntryType = Misc.getAttribute(node,XMLString.TEXT_BIBILIOGRAPHIC_TYPE); } - fields[ADDRESS] = Misc.getAttribute(node,XMLString.TEXT_ADDRESS); - fields[ANNOTE] = Misc.getAttribute(node,XMLString.TEXT_ANNOTE); - fields[AUTHOR] = Misc.getAttribute(node,XMLString.TEXT_AUTHOR); - fields[BOOKTITLE] = Misc.getAttribute(node,XMLString.TEXT_BOOKTITLE); - fields[CHAPTER] = Misc.getAttribute(node,XMLString.TEXT_CHAPTER); - fields[EDITION] = Misc.getAttribute(node,XMLString.TEXT_EDITION); - fields[EDITOR] = Misc.getAttribute(node,XMLString.TEXT_EDITOR); - fields[HOWPUBLISHED] = Misc.getAttribute(node,XMLString.TEXT_HOWPUBLISHED); - fields[INSTITUTION] = Misc.getAttribute(node,XMLString.TEXT_INSTITUTION); - fields[JOURNAL] = Misc.getAttribute(node,XMLString.TEXT_JOURNAL); - fields[MONTH] = Misc.getAttribute(node,XMLString.TEXT_MONTH); - fields[NOTE] = Misc.getAttribute(node,XMLString.TEXT_NOTE); - fields[NUMBER] = Misc.getAttribute(node,XMLString.TEXT_NUMBER); - fields[ORGANIZATIONS] = Misc.getAttribute(node,XMLString.TEXT_ORGANIZATIONS); - fields[PAGES] = Misc.getAttribute(node,XMLString.TEXT_PAGES); - fields[PUBLISHER] = Misc.getAttribute(node,XMLString.TEXT_PUBLISHER); - fields[SCHOOL] = Misc.getAttribute(node,XMLString.TEXT_SCHOOL); - fields[SERIES] = Misc.getAttribute(node,XMLString.TEXT_SERIES); - fields[TITLE] = Misc.getAttribute(node,XMLString.TEXT_TITLE); - fields[REPORT_TYPE] = Misc.getAttribute(node,XMLString.TEXT_REPORT_TYPE); - fields[VOLUME] = Misc.getAttribute(node,XMLString.TEXT_VOLUME); - fields[YEAR] = Misc.getAttribute(node,XMLString.TEXT_YEAR); - fields[URL] = Misc.getAttribute(node,XMLString.TEXT_URL); - fields[CUSTOM1] = Misc.getAttribute(node,XMLString.TEXT_CUSTOM1); - fields[CUSTOM2] = Misc.getAttribute(node,XMLString.TEXT_CUSTOM2); - fields[CUSTOM3] = Misc.getAttribute(node,XMLString.TEXT_CUSTOM3); - fields[CUSTOM4] = Misc.getAttribute(node,XMLString.TEXT_CUSTOM4); - fields[CUSTOM5] = Misc.getAttribute(node,XMLString.TEXT_CUSTOM5); - fields[ISBN] = Misc.getAttribute(node,XMLString.TEXT_ISBN); + fields.put(EntryType.address, Misc.getAttribute(node,XMLString.TEXT_ADDRESS)); + fields.put(EntryType.annote, Misc.getAttribute(node,XMLString.TEXT_ANNOTE)); + fields.put(EntryType.author, Misc.getAttribute(node,XMLString.TEXT_AUTHOR)); + fields.put(EntryType.booktitle, Misc.getAttribute(node,XMLString.TEXT_BOOKTITLE)); + fields.put(EntryType.chapter, Misc.getAttribute(node,XMLString.TEXT_CHAPTER)); + fields.put(EntryType.edition, Misc.getAttribute(node,XMLString.TEXT_EDITION)); + fields.put(EntryType.editor, Misc.getAttribute(node,XMLString.TEXT_EDITOR)); + fields.put(EntryType.howpublished, Misc.getAttribute(node,XMLString.TEXT_HOWPUBLISHED)); + fields.put(EntryType.institution, Misc.getAttribute(node,XMLString.TEXT_INSTITUTION)); + fields.put(EntryType.journal, Misc.getAttribute(node,XMLString.TEXT_JOURNAL)); + fields.put(EntryType.month, Misc.getAttribute(node,XMLString.TEXT_MONTH)); + fields.put(EntryType.note, Misc.getAttribute(node,XMLString.TEXT_NOTE)); + fields.put(EntryType.number, Misc.getAttribute(node,XMLString.TEXT_NUMBER)); + fields.put(EntryType.organizations, Misc.getAttribute(node,XMLString.TEXT_ORGANIZATIONS)); + fields.put(EntryType.pages, Misc.getAttribute(node,XMLString.TEXT_PAGES)); + fields.put(EntryType.publisher, Misc.getAttribute(node,XMLString.TEXT_PUBLISHER)); + fields.put(EntryType.school, Misc.getAttribute(node,XMLString.TEXT_SCHOOL)); + fields.put(EntryType.series, Misc.getAttribute(node,XMLString.TEXT_SERIES)); + fields.put(EntryType.title, Misc.getAttribute(node,XMLString.TEXT_TITLE)); + fields.put(EntryType.report_type, Misc.getAttribute(node,XMLString.TEXT_REPORT_TYPE)); + fields.put(EntryType.volume, Misc.getAttribute(node,XMLString.TEXT_VOLUME)); + fields.put(EntryType.year, Misc.getAttribute(node,XMLString.TEXT_YEAR)); + fields.put(EntryType.url, Misc.getAttribute(node,XMLString.TEXT_URL)); + fields.put(EntryType.custom1, Misc.getAttribute(node,XMLString.TEXT_CUSTOM1)); + fields.put(EntryType.custom2, Misc.getAttribute(node,XMLString.TEXT_CUSTOM2)); + fields.put(EntryType.custom3, Misc.getAttribute(node,XMLString.TEXT_CUSTOM3)); + fields.put(EntryType.custom4, Misc.getAttribute(node,XMLString.TEXT_CUSTOM4)); + fields.put(EntryType.custom5, Misc.getAttribute(node,XMLString.TEXT_CUSTOM5)); + fields.put(EntryType.isbn, Misc.getAttribute(node,XMLString.TEXT_ISBN)); } - /** - *

Get the identifier.

+ /** Get the identifier. + * + * @return the unique identifier of this BibMark */ public String getIdentifier() { return sIdentifier; } - /** - *

Get the entry type.

+ /** Get the entry type. + * + * @return the entry type of this BibMark */ public String getEntryType() { return sEntryType; } - /** - *

Set a specific field.

+ /** Set a specific field. + * + * @param entryType the type of field to set + * @param sValue the new value of the field */ - public void setField(int nField,String sValue) { fields[nField] = sValue; } + public void setField(EntryType entryType,String sValue) { fields.put(entryType, sValue); } - /** - *

Return a specific field.

+ /** Return a specific field. + * + * @param entryType the type of the field to get + * @return the value of the field, or null if the field is not set */ - public String getField(int nField) { return fields[nField]; } + public String getField(EntryType entryType) { + return fields.containsKey(entryType) ? fields.get(entryType) : null; + } } \ No newline at end of file diff --git a/source/java/writer2latex/xhtml/MathConverter.java b/source/java/writer2latex/xhtml/MathConverter.java index 0028f40..2dd1b31 100644 --- a/source/java/writer2latex/xhtml/MathConverter.java +++ b/source/java/writer2latex/xhtml/MathConverter.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.4 (2014-09-16) + * Version 1.4 (2014-11-24) * */ diff --git a/source/lib/jbibtex-1.0.14.jar b/source/lib/jbibtex-1.0.14.jar new file mode 100644 index 0000000..7c41fab Binary files /dev/null and b/source/lib/jbibtex-1.0.14.jar differ diff --git a/source/oxt/writer2latex/W4LDialogs/BibTeXEntry.xdl b/source/oxt/writer2latex/W4LDialogs/BibTeXEntry.xdl new file mode 100644 index 0000000..aff8a93 --- /dev/null +++ b/source/oxt/writer2latex/W4LDialogs/BibTeXEntry.xdl @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/oxt/writer2latex/W4LDialogs/dialog.xlb b/source/oxt/writer2latex/W4LDialogs/dialog.xlb index 073ea2a..166d19d 100644 --- a/source/oxt/writer2latex/W4LDialogs/dialog.xlb +++ b/source/oxt/writer2latex/W4LDialogs/dialog.xlb @@ -6,4 +6,5 @@ + \ No newline at end of file