From e2f5e3ed5970a6bbcf63610e443e103458492fb6 Mon Sep 17 00:00:00 2001 From: henrikjust <henrikjust@f0f2a975-2e09-46c8-9428-3b39399b9f3c> Date: Wed, 13 Oct 2010 06:29:04 +0000 Subject: [PATCH] Zotero support git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@73 f0f2a975-2e09-46c8-9428-3b39399b9f3c --- source/distro/changelog.txt | 4 + .../comp/w2lcommon/helper/FolderPicker.java | 82 ++++++ .../comp/w2lcommon/helper/RegistryHelper.java | 2 +- .../writer2latex/ConfigurationDialog.java | 2 +- ...ionDialog.java => ApplicationsDialog.java} | 24 +- .../comp/writer4latex/BibliographyDialog.java | 257 ++++++++++++++++++ .../da/comp/writer4latex/ExternalApps.java | 53 +--- .../da/comp/writer4latex/TeXImportFilter.java | 4 +- .../da/comp/writer4latex/W4LRegistration.java | 22 +- .../da/comp/writer4latex/Writer4LaTeX.java | 63 ++++- .../writer2latex/api/ConverterFactory.java | 4 +- .../writer2latex/latex/DrawConverter.java | 4 +- .../writer2latex/latex/FieldConverter.java | 12 +- .../java/writer2latex/latex/LaTeXConfig.java | 69 ++--- source/oxt/writer4latex/META-INF/manifest.xml | 2 +- source/oxt/writer4latex/OptionPages.xcu | 72 +++++ source/oxt/writer4latex/Options.xcs | 7 + source/oxt/writer4latex/Options.xcu | 17 ++ source/oxt/writer4latex/OptionsDialog.xcu | 29 -- .../{Configuration.xdl => Applications.xdl} | 10 +- .../writer4latex/W4LDialogs/Bibliography.xdl | 27 ++ .../W4LDialogs/ConfigurationRoot.xdl | 15 + source/oxt/writer4latex/W4LDialogs/dialog.xlb | 4 +- 23 files changed, 634 insertions(+), 151 deletions(-) create mode 100644 source/java/org/openoffice/da/comp/w2lcommon/helper/FolderPicker.java rename source/java/org/openoffice/da/comp/writer4latex/{ConfigurationDialog.java => ApplicationsDialog.java} (97%) create mode 100644 source/java/org/openoffice/da/comp/writer4latex/BibliographyDialog.java create mode 100644 source/oxt/writer4latex/OptionPages.xcu delete mode 100644 source/oxt/writer4latex/OptionsDialog.xcu rename source/oxt/writer4latex/W4LDialogs/{Configuration.xdl => Applications.xdl} (90%) create mode 100644 source/oxt/writer4latex/W4LDialogs/Bibliography.xdl create mode 100644 source/oxt/writer4latex/W4LDialogs/ConfigurationRoot.xdl diff --git a/source/distro/changelog.txt b/source/distro/changelog.txt index a843b32..c144bc3 100644 --- a/source/distro/changelog.txt +++ b/source/distro/changelog.txt @@ -2,6 +2,10 @@ Changelog for Writer2LaTeX version 1.0 -> 1.2 ---------- version 1.1.5 ---------- +[w2l] Bugfix: Fixed problem with lost images in some documents + +[w2l] New option: natbib_options is used to set options for natbib.sty (used by Zotero export) + [w2l] Added support for Zotero reference marks (with contributions from Kevin Brubeck Unhammer). A new option zotero_bibtex_files has been added to give the names of the BibTeX files from Zotero diff --git a/source/java/org/openoffice/da/comp/w2lcommon/helper/FolderPicker.java b/source/java/org/openoffice/da/comp/w2lcommon/helper/FolderPicker.java new file mode 100644 index 0000000..4dbf39b --- /dev/null +++ b/source/java/org/openoffice/da/comp/w2lcommon/helper/FolderPicker.java @@ -0,0 +1,82 @@ +/************************************************************************ + * + * FolderPicker.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-2010 by Henrik Just + * + * All Rights Reserved. + * + * Version 1.2 (2010-10-11) + * + */ + +package org.openoffice.da.comp.w2lcommon.helper; + +import com.sun.star.lang.XComponent; +import com.sun.star.ui.dialogs.ExecutableDialogResults; +import com.sun.star.ui.dialogs.XExecutableDialog; +import com.sun.star.ui.dialogs.XFolderPicker; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; + +public class FolderPicker { + + private XComponentContext xContext; + + /** Convenience wrapper class for the UNO folder picker service + * + * @param xContext the UNO component context from which the folder picker can be created + */ + public FolderPicker(XComponentContext xContext) { + this.xContext = xContext; + } + + /** Get a user selected path with a folder picker + * + * @return the path or null if the dialog is canceled + */ + public String getPath() { + // Create FolderPicker + Object folderPicker = null; + try { + folderPicker = xContext.getServiceManager().createInstanceWithContext("com.sun.star.ui.dialogs.FolderPicker", xContext); + } + catch (com.sun.star.uno.Exception e) { + return null; + } + + // Display the FolderPicker + XFolderPicker xFolderPicker = (XFolderPicker) UnoRuntime.queryInterface(XFolderPicker.class, folderPicker); + XExecutableDialog xExecutable = (XExecutableDialog) UnoRuntime.queryInterface(XExecutableDialog.class, xFolderPicker); + + // Get the path + String sPath = null; + + if (xExecutable.execute() == ExecutableDialogResults.OK) { + sPath = xFolderPicker.getDirectory(); + } + + // Dispose the folder picker + XComponent xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, folderPicker); + if (xComponent!=null) { // Seems not to be ?? + xComponent.dispose(); + } + + return sPath; + } + +} diff --git a/source/java/org/openoffice/da/comp/w2lcommon/helper/RegistryHelper.java b/source/java/org/openoffice/da/comp/w2lcommon/helper/RegistryHelper.java index e9db09f..602c389 100644 --- a/source/java/org/openoffice/da/comp/w2lcommon/helper/RegistryHelper.java +++ b/source/java/org/openoffice/da/comp/w2lcommon/helper/RegistryHelper.java @@ -50,7 +50,7 @@ public class RegistryHelper { /** Get a registry view relative to the given path * - * @param sPath the base path witin the registry + * @param sPath the base path within the registry * @param bUpdate true if we need update access * @return the registry view * @throws com.sun.star.uno.Exception diff --git a/source/java/org/openoffice/da/comp/writer2latex/ConfigurationDialog.java b/source/java/org/openoffice/da/comp/writer2latex/ConfigurationDialog.java index d969df4..8de1928 100644 --- a/source/java/org/openoffice/da/comp/writer2latex/ConfigurationDialog.java +++ b/source/java/org/openoffice/da/comp/writer2latex/ConfigurationDialog.java @@ -66,7 +66,7 @@ import org.openoffice.da.comp.w2lcommon.helper.StyleNameProvider; /** This class provides a uno component which implements the configuration * of Writer2LaTeX. The same component is used for all pages - using the - * dialog title to distinguish between tha pages. + * dialog title to distinguish between the pages. */ public final class ConfigurationDialog extends WeakBase implements XServiceInfo, XContainerWindowEventHandler { diff --git a/source/java/org/openoffice/da/comp/writer4latex/ConfigurationDialog.java b/source/java/org/openoffice/da/comp/writer4latex/ApplicationsDialog.java similarity index 97% rename from source/java/org/openoffice/da/comp/writer4latex/ConfigurationDialog.java rename to source/java/org/openoffice/da/comp/writer4latex/ApplicationsDialog.java index f6b9d33..e7bc53b 100644 --- a/source/java/org/openoffice/da/comp/writer4latex/ConfigurationDialog.java +++ b/source/java/org/openoffice/da/comp/writer4latex/ApplicationsDialog.java @@ -1,6 +1,6 @@ /************************************************************************ * - * ConfigurationDialog.java + * ApplicationsDialog.java * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.2 (2010-05-13) + * Version 1.2 (2010-10-10) * */ @@ -52,9 +52,9 @@ import org.openoffice.da.comp.w2lcommon.helper.DialogAccess; import org.openoffice.da.comp.w2lcommon.helper.FilePicker; /** This class provides a uno component which implements the configuration - * of Writer4LaTeX + * of applications in Writer4LaTeX. */ -public final class ConfigurationDialog +public final class ApplicationsDialog extends WeakBase implements XServiceInfo, XContainerWindowEventHandler { @@ -65,14 +65,14 @@ public final class ConfigurationDialog /** The component will be registered under this name. */ - public static String __serviceName = "org.openoffice.da.writer4latex.ConfigurationDialog"; + public static String __serviceName = "org.openoffice.da.writer4latex.ApplicationsDialog"; /** The component should also have an implementation name. */ - public static String __implementationName = "org.openoffice.da.comp.writer4latex.ConfigurationDialog"; + public static String __implementationName = "org.openoffice.da.comp.writer4latex.ApplicationsDialog"; - /** Create a new ConfigurationDialog */ - public ConfigurationDialog(XComponentContext xContext) { + /** Create a new ApplicationsDialog */ + public ApplicationsDialog(XComponentContext xContext) { this.xContext = xContext; externalApps = new ExternalApps(xContext); filePicker = new FilePicker(xContext); @@ -183,8 +183,8 @@ public final class ConfigurationDialog return true; } - // Unix: Test to determine wether a certain application is available in the OS - // Requires "which", hence unix only + // Unix: Test to determine whether a certain application is available in the OS + // Requires "which", hence Unix only private boolean hasApp(String sAppName) { try { Vector<String> command = new Vector<String>(); @@ -198,7 +198,7 @@ public final class ConfigurationDialog StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR"); - // Gooble the output stream of the application + // Gobble the output stream of the application StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "OUTPUT"); @@ -357,7 +357,7 @@ public final class ConfigurationDialog externalApps.setApplication(ExternalApps.POSTSCRIPTVIEWER, sGsview, "-e \"%s\""); } - else { // Assume a unix-like system supporting the "which" command + else { // Assume a Unix-like system supporting the "which" command configureApp(ExternalApps.LATEX, "latex", "--interaction=batchmode %s",info); configureApp(ExternalApps.PDFLATEX, "pdflatex", "--interaction=batchmode %s",info); configureApp(ExternalApps.XELATEX, "xelatex", "--interaction=batchmode %s",info); diff --git a/source/java/org/openoffice/da/comp/writer4latex/BibliographyDialog.java b/source/java/org/openoffice/da/comp/writer4latex/BibliographyDialog.java new file mode 100644 index 0000000..e67e43f --- /dev/null +++ b/source/java/org/openoffice/da/comp/writer4latex/BibliographyDialog.java @@ -0,0 +1,257 @@ +/************************************************************************ + * + * BibliographyDialog.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-2010 by Henrik Just + * + * All Rights Reserved. + * + * Version 1.2 (2010-10-10) + * + */ + +package org.openoffice.da.comp.writer4latex; + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +import com.sun.star.awt.XContainerWindowEventHandler; +import com.sun.star.awt.XDialog; +import com.sun.star.awt.XWindow; +import com.sun.star.beans.XPropertySet; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.util.XChangesBatch; + +import com.sun.star.lib.uno.helper.WeakBase; + +import org.openoffice.da.comp.w2lcommon.helper.DialogAccess; +import org.openoffice.da.comp.w2lcommon.helper.FolderPicker; +import org.openoffice.da.comp.w2lcommon.helper.RegistryHelper; +import org.openoffice.da.comp.w2lcommon.helper.XPropertySetHelper; + +/** This class provides a uno component which implements the configuration + * of the bibliography in Writer4LaTeX. + */ +public final class BibliographyDialog + extends WeakBase + implements XServiceInfo, XContainerWindowEventHandler { + + public static final String REGISTRY_PATH = "/org.openoffice.da.Writer4LaTeX.Options/BibliographyOptions"; + + private XComponentContext xContext; + private FolderPicker folderPicker; + + /** The component will be registered under this name. + */ + public static String __serviceName = "org.openoffice.da.writer4latex.BibliographyDialog"; + + /** The component should also have an implementation name. + */ + public static String __implementationName = "org.openoffice.da.comp.writer4latex.BibliographyDialog"; + + /** Create a new ConfigurationDialog */ + public BibliographyDialog(XComponentContext xContext) { + this.xContext = xContext; + folderPicker = new FolderPicker(xContext); + } + + + // Implement XContainerWindowEventHandler + public boolean callHandlerMethod(XWindow xWindow, Object event, String sMethod) + throws com.sun.star.lang.WrappedTargetException { + XDialog xDialog = (XDialog)UnoRuntime.queryInterface(XDialog.class, xWindow); + DialogAccess dlg = new DialogAccess(xDialog); + + try { + if (sMethod.equals("external_event") ){ + return handleExternalEvent(dlg, event); + } + else if (sMethod.equals("ConvertZoteroCitationsChange")) { + return convertZoteroCitationsChange(dlg); + } + else if (sMethod.equals("ZoteroBibTeXDirClick")) { + return zoteroBibTeXDirClick(dlg); + } + else if (sMethod.equals("UseExternalBibTeXFilesChange")) { + return useExternalBibTeXFilesChange(dlg); + } + else if (sMethod.equals("ExternalBibTeXDirClick")) { + return externalBibTeXDirClick(dlg); + } + } + catch (com.sun.star.uno.RuntimeException e) { + throw e; + } + catch (com.sun.star.uno.Exception e) { + throw new com.sun.star.lang.WrappedTargetException(sMethod, this, e); + } + return false; + } + + public String[] getSupportedMethodNames() { + String[] sNames = { "external_event", "ConvertZoteroCitationsChange", "ZoteroBibTeXDirClick", "UseExternalBibTeXFilesChange", "ExternalBibTeXDirClick" }; + return sNames; + } + + // Implement the interface XServiceInfo + public boolean supportsService(String sServiceName) { + return sServiceName.equals(__serviceName); + } + + public String getImplementationName() { + return __implementationName; + } + + public String[] getSupportedServiceNames() { + String[] sSupportedServiceNames = { __serviceName }; + return sSupportedServiceNames; + } + + // Private stuff + + private boolean handleExternalEvent(DialogAccess dlg, Object aEventObject) + throws com.sun.star.uno.Exception { + try { + String sMethod = AnyConverter.toString(aEventObject); + if (sMethod.equals("ok")) { + saveConfiguration(dlg); + return true; + } else if (sMethod.equals("back") || sMethod.equals("initialize")) { + loadConfiguration(dlg); + return true; + } + } + catch (com.sun.star.lang.IllegalArgumentException e) { + throw new com.sun.star.lang.IllegalArgumentException( + "Method external_event requires a string in the event object argument.", this,(short) -1); + } + return false; + } + + // Load settings from the registry into the dialog + private void loadConfiguration(DialogAccess dlg) { + RegistryHelper registry = new RegistryHelper(xContext); + try { + Object view = registry.getRegistryView(REGISTRY_PATH, false); + XPropertySet xProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,view); + dlg.setCheckBoxStateAsBoolean("ConvertZoteroCitations", + XPropertySetHelper.getPropertyValueAsBoolean(xProps, "ConvertZoteroCitations")); + dlg.setTextFieldText("ZoteroBibTeXDir", + XPropertySetHelper.getPropertyValueAsString(xProps, "ZoteroBibTeXDir")); + dlg.setTextFieldText("NatbibOptions", + XPropertySetHelper.getPropertyValueAsString(xProps, "NatbibOptions")); + dlg.setCheckBoxStateAsBoolean("UseExternalBibTeXFiles", + XPropertySetHelper.getPropertyValueAsBoolean(xProps, "UseExternalBibTeXFiles")); + dlg.setTextFieldText("ExternalBibTeXDir", + XPropertySetHelper.getPropertyValueAsString(xProps, "ExternalBibTeXDir")); + registry.disposeRegistryView(view); + } + catch (Exception e) { + // Failed to get registry view + } + + // Update dialog according to the settings + convertZoteroCitationsChange(dlg); + useExternalBibTeXFilesChange(dlg); + } + + // Save settings from the dialog to the registry + private void saveConfiguration(DialogAccess dlg) { + RegistryHelper registry = new RegistryHelper(xContext); + try { + Object view = registry.getRegistryView(REGISTRY_PATH, true); + XPropertySet xProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,view); + XPropertySetHelper.setPropertyValue(xProps, "ConvertZoteroCitations", dlg.getCheckBoxStateAsBoolean("ConvertZoteroCitations")); + XPropertySetHelper.setPropertyValue(xProps, "ZoteroBibTeXDir", dlg.getTextFieldText("ZoteroBibTeXDir")); + XPropertySetHelper.setPropertyValue(xProps, "NatbibOptions", dlg.getTextFieldText("NatbibOptions")); + XPropertySetHelper.setPropertyValue(xProps, "UseExternalBibTeXFiles", dlg.getCheckBoxStateAsBoolean("UseExternalBibTeXFiles")); + XPropertySetHelper.setPropertyValue(xProps, "ExternalBibTeXDir", dlg.getTextFieldText("ExternalBibTeXDir")); + + // Commit registry changes + XChangesBatch xUpdateContext = (XChangesBatch) + UnoRuntime.queryInterface(XChangesBatch.class,view); + try { + xUpdateContext.commitChanges(); + } + catch (Exception e) { + // ignore + } + + registry.disposeRegistryView(view); + } + catch (Exception e) { + // Failed to get registry view + } + } + + private boolean convertZoteroCitationsChange(DialogAccess dlg) { + // Update dialog according to the current setting of the checkbox + boolean bConvert = dlg.getCheckBoxStateAsBoolean("ConvertZoteroCitations"); + dlg.setControlEnabled("ZoteroBibTeXDirLabel", bConvert); + dlg.setControlEnabled("ZoteroBibTeXDir", bConvert); + dlg.setControlEnabled("ZoteroBibTeXDirButton", bConvert); + dlg.setControlEnabled("NatbibOptionsLabel", bConvert); + dlg.setControlEnabled("NatbibOptions", bConvert); + return true; + } + + private boolean zoteroBibTeXDirClick(DialogAccess dlg) { + String sPath = folderPicker.getPath(); + if (sPath!=null) { + try { + dlg.setTextFieldText("ZoteroBibTeXDir", new File(new URI(sPath)).getCanonicalPath()); + } + catch (IOException e) { + } + catch (URISyntaxException e) { + } + } + return true; + } + + private boolean useExternalBibTeXFilesChange(DialogAccess dlg) { + // Update dialog according to the current setting of the checkbox + boolean bExternal = dlg.getCheckBoxStateAsBoolean("UseExternalBibTeXFiles"); + dlg.setControlEnabled("ExternalBibTeXDirLabel", bExternal); + dlg.setControlEnabled("ExternalBibTeXDir", bExternal); + dlg.setControlEnabled("ExternalBibTeXDirButton", bExternal); + return true; + } + + private boolean externalBibTeXDirClick(DialogAccess dlg) { + String sPath = folderPicker.getPath(); + if (sPath!=null) { + try { + dlg.setTextFieldText("ExternalBibTeXDir", new File(new URI(sPath)).getCanonicalPath()); + } + catch (IOException e) { + } + catch (URISyntaxException e) { + } + } + return true; + } + +} + + + diff --git a/source/java/org/openoffice/da/comp/writer4latex/ExternalApps.java b/source/java/org/openoffice/da/comp/writer4latex/ExternalApps.java index 1110d3b..d4d31c7 100644 --- a/source/java/org/openoffice/da/comp/writer4latex/ExternalApps.java +++ b/source/java/org/openoffice/da/comp/writer4latex/ExternalApps.java @@ -16,11 +16,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * - * Copyright: 2002-2009 by Henrik Just + * Copyright: 2002-2010 by Henrik Just * * All Rights Reserved. * - * Version 1.2 (2009-11-19) + * Version 1.2 (2010-10-11) * */ @@ -32,12 +32,11 @@ import java.lang.Process; import java.lang.ProcessBuilder; import java.util.HashMap; import java.util.Vector; + +import org.openoffice.da.comp.w2lcommon.helper.RegistryHelper; //import java.util.Map; -import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XMultiHierarchicalPropertySet; -import com.sun.star.lang.XComponent; -import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; import com.sun.star.util.XChangesBatch; @@ -158,10 +157,12 @@ public class ExternalApps { /** Load the external applications from the registry */ public void load() { - Object view; - try { - view = getRegistryView(false); - } + RegistryHelper registry = new RegistryHelper(xContext); + Object view; + try { + // Prepare registry view + view = registry.getRegistryView("/org.openoffice.da.Writer4LaTeX.Options/Applications",false); + } catch (com.sun.star.uno.Exception e) { // Give up... //setApplication(LATEX,"Error!",e.getMessage()); @@ -183,15 +184,16 @@ public class ExternalApps { } } - disposeRegistryView(view); + registry.disposeRegistryView(view); } /** Save the external applications to the registry */ public void save() { + RegistryHelper registry = new RegistryHelper(xContext); Object view; try { - view = getRegistryView(true); + view = registry.getRegistryView("/org.openoffice.da.Writer4LaTeX.Options/Applications",true); } catch (com.sun.star.uno.Exception e) { // Give up... @@ -223,34 +225,7 @@ public class ExternalApps { // ignore } - disposeRegistryView(view); + registry.disposeRegistryView(view); } - // Get a view of the options root in the registry - private Object getRegistryView(boolean bUpdate) - throws com.sun.star.uno.Exception { - //Object provider = xMSF.createInstance( - Object provider = xContext.getServiceManager().createInstanceWithContext( - "com.sun.star.configuration.ConfigurationProvider", xContext); - XMultiServiceFactory xProvider = (XMultiServiceFactory) - UnoRuntime.queryInterface(XMultiServiceFactory.class,provider); - PropertyValue[] args = new PropertyValue[1]; - args[0] = new PropertyValue(); - args[0].Name = "nodepath"; - args[0].Value = "/org.openoffice.da.Writer4LaTeX.Options/Applications"; - String sServiceName = bUpdate ? - "com.sun.star.configuration.ConfigurationUpdateAccess" : - "com.sun.star.configuration.ConfigurationAccess"; - Object view = xProvider.createInstanceWithArguments(sServiceName,args); - return view; - } - - // Dispose a previously obtained registry view - private void disposeRegistryView(Object view) { - XComponent xComponent = (XComponent) - UnoRuntime.queryInterface(XComponent.class,view); - xComponent.dispose(); - } - - } \ No newline at end of file diff --git a/source/java/org/openoffice/da/comp/writer4latex/TeXImportFilter.java b/source/java/org/openoffice/da/comp/writer4latex/TeXImportFilter.java index f620f36..7f30963 100644 --- a/source/java/org/openoffice/da/comp/writer4latex/TeXImportFilter.java +++ b/source/java/org/openoffice/da/comp/writer4latex/TeXImportFilter.java @@ -107,7 +107,7 @@ public class TeXImportFilter extends WeakBase implements XInitialization, XNamed return m_serviceNames; } - // The following methods may be called from multiple threads (eg. if someone wants to cancel the filtering), + // The following methods may be called from multiple threads (e.g. if someone wants to cancel the filtering), // thus all access to class members must be synchronized // Implement XInitialization: @@ -236,7 +236,7 @@ public class TeXImportFilter extends WeakBase implements XInitialization, XNamed // Private helper methods /** Import a TeX document with TeX4ht * @param xText into this document - * @param sURL from the TeX documetn given by this URL + * @param sURL from the TeX document given by this URL */ public boolean importTeX(XTextDocument xText, String sURL, XStatusIndicator xStatus) { int nStep = 0; diff --git a/source/java/org/openoffice/da/comp/writer4latex/W4LRegistration.java b/source/java/org/openoffice/da/comp/writer4latex/W4LRegistration.java index 5013f3a..63f6ef4 100644 --- a/source/java/org/openoffice/da/comp/writer4latex/W4LRegistration.java +++ b/source/java/org/openoffice/da/comp/writer4latex/W4LRegistration.java @@ -16,11 +16,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * - * Copyright: 2002-2009 by Henrik Just + * Copyright: 2002-2010 by Henrik Just * * All Rights Reserved. * - * Version 1.2 (2009-05-20) + * Version 1.2 (2010-10-10) * */ @@ -78,9 +78,15 @@ public class W4LRegistration { multiFactory, regKey); } - else if (implName.equals(ConfigurationDialog.__implementationName) ) { - xSingleServiceFactory = FactoryHelper.getServiceFactory(ConfigurationDialog.class, - ConfigurationDialog.__serviceName, + else if (implName.equals(ApplicationsDialog.__implementationName) ) { + xSingleServiceFactory = FactoryHelper.getServiceFactory(ApplicationsDialog.class, + ApplicationsDialog.__serviceName, + multiFactory, + regKey); + } + else if (implName.equals(BibliographyDialog.__implementationName) ) { + xSingleServiceFactory = FactoryHelper.getServiceFactory(BibliographyDialog.class, + BibliographyDialog.__serviceName, multiFactory, regKey); } @@ -110,8 +116,10 @@ public class W4LRegistration { TeXImportFilter.__serviceName, regKey) & FactoryHelper.writeRegistryServiceInfo(TeXDetectService.__implementationName, TeXDetectService.__serviceName, regKey) & - FactoryHelper.writeRegistryServiceInfo(ConfigurationDialog.__implementationName, - ConfigurationDialog.__serviceName, regKey) & + FactoryHelper.writeRegistryServiceInfo(ApplicationsDialog.__implementationName, + ApplicationsDialog.__serviceName, regKey) & + FactoryHelper.writeRegistryServiceInfo(BibliographyDialog.__implementationName, + BibliographyDialog.__serviceName, regKey) & FactoryHelper.writeRegistryServiceInfo(LogViewerDialog.__implementationName, LogViewerDialog.__serviceName, regKey); } diff --git a/source/java/org/openoffice/da/comp/writer4latex/Writer4LaTeX.java b/source/java/org/openoffice/da/comp/writer4latex/Writer4LaTeX.java index e84d974..e17a5bb 100644 --- a/source/java/org/openoffice/da/comp/writer4latex/Writer4LaTeX.java +++ b/source/java/org/openoffice/da/comp/writer4latex/Writer4LaTeX.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.2 (2010-03-12) + * Version 1.2 (2010-10-13) * */ @@ -52,6 +52,8 @@ import org.openoffice.da.comp.w2lcommon.helper.MessageBox; import org.openoffice.da.comp.w2lcommon.helper.PropertyHelper; import org.openoffice.da.comp.w2lcommon.helper.RegistryHelper; import org.openoffice.da.comp.w2lcommon.helper.XPropertySetHelper; + +import writer2latex.util.CSVList; /** This class implements the ui (dispatch) commands provided by Writer4LaTeX. * The actual processing is done by the three core classes <code>TeXify</code>, @@ -198,6 +200,39 @@ public final class Writer4LaTeX extends WeakBase xStatus.start("Writer4LaTeX",10); xStatus.setValue(1); // At least we have started, that's 10% :-) + // First work a bit on the FilterData (get the backend and set bibliography options) + String sBackend = "generic"; + PropertyHelper mediaHelper = new PropertyHelper(mediaProps); + Object filterData = mediaHelper.get("FilterData"); + if (filterData instanceof PropertyValue[]) { + PropertyHelper filterHelper = new PropertyHelper((PropertyValue[])filterData); + // Get the backend + Object backend = filterHelper.get("backend"); + if (backend instanceof String) { + sBackend = (String) backend; + } + + // Set the bibliography options according to the settings + RegistryHelper registry = new RegistryHelper(m_xContext); + try { + Object view = registry.getRegistryView(BibliographyDialog.REGISTRY_PATH, false); + XPropertySet xProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,view); + if (XPropertySetHelper.getPropertyValueAsBoolean(xProps, "ConvertZoteroCitations")) { + filterHelper.put("zotero_bibtex_files", getFileList(XPropertySetHelper.getPropertyValueAsString(xProps, "ZoteroBibTeXDir"))); + filterHelper.put("natbib_options", XPropertySetHelper.getPropertyValueAsString(xProps, "NatbibOptions")); + } + if (XPropertySetHelper.getPropertyValueAsBoolean(xProps, "UseExternalBibTeXFiles")) { + filterHelper.put("external_bibtex_files", getFileList(XPropertySetHelper.getPropertyValueAsString(xProps, "ExternalBibTeXDir"))); + } + mediaHelper.put("FilterData",filterHelper.toArray()); + mediaProps = mediaHelper.toArray(); + registry.disposeRegistryView(view); + } + catch (Exception e) { + // Failed to get registry view + } + } + try { // Convert to LaTeX String sTargetUrl = sBasePath+sBaseFileName+".tex"; @@ -213,16 +248,6 @@ public final class Writer4LaTeX extends WeakBase xStatus.setValue(6); // Export is finished, that's more than half :-) - // Get the backend from the media properties - String sBackend = "generic"; - Object filterData = (new PropertyHelper(mediaProps)).get("FilterData"); - if (filterData instanceof PropertyValue[]) { - Object backend = (new PropertyHelper((PropertyValue[])filterData)).get("backend"); - if (backend instanceof String) { - sBackend = (String) backend; - } - } - if (texify==null) { texify = new TeXify(m_xContext); } File file = new File(urlToFile(sBasePath),sBaseFileName); @@ -257,7 +282,21 @@ public final class Writer4LaTeX extends WeakBase xStatus.end(); } - private void viewLog() { + private String getFileList(String sDirectory) { + File dir = new File(sDirectory); + CSVList filelist = new CSVList(","); + if (dir.isDirectory()) { + File[] files = dir.listFiles(); + for (File file : files) { + if (file.isFile() && file.getName().endsWith(".bib")) { + filelist.addValue(file.getAbsolutePath()); + } + } + } + return filelist.toString(); + } + + private void viewLog() { if (updateLocation()) { // Execute the log viewer dialog try { diff --git a/source/java/writer2latex/api/ConverterFactory.java b/source/java/writer2latex/api/ConverterFactory.java index bcc8170..3339bbd 100644 --- a/source/java/writer2latex/api/ConverterFactory.java +++ b/source/java/writer2latex/api/ConverterFactory.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.2 (2010-10-01) + * Version 1.2 (2010-10-13) * */ @@ -33,7 +33,7 @@ public class ConverterFactory { // Version information private static final String VERSION = "1.1.5"; - private static final String DATE = "2010-10-06"; + private static final String DATE = "2010-10-13"; /** Return the Writer2LaTeX version in the form * (major version).(minor version).(patch level)<br/> diff --git a/source/java/writer2latex/latex/DrawConverter.java b/source/java/writer2latex/latex/DrawConverter.java index ec73893..3e494df 100644 --- a/source/java/writer2latex/latex/DrawConverter.java +++ b/source/java/writer2latex/latex/DrawConverter.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.2 (2010-03-29) + * Version 1.2 (2010-10-09) * */ @@ -340,7 +340,7 @@ public class DrawConverter extends ConverterHelper { boolean bCommentOut = true; String sHref = node.getAttribute(XMLString.XLINK_HREF); - if (node.hasAttribute(XMLString.XLINK_HREF) && !ofr.isInPackage(sHref)) { + if (sHref.length()>0 && !ofr.isInPackage(sHref)) { // Linked image is not yet handled by ImageLoader. This is a temp. // solution (will go away when ImageLoader is finished) sFileName = ofr.fixRelativeLink(sHref); diff --git a/source/java/writer2latex/latex/FieldConverter.java b/source/java/writer2latex/latex/FieldConverter.java index ad9f9da..08822ef 100644 --- a/source/java/writer2latex/latex/FieldConverter.java +++ b/source/java/writer2latex/latex/FieldConverter.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.2 (2010-10-06) + * Version 1.2 (2010-10-13) * */ @@ -136,7 +136,11 @@ public class FieldConverter extends ConverterHelper { // Use natbib if (bNeedNatbib) { - pack.append("\\usepackage{natbib}").nl(); + pack.append("\\usepackage"); + if (config.getNatbibOptions().length()>0) { + pack.append("[").append(config.getNatbibOptions()).append("]"); + } + pack.append("{natbib}").nl(); } // Export sequence declarations @@ -459,12 +463,12 @@ public class FieldConverter extends ConverterHelper { // (we don't expect any errors and ignore them, if they happen anyway) // Sort key (purpose? currently ignored) - boolean bSort = true; + /*boolean bSort = true; try { bSort = jo.getBoolean("sort"); } catch (JSONException e) { - } + }*/ JSONArray citationItemsArray = null; try { // The value is an array of objects, one for each source in this citation diff --git a/source/java/writer2latex/latex/LaTeXConfig.java b/source/java/writer2latex/latex/LaTeXConfig.java index 1d42e47..57fe60d 100644 --- a/source/java/writer2latex/latex/LaTeXConfig.java +++ b/source/java/writer2latex/latex/LaTeXConfig.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.2 (2010-10-04) + * Version 1.2 (2010-10-09) * */ @@ -48,7 +48,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase { ///////////////////////////////////////////////////////////////////////// // I. Define items needed by ConfigBase - protected int getOptionCount() { return 66; } + protected int getOptionCount() { return 67; } protected String getDefaultConfigPath() { return "/writer2latex/latex/config/"; } ///////////////////////////////////////////////////////////////////////// @@ -145,37 +145,38 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase { private static final int BIBTEX_STYLE = 32; private static final int EXTERNAL_BIBTEX_FILES = 33; private static final int ZOTERO_BIBTEX_FILES = 34; - private static final int FORMATTING = 35; - private static final int PAGE_FORMATTING = 36; - private static final int OTHER_STYLES = 37; - private static final int IMAGE_CONTENT = 38; - private static final int TABLE_CONTENT = 39; - private static final int TABLE_FIRST_HEAD_STYLE = 40; - private static final int TABLE_HEAD_STYLE = 41; - private static final int TABLE_FOOT_STYLE = 42; - private static final int TABLE_LAST_FOOT_STYLE = 43; - private static final int IGNORE_HARD_PAGE_BREAKS = 44; - private static final int IGNORE_HARD_LINE_BREAKS = 45; - private static final int IGNORE_EMPTY_PARAGRAPHS = 46; - private static final int IGNORE_DOUBLE_SPACES = 47; - private static final int ALIGN_FRAMES = 48; - private static final int FLOAT_FIGURES = 49; - private static final int FLOAT_TABLES = 50; - private static final int FLOAT_OPTIONS = 51; - private static final int FIGURE_SEQUENCE_NAME = 52; - private static final int TABLE_SEQUENCE_NAME = 53; - private static final int IMAGE_OPTIONS = 54; - private static final int REMOVE_GRAPHICS_EXTENSION = 55; - private static final int ORIGINAL_IMAGE_SIZE = 56; - private static final int SIMPLE_TABLE_LIMIT = 57; - private static final int NOTES = 58; - private static final int METADATA = 59; - private static final int TABSTOP = 60; - private static final int WRAP_LINES_AFTER = 61; - private static final int SPLIT_LINKED_SECTIONS = 62; - private static final int SPLIT_TOPLEVEL_SECTIONS = 63; - private static final int SAVE_IMAGES_IN_SUBDIR = 64; - private static final int DEBUG = 65; + private static final int NATBIB_OPTIONS = 35; + private static final int FORMATTING = 36; + private static final int PAGE_FORMATTING = 37; + private static final int OTHER_STYLES = 38; + private static final int IMAGE_CONTENT = 39; + private static final int TABLE_CONTENT = 40; + private static final int TABLE_FIRST_HEAD_STYLE = 41; + private static final int TABLE_HEAD_STYLE = 42; + private static final int TABLE_FOOT_STYLE = 43; + private static final int TABLE_LAST_FOOT_STYLE = 44; + private static final int IGNORE_HARD_PAGE_BREAKS = 45; + private static final int IGNORE_HARD_LINE_BREAKS = 46; + private static final int IGNORE_EMPTY_PARAGRAPHS = 47; + private static final int IGNORE_DOUBLE_SPACES = 48; + private static final int ALIGN_FRAMES = 49; + private static final int FLOAT_FIGURES = 50; + private static final int FLOAT_TABLES = 51; + private static final int FLOAT_OPTIONS = 52; + private static final int FIGURE_SEQUENCE_NAME = 53; + private static final int TABLE_SEQUENCE_NAME = 54; + private static final int IMAGE_OPTIONS = 55; + private static final int REMOVE_GRAPHICS_EXTENSION = 56; + private static final int ORIGINAL_IMAGE_SIZE = 57; + private static final int SIMPLE_TABLE_LIMIT = 58; + private static final int NOTES = 59; + private static final int METADATA = 60; + private static final int TABSTOP = 61; + private static final int WRAP_LINES_AFTER = 62; + private static final int SPLIT_LINKED_SECTIONS = 63; + private static final int SPLIT_TOPLEVEL_SECTIONS = 64; + private static final int SAVE_IMAGES_IN_SUBDIR = 65; + private static final int DEBUG = 66; ///////////////////////////////////////////////////////////////////////// // IV. Our options data @@ -249,6 +250,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase { options[BIBTEX_STYLE] = new Option("bibtex_style","plain"); options[EXTERNAL_BIBTEX_FILES] = new Option("external_bibtex_files",""); options[ZOTERO_BIBTEX_FILES] = new Option("zotero_bibtex_files",""); + options[NATBIB_OPTIONS] = new Option("natbib_options",""); options[FORMATTING] = new IntegerOption("formatting","convert_basic") { public void setString(String sValue) { super.setString(sValue); @@ -659,6 +661,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase { public String bibtexStyle() { return options[BIBTEX_STYLE].getString(); } public String externalBibtexFiles() { return options[EXTERNAL_BIBTEX_FILES].getString(); } public String zoteroBibtexFiles() { return options[ZOTERO_BIBTEX_FILES].getString(); } + public String getNatbibOptions() { return options[NATBIB_OPTIONS].getString(); } // Formatting options public int formatting() { return ((IntegerOption) options[FORMATTING]).getValue(); } diff --git a/source/oxt/writer4latex/META-INF/manifest.xml b/source/oxt/writer4latex/META-INF/manifest.xml index 3a837b4..5c0c6d2 100644 --- a/source/oxt/writer4latex/META-INF/manifest.xml +++ b/source/oxt/writer4latex/META-INF/manifest.xml @@ -10,7 +10,7 @@ manifest:media-type="application/vnd.sun.star.configuration-data"/> <manifest:file-entry - manifest:full-path="OptionsDialog.xcu" + manifest:full-path="OptionPages.xcu" manifest:media-type="application/vnd.sun.star.configuration-data"/> <manifest:file-entry diff --git a/source/oxt/writer4latex/OptionPages.xcu b/source/oxt/writer4latex/OptionPages.xcu new file mode 100644 index 0000000..05d163c --- /dev/null +++ b/source/oxt/writer4latex/OptionPages.xcu @@ -0,0 +1,72 @@ +<?xml version='1.0' encoding='UTF-8'?> + +<oor:component-data oor:name="OptionsDialog" oor:package="org.openoffice.Office" + xmlns:oor="http://openoffice.org/2001/registry" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + + <node oor:name="Modules"> + <!-- This node should appear in the Writer module --> + <node oor:name="com.sun.star.text.TextDocument" oor:op="fuse"> + <node oor:name="Nodes"> + <node oor:name="org.openoffice.da.writer4latex.configuration" + oor:op="fuse"> + </node> + </node> + </node> + </node> + + <node oor:name="Nodes"> + + <!-- We define a single root node --> + <node oor:name="org.openoffice.da.writer4latex.configuration" + oor:op="fuse"> + <prop oor:name="Id"> + <value>org.openoffice.da.writer4latex.configuration</value> + </prop> + <prop oor:name="Label"> + <value xml:lang="en-US">Writer4LaTeX</value> + </prop> + <prop oor:name="OptionsPage"> + <value>%origin%/W4LDialogs/ConfigurationRoot.xdl</value> + </prop> + <prop oor:name="EventHandlerService"> + <value></value> + </prop> + + <node oor:name="Leaves"> + <!-- and the root node has several leaves --> + <node oor:name="org.openoffice.da.writer4latex.configuration.applications" + oor:op="fuse"> + <prop oor:name="Id"> + <value>org.openoffice.da.writer4latex.applications</value> + </prop> + <prop oor:name="Label"> + <value xml:lang="en-US">Applications</value> + </prop> + <prop oor:name="OptionsPage"> + <value>%origin%/W4LDialogs/Applications.xdl</value> + </prop> + <prop oor:name="EventHandlerService"> + <value>org.openoffice.da.writer4latex.ApplicationsDialog</value> + </prop> + </node> + <node oor:name="org.openoffice.da.writer4latex.configuration.bibliography" + oor:op="fuse"> + <prop oor:name="Id"> + <value>org.openoffice.da.writer4latex.bibliography</value> + </prop> + <prop oor:name="Label"> + <value xml:lang="en-US">Bibliography</value> + </prop> + <prop oor:name="OptionsPage"> + <value>%origin%/W4LDialogs/Bibliography.xdl</value> + </prop> + <prop oor:name="EventHandlerService"> + <value>org.openoffice.da.writer4latex.BibliographyDialog</value> + </prop> + </node> + </node> + </node> + </node> +</oor:component-data> \ No newline at end of file diff --git a/source/oxt/writer4latex/Options.xcs b/source/oxt/writer4latex/Options.xcs index 4947124..5f54a2d 100644 --- a/source/oxt/writer4latex/Options.xcs +++ b/source/oxt/writer4latex/Options.xcs @@ -24,5 +24,12 @@ <node-ref oor:name="PostscriptViewer" oor:node-type="Application" /> <node-ref oor:name="PdfViewer" oor:node-type="Application" /> </group> + <group oor:name="BibliographyOptions"> + <prop oor:name="ConvertZoteroCitations" oor:type="xs:boolean" /> + <prop oor:name="ZoteroBibTeXDir" oor:type="xs:string" /> + <prop oor:name="NatbibOptions" oor:type="xs:string" /> + <prop oor:name="UseExternalBibTeXFiles" oor:type="xs:boolean" /> + <prop oor:name="ExternalBibTeXDir" oor:type="xs:string" /> + </group> </component> </oor:component-schema> \ No newline at end of file diff --git a/source/oxt/writer4latex/Options.xcu b/source/oxt/writer4latex/Options.xcu index b36c7a4..ca48d90 100644 --- a/source/oxt/writer4latex/Options.xcu +++ b/source/oxt/writer4latex/Options.xcu @@ -86,4 +86,21 @@ </prop> </node> </node> + <node oor:name="BibliographyOptions"> + <prop oor:name="ConvertZoteroCitations" oor:type="xs:boolean"> + <value>false</value> + </prop> + <prop oor:name="ZoteroBibTeXDir" oor:type="xs:string"> + <value></value> + </prop> + <prop oor:name="NatbibOptions" oor:type="xs:string"> + <value></value> + </prop> + <prop oor:name="UseExternalBibTeXFiles" oor:type="xs:boolean"> + <value>false</value> + </prop> + <prop oor:name="ExternalBibTeXDir" oor:type="xs:string"> + <value></value> + </prop> + </node> </oor:component-data> \ No newline at end of file diff --git a/source/oxt/writer4latex/OptionsDialog.xcu b/source/oxt/writer4latex/OptionsDialog.xcu deleted file mode 100644 index 131fe19..0000000 --- a/source/oxt/writer4latex/OptionsDialog.xcu +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> - -<oor:component-data oor:name="OptionsDialog" oor:package="org.openoffice.Office" - xmlns:oor="http://openoffice.org/2001/registry" - xmlns:xs="http://www.w3.org/2001/XMLSchema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - - <node oor:name="Nodes"> - <node oor:name="Writer" oor:op="fuse"> - <node oor:name="Leaves"> - <node oor:name="org.openoffice.da.writer4latex.configuration" - oor:op="fuse"> - <prop oor:name="Id"> - <value>org.openoffice.da.writer4latex.oxt</value> - </prop> - <prop oor:name="Label"> - <value xml:lang="en-US">Writer4LaTeX</value> - </prop> - <prop oor:name="OptionsPage"> - <value>%origin%/W4LDialogs/Configuration.xdl</value> - </prop> - <prop oor:name="EventHandlerService"> - <value>org.openoffice.da.writer4latex.ConfigurationDialog</value> - </prop> - </node> - </node> - </node> - </node> -</oor:component-data> \ No newline at end of file diff --git a/source/oxt/writer4latex/W4LDialogs/Configuration.xdl b/source/oxt/writer4latex/W4LDialogs/Applications.xdl similarity index 90% rename from source/oxt/writer4latex/W4LDialogs/Configuration.xdl rename to source/oxt/writer4latex/W4LDialogs/Applications.xdl index bcfbe2e..aa47e87 100644 --- a/source/oxt/writer4latex/W4LDialogs/Configuration.xdl +++ b/source/oxt/writer4latex/W4LDialogs/Applications.xdl @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!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="Configuration" dlg:left="139" dlg:top="84" dlg:width="260" dlg:height="101" dlg:closeable="true" dlg:moveable="true" dlg:title="Writer4LaTeX Configuration" dlg:withtitlebar="false" dlg:help-url="org.openoffice.da.writer4latex.oxt:ConfigurationDialog"> +<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Configuration" dlg:left="139" dlg:top="84" dlg:width="260" dlg:height="185" dlg:closeable="true" dlg:moveable="true" dlg:title="Writer4LaTeX Configuration" dlg:withtitlebar="false" dlg:help-url="org.openoffice.da.writer4latex.oxt:ConfigurationDialog"> <dlg:bulletinboard> <dlg:text dlg:id="ExternalAppsLabel" dlg:tab-index="0" dlg:left="6" dlg:top="4" dlg:width="210" dlg:height="12" dlg:value="External Applications"/> <dlg:text dlg:id="AppLabel" dlg:tab-index="1" dlg:left="12" dlg:top="18" dlg:width="55" dlg:height="12" dlg:value="Application"/> @@ -8,7 +8,7 @@ <script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:BrowseClick" script:language="UNO"/> </dlg:button> <dlg:text dlg:id="ExecutableLabel" dlg:tab-index="3" dlg:left="12" dlg:top="32" dlg:width="55" dlg:height="12" dlg:value="Executable"/> - <dlg:menulist dlg:id="Application" dlg:tab-index="2" dlg:left="72" dlg:top="17" dlg:width="120" dlg:height="12" dlg:spin="true" dlg:linecount="10" dlg:help-url="org.openoffice.da.writer4latex.oxt:ConfigurationApplication"> + <dlg:menulist dlg:id="Application" dlg:tab-index="2" dlg:left="72" dlg:top="16" dlg:width="120" dlg:height="12" dlg:spin="true" dlg:linecount="10" dlg:help-url="org.openoffice.da.writer4latex.oxt:ConfigurationApplication"> <dlg:menupopup> <dlg:menuitem dlg:value="LaTeX" dlg:selected="true"/> <dlg:menuitem dlg:value="PdfLaTeX"/> @@ -23,13 +23,13 @@ </dlg:menupopup> <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:ApplicationChange" script:language="UNO"/> </dlg:menulist> - <dlg:textfield dlg:id="Executable" dlg:tab-index="4" dlg:left="72" dlg:top="31" dlg:width="120" dlg:height="12" dlg:help-url="org.openoffice.da.writer4latex.oxt:ConfigurationExecutable"> + <dlg:textfield dlg:id="Executable" dlg:tab-index="4" dlg:left="72" dlg:top="30" dlg:width="120" dlg:height="12" dlg:help-url="org.openoffice.da.writer4latex.oxt:ConfigurationExecutable"> <script:event script:event-name="on-blur" script:macro-name="vnd.sun.star.UNO:ExecutableUnfocus" script:language="UNO"/> </dlg:textfield> - <dlg:textfield dlg:id="Options" dlg:tab-index="7" dlg:left="72" dlg:top="45" dlg:width="120" dlg:height="12" dlg:help-url="org.openoffice.da.writer4latex.oxt:ConfigurationOptions"> + <dlg:textfield dlg:id="Options" dlg:tab-index="7" dlg:left="72" dlg:top="44" dlg:width="120" dlg:height="12" dlg:help-url="org.openoffice.da.writer4latex.oxt:ConfigurationOptions"> <script:event script:event-name="on-blur" script:macro-name="vnd.sun.star.UNO:OptionsUnfocus" script:language="UNO"/> </dlg:textfield> - <dlg:button dlg:id="AutoButton" dlg:tab-index="8" dlg:left="72" dlg:top="65" dlg:width="120" dlg:height="14" dlg:value="Automatic configuration" dlg:help-url="org.openoffice.da.writer4latex.oxt:ConfigurationAutoButton"> + <dlg:button dlg:id="AutoButton" dlg:tab-index="8" dlg:left="72" dlg:top="64" dlg:width="120" dlg:height="14" dlg:value="Automatic configuration" dlg:help-url="org.openoffice.da.writer4latex.oxt:ConfigurationAutoButton"> <script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:AutomaticClick" script:language="UNO"/> </dlg:button> <dlg:text dlg:id="OptionsLabel" dlg:tab-index="6" dlg:left="12" dlg:top="46" dlg:width="55" dlg:height="12" dlg:value="Options"/> diff --git a/source/oxt/writer4latex/W4LDialogs/Bibliography.xdl b/source/oxt/writer4latex/W4LDialogs/Bibliography.xdl new file mode 100644 index 0000000..e6c3bb2 --- /dev/null +++ b/source/oxt/writer4latex/W4LDialogs/Bibliography.xdl @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!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:closeable="true" dlg:moveable="true" dlg:title="Writer4LaTeX Bibliography Configuration" dlg:withtitlebar="false" dlg:help-url="org.openoffice.da.writer4latex.oxt:BibliographyDialog"> + <dlg:bulletinboard> + <dlg:text dlg:id="ZoteroLabel" dlg:tab-index="0" dlg:left="6" dlg:top="4" dlg:width="244" dlg:height="12" dlg:value="Zotero Support"/> + <dlg:checkbox dlg:id="ConvertZoteroCitations" dlg:tab-index="1" dlg:left="10" dlg:top="18" dlg:width="240" dlg:height="12" dlg:value="Convert Zotero ciations (requires natbib.sty)" dlg:checked="false" dlg:help-url="org.openoffice.da.writer2latex.oxt:BibliographyConvertZoteroCitations"> + <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:ConvertZoteroCitationsChange" script:language="UNO"/> + </dlg:checkbox> + <dlg:text dlg:id="ZoteroBibTeXDirLabel" dlg:tab-index="2" dlg:left="10" dlg:top="32" dlg:width="60" dlg:height="12" dlg:value="BibTeX folder"/> + <dlg:textfield dlg:id="ZoteroBibTeXDir" dlg:tab-index="3" dlg:left="70" dlg:top="30" dlg:width="130" dlg:height="12" dlg:help-url="org.openoffice.da.writer2latex.oxt:ZoteroBibTeXDir"/> + <dlg:button dlg:id="ZoteroBibTeXDirButton" dlg:tab-index="4" dlg:left="210" dlg:top="30" dlg:width="40" dlg:height="12" dlg:value="Browse..." dlg:help-url="org.openoffice.da.writer2latex.oxt:ZoteroBibTeXDirButton"> + <script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:ZoteroBibTeXDirClick" script:language="UNO"/> + </dlg:button> + <dlg:text dlg:id="NatbibOptionsLabel" dlg:tab-index="5" dlg:left="10" dlg:top="46" dlg:width="50" dlg:height="12" dlg:value="Natbib options"/> + <dlg:textfield dlg:id="NatbibOptions" dlg:tab-index="6" dlg:left="70" dlg:top="44" dlg:width="180" dlg:height="12" dlg:help-url="org.openoffice.da.writer2latex.oxt:NatbibOptions"/> + + <dlg:text dlg:id="ExternalBibTeXLabel" dlg:tab-index="7" dlg:left="6" dlg:top="60" dlg:width="244" dlg:height="12" dlg:value="External BibTeX files"/> + <dlg:checkbox dlg:id="UseExternalBibTeXFiles" dlg:tab-index="8" dlg:left="10" dlg:top="74" dlg:width="240" dlg:height="12" dlg:value="Use external BibTeX files" dlg:checked="false" dlg:help-url="org.openoffice.da.writer2latex.oxt:UseExternalBibTeXFiles" > + <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:UseExternalBibTeXFilesChange" script:language="UNO"/> + </dlg:checkbox> + <dlg:text dlg:id="ExternalBibTeXDirLabel" dlg:tab-index="9" dlg:left="10" dlg:top="88" dlg:width="60" dlg:height="12" dlg:value="BibTeX folder"/> + <dlg:textfield dlg:id="ExternalBibTeXDir" dlg:tab-index="10" dlg:left="70" dlg:top="86" dlg:width="130" dlg:height="12" dlg:help-url="org.openoffice.da.writer2latex.oxt:ExternalBibTeXDir"/> + <dlg:button dlg:id="ExternalBibTeXDirButton" dlg:tab-index="11" dlg:left="210" dlg:top="86" dlg:width="40" dlg:height="12" dlg:value="Browse..." dlg:help-url="org.openoffice.da.writer2latex.oxt:ExternalBibTeXDirButton"> + <script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:ExternalBibTeXDirClick" script:language="UNO"/> + </dlg:button> + </dlg:bulletinboard> +</dlg:window> \ No newline at end of file diff --git a/source/oxt/writer4latex/W4LDialogs/ConfigurationRoot.xdl b/source/oxt/writer4latex/W4LDialogs/ConfigurationRoot.xdl new file mode 100644 index 0000000..b2cb971 --- /dev/null +++ b/source/oxt/writer4latex/W4LDialogs/ConfigurationRoot.xdl @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!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="Configuration1" dlg:left="139" dlg:top="84" dlg:width="260" dlg:height="185" dlg:closeable="true" dlg:moveable="true" dlg:title="ConfigurationRoot" dlg:withtitlebar="false"> + <dlg:styles> + <dlg:style dlg:style-id="0" dlg:border="none"/> + <dlg:style dlg:style-id="1" dlg:font-height="14"/> + </dlg:styles> + <dlg:bulletinboard> + <dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="0" dlg:left="6" dlg:top="32" dlg:width="248" dlg:height="2"/> + <dlg:img dlg:style-id="0" dlg:id="ImageControl1" dlg:tab-index="1" dlg:left="8" dlg:top="6" dlg:width="21" dlg:height="21" dlg:scale-image="false" dlg:src="../images/w2licon.png"/> + <dlg:text dlg:style-id="1" dlg:id="Label1" dlg:tab-index="2" dlg:left="34" dlg:top="10" dlg:width="193" dlg:height="16" dlg:value="Writer4LaTeX Configuration"/> + <dlg:text dlg:id="Label2" dlg:tab-index="3" dlg:left="34" dlg:top="43" dlg:width="194" dlg:height="78" dlg:value="This is where you configure the Writer4LaTeX frontend. You can configure the interaction with LaTeX and friends, and you can configure interaction with external BibTeX files created by Zotero or other applications." dlg:multiline="true"/> + + </dlg:bulletinboard> +</dlg:window> \ No newline at end of file diff --git a/source/oxt/writer4latex/W4LDialogs/dialog.xlb b/source/oxt/writer4latex/W4LDialogs/dialog.xlb index 3fc1e83..073ea2a 100644 --- a/source/oxt/writer4latex/W4LDialogs/dialog.xlb +++ b/source/oxt/writer4latex/W4LDialogs/dialog.xlb @@ -1,7 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> <library:library xmlns:library="http://openoffice.org/2000/library" library:name="W4LDialogs" library:readonly="false" library:passwordprotected="false"> - <library:element library:name="Configuration"/> + <library:element library:name="ConfigurationRoot"/> + <library:element library:name="Applications"/> + <library:element library:name="Bibliography"/> <library:element library:name="LogViewer"/> <library:element library:name="AutoConfigInfo"/> </library:library> \ No newline at end of file