JabRef support
git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@85 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
parent
905918aaf2
commit
22c38c3ff4
11 changed files with 385 additions and 202 deletions
|
@ -2,8 +2,11 @@ Changelog for Writer2LaTeX version 1.0 -> 1.2
|
||||||
|
|
||||||
---------- version 1.1.6 ----------
|
---------- version 1.1.6 ----------
|
||||||
|
|
||||||
|
[w2l] New option use_natbib (default false) to use natbib.sty. This implies that natbib.sty is no longer loaded automatically
|
||||||
|
if Zotero or JabRef support is enabled
|
||||||
|
|
||||||
[w4l] Bibliography options page has been reworked to include JabRef support and unify BibTeX directory (which is now allowed
|
[w4l] Bibliography options page has been reworked to include JabRef support and unify BibTeX directory (which is now allowed
|
||||||
to contain special characters like spaces)
|
to contain special characters like spaces and can be relative to the the document directory)
|
||||||
|
|
||||||
[w2l] Added support for JabRef reference marks: A new option jabref_bibtex_files has been added to give the names of
|
[w2l] Added support for JabRef reference marks: A new option jabref_bibtex_files has been added to give the names of
|
||||||
the BibTeX files from JabRef
|
the BibTeX files from JabRef
|
||||||
|
|
Binary file not shown.
|
@ -20,7 +20,7 @@
|
||||||
*
|
*
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Version 1.2 (2011-01-24)
|
* Version 1.2 (2011-01-28)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -35,8 +35,12 @@ import com.sun.star.awt.XContainerWindowEventHandler;
|
||||||
import com.sun.star.awt.XDialog;
|
import com.sun.star.awt.XDialog;
|
||||||
import com.sun.star.awt.XWindow;
|
import com.sun.star.awt.XWindow;
|
||||||
import com.sun.star.beans.XPropertySet;
|
import com.sun.star.beans.XPropertySet;
|
||||||
|
import com.sun.star.frame.XDesktop;
|
||||||
|
import com.sun.star.frame.XModel;
|
||||||
|
import com.sun.star.lang.XComponent;
|
||||||
import com.sun.star.lang.XServiceInfo;
|
import com.sun.star.lang.XServiceInfo;
|
||||||
import com.sun.star.uno.AnyConverter;
|
import com.sun.star.uno.AnyConverter;
|
||||||
|
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.XChangesBatch;
|
import com.sun.star.util.XChangesBatch;
|
||||||
|
@ -45,9 +49,13 @@ import com.sun.star.lib.uno.helper.WeakBase;
|
||||||
|
|
||||||
import org.openoffice.da.comp.w2lcommon.helper.DialogAccess;
|
import org.openoffice.da.comp.w2lcommon.helper.DialogAccess;
|
||||||
import org.openoffice.da.comp.w2lcommon.helper.FolderPicker;
|
import org.openoffice.da.comp.w2lcommon.helper.FolderPicker;
|
||||||
|
import org.openoffice.da.comp.w2lcommon.helper.MessageBox;
|
||||||
import org.openoffice.da.comp.w2lcommon.helper.RegistryHelper;
|
import org.openoffice.da.comp.w2lcommon.helper.RegistryHelper;
|
||||||
import org.openoffice.da.comp.w2lcommon.helper.XPropertySetHelper;
|
import org.openoffice.da.comp.w2lcommon.helper.XPropertySetHelper;
|
||||||
|
|
||||||
|
import writer2latex.util.CSVList;
|
||||||
|
import writer2latex.util.Misc;
|
||||||
|
|
||||||
/** This class provides a uno component which implements the configuration
|
/** This class provides a uno component which implements the configuration
|
||||||
* of the bibliography in Writer4LaTeX.
|
* of the bibliography in Writer4LaTeX.
|
||||||
*/
|
*/
|
||||||
|
@ -85,9 +93,6 @@ public final class BibliographyDialog
|
||||||
if (sMethod.equals("external_event") ){
|
if (sMethod.equals("external_event") ){
|
||||||
return handleExternalEvent(dlg, event);
|
return handleExternalEvent(dlg, event);
|
||||||
}
|
}
|
||||||
else if (sMethod.equals("BibTeXDirClick")) {
|
|
||||||
return bibTeXDirClick(dlg);
|
|
||||||
}
|
|
||||||
else if (sMethod.equals("ConvertZoteroCitationsChange")) {
|
else if (sMethod.equals("ConvertZoteroCitationsChange")) {
|
||||||
return convertZoteroCitationsChange(dlg);
|
return convertZoteroCitationsChange(dlg);
|
||||||
}
|
}
|
||||||
|
@ -97,6 +102,15 @@ public final class BibliographyDialog
|
||||||
else if (sMethod.equals("UseExternalBibTeXFilesChange")) {
|
else if (sMethod.equals("UseExternalBibTeXFilesChange")) {
|
||||||
return useExternalBibTeXFilesChange(dlg);
|
return useExternalBibTeXFilesChange(dlg);
|
||||||
}
|
}
|
||||||
|
else if (sMethod.equals("UseNatbibChange")) {
|
||||||
|
return useNatbibChange(dlg);
|
||||||
|
}
|
||||||
|
else if (sMethod.equals("BibTeXLocationChange")) {
|
||||||
|
return bibTeXLocationChange(dlg);
|
||||||
|
}
|
||||||
|
else if (sMethod.equals("BibTeXDirClick")) {
|
||||||
|
return bibTeXDirClick(dlg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (com.sun.star.uno.RuntimeException e) {
|
catch (com.sun.star.uno.RuntimeException e) {
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -109,7 +123,7 @@ public final class BibliographyDialog
|
||||||
|
|
||||||
public String[] getSupportedMethodNames() {
|
public String[] getSupportedMethodNames() {
|
||||||
String[] sNames = { "external_event", "UseExternalBibTeXFilesChange", "ConvertZoteroCitationsChange",
|
String[] sNames = { "external_event", "UseExternalBibTeXFilesChange", "ConvertZoteroCitationsChange",
|
||||||
"ConvertJabRefCitationsChange", "ExternalBibTeXDirClick" };
|
"ConvertJabRefCitationsChange", "UseNatbibChange", "BibTeXLocationChange", "ExternalBibTeXDirClick" };
|
||||||
return sNames;
|
return sNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,6 +152,8 @@ public final class BibliographyDialog
|
||||||
return true;
|
return true;
|
||||||
} else if (sMethod.equals("back") || sMethod.equals("initialize")) {
|
} else if (sMethod.equals("back") || sMethod.equals("initialize")) {
|
||||||
loadConfiguration(dlg);
|
loadConfiguration(dlg);
|
||||||
|
enableBibTeXSettings(dlg);
|
||||||
|
useNatbibChange(dlg);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,8 +176,12 @@ public final class BibliographyDialog
|
||||||
XPropertySetHelper.getPropertyValueAsBoolean(xProps, "ConvertZoteroCitations"));
|
XPropertySetHelper.getPropertyValueAsBoolean(xProps, "ConvertZoteroCitations"));
|
||||||
dlg.setCheckBoxStateAsBoolean("ConvertJabRefCitations",
|
dlg.setCheckBoxStateAsBoolean("ConvertJabRefCitations",
|
||||||
XPropertySetHelper.getPropertyValueAsBoolean(xProps, "ConvertJabRefCitations"));
|
XPropertySetHelper.getPropertyValueAsBoolean(xProps, "ConvertJabRefCitations"));
|
||||||
dlg.setTextFieldText("NatbibOptions",
|
dlg.setCheckBoxStateAsBoolean("UseNatbib",
|
||||||
|
XPropertySetHelper.getPropertyValueAsBoolean(xProps, "UseNatbib"));
|
||||||
|
dlg.setTextFieldText("NatbibOptions",
|
||||||
XPropertySetHelper.getPropertyValueAsString(xProps, "NatbibOptions"));
|
XPropertySetHelper.getPropertyValueAsString(xProps, "NatbibOptions"));
|
||||||
|
dlg.setListBoxSelectedItem("BibTeXLocation",
|
||||||
|
XPropertySetHelper.getPropertyValueAsShort(xProps, "BibTeXLocation"));
|
||||||
dlg.setTextFieldText("BibTeXDir",
|
dlg.setTextFieldText("BibTeXDir",
|
||||||
XPropertySetHelper.getPropertyValueAsString(xProps, "BibTeXDir"));
|
XPropertySetHelper.getPropertyValueAsString(xProps, "BibTeXDir"));
|
||||||
registry.disposeRegistryView(view);
|
registry.disposeRegistryView(view);
|
||||||
|
@ -184,7 +204,9 @@ public final class BibliographyDialog
|
||||||
XPropertySetHelper.setPropertyValue(xProps, "UseExternalBibTeXFiles", dlg.getCheckBoxStateAsBoolean("UseExternalBibTeXFiles"));
|
XPropertySetHelper.setPropertyValue(xProps, "UseExternalBibTeXFiles", dlg.getCheckBoxStateAsBoolean("UseExternalBibTeXFiles"));
|
||||||
XPropertySetHelper.setPropertyValue(xProps, "ConvertZoteroCitations", dlg.getCheckBoxStateAsBoolean("ConvertZoteroCitations"));
|
XPropertySetHelper.setPropertyValue(xProps, "ConvertZoteroCitations", dlg.getCheckBoxStateAsBoolean("ConvertZoteroCitations"));
|
||||||
XPropertySetHelper.setPropertyValue(xProps, "ConvertJabRefCitations", dlg.getCheckBoxStateAsBoolean("ConvertJabRefCitations"));
|
XPropertySetHelper.setPropertyValue(xProps, "ConvertJabRefCitations", dlg.getCheckBoxStateAsBoolean("ConvertJabRefCitations"));
|
||||||
|
XPropertySetHelper.setPropertyValue(xProps, "UseNatbib", dlg.getCheckBoxStateAsBoolean("UseNatbib"));
|
||||||
XPropertySetHelper.setPropertyValue(xProps, "NatbibOptions", dlg.getTextFieldText("NatbibOptions"));
|
XPropertySetHelper.setPropertyValue(xProps, "NatbibOptions", dlg.getTextFieldText("NatbibOptions"));
|
||||||
|
XPropertySetHelper.setPropertyValue(xProps, "BibTeXLocation", dlg.getListBoxSelectedItem("BibTeXLocation"));
|
||||||
XPropertySetHelper.setPropertyValue(xProps, "BibTeXDir", dlg.getTextFieldText("BibTeXDir"));
|
XPropertySetHelper.setPropertyValue(xProps, "BibTeXDir", dlg.getTextFieldText("BibTeXDir"));
|
||||||
|
|
||||||
// Commit registry changes
|
// Commit registry changes
|
||||||
|
@ -205,43 +227,114 @@ public final class BibliographyDialog
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean useExternalBibTeXFilesChange(DialogAccess dlg) {
|
private boolean useExternalBibTeXFilesChange(DialogAccess dlg) {
|
||||||
enableBibTeXDir(dlg);
|
enableBibTeXSettings(dlg);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean convertZoteroCitationsChange(DialogAccess dlg) {
|
private boolean convertZoteroCitationsChange(DialogAccess dlg) {
|
||||||
enableNatbibOptions(dlg);
|
enableBibTeXSettings(dlg);
|
||||||
enableBibTeXDir(dlg);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean convertJabRefCitationsChange(DialogAccess dlg) {
|
private boolean convertJabRefCitationsChange(DialogAccess dlg) {
|
||||||
enableNatbibOptions(dlg);
|
enableBibTeXSettings(dlg);
|
||||||
enableBibTeXDir(dlg);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableNatbibOptions(DialogAccess dlg) {
|
private boolean useNatbibChange(DialogAccess dlg) {
|
||||||
boolean bConvertZotero = dlg.getCheckBoxStateAsBoolean("ConvertZoteroCitations");
|
boolean bUseNatbib = dlg.getCheckBoxStateAsBoolean("UseNatbib");
|
||||||
boolean bConvertJabRef = dlg.getCheckBoxStateAsBoolean("ConvertJabRefCitations");
|
dlg.setControlEnabled("NatbibOptionsLabel", bUseNatbib);
|
||||||
dlg.setControlEnabled("NatbibOptionsLabel", bConvertZotero || bConvertJabRef);
|
dlg.setControlEnabled("NatbibOptions", bUseNatbib);
|
||||||
dlg.setControlEnabled("NatbibOptions", bConvertZotero || bConvertJabRef);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableBibTeXDir(DialogAccess dlg) {
|
private boolean bibTeXLocationChange(DialogAccess dlg) {
|
||||||
boolean bExternal = dlg.getCheckBoxStateAsBoolean("UseExternalBibTeXFiles");
|
enableBibTeXSettings(dlg);
|
||||||
boolean bConvertZotero = dlg.getCheckBoxStateAsBoolean("ConvertZoteroCitations");
|
return true;
|
||||||
boolean bConvertJabRef = dlg.getCheckBoxStateAsBoolean("ConvertJabRefCitations");
|
|
||||||
dlg.setControlEnabled("BibTeXDirLabel", bExternal || bConvertZotero || bConvertJabRef);
|
|
||||||
dlg.setControlEnabled("BibTeXDir", bExternal || bConvertZotero || bConvertJabRef);
|
|
||||||
dlg.setControlEnabled("BibTeXDirButton", bExternal|| bConvertZotero || bConvertJabRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void enableBibTeXSettings(DialogAccess dlg) {
|
||||||
|
boolean bEnableLocation = dlg.getCheckBoxStateAsBoolean("UseExternalBibTeXFiles")
|
||||||
|
|| dlg.getCheckBoxStateAsBoolean("ConvertZoteroCitations")
|
||||||
|
|| dlg.getCheckBoxStateAsBoolean("ConvertJabRefCitations");
|
||||||
|
boolean bEnableDir = dlg.getListBoxSelectedItem("BibTeXLocation")<2;
|
||||||
|
dlg.setControlEnabled("BibTeXLocationLabel", bEnableLocation);
|
||||||
|
dlg.setControlEnabled("BibTeXLocation", bEnableLocation);
|
||||||
|
dlg.setControlEnabled("BibTeXDirLabel", bEnableLocation && bEnableDir);
|
||||||
|
dlg.setControlEnabled("BibTeXDir", bEnableLocation && bEnableDir);
|
||||||
|
dlg.setControlEnabled("BibTeXDirButton", bEnableLocation && bEnableDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getDocumentDirURL() {
|
||||||
|
// Get the desktop from the service manager
|
||||||
|
Object desktop=null;
|
||||||
|
try {
|
||||||
|
desktop = xContext.getServiceManager().createInstanceWithContext("com.sun.star.frame.Desktop", xContext);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Failed to get the desktop service
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, desktop);
|
||||||
|
|
||||||
|
// Get the current component and verify that it really is a text document
|
||||||
|
if (xDesktop!=null) {
|
||||||
|
XComponent xComponent = xDesktop.getCurrentComponent();
|
||||||
|
XServiceInfo xInfo = (XServiceInfo)UnoRuntime.queryInterface(XServiceInfo.class, xComponent);
|
||||||
|
if (xInfo!=null && xInfo.supportsService("com.sun.star.text.TextDocument")) {
|
||||||
|
// Get the model, which provides the URL
|
||||||
|
XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xComponent);
|
||||||
|
if (xModel!=null) {
|
||||||
|
String sURL = xModel.getURL();
|
||||||
|
int nSlash = sURL.lastIndexOf('/');
|
||||||
|
return nSlash>-1 ? sURL.substring(0, nSlash) : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasBibTeXFiles(File dir) {
|
||||||
|
if (dir.isDirectory()) {
|
||||||
|
File[] files = dir.listFiles();
|
||||||
|
for (File file : files) {
|
||||||
|
if (file.isFile() && file.getName().endsWith(".bib")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean bibTeXDirClick(DialogAccess dlg) {
|
private boolean bibTeXDirClick(DialogAccess dlg) {
|
||||||
String sPath = folderPicker.getPath();
|
String sPath = folderPicker.getPath();
|
||||||
if (sPath!=null) {
|
if (sPath!=null) {
|
||||||
try {
|
try {
|
||||||
dlg.setTextFieldText("BibTeXDir", new File(new URI(sPath)).getCanonicalPath());
|
File bibDir = new File(new URI(sPath));
|
||||||
|
String sBibPath = bibDir.getCanonicalPath();
|
||||||
|
if (dlg.getListBoxSelectedItem("BibTeXLocation")==1) {
|
||||||
|
// Path relative to document directory, remove the document directory part
|
||||||
|
String sDocumentDirURL = getDocumentDirURL();
|
||||||
|
if (sDocumentDirURL.length()>0) {
|
||||||
|
String sDocumentDirPath = new File(new URI(sDocumentDirURL)).getCanonicalPath();
|
||||||
|
if (sBibPath.startsWith(sDocumentDirPath)) {
|
||||||
|
if (sBibPath.length()>sDocumentDirPath.length()) {
|
||||||
|
sBibPath = sBibPath.substring(sDocumentDirPath.length()+1);
|
||||||
|
}
|
||||||
|
else { // Same as document directory
|
||||||
|
sBibPath = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { // not a subdirectory
|
||||||
|
sBibPath = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dlg.setTextFieldText("BibTeXDir", sBibPath);
|
||||||
|
if (!hasBibTeXFiles(bibDir)) {
|
||||||
|
MessageBox msgBox = new MessageBox(xContext);
|
||||||
|
msgBox.showMessage("Writer4LaTeX warning", "The selected directory does not contain any BibTeX files");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
*
|
*
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Version 1.2 (2011-01-25)
|
* Version 1.2 (2011-01-28)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -36,15 +36,18 @@ import com.sun.star.beans.XPropertyAccess;
|
||||||
import com.sun.star.beans.XPropertySet;
|
import com.sun.star.beans.XPropertySet;
|
||||||
import com.sun.star.container.XNameAccess;
|
import com.sun.star.container.XNameAccess;
|
||||||
import com.sun.star.frame.XController;
|
import com.sun.star.frame.XController;
|
||||||
|
import com.sun.star.frame.XDesktop;
|
||||||
import com.sun.star.frame.XFrame;
|
import com.sun.star.frame.XFrame;
|
||||||
import com.sun.star.frame.XModel;
|
import com.sun.star.frame.XModel;
|
||||||
import com.sun.star.frame.XStorable;
|
import com.sun.star.frame.XStorable;
|
||||||
|
import com.sun.star.lang.XComponent;
|
||||||
|
import com.sun.star.lang.XServiceInfo;
|
||||||
import com.sun.star.lib.uno.helper.WeakBase;
|
import com.sun.star.lib.uno.helper.WeakBase;
|
||||||
import com.sun.star.task.XStatusIndicator;
|
import com.sun.star.task.XStatusIndicator;
|
||||||
import com.sun.star.task.XStatusIndicatorFactory;
|
import com.sun.star.task.XStatusIndicatorFactory;
|
||||||
import com.sun.star.ui.dialogs.ExecutableDialogResults;
|
import com.sun.star.ui.dialogs.ExecutableDialogResults;
|
||||||
import com.sun.star.ui.dialogs.XExecutableDialog;
|
import com.sun.star.ui.dialogs.XExecutableDialog;
|
||||||
import com.sun.star.uno.AnyConverter;
|
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;
|
||||||
|
|
||||||
|
@ -221,22 +224,24 @@ public final class Writer4LaTeX extends WeakBase
|
||||||
try {
|
try {
|
||||||
Object view = registry.getRegistryView(BibliographyDialog.REGISTRY_PATH, false);
|
Object view = registry.getRegistryView(BibliographyDialog.REGISTRY_PATH, false);
|
||||||
XPropertySet xProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,view);
|
XPropertySet xProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,view);
|
||||||
String sBibTeXFiles = getFileList(XPropertySetHelper.getPropertyValueAsString(xProps, "BibTeXDir"));
|
String sBibTeXFiles = getFileList(XPropertySetHelper.getPropertyValueAsShort(xProps, "BibTeXLocation"),
|
||||||
|
XPropertySetHelper.getPropertyValueAsString(xProps, "BibTeXDir"));
|
||||||
if (XPropertySetHelper.getPropertyValueAsBoolean(xProps, "ConvertZoteroCitations")) {
|
if (XPropertySetHelper.getPropertyValueAsBoolean(xProps, "ConvertZoteroCitations")) {
|
||||||
filterHelper.put("zotero_bibtex_files", sBibTeXFiles);
|
filterHelper.put("zotero_bibtex_files", sBibTeXFiles);
|
||||||
filterHelper.put("natbib_options", XPropertySetHelper.getPropertyValueAsString(xProps, "NatbibOptions"));
|
|
||||||
}
|
}
|
||||||
if (XPropertySetHelper.getPropertyValueAsBoolean(xProps, "ConvertJabRefCitations")) {
|
if (XPropertySetHelper.getPropertyValueAsBoolean(xProps, "ConvertJabRefCitations")) {
|
||||||
filterHelper.put("jabref_bibtex_files", sBibTeXFiles);
|
filterHelper.put("jabref_bibtex_files", sBibTeXFiles);
|
||||||
filterHelper.put("natbib_options", XPropertySetHelper.getPropertyValueAsString(xProps, "NatbibOptions"));
|
|
||||||
}
|
}
|
||||||
if (XPropertySetHelper.getPropertyValueAsBoolean(xProps, "UseExternalBibTeXFiles")) {
|
if (XPropertySetHelper.getPropertyValueAsBoolean(xProps, "UseExternalBibTeXFiles")) {
|
||||||
filterHelper.put("external_bibtex_files", sBibTeXFiles);
|
filterHelper.put("external_bibtex_files", sBibTeXFiles);
|
||||||
}
|
}
|
||||||
String sBibTeXDir = XPropertySetHelper.getPropertyValueAsString(xProps, "BibTeXDir");
|
String sBibTeXDir = XPropertySetHelper.getPropertyValueAsString(xProps, "BibTeXDir");
|
||||||
if (sBibTeXDir.length()>0) {
|
if (sBibTeXDir.length()>0) {
|
||||||
sBibinputs = sBibTeXDir+":";
|
// The separator character in BIBINPUTS is OS specific
|
||||||
|
sBibinputs = sBibTeXDir+File.pathSeparatorChar;
|
||||||
}
|
}
|
||||||
|
filterHelper.put("use_natbib", Boolean.toString(XPropertySetHelper.getPropertyValueAsBoolean(xProps, "UseNatbib")));
|
||||||
|
filterHelper.put("natbib_options", XPropertySetHelper.getPropertyValueAsString(xProps, "NatbibOptions"));
|
||||||
|
|
||||||
mediaHelper.put("FilterData",filterHelper.toArray());
|
mediaHelper.put("FilterData",filterHelper.toArray());
|
||||||
mediaProps = mediaHelper.toArray();
|
mediaProps = mediaHelper.toArray();
|
||||||
|
@ -295,9 +300,20 @@ public final class Writer4LaTeX extends WeakBase
|
||||||
|
|
||||||
xStatus.end();
|
xStatus.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getFileList(String sDirectory) {
|
private String getFileList(short nType, String sDirectory) {
|
||||||
File dir = new File(sDirectory);
|
File dir;
|
||||||
|
switch (nType) {
|
||||||
|
case 0: // absolute path
|
||||||
|
dir = new File(sDirectory);
|
||||||
|
break;
|
||||||
|
case 1: // relative path
|
||||||
|
dir = new File(urlToFile(sBasePath),sDirectory);
|
||||||
|
break;
|
||||||
|
default: // document directory
|
||||||
|
dir = urlToFile(sBasePath);
|
||||||
|
}
|
||||||
|
|
||||||
CSVList filelist = new CSVList(",");
|
CSVList filelist = new CSVList(",");
|
||||||
if (dir.isDirectory()) {
|
if (dir.isDirectory()) {
|
||||||
File[] files = dir.listFiles();
|
File[] files = dir.listFiles();
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
*
|
*
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Version 1.2 (2011-01-25)
|
* Version 1.2 (2011-01-28)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public class ConverterFactory {
|
||||||
|
|
||||||
// Version information
|
// Version information
|
||||||
private static final String VERSION = "1.1.6";
|
private static final String VERSION = "1.1.6";
|
||||||
private static final String DATE = "2011-01-25";
|
private static final String DATE = "2011-01-28";
|
||||||
|
|
||||||
/** 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/>
|
||||||
|
|
|
@ -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-2010 by Henrik Just
|
* Copyright: 2002-2011 by Henrik Just
|
||||||
*
|
*
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Version 1.2 (2010-03-28)
|
* Version 1.2 (2011-01-27)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -79,7 +79,14 @@ public class BibConverter extends ConverterHelper {
|
||||||
* other declarations should be added.
|
* other declarations should be added.
|
||||||
*/
|
*/
|
||||||
public void appendDeclarations(LaTeXDocumentPortion pack, LaTeXDocumentPortion decl) {
|
public void appendDeclarations(LaTeXDocumentPortion pack, LaTeXDocumentPortion decl) {
|
||||||
// Currently nothing; may add support for eg. natbib later
|
// Use natbib
|
||||||
|
if (config.useBibtex() && config.useNatbib()) {
|
||||||
|
pack.append("\\usepackage");
|
||||||
|
if (config.getNatbibOptions().length()>0) {
|
||||||
|
pack.append("[").append(config.getNatbibOptions()).append("]");
|
||||||
|
}
|
||||||
|
pack.append("{natbib}").nl();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Process a bibliography (text:bibliography tag)
|
/** Process a bibliography (text:bibliography tag)
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
*
|
*
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Version 1.2 (2011-01-24)
|
* Version 1.2 (2011-01-28)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -59,8 +59,7 @@ public class FieldConverter extends ConverterHelper {
|
||||||
// Identify Zotero items
|
// Identify Zotero items
|
||||||
private static final String ZOTERO_ITEM = "ZOTERO_ITEM";
|
private static final String ZOTERO_ITEM = "ZOTERO_ITEM";
|
||||||
// Identify JabRef items
|
// Identify JabRef items
|
||||||
private static final String JABREF_ITEM_1 = "JR_cite_1";
|
private static final String JABREF_ITEM = "JR_cite";
|
||||||
private static final String JABREF_ITEM_2 = "JR_cite_2";
|
|
||||||
|
|
||||||
// Links & references
|
// Links & references
|
||||||
private ExportNameCollection targets = new ExportNameCollection(true);
|
private ExportNameCollection targets = new ExportNameCollection(true);
|
||||||
|
@ -83,7 +82,7 @@ public class FieldConverter extends ConverterHelper {
|
||||||
private boolean bUsesOooref = false;
|
private boolean bUsesOooref = false;
|
||||||
private boolean bConvertZotero = false;
|
private boolean bConvertZotero = false;
|
||||||
private boolean bConvertJabRef = false;
|
private boolean bConvertJabRef = false;
|
||||||
private boolean bNeedNatbib = false;
|
private boolean bUseNatbib = false;
|
||||||
|
|
||||||
public FieldConverter(OfficeReader ofr, LaTeXConfig config, ConverterPalette palette) {
|
public FieldConverter(OfficeReader ofr, LaTeXConfig config, ConverterPalette palette) {
|
||||||
super(ofr,config,palette);
|
super(ofr,config,palette);
|
||||||
|
@ -91,6 +90,7 @@ public class FieldConverter extends ConverterHelper {
|
||||||
bUseHyperref = config.useHyperref() && !config.useTitleref() && !config.useOooref();
|
bUseHyperref = config.useHyperref() && !config.useTitleref() && !config.useOooref();
|
||||||
bConvertZotero = config.useBibtex() && config.zoteroBibtexFiles().length()>0;
|
bConvertZotero = config.useBibtex() && config.zoteroBibtexFiles().length()>0;
|
||||||
bConvertJabRef = config.useBibtex() && config.jabrefBibtexFiles().length()>0;
|
bConvertJabRef = config.useBibtex() && config.jabrefBibtexFiles().length()>0;
|
||||||
|
bUseNatbib = config.useBibtex() && config.useNatbib();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** <p>Append declarations needed by the <code>FieldConverter</code> to
|
/** <p>Append declarations needed by the <code>FieldConverter</code> to
|
||||||
|
@ -138,16 +138,7 @@ public class FieldConverter extends ConverterHelper {
|
||||||
}
|
}
|
||||||
pack.append("}").nl();
|
pack.append("}").nl();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use natbib
|
|
||||||
if (bNeedNatbib) {
|
|
||||||
pack.append("\\usepackage");
|
|
||||||
if (config.getNatbibOptions().length()>0) {
|
|
||||||
pack.append("[").append(config.getNatbibOptions()).append("]");
|
|
||||||
}
|
|
||||||
pack.append("{natbib}").nl();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Export sequence declarations
|
// Export sequence declarations
|
||||||
// The number format is fetched from the first occurence of the
|
// The number format is fetched from the first occurence of the
|
||||||
// sequence in the text, while the outline level and the separation
|
// sequence in the text, while the outline level and the separation
|
||||||
|
@ -484,129 +475,165 @@ public class FieldConverter extends ConverterHelper {
|
||||||
|
|
||||||
if (citationItemsArray!=null) {
|
if (citationItemsArray!=null) {
|
||||||
int nCitationCount = citationItemsArray.length();
|
int nCitationCount = citationItemsArray.length();
|
||||||
if (nCitationCount>1) {
|
|
||||||
// For multiple citations, use \citetext, otherwise we cannot add individual prefixes and suffixes
|
|
||||||
// TODO: If no prefixes or suffixes exist, it's safe to combine the citations
|
|
||||||
ldp.append("\\citetext{");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int nIndex=0; nIndex<nCitationCount; nIndex++) {
|
if (bUseNatbib) {
|
||||||
|
if (nCitationCount>1) {
|
||||||
JSONObject citationItems = null;
|
// For multiple citations, use \citetext, otherwise we cannot add individual prefixes and suffixes
|
||||||
try { // Each citation is represented as an object
|
// TODO: If no prefixes or suffixes exist, it's safe to combine the citations
|
||||||
citationItems = citationItemsArray.getJSONObject(nIndex);
|
ldp.append("\\citetext{");
|
||||||
}
|
|
||||||
catch (JSONException e) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (citationItems!=null) {
|
for (int nIndex=0; nIndex<nCitationCount; nIndex++) {
|
||||||
if (nIndex>0) {
|
|
||||||
ldp.append("; "); // Separate multiple citations in this reference
|
JSONObject citationItems = null;
|
||||||
|
try { // Each citation is represented as an object
|
||||||
|
citationItems = citationItemsArray.getJSONObject(nIndex);
|
||||||
|
}
|
||||||
|
catch (JSONException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Citation items
|
if (citationItems!=null) {
|
||||||
String sURI = "";
|
if (nIndex>0) {
|
||||||
boolean bSuppressAuthor = false;
|
ldp.append("; "); // Separate multiple citations in this reference
|
||||||
String sPrefix = "";
|
}
|
||||||
String sSuffix = "";
|
|
||||||
String sLocator = "";
|
|
||||||
String sLocatorType = "";
|
|
||||||
|
|
||||||
try { // The URI seems to be an array with a single string value(?)
|
// Citation items
|
||||||
sURI = citationItems.getJSONArray("uri").getString(0);
|
String sURI = "";
|
||||||
}
|
boolean bSuppressAuthor = false;
|
||||||
catch (JSONException e) {
|
String sPrefix = "";
|
||||||
}
|
String sSuffix = "";
|
||||||
|
String sLocator = "";
|
||||||
|
String sLocatorType = "";
|
||||||
|
|
||||||
try { // SuppressAuthor is a boolean value
|
try { // The URI seems to be an array with a single string value(?)
|
||||||
bSuppressAuthor = citationItems.getBoolean("suppressAuthor");
|
sURI = citationItems.getJSONArray("uri").getString(0);
|
||||||
}
|
}
|
||||||
catch (JSONException e) {
|
catch (JSONException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try { // Prefix is a string value
|
try { // SuppressAuthor is a boolean value
|
||||||
sPrefix = citationItems.getString("prefix");
|
bSuppressAuthor = citationItems.getBoolean("suppressAuthor");
|
||||||
}
|
}
|
||||||
catch (JSONException e) {
|
catch (JSONException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try { // Suffix is a string value
|
try { // Prefix is a string value
|
||||||
sSuffix = citationItems.getString("suffix");
|
sPrefix = citationItems.getString("prefix");
|
||||||
}
|
}
|
||||||
catch (JSONException e) {
|
catch (JSONException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try { // Locator is a string value, e.g. a page number
|
try { // Suffix is a string value
|
||||||
sLocator = citationItems.getString("locator");
|
sSuffix = citationItems.getString("suffix");
|
||||||
}
|
}
|
||||||
catch (JSONException e) {
|
catch (JSONException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try { // Locator is a string value, e.g. a page number
|
||||||
// LocatorType is a string value, e.g. book, verse, page (missing locatorType means page)
|
sLocator = citationItems.getString("locator");
|
||||||
sLocatorType = citationItems.getString("locatorType");
|
}
|
||||||
}
|
catch (JSONException e) {
|
||||||
catch (JSONException e) {
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Adjust locator type (empty locator type means "page")
|
try {
|
||||||
// TODO: Handle other locator types (localize and abbreviate): Currently the internal name (e.g. book) is used.
|
// LocatorType is a string value, e.g. book, verse, page (missing locatorType means page)
|
||||||
if (sLocator.length()>0 && sLocatorType.length()==0) {
|
sLocatorType = citationItems.getString("locatorType");
|
||||||
// A locator of the form <number><other characters><number> is interpreted as several pages
|
}
|
||||||
if (Pattern.compile("[0-9]+[^0-9]+[0-9]+").matcher(sLocator).find()) {
|
catch (JSONException e) {
|
||||||
sLocatorType = "pp.";
|
}
|
||||||
|
|
||||||
|
// Adjust locator type (empty locator type means "page")
|
||||||
|
// TODO: Handle other locator types (localize and abbreviate): Currently the internal name (e.g. book) is used.
|
||||||
|
if (sLocator.length()>0 && sLocatorType.length()==0) {
|
||||||
|
// A locator of the form <number><other characters><number> is interpreted as several pages
|
||||||
|
if (Pattern.compile("[0-9]+[^0-9]+[0-9]+").matcher(sLocator).find()) {
|
||||||
|
sLocatorType = "pp.";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sLocatorType = "p.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert command. TODO: Evaluate this
|
||||||
|
if (nCitationCount>1) { // Use commands without parentheses
|
||||||
|
if (bSuppressAuthor) { ldp.append("\\citeyear"); }
|
||||||
|
else { ldp.append("\\citet"); }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sLocatorType = "p.";
|
if (bSuppressAuthor) { ldp.append("\\citeyearpar"); }
|
||||||
|
else { ldp.append("\\citep"); }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Insert command. TODO: Evaluate this
|
if (sPrefix.length()>0) {
|
||||||
if (nCitationCount>1) { // Use commands without parentheses
|
ldp.append("[").append(palette.getI18n().convert(sPrefix,true,oc.getLang())).append("]");
|
||||||
if (bSuppressAuthor) { ldp.append("\\citeyear"); }
|
|
||||||
else { ldp.append("\\citet"); }
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (bSuppressAuthor) { ldp.append("\\citeyearpar"); }
|
|
||||||
else { ldp.append("\\citep"); }
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sPrefix.length()>0) {
|
|
||||||
ldp.append("[").append(palette.getI18n().convert(sPrefix,true,oc.getLang())).append("]");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sPrefix.length()>0 || sSuffix.length()>0 || sLocatorType.length()>0 || sLocator.length()>0) {
|
|
||||||
// Note that we need to include an empty suffix if there's a prefix!
|
|
||||||
ldp.append("[")
|
|
||||||
.append(palette.getI18n().convert(sSuffix,true,oc.getLang()))
|
|
||||||
.append(palette.getI18n().convert(sLocatorType,true,oc.getLang()));
|
|
||||||
if (sLocatorType.length()>0 && sLocator.length()>0) {
|
|
||||||
ldp.append("~");
|
|
||||||
}
|
}
|
||||||
ldp.append(palette.getI18n().convert(sLocator,true,oc.getLang()))
|
|
||||||
.append("]");
|
|
||||||
}
|
|
||||||
|
|
||||||
ldp.append("{");
|
if (sPrefix.length()>0 || sSuffix.length()>0 || sLocatorType.length()>0 || sLocator.length()>0) {
|
||||||
int nSlash = sURI.lastIndexOf('/');
|
// Note that we need to include an empty suffix if there's a prefix!
|
||||||
if (nSlash>0) {
|
ldp.append("[")
|
||||||
ldp.append(sURI.substring(nSlash+1));
|
.append(palette.getI18n().convert(sSuffix,true,oc.getLang()))
|
||||||
}
|
.append(palette.getI18n().convert(sLocatorType,true,oc.getLang()));
|
||||||
else {
|
if (sLocatorType.length()>0 && sLocator.length()>0) {
|
||||||
ldp.append(sURI);
|
ldp.append("~");
|
||||||
|
}
|
||||||
|
ldp.append(palette.getI18n().convert(sLocator,true,oc.getLang()))
|
||||||
|
.append("]");
|
||||||
|
}
|
||||||
|
|
||||||
|
ldp.append("{");
|
||||||
|
int nSlash = sURI.lastIndexOf('/');
|
||||||
|
if (nSlash>0) {
|
||||||
|
ldp.append(sURI.substring(nSlash+1));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ldp.append(sURI);
|
||||||
|
}
|
||||||
|
ldp.append("}");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nCitationCount>1) { // End the \citetext command
|
||||||
ldp.append("}");
|
ldp.append("}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else { // natbib is not available, use simple \cite command
|
||||||
if (nCitationCount>1) { // End the \citetext command
|
ldp.append("\\cite{");
|
||||||
ldp.append("}");
|
for (int nIndex=0; nIndex<nCitationCount; nIndex++) {
|
||||||
|
JSONObject citationItems = null;
|
||||||
|
try { // Each citation is represented as an object
|
||||||
|
citationItems = citationItemsArray.getJSONObject(nIndex);
|
||||||
|
}
|
||||||
|
catch (JSONException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (citationItems!=null) {
|
||||||
|
if (nIndex>0) {
|
||||||
|
ldp.append(","); // Separate multiple citations in this reference
|
||||||
|
}
|
||||||
|
|
||||||
|
// Citation items
|
||||||
|
String sURI = "";
|
||||||
|
|
||||||
|
try { // The URI seems to be an array with a single string value(?)
|
||||||
|
sURI = citationItems.getJSONArray("uri").getString(0);
|
||||||
|
}
|
||||||
|
catch (JSONException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
int nSlash = sURI.lastIndexOf('/');
|
||||||
|
if (nSlash>0) {
|
||||||
|
ldp.append(sURI.substring(nSlash+1));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ldp.append(sURI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ldp.append("}");
|
||||||
}
|
}
|
||||||
|
|
||||||
oc.setInZoteroJabRefText(true);
|
oc.setInZoteroJabRefText(true);
|
||||||
|
|
||||||
bNeedNatbib = true;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -617,19 +644,32 @@ public class FieldConverter extends ConverterHelper {
|
||||||
// Try to handle this reference name as a JabRef reference, return true on success
|
// Try to handle this reference name as a JabRef reference, return true on success
|
||||||
private boolean handleJabRefReferenceName(String sName, LaTeXDocumentPortion ldp, Context oc) {
|
private boolean handleJabRefReferenceName(String sName, LaTeXDocumentPortion ldp, Context oc) {
|
||||||
// First parse the reference name:
|
// First parse the reference name:
|
||||||
// A JabRef reference name has the form JR_cite_n_identifiers where
|
// A JabRef reference name has the form JR_cite<m>_<n>_<identifiers> where
|
||||||
|
// m is a sequence number to ensure unique citations (may be empty)
|
||||||
// n=1 for (Author date) and n=2 for Author (date) citations
|
// n=1 for (Author date) and n=2 for Author (date) citations
|
||||||
// identifiers is a comma separated list of BibTeX keys
|
// identifiers is a comma separated list of BibTeX keys
|
||||||
if (sName.startsWith(JABREF_ITEM_1)) {
|
if (sName.startsWith(JABREF_ITEM)) {
|
||||||
ldp.append("\\citep{").append(sName.substring(JABREF_ITEM_1.length()+1)).append("}");
|
String sRemains = sName.substring(JABREF_ITEM.length());
|
||||||
|
int nUnderscore = sRemains.indexOf('_');
|
||||||
|
if (nUnderscore>-1) {
|
||||||
|
sRemains = sRemains.substring(nUnderscore+1);
|
||||||
|
if (sRemains.length()>2) {
|
||||||
|
String sCommand;
|
||||||
|
if (bUseNatbib) {
|
||||||
|
if (sRemains.charAt(0)=='1') {
|
||||||
|
sCommand = "\\citep";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sCommand = "\\citet";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sCommand = "\\cite";
|
||||||
|
}
|
||||||
|
ldp.append(sCommand).append("{").append(sRemains.substring(2)).append("}");
|
||||||
|
}
|
||||||
|
}
|
||||||
oc.setInZoteroJabRefText(true);
|
oc.setInZoteroJabRefText(true);
|
||||||
bNeedNatbib = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (sName.startsWith(JABREF_ITEM_2)) {
|
|
||||||
ldp.append("\\citet{").append(sName.substring(JABREF_ITEM_2.length()+1)).append("}");
|
|
||||||
oc.setInZoteroJabRefText(true);
|
|
||||||
bNeedNatbib = true;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
*
|
*
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Version 1.2 (2011-01-23)
|
* Version 1.2 (2011-01-28)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase {
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// I. Define items needed by ConfigBase
|
// I. Define items needed by ConfigBase
|
||||||
|
|
||||||
protected int getOptionCount() { return 68; }
|
protected int getOptionCount() { return 69; }
|
||||||
protected String getDefaultConfigPath() { return "/writer2latex/latex/config/"; }
|
protected String getDefaultConfigPath() { return "/writer2latex/latex/config/"; }
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -146,38 +146,39 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase {
|
||||||
private static final int EXTERNAL_BIBTEX_FILES = 33;
|
private static final int EXTERNAL_BIBTEX_FILES = 33;
|
||||||
private static final int ZOTERO_BIBTEX_FILES = 34;
|
private static final int ZOTERO_BIBTEX_FILES = 34;
|
||||||
private static final int JABREF_BIBTEX_FILES = 35;
|
private static final int JABREF_BIBTEX_FILES = 35;
|
||||||
private static final int NATBIB_OPTIONS = 36;
|
private static final int USE_NATBIB = 36;
|
||||||
private static final int FORMATTING = 37;
|
private static final int NATBIB_OPTIONS = 37;
|
||||||
private static final int PAGE_FORMATTING = 38;
|
private static final int FORMATTING = 38;
|
||||||
private static final int OTHER_STYLES = 39;
|
private static final int PAGE_FORMATTING = 39;
|
||||||
private static final int IMAGE_CONTENT = 40;
|
private static final int OTHER_STYLES = 40;
|
||||||
private static final int TABLE_CONTENT = 41;
|
private static final int IMAGE_CONTENT = 41;
|
||||||
private static final int TABLE_FIRST_HEAD_STYLE = 42;
|
private static final int TABLE_CONTENT = 42;
|
||||||
private static final int TABLE_HEAD_STYLE = 43;
|
private static final int TABLE_FIRST_HEAD_STYLE = 43;
|
||||||
private static final int TABLE_FOOT_STYLE = 44;
|
private static final int TABLE_HEAD_STYLE = 44;
|
||||||
private static final int TABLE_LAST_FOOT_STYLE = 45;
|
private static final int TABLE_FOOT_STYLE = 45;
|
||||||
private static final int IGNORE_HARD_PAGE_BREAKS = 46;
|
private static final int TABLE_LAST_FOOT_STYLE = 46;
|
||||||
private static final int IGNORE_HARD_LINE_BREAKS = 47;
|
private static final int IGNORE_HARD_PAGE_BREAKS = 47;
|
||||||
private static final int IGNORE_EMPTY_PARAGRAPHS = 48;
|
private static final int IGNORE_HARD_LINE_BREAKS = 48;
|
||||||
private static final int IGNORE_DOUBLE_SPACES = 49;
|
private static final int IGNORE_EMPTY_PARAGRAPHS = 49;
|
||||||
private static final int ALIGN_FRAMES = 50;
|
private static final int IGNORE_DOUBLE_SPACES = 50;
|
||||||
private static final int FLOAT_FIGURES = 51;
|
private static final int ALIGN_FRAMES = 51;
|
||||||
private static final int FLOAT_TABLES = 52;
|
private static final int FLOAT_FIGURES = 52;
|
||||||
private static final int FLOAT_OPTIONS = 53;
|
private static final int FLOAT_TABLES = 53;
|
||||||
private static final int FIGURE_SEQUENCE_NAME = 54;
|
private static final int FLOAT_OPTIONS = 54;
|
||||||
private static final int TABLE_SEQUENCE_NAME = 55;
|
private static final int FIGURE_SEQUENCE_NAME = 55;
|
||||||
private static final int IMAGE_OPTIONS = 56;
|
private static final int TABLE_SEQUENCE_NAME = 56;
|
||||||
private static final int REMOVE_GRAPHICS_EXTENSION = 57;
|
private static final int IMAGE_OPTIONS = 57;
|
||||||
private static final int ORIGINAL_IMAGE_SIZE = 58;
|
private static final int REMOVE_GRAPHICS_EXTENSION = 58;
|
||||||
private static final int SIMPLE_TABLE_LIMIT = 59;
|
private static final int ORIGINAL_IMAGE_SIZE = 59;
|
||||||
private static final int NOTES = 60;
|
private static final int SIMPLE_TABLE_LIMIT = 60;
|
||||||
private static final int METADATA = 61;
|
private static final int NOTES = 61;
|
||||||
private static final int TABSTOP = 62;
|
private static final int METADATA = 62;
|
||||||
private static final int WRAP_LINES_AFTER = 63;
|
private static final int TABSTOP = 63;
|
||||||
private static final int SPLIT_LINKED_SECTIONS = 64;
|
private static final int WRAP_LINES_AFTER = 64;
|
||||||
private static final int SPLIT_TOPLEVEL_SECTIONS = 65;
|
private static final int SPLIT_LINKED_SECTIONS = 65;
|
||||||
private static final int SAVE_IMAGES_IN_SUBDIR = 66;
|
private static final int SPLIT_TOPLEVEL_SECTIONS = 66;
|
||||||
private static final int DEBUG = 67;
|
private static final int SAVE_IMAGES_IN_SUBDIR = 67;
|
||||||
|
private static final int DEBUG = 68;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// IV. Our options data
|
// IV. Our options data
|
||||||
|
@ -252,6 +253,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase {
|
||||||
options[EXTERNAL_BIBTEX_FILES] = new Option("external_bibtex_files","");
|
options[EXTERNAL_BIBTEX_FILES] = new Option("external_bibtex_files","");
|
||||||
options[ZOTERO_BIBTEX_FILES] = new Option("zotero_bibtex_files","");
|
options[ZOTERO_BIBTEX_FILES] = new Option("zotero_bibtex_files","");
|
||||||
options[JABREF_BIBTEX_FILES] = new Option("jabref_bibtex_files","");
|
options[JABREF_BIBTEX_FILES] = new Option("jabref_bibtex_files","");
|
||||||
|
options[USE_NATBIB] = new BooleanOption("use_natbib","false");
|
||||||
options[NATBIB_OPTIONS] = new Option("natbib_options","");
|
options[NATBIB_OPTIONS] = new Option("natbib_options","");
|
||||||
options[FORMATTING] = new IntegerOption("formatting","convert_basic") {
|
options[FORMATTING] = new IntegerOption("formatting","convert_basic") {
|
||||||
public void setString(String sValue) {
|
public void setString(String sValue) {
|
||||||
|
@ -664,6 +666,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase {
|
||||||
public String externalBibtexFiles() { return options[EXTERNAL_BIBTEX_FILES].getString(); }
|
public String externalBibtexFiles() { return options[EXTERNAL_BIBTEX_FILES].getString(); }
|
||||||
public String zoteroBibtexFiles() { return options[ZOTERO_BIBTEX_FILES].getString(); }
|
public String zoteroBibtexFiles() { return options[ZOTERO_BIBTEX_FILES].getString(); }
|
||||||
public String jabrefBibtexFiles() { return options[JABREF_BIBTEX_FILES].getString(); }
|
public String jabrefBibtexFiles() { return options[JABREF_BIBTEX_FILES].getString(); }
|
||||||
|
public boolean useNatbib() { return ((BooleanOption) options[USE_NATBIB]).getValue(); }
|
||||||
public String getNatbibOptions() { return options[NATBIB_OPTIONS].getString(); }
|
public String getNatbibOptions() { return options[NATBIB_OPTIONS].getString(); }
|
||||||
|
|
||||||
// Formatting options
|
// Formatting options
|
||||||
|
|
|
@ -28,7 +28,9 @@
|
||||||
<prop oor:name="UseExternalBibTeXFiles" oor:type="xs:boolean" />
|
<prop oor:name="UseExternalBibTeXFiles" oor:type="xs:boolean" />
|
||||||
<prop oor:name="ConvertZoteroCitations" oor:type="xs:boolean" />
|
<prop oor:name="ConvertZoteroCitations" oor:type="xs:boolean" />
|
||||||
<prop oor:name="ConvertJabRefCitations" oor:type="xs:boolean" />
|
<prop oor:name="ConvertJabRefCitations" oor:type="xs:boolean" />
|
||||||
|
<prop oor:name="UseNatbib" oor:type="xs:boolean" />
|
||||||
<prop oor:name="NatbibOptions" oor:type="xs:string" />
|
<prop oor:name="NatbibOptions" oor:type="xs:string" />
|
||||||
|
<prop oor:name="BibTeXLocation" oor:type="xs:short" />
|
||||||
<prop oor:name="BibTeXDir" oor:type="xs:string" />
|
<prop oor:name="BibTeXDir" oor:type="xs:string" />
|
||||||
</group>
|
</group>
|
||||||
</component>
|
</component>
|
||||||
|
|
|
@ -96,9 +96,15 @@
|
||||||
<prop oor:name="ConvertJabRefCitations" oor:type="xs:boolean">
|
<prop oor:name="ConvertJabRefCitations" oor:type="xs:boolean">
|
||||||
<value>false</value>
|
<value>false</value>
|
||||||
</prop>
|
</prop>
|
||||||
|
<prop oor:name="UseNatbib" oor:type="xs:boolean">
|
||||||
|
<value>false</value>
|
||||||
|
</prop>
|
||||||
<prop oor:name="NatbibOptions" oor:type="xs:string">
|
<prop oor:name="NatbibOptions" oor:type="xs:string">
|
||||||
<value></value>
|
<value></value>
|
||||||
</prop>
|
</prop>
|
||||||
|
<prop oor:name="BibTeXLocation" oor:type="xs:short">
|
||||||
|
<value>2</value><!-- document directory -->
|
||||||
|
</prop>
|
||||||
<prop oor:name="BibTeXDir" oor:type="xs:string">
|
<prop oor:name="BibTeXDir" oor:type="xs:string">
|
||||||
<value></value>
|
<value></value>
|
||||||
</prop>
|
</prop>
|
||||||
|
|
|
@ -2,22 +2,35 @@
|
||||||
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
|
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
|
||||||
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Bibliography" dlg:left="139" dlg:top="84" dlg:width="260" dlg:height="185" dlg:help-url="org.openoffice.da.writer4latex.oxt:BibliographyDialog" dlg:closeable="true" dlg:moveable="true" dlg:title="Writer4LaTeX Bibliography Configuration" dlg:withtitlebar="false">
|
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Bibliography" dlg:left="139" dlg:top="84" dlg:width="260" dlg:height="185" dlg:help-url="org.openoffice.da.writer4latex.oxt:BibliographyDialog" dlg:closeable="true" dlg:moveable="true" dlg:title="Writer4LaTeX Bibliography Configuration" dlg:withtitlebar="false">
|
||||||
<dlg:bulletinboard>
|
<dlg:bulletinboard>
|
||||||
<dlg:checkbox dlg:id="ConvertZoteroCitations" dlg:tab-index="2" dlg:left="10" dlg:top="32" dlg:width="240" dlg:height="12" dlg:help-url="org.openoffice.da.writer4latex.oxt:BibliographyConvertZoteroCitations" dlg:value="Convert Zotero citations (requires natbib.sty)" dlg:checked="false">
|
<dlg:checkbox dlg:id="ConvertZoteroCitations" dlg:tab-index="2" dlg:left="10" dlg:top="32" dlg:width="240" dlg:height="12" dlg:help-url="org.openoffice.da.writer4latex.oxt:BibliographyConvertZoteroCitations" dlg:value="Convert Zotero citations" dlg:checked="false">
|
||||||
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:ConvertZoteroCitationsChange" script:language="UNO"/>
|
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:ConvertZoteroCitationsChange" script:language="UNO"/>
|
||||||
</dlg:checkbox>
|
</dlg:checkbox>
|
||||||
<dlg:text dlg:id="NatbibOptionsLabel" dlg:tab-index="7" dlg:left="10" dlg:top="60" dlg:width="55" dlg:height="12" dlg:value="Natbib options"/>
|
<dlg:text dlg:id="NatbibOptionsLabel" dlg:tab-index="9" dlg:left="19" dlg:top="116" dlg:width="45" dlg:height="12" dlg:value="Options"/>
|
||||||
<dlg:textfield dlg:id="NatbibOptions" dlg:tab-index="4" dlg:left="70" dlg:top="58" dlg:width="180" dlg:height="12" dlg:help-url="org.openoffice.da.writer4latex.oxt:BibliographyNatbibOptions"/>
|
<dlg:textfield dlg:id="NatbibOptions" dlg:tab-index="8" dlg:left="70" dlg:top="114" dlg:width="180" dlg:height="12" dlg:help-url="org.openoffice.da.writer4latex.oxt:BibliographyNatbibOptions"/>
|
||||||
<dlg:checkbox dlg:id="UseExternalBibTeXFiles" dlg:tab-index="1" dlg:left="10" dlg:top="18" dlg:width="240" dlg:height="12" dlg:help-url="org.openoffice.da.writer4latex.oxt:BibliographyUseExternalBibTeXFiles" dlg:value="Use external BibTeX files for normal citations" dlg:checked="false">
|
<dlg:checkbox dlg:id="UseExternalBibTeXFiles" dlg:tab-index="1" dlg:left="10" dlg:top="18" dlg:width="240" dlg:height="12" dlg:help-url="org.openoffice.da.writer4latex.oxt:BibliographyUseExternalBibTeXFiles" dlg:value="Use external BibTeX files for ordinary citations" dlg:checked="false">
|
||||||
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:UseExternalBibTeXFilesChange" script:language="UNO"/>
|
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:UseExternalBibTeXFilesChange" script:language="UNO"/>
|
||||||
</dlg:checkbox>
|
</dlg:checkbox>
|
||||||
<dlg:text dlg:id="BibTeXDirLabel" dlg:tab-index="8" dlg:left="10" dlg:top="74" dlg:width="55" dlg:height="12" dlg:value="BibTeX folder"/>
|
<dlg:text dlg:id="BibTeXDirLabel" dlg:tab-index="10" dlg:left="10" dlg:top="74" dlg:width="55" dlg:height="12" dlg:value="BibTeX folder"/>
|
||||||
<dlg:textfield dlg:id="BibTeXDir" dlg:tab-index="5" dlg:left="70" dlg:top="72" dlg:width="130" dlg:height="12" dlg:help-url="org.openoffice.da.writer4latex.oxt:BibliographyBibTeXDir"/>
|
<dlg:textfield dlg:id="BibTeXDir" dlg:tab-index="5" dlg:left="70" dlg:top="72" dlg:width="130" dlg:height="12" dlg:help-url="org.openoffice.da.writer4latex.oxt:BibliographyBibTeXDir"/>
|
||||||
<dlg:button dlg:id="BibTeXDirButton" dlg:tab-index="6" dlg:left="210" dlg:top="72" dlg:width="40" dlg:height="12" dlg:help-url="org.openoffice.da.writer4latex.oxt:BibliographyBibTeXDirButton" dlg:value="Browse...">
|
<dlg:button dlg:id="BibTeXDirButton" dlg:tab-index="6" dlg:left="210" dlg:top="72" dlg:width="40" dlg:height="12" dlg:help-url="org.openoffice.da.writer4latex.oxt:BibliographyBibTeXDirButton" dlg:value="Browse...">
|
||||||
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:BibTeXDirClick" script:language="UNO"/>
|
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:BibTeXDirClick" script:language="UNO"/>
|
||||||
</dlg:button>
|
</dlg:button>
|
||||||
<dlg:text dlg:id="BibliographyLabel" dlg:tab-index="0" dlg:left="6" dlg:top="4" dlg:width="244" dlg:height="12" dlg:value="Bibliography and BibTeX"/>
|
<dlg:text dlg:id="BibliographyLabel" dlg:tab-index="0" dlg:left="6" dlg:top="4" dlg:width="244" dlg:height="12" dlg:value="Citations and BibTeX files"/>
|
||||||
<dlg:checkbox dlg:id="ConvertJabRefCitations" dlg:tab-index="3" dlg:left="10" dlg:top="46" dlg:width="240" dlg:height="12" dlg:value="Convert JabRef citations (requires natbib.sty)" dlg:help-url="org.openoffice.da.writer4latex.oxt:BibliographyConvertJabRefCitations" dlg:checked="false">
|
<dlg:checkbox dlg:id="ConvertJabRefCitations" dlg:tab-index="3" dlg:left="10" dlg:top="46" dlg:width="240" dlg:height="12" dlg:help-url="org.openoffice.da.writer4latex.oxt:BibliographyConvertJabRefCitations" dlg:value="Convert JabRef citations" dlg:checked="false">
|
||||||
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:ConvertJabRefCitationsChange" script:language="UNO"/>
|
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:ConvertJabRefCitationsChange" script:language="UNO"/>
|
||||||
</dlg:checkbox>
|
</dlg:checkbox>
|
||||||
|
<dlg:checkbox dlg:id="UseNatbib" dlg:tab-index="7" dlg:left="10" dlg:top="102" dlg:width="240" dlg:height="12" dlg:help-url="org.openoffice.da.writer4latex.oxt:BibliographyUseNatbib" dlg:value="Use natbib.sty" dlg:checked="false">
|
||||||
|
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:UseNatbibChange" script:language="UNO"/>
|
||||||
|
</dlg:checkbox>
|
||||||
|
<dlg:menulist dlg:id="BibTeXLocation" dlg:tab-index="4" dlg:left="70" dlg:top="58" dlg:width="180" dlg:height="13" dlg:help-url="org.openoffice.da.writer4latex.oxt:BibliographyBibTeXLocation" dlg:spin="true" dlg:linecount="3">
|
||||||
|
<dlg:menupopup>
|
||||||
|
<dlg:menuitem dlg:value="In central folder"/>
|
||||||
|
<dlg:menuitem dlg:value="In subfolder of document folder"/>
|
||||||
|
<dlg:menuitem dlg:value="In document folder"/>
|
||||||
|
</dlg:menupopup>
|
||||||
|
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:BibTeXLocationChange" script:language="UNO"/>
|
||||||
|
</dlg:menulist>
|
||||||
|
<dlg:text dlg:id="BibTeXLocationLabel" dlg:tab-index="11" dlg:left="10" dlg:top="60" dlg:width="55" dlg:height="12" dlg:value="BibTeX location"/>
|
||||||
|
<dlg:text dlg:id="NatbibLabel" dlg:tab-index="12" dlg:left="6" dlg:top="88" dlg:width="244" dlg:height="11" dlg:value="Natbib"/>
|
||||||
</dlg:bulletinboard>
|
</dlg:bulletinboard>
|
||||||
</dlg:window>
|
</dlg:window>
|
Loading…
Add table
Reference in a new issue