]> git.lyx.org Git - lyx.git/blobdiff - src/exporter.C
Alfredo's second patch
[lyx.git] / src / exporter.C
index 08a857ff68010409a5a5c97ff44e19a708e0d199..c0b89ab18c473d08d3ae4e4f0548464decc96f3c 100644 (file)
@@ -1,27 +1,25 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file exporter.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
+ * \author unknown
  *
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2001 The LyX Team.
- *
- * ====================================================== */
+ * Full author contact details are available in file CREDITS
+ */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
 #include <algorithm>
 
 #include "exporter.h"
 #include "buffer.h"
 #include "lyx_cb.h" //ShowMessage()
 #include "support/filetools.h"
+#include "support/BoostFormat.h"
 #include "lyxrc.h"
 #include "converter.h"
+#include "format.h"
 #include "frontends/Alert.h"
 #include "gettext.h"
 #include "BufferView.h"
@@ -29,6 +27,8 @@
 using std::vector;
 using std::find;
 
+bool pdf_mode = false;
+
 bool Exporter::Export(Buffer * buffer, string const & format,
                      bool put_in_tempdir, string & result_file)
 {
@@ -50,18 +50,25 @@ bool Exporter::Export(Buffer * buffer, string const & format,
        if (find(backends.begin(), backends.end(), format) == backends.end()) {
                for (vector<string>::const_iterator it = backends.begin();
                     it != backends.end(); ++it) {
-                       Converters::EdgePath p =
+                       Graph::EdgePath p =
                                converters.getPath(*it, format);
                        if (!p.empty()) {
-                               lyxrc.pdf_mode = converters.usePdflatex(p);
+                               pdf_mode = converters.usePdflatex(p);
                                backend_format = *it;
                                break;
                        }
                }
                if (backend_format.empty()) {
-                       Alert::alert(_("Cannot export file"),
-                                  _("No information for exporting to ")
-                                  + formats.prettyName(format));
+#if USE_BOOST_FORMAT
+// FIXME: better english ...
+                       Alert::error(_("Couldn't export file"),
+                                    boost::io::str(boost::format(_("No information for exporting the format %1$s."))
+                                  % formats.prettyName(format)));
+#else
+                       Alert::error(_("Couldn't export file"),
+                                    _("No information for exporting the format ")
+                                    + formats.prettyName(format) + ".");
+#endif
                        return false;
                }
        } else
@@ -86,8 +93,8 @@ bool Exporter::Export(Buffer * buffer, string const & format,
        else if (backend_format == format)
                buffer->makeLaTeXFile(filename, string(), true);
        else if (contains(buffer->filePath(), ' ')) {
-               Alert::alert(_("Cannot run LaTeX."),
-                          _("The path to the lyx file cannot contain spaces."));
+               Alert::error(_("File name error"),
+                          _("The directory path to the document cannot contain spaces."));
                return false;
        } else
                buffer->makeLaTeXFile(filename, buffer->filePath(), false);