A few minor W2X and W4L changes

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@99 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2011-03-16 08:58:30 +00:00
parent 028e30afb6
commit 4ecd5ede1e
5 changed files with 57 additions and 44 deletions

View file

@ -2,6 +2,12 @@ Changelog for Writer2LaTeX version 1.0 -> 1.2
---------- version 1.1.7 ---------- ---------- version 1.1.7 ----------
[w4l] Check that the document is saved locally (file) and (on Windows) with a drive letter - otherwise LaTeX cannot run
[w4l] Delete .aux file before TeXifying (this avoids errors in some cases)
[w2x] Changed Dublin Core profile name to match current specification
[w2l] Polyglossia bugfix: Now sets the default language correctly [w2l] Polyglossia bugfix: Now sets the default language correctly
[w2l] Babel bugfix: No language is now ignored rather than exported as English [w2l] Babel bugfix: No language is now ignored rather than exported as English

View file

@ -135,6 +135,9 @@ public final class TeXify {
} }
private boolean doTeXify(String[] sAppList, File file, String sBibinputs) throws IOException { private boolean doTeXify(String[] sAppList, File file, String sBibinputs) throws IOException {
// Remove the .aux file first (to avoid potential error messages)
File aux = new File(file.getParentFile(), file.getName()+".aux");
aux.delete();
for (int i=0; i<sAppList.length; i++) { for (int i=0; i<sAppList.length; i++) {
// Execute external application // Execute external application
Map<String,String> env =null; Map<String,String> env =null;

View file

@ -20,7 +20,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* *
* Version 1.2 (2011-02-01) * Version 1.2 (2011-03-10)
* *
*/ */
@ -30,6 +30,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.regex.Pattern;
import com.sun.star.beans.PropertyValue; import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertyAccess; import com.sun.star.beans.XPropertyAccess;
@ -157,14 +158,9 @@ public final class Writer4LaTeX extends WeakBase
com.sun.star.beans.PropertyValue[] aArguments ) { com.sun.star.beans.PropertyValue[] aArguments ) {
if ( aURL.Protocol.compareTo(PROTOCOL) == 0 ) { if ( aURL.Protocol.compareTo(PROTOCOL) == 0 ) {
if ( aURL.Path.compareTo("ProcessDocument") == 0 ) { if ( aURL.Path.compareTo("ProcessDocument") == 0 ) {
if (updateLocation()) { if (updateLocation() && updateMediaProperties()) {
if (updateMediaProperties()) {
process(); process();
} }
}
else {
warnNotSaved();
}
return; return;
} }
else if ( aURL.Path.compareTo("ProcessDirectly") == 0 ) { else if ( aURL.Path.compareTo("ProcessDirectly") == 0 ) {
@ -172,9 +168,6 @@ public final class Writer4LaTeX extends WeakBase
updateMediaPropertiesSilent(); updateMediaPropertiesSilent();
process(); process();
} }
else {
warnNotSaved();
}
return; return;
} }
else if ( aURL.Path.compareTo("ViewLog") == 0 ) { else if ( aURL.Path.compareTo("ViewLog") == 0 ) {
@ -345,10 +338,6 @@ public final class Writer4LaTeX extends WeakBase
catch (com.sun.star.uno.Exception e) { catch (com.sun.star.uno.Exception e) {
} }
} }
else {
warnNotSaved();
}
} }
// Some utility methods // Some utility methods
@ -560,6 +549,16 @@ public final class Writer4LaTeX extends WeakBase
private boolean updateLocation() { private boolean updateLocation() {
String sDocumentUrl = xModel.getURL(); String sDocumentUrl = xModel.getURL();
if (sDocumentUrl.length()!=0) { if (sDocumentUrl.length()!=0) {
if (sDocumentUrl.startsWith("file:")) {
if (System.getProperty("os.name").startsWith("Windows")) {
Pattern windowsPattern = Pattern.compile("^file:///[A-Za-z][|:]");
if (!windowsPattern.matcher(sDocumentUrl).matches()) {
MessageBox msgBox = new MessageBox(m_xContext, m_xFrame);
msgBox.showMessage("Please save the document on a location with a drive name!",
"LaTeX does not support UNC paths");
return false;
}
}
// Get the file name (without extension) // Get the file name (without extension)
File f = urlToFile(sDocumentUrl); File f = urlToFile(sDocumentUrl);
sBaseFileName = f.getName(); sBaseFileName = f.getName();
@ -581,13 +580,16 @@ public final class Writer4LaTeX extends WeakBase
return true; return true;
} }
else { else {
MessageBox msgBox = new MessageBox(m_xContext, m_xFrame);
msgBox.showMessage("Please save the document locally!","LaTeX does not support documents in remote storages");
return false; return false;
} }
} }
else {
private void warnNotSaved() {
MessageBox msgBox = new MessageBox(m_xContext, m_xFrame); MessageBox msgBox = new MessageBox(m_xContext, m_xFrame);
msgBox.showMessage("Document not saved!","Please save the document before processing the file"); msgBox.showMessage("Document not saved!","Please save the document before processing the file");
return false;
}
} }
private String makeTeXSafe(String sArgument) { private String makeTeXSafe(String sArgument) {

View file

@ -98,9 +98,11 @@ public class HeadingConverter extends ConverterHelper {
// Export the heading // Export the heading
ldp.append(baHardPage.getBefore()); ldp.append(baHardPage.getBefore());
ldp.append("\\"+hm.getName(nLevel)); ldp.append("\\"+hm.getName(nLevel));
if (bUnNumbered) { ldp.append("*"); } if (bUnNumbered) {
ldp.append("*");
}
else if (baHardChar.getBefore().length()>0 || containsElements(node)) {
// If this heading contains formatting, add optional argument: // If this heading contains formatting, add optional argument:
if (baHardChar.getBefore().length()>0 || containsElements(node)) {
ldp.append("["); ldp.append("[");
palette.getInlineCv().traversePlainInlineText(node,ldp,ic); palette.getInlineCv().traversePlainInlineText(node,ldp,ic);
ldp.append("]"); ldp.append("]");

View file

@ -604,10 +604,10 @@ public class Converter extends ConverterBase {
createMeta(head,"keywords",metaData.getKeywords()); createMeta(head,"keywords",metaData.getKeywords());
// Dublin core meta data (optional) // Dublin core meta data (optional)
// Format as recommended on dublincore.org // Format as recommended on dublincore.org (http://dublincore.org/documents/dc-html/)
// Declare meta data profile // Declare meta data profile
if (config.xhtmlUseDublinCore()) { if (config.xhtmlUseDublinCore()) {
head.setAttribute("profile","http://dublincore.org/documents/dcq-html/"); head.setAttribute("profile","http://dublincore.org/documents/2008/08/04/dc-html/");
// Add link to declare namespace // Add link to declare namespace
Element dclink = htmlDOM.createElement("link"); Element dclink = htmlDOM.createElement("link");
dclink.setAttribute("rel","schema.DC"); dclink.setAttribute("rel","schema.DC");