A few XeTeX and Writer4LaTeX changes

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@12 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2009-04-01 20:33:34 +00:00
parent 9241a44f6c
commit 42236bbce5
5 changed files with 45 additions and 5 deletions

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2009-03-30)
* Version 1.2 (2009-03-31)
*
*/
@ -44,6 +44,9 @@ public final class TeXify {
/** Backend format pdfTeX (pdf) */
public static final short PDFTEX = 3;
/** Backend format XeTeX (also pdf, usually) */
public static final short XETEX = 4;
// Define the applications to run for each backend
private static final String[] genericTexify = {
@ -56,6 +59,9 @@ public final class TeXify {
ExternalApps.LATEX, ExternalApps.BIBTEX, ExternalApps.MAKEINDEX,
ExternalApps.LATEX, ExternalApps.MAKEINDEX, ExternalApps.LATEX,
ExternalApps.DVIPS };
private static final String[] xeTexify = {
ExternalApps.XELATEX, ExternalApps.BIBTEX, ExternalApps.MAKEINDEX,
ExternalApps.XELATEX, ExternalApps.MAKEINDEX, ExternalApps.XELATEX };
// Global objects
//private XComponentContext xContext;
@ -107,6 +113,14 @@ public final class TeXify {
throw new IOException("Error executing postscript viewer");
}
}
else if (nBackend==XETEX) {
doTeXify(xeTexify, file);
if (externalApps.execute(ExternalApps.PDFVIEWER,
new File(file.getParentFile(),file.getName()+".pdf").getPath(),
file.getParentFile(), false)>0) {
throw new IOException("Error executing pdf viewer");
}
}
}

View file

@ -158,6 +158,10 @@ public final class Writer4LaTeX extends WeakBase
if (updateMediaProperties()) {
process();
}
else {
MessageBox msgBox = new MessageBox(m_xContext, m_xFrame);
msgBox.showMessage("Writer4LaTeX Error","Please install Writer2LaTeX version 1.0 or later");
}
}
else {
warnNotSaved();
@ -169,6 +173,10 @@ public final class Writer4LaTeX extends WeakBase
if (mediaProps!=null || updateMediaProperties()) {
process();
}
else {
MessageBox msgBox = new MessageBox(m_xContext, m_xFrame);
msgBox.showMessage("Writer4LaTeX Error","Please install Writer2LaTeX version 1.0 or later");
}
}
else {
warnNotSaved();
@ -250,6 +258,9 @@ public final class Writer4LaTeX extends WeakBase
else if (sBackend=="dvips") {
texify.process(file, TeXify.DVIPS, true);
}
else if (sBackend=="xetex") {
texify.process(file, TeXify.XETEX, true);
}
else if (sBackend=="generic") {
texify.process(file, TeXify.GENERIC, true);
}
@ -303,6 +314,12 @@ public final class Writer4LaTeX extends WeakBase
// Display options dialog
Object dialog = m_xContext.getServiceManager()
.createInstanceWithContext("org.openoffice.da.writer2latex.LaTeXOptionsDialog", m_xContext);
// If Writer2LaTeX is not installed, this will return null
if (dialog==null) {
mediaProps = null;
return false;
}
XPropertyAccess xPropertyAccess = (XPropertyAccess)
UnoRuntime.queryInterface(XPropertyAccess.class, dialog);