Writer4LaTeX help content

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@86 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2011-02-10 08:39:07 +00:00
parent 22c38c3ff4
commit 559293a169
16 changed files with 878 additions and 120 deletions

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2011-01-28)
* Version 1.2 (2011-01-31)
*
*/
@ -53,9 +53,6 @@ import org.openoffice.da.comp.w2lcommon.helper.MessageBox;
import org.openoffice.da.comp.w2lcommon.helper.RegistryHelper;
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
* of the bibliography in Writer4LaTeX.
*/
@ -176,14 +173,16 @@ public final class BibliographyDialog
XPropertySetHelper.getPropertyValueAsBoolean(xProps, "ConvertZoteroCitations"));
dlg.setCheckBoxStateAsBoolean("ConvertJabRefCitations",
XPropertySetHelper.getPropertyValueAsBoolean(xProps, "ConvertJabRefCitations"));
dlg.setCheckBoxStateAsBoolean("UseNatbib",
XPropertySetHelper.getPropertyValueAsBoolean(xProps, "UseNatbib"));
dlg.setTextFieldText("NatbibOptions",
XPropertySetHelper.getPropertyValueAsString(xProps, "NatbibOptions"));
dlg.setCheckBoxStateAsBoolean("IncludeOriginalCitations",
XPropertySetHelper.getPropertyValueAsBoolean(xProps, "IncludeOriginalCitations"));
dlg.setListBoxSelectedItem("BibTeXLocation",
XPropertySetHelper.getPropertyValueAsShort(xProps, "BibTeXLocation"));
dlg.setTextFieldText("BibTeXDir",
XPropertySetHelper.getPropertyValueAsString(xProps, "BibTeXDir"));
dlg.setCheckBoxStateAsBoolean("UseNatbib",
XPropertySetHelper.getPropertyValueAsBoolean(xProps, "UseNatbib"));
dlg.setTextFieldText("NatbibOptions",
XPropertySetHelper.getPropertyValueAsString(xProps, "NatbibOptions"));
registry.disposeRegistryView(view);
}
catch (Exception e) {
@ -204,10 +203,11 @@ public final class BibliographyDialog
XPropertySetHelper.setPropertyValue(xProps, "UseExternalBibTeXFiles", dlg.getCheckBoxStateAsBoolean("UseExternalBibTeXFiles"));
XPropertySetHelper.setPropertyValue(xProps, "ConvertZoteroCitations", dlg.getCheckBoxStateAsBoolean("ConvertZoteroCitations"));
XPropertySetHelper.setPropertyValue(xProps, "ConvertJabRefCitations", dlg.getCheckBoxStateAsBoolean("ConvertJabRefCitations"));
XPropertySetHelper.setPropertyValue(xProps, "UseNatbib", dlg.getCheckBoxStateAsBoolean("UseNatbib"));
XPropertySetHelper.setPropertyValue(xProps, "NatbibOptions", dlg.getTextFieldText("NatbibOptions"));
XPropertySetHelper.setPropertyValue(xProps, "IncludeOriginalCitations", dlg.getCheckBoxStateAsBoolean("IncludeOriginalCitations"));
XPropertySetHelper.setPropertyValue(xProps, "BibTeXLocation", dlg.getListBoxSelectedItem("BibTeXLocation"));
XPropertySetHelper.setPropertyValue(xProps, "BibTeXDir", dlg.getTextFieldText("BibTeXDir"));
XPropertySetHelper.setPropertyValue(xProps, "UseNatbib", dlg.getCheckBoxStateAsBoolean("UseNatbib"));
XPropertySetHelper.setPropertyValue(xProps, "NatbibOptions", dlg.getTextFieldText("NatbibOptions"));
// Commit registry changes
XChangesBatch xUpdateContext = (XChangesBatch)
@ -254,10 +254,11 @@ public final class BibliographyDialog
}
private void enableBibTeXSettings(DialogAccess dlg) {
boolean bEnableLocation = dlg.getCheckBoxStateAsBoolean("UseExternalBibTeXFiles")
|| dlg.getCheckBoxStateAsBoolean("ConvertZoteroCitations")
boolean bConvertZoteroJabRef = dlg.getCheckBoxStateAsBoolean("ConvertZoteroCitations")
|| dlg.getCheckBoxStateAsBoolean("ConvertJabRefCitations");
boolean bEnableLocation = dlg.getCheckBoxStateAsBoolean("UseExternalBibTeXFiles") || bConvertZoteroJabRef;
boolean bEnableDir = dlg.getListBoxSelectedItem("BibTeXLocation")<2;
dlg.setControlEnabled("IncludeOriginalCitations", bConvertZoteroJabRef);
dlg.setControlEnabled("BibTeXLocationLabel", bEnableLocation);
dlg.setControlEnabled("BibTeXLocation", bEnableLocation);
dlg.setControlEnabled("BibTeXDirLabel", bEnableLocation && bEnableDir);

View file

@ -88,7 +88,7 @@ public class ExternalApps {
/** Get the definition for an external application
* @param sAppName the name of the application to get
* @return a String array containg the system dependent path to the
* @return a String array containing the system dependent path to the
* executable file as entry 0, and the parameters as entry 1
* returns null if the application is unknown
*/
@ -134,9 +134,6 @@ public class ExternalApps {
pb.directory(workDir);
if (env!=null) {
pb.environment().putAll(env);
if (env.containsKey("BIBINPUTS")) {
System.out.println("Running "+sApp[0]+" with BIBINPUTS="+env.get("BIBINPUTS"));
}
}
Process proc = pb.start();
@ -144,7 +141,7 @@ public class ExternalApps {
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");
@ -174,7 +171,6 @@ public class ExternalApps {
}
catch (com.sun.star.uno.Exception e) {
// Give up...
//setApplication(LATEX,"Error!",e.getMessage());
return;
}

View file

@ -144,7 +144,6 @@ public final class TeXify {
}
int nReturnCode = externalApps.execute(
sAppList[i], file.getName(), file.getParentFile(), env, true);
System.out.println("Return code from "+sAppList[i]+": "+nReturnCode);
if (i==0 && nReturnCode>0) {
return false;
//throw new IOException("Error executing "+sAppList[i]);

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2011-01-28)
* Version 1.2 (2011-02-01)
*
*/
@ -36,12 +36,9 @@ import com.sun.star.beans.XPropertyAccess;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XNameAccess;
import com.sun.star.frame.XController;
import com.sun.star.frame.XDesktop;
import com.sun.star.frame.XFrame;
import com.sun.star.frame.XModel;
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.task.XStatusIndicator;
import com.sun.star.task.XStatusIndicatorFactory;
@ -235,6 +232,8 @@ public final class Writer4LaTeX extends WeakBase
if (XPropertySetHelper.getPropertyValueAsBoolean(xProps, "UseExternalBibTeXFiles")) {
filterHelper.put("external_bibtex_files", sBibTeXFiles);
}
filterHelper.put("include_original_citations",
Boolean.toString(XPropertySetHelper.getPropertyValueAsBoolean(xProps, "IncludeOriginalCitations")));
String sBibTeXDir = XPropertySetHelper.getPropertyValueAsString(xProps, "BibTeXDir");
if (sBibTeXDir.length()>0) {
// The separator character in BIBINPUTS is OS specific

View file

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

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2011-01-28)
* Version 1.2 (2011-02-01)
*
*/
@ -82,6 +82,7 @@ public class FieldConverter extends ConverterHelper {
private boolean bUsesOooref = false;
private boolean bConvertZotero = false;
private boolean bConvertJabRef = false;
private boolean bIncludeOriginalCitations = false;
private boolean bUseNatbib = false;
public FieldConverter(OfficeReader ofr, LaTeXConfig config, ConverterPalette palette) {
@ -90,6 +91,7 @@ public class FieldConverter extends ConverterHelper {
bUseHyperref = config.useHyperref() && !config.useTitleref() && !config.useOooref();
bConvertZotero = config.useBibtex() && config.zoteroBibtexFiles().length()>0;
bConvertJabRef = config.useBibtex() && config.jabrefBibtexFiles().length()>0;
bIncludeOriginalCitations = config.includeOriginalCitations();
bUseNatbib = config.useBibtex() && config.useNatbib();
}
@ -695,6 +697,9 @@ public class FieldConverter extends ConverterHelper {
public void handleReferenceMarkEnd(Element node, LaTeXDocumentPortion ldp, Context oc) {
// Nothing to do, except to mark that this ends any Zotero/JabRef citation
oc.setInZoteroJabRefText(false);
if (bIncludeOriginalCitations) { // Protect space after comment
ldp.append("{}");
}
}
/** <p>Process a reference mark (text:reference-mark or text:reference-mark-start tag)</p>

View file

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2010 by Henrik Just
* Copyright: 2002-2011 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.2 (2010-10-30)
* Version 1.2 (2011-02-01)
*
*/
@ -43,11 +43,13 @@ import writer2latex.latex.util.HeadingMap;
*/
public class InlineConverter extends ConverterHelper {
private boolean bIncludeOriginalCitations = false;
private String sTabstop = "\\ \\ ";
private boolean bHasPdfannotation = false;
public InlineConverter(OfficeReader ofr, LaTeXConfig config, ConverterPalette palette) {
super(ofr,config,palette);
bIncludeOriginalCitations = config.includeOriginalCitations();
// Get custom code for tab stops
if (config.getTabstop().length()>0) {
sTabstop = config.getTabstop();
@ -195,13 +197,16 @@ public class InlineConverter extends ConverterHelper {
case Node.TEXT_NODE:
String s = childNode.getNodeValue();
if (s.length() > 0) {
if (oc.isInZoteroJabRefText()) { // Comment out Zotero citations
ldp.append("%");
if (oc.isInZoteroJabRefText()) {
if (bIncludeOriginalCitations) { // Include original citation as a comment
ldp.append("%")
.append(palette.getI18n().convert(s, false, oc.getLang()))
.nl();
}
}
else { // Normal text
ldp.append(palette.getI18n().convert(s, false, oc.getLang()));
}
ldp.append(palette.getI18n().convert(s, false, oc.getLang()));
if (oc.isInZoteroJabRefText()) { // End comment out
ldp.nl();
}
}
break;

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2011-01-28)
* Version 1.2 (2011-02-01)
*
*/
@ -48,7 +48,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase {
/////////////////////////////////////////////////////////////////////////
// I. Define items needed by ConfigBase
protected int getOptionCount() { return 69; }
protected int getOptionCount() { return 70; }
protected String getDefaultConfigPath() { return "/writer2latex/latex/config/"; }
/////////////////////////////////////////////////////////////////////////
@ -146,39 +146,40 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase {
private static final int EXTERNAL_BIBTEX_FILES = 33;
private static final int ZOTERO_BIBTEX_FILES = 34;
private static final int JABREF_BIBTEX_FILES = 35;
private static final int USE_NATBIB = 36;
private static final int NATBIB_OPTIONS = 37;
private static final int FORMATTING = 38;
private static final int PAGE_FORMATTING = 39;
private static final int OTHER_STYLES = 40;
private static final int IMAGE_CONTENT = 41;
private static final int TABLE_CONTENT = 42;
private static final int TABLE_FIRST_HEAD_STYLE = 43;
private static final int TABLE_HEAD_STYLE = 44;
private static final int TABLE_FOOT_STYLE = 45;
private static final int TABLE_LAST_FOOT_STYLE = 46;
private static final int IGNORE_HARD_PAGE_BREAKS = 47;
private static final int IGNORE_HARD_LINE_BREAKS = 48;
private static final int IGNORE_EMPTY_PARAGRAPHS = 49;
private static final int IGNORE_DOUBLE_SPACES = 50;
private static final int ALIGN_FRAMES = 51;
private static final int FLOAT_FIGURES = 52;
private static final int FLOAT_TABLES = 53;
private static final int FLOAT_OPTIONS = 54;
private static final int FIGURE_SEQUENCE_NAME = 55;
private static final int TABLE_SEQUENCE_NAME = 56;
private static final int IMAGE_OPTIONS = 57;
private static final int REMOVE_GRAPHICS_EXTENSION = 58;
private static final int ORIGINAL_IMAGE_SIZE = 59;
private static final int SIMPLE_TABLE_LIMIT = 60;
private static final int NOTES = 61;
private static final int METADATA = 62;
private static final int TABSTOP = 63;
private static final int WRAP_LINES_AFTER = 64;
private static final int SPLIT_LINKED_SECTIONS = 65;
private static final int SPLIT_TOPLEVEL_SECTIONS = 66;
private static final int SAVE_IMAGES_IN_SUBDIR = 67;
private static final int DEBUG = 68;
private static final int INCLUDE_ORIGINAL_CITATIONS = 36;
private static final int USE_NATBIB = 37;
private static final int NATBIB_OPTIONS = 38;
private static final int FORMATTING = 39;
private static final int PAGE_FORMATTING = 40;
private static final int OTHER_STYLES = 41;
private static final int IMAGE_CONTENT = 42;
private static final int TABLE_CONTENT = 43;
private static final int TABLE_FIRST_HEAD_STYLE = 44;
private static final int TABLE_HEAD_STYLE = 45;
private static final int TABLE_FOOT_STYLE = 46;
private static final int TABLE_LAST_FOOT_STYLE = 47;
private static final int IGNORE_HARD_PAGE_BREAKS = 48;
private static final int IGNORE_HARD_LINE_BREAKS = 49;
private static final int IGNORE_EMPTY_PARAGRAPHS =50;
private static final int IGNORE_DOUBLE_SPACES = 51;
private static final int ALIGN_FRAMES = 52;
private static final int FLOAT_FIGURES = 53;
private static final int FLOAT_TABLES = 54;
private static final int FLOAT_OPTIONS = 55;
private static final int FIGURE_SEQUENCE_NAME = 56;
private static final int TABLE_SEQUENCE_NAME = 57;
private static final int IMAGE_OPTIONS = 58;
private static final int REMOVE_GRAPHICS_EXTENSION = 59;
private static final int ORIGINAL_IMAGE_SIZE = 60;
private static final int SIMPLE_TABLE_LIMIT = 61;
private static final int NOTES = 62;
private static final int METADATA = 63;
private static final int TABSTOP = 64;
private static final int WRAP_LINES_AFTER = 65;
private static final int SPLIT_LINKED_SECTIONS = 66;
private static final int SPLIT_TOPLEVEL_SECTIONS = 67;
private static final int SAVE_IMAGES_IN_SUBDIR = 68;
private static final int DEBUG = 69;
/////////////////////////////////////////////////////////////////////////
// IV. Our options data
@ -253,6 +254,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase {
options[EXTERNAL_BIBTEX_FILES] = new Option("external_bibtex_files","");
options[ZOTERO_BIBTEX_FILES] = new Option("zotero_bibtex_files","");
options[JABREF_BIBTEX_FILES] = new Option("jabref_bibtex_files","");
options[INCLUDE_ORIGINAL_CITATIONS] = new BooleanOption("include_original_citations","false");
options[USE_NATBIB] = new BooleanOption("use_natbib","false");
options[NATBIB_OPTIONS] = new Option("natbib_options","");
options[FORMATTING] = new IntegerOption("formatting","convert_basic") {
@ -666,6 +668,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase {
public String externalBibtexFiles() { return options[EXTERNAL_BIBTEX_FILES].getString(); }
public String zoteroBibtexFiles() { return options[ZOTERO_BIBTEX_FILES].getString(); }
public String jabrefBibtexFiles() { return options[JABREF_BIBTEX_FILES].getString(); }
public boolean includeOriginalCitations() { return ((BooleanOption) options[INCLUDE_ORIGINAL_CITATIONS]).getValue(); }
public boolean useNatbib() { return ((BooleanOption) options[USE_NATBIB]).getValue(); }
public String getNatbibOptions() { return options[NATBIB_OPTIONS].getString(); }