diff --git a/source/distro/changelog.txt b/source/distro/changelog.txt index efcb75f..c4bbcc7 100644 --- a/source/distro/changelog.txt +++ b/source/distro/changelog.txt @@ -2,6 +2,12 @@ Changelog for Writer2LaTeX version 1.0 -> 1.2 ---------- 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] Babel bugfix: No language is now ignored rather than exported as English diff --git a/source/java/org/openoffice/da/comp/writer4latex/TeXify.java b/source/java/org/openoffice/da/comp/writer4latex/TeXify.java index ea117dc..95d02d7 100644 --- a/source/java/org/openoffice/da/comp/writer4latex/TeXify.java +++ b/source/java/org/openoffice/da/comp/writer4latex/TeXify.java @@ -135,6 +135,9 @@ public final class TeXify { } 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 env =null; diff --git a/source/java/org/openoffice/da/comp/writer4latex/Writer4LaTeX.java b/source/java/org/openoffice/da/comp/writer4latex/Writer4LaTeX.java index 248f1c7..8f900f5 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 (2011-02-01) + * Version 1.2 (2011-03-10) * */ @@ -30,6 +30,7 @@ import java.io.File; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; +import java.util.regex.Pattern; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertyAccess; @@ -157,13 +158,8 @@ public final class Writer4LaTeX extends WeakBase com.sun.star.beans.PropertyValue[] aArguments ) { if ( aURL.Protocol.compareTo(PROTOCOL) == 0 ) { if ( aURL.Path.compareTo("ProcessDocument") == 0 ) { - if (updateLocation()) { - if (updateMediaProperties()) { - process(); - } - } - else { - warnNotSaved(); + if (updateLocation() && updateMediaProperties()) { + process(); } return; } @@ -172,9 +168,6 @@ public final class Writer4LaTeX extends WeakBase updateMediaPropertiesSilent(); process(); } - else { - warnNotSaved(); - } return; } else if ( aURL.Path.compareTo("ViewLog") == 0 ) { @@ -345,10 +338,6 @@ public final class Writer4LaTeX extends WeakBase catch (com.sun.star.uno.Exception e) { } } - else { - warnNotSaved(); - } - } // Some utility methods @@ -560,36 +549,49 @@ public final class Writer4LaTeX extends WeakBase private boolean updateLocation() { String sDocumentUrl = xModel.getURL(); if (sDocumentUrl.length()!=0) { - // Get the file name (without extension) - File f = urlToFile(sDocumentUrl); - sBaseFileName = f.getName(); - int iDot = sBaseFileName.lastIndexOf("."); - if (iDot>-1) { // remove extension - sBaseFileName = sBaseFileName.substring(0,iDot); - } - sBaseFileName=makeTeXSafe(sBaseFileName); + 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) + File f = urlToFile(sDocumentUrl); + sBaseFileName = f.getName(); + int iDot = sBaseFileName.lastIndexOf("."); + if (iDot>-1) { // remove extension + sBaseFileName = sBaseFileName.substring(0,iDot); + } + sBaseFileName=makeTeXSafe(sBaseFileName); - // Get the path - int iSlash = sDocumentUrl.lastIndexOf("/"); - if (iSlash>-1) { - sBasePath = sDocumentUrl.substring(0,iSlash+1); - } - else { - sBasePath = ""; - } - - return true; + // Get the path + int iSlash = sDocumentUrl.lastIndexOf("/"); + if (iSlash>-1) { + sBasePath = sDocumentUrl.substring(0,iSlash+1); + } + else { + sBasePath = ""; + } + + return true; + } + 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; + } } else { + MessageBox msgBox = new MessageBox(m_xContext, m_xFrame); + msgBox.showMessage("Document not saved!","Please save the document before processing the file"); return false; } } - - private void warnNotSaved() { - MessageBox msgBox = new MessageBox(m_xContext, m_xFrame); - msgBox.showMessage("Document not saved!","Please save the document before processing the file"); - } - + private String makeTeXSafe(String sArgument) { String sResult = ""; for (int i=0; i0 || containsElements(node)) { + if (bUnNumbered) { + ldp.append("*"); + } + else if (baHardChar.getBefore().length()>0 || containsElements(node)) { + // If this heading contains formatting, add optional argument: ldp.append("["); palette.getInlineCv().traversePlainInlineText(node,ldp,ic); ldp.append("]"); diff --git a/source/java/writer2latex/xhtml/Converter.java b/source/java/writer2latex/xhtml/Converter.java index 11829a6..0358287 100644 --- a/source/java/writer2latex/xhtml/Converter.java +++ b/source/java/writer2latex/xhtml/Converter.java @@ -604,10 +604,10 @@ public class Converter extends ConverterBase { createMeta(head,"keywords",metaData.getKeywords()); // 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 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 Element dclink = htmlDOM.createElement("link"); dclink.setAttribute("rel","schema.DC");