* Licence details can be found in the file COPYING.
*
* \author unknown
+ * \author Alfredo Braunstein
+ * \author Lars Gullik Bjønnes
+ * \author Jean Marc Lasgouttes
+ * \author Angus Leeming
+ * \author John Levon
+ * \author André Pönitz
*
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "exporter.h"
+
#include "buffer.h"
#include "buffer_funcs.h"
-#include "lyx_cb.h" //ShowMessage()
-#include "support/filetools.h"
-#include "lyxrc.h"
+#include "bufferparams.h"
#include "converter.h"
#include "format.h"
-#include "frontends/Alert.h"
#include "gettext.h"
-#include "BufferView.h"
+#include "lyxrc.h"
+#include "output_plaintext.h"
+#include "outputparams.h"
+#include "frontends/Alert.h"
+
+#include "support/filetools.h"
-#include <algorithm>
+using lyx::support::AddName;
+using lyx::support::bformat;
+using lyx::support::ChangeExtension;
+using lyx::support::contains;
+using lyx::support::MakeDisplayPath;
-using std::vector;
using std::find;
+using std::string;
+using std::vector;
namespace {
-vector<string> const Backends(Buffer const * buffer)
+vector<string> const Backends(Buffer const & buffer)
{
vector<string> v;
- if (buffer->params.getLyXTextClass().isTeXClassAvailable())
- v.push_back(BufferFormat(*buffer));
+ if (buffer.params().getLyXTextClass().isTeXClassAvailable())
+ v.push_back(BufferFormat(buffer));
v.push_back("text");
return v;
}
bool put_in_tempdir, string & result_file)
{
string backend_format;
- LatexRunParams runparams;
- runparams.flavor = LatexRunParams::LATEX;
- vector<string> backends = Backends(buffer);
+ OutputParams runparams;
+ runparams.flavor = OutputParams::LATEX;
+ runparams.linelen = lyxrc.ascii_linelen;
+ vector<string> backends = Backends(*buffer);
if (find(backends.begin(), backends.end(), format) == backends.end()) {
for (vector<string>::const_iterator it = backends.begin();
it != backends.end(); ++it) {
Graph::EdgePath p =
converters.getPath(*it, format);
if (!p.empty()) {
- if (converters.usePdflatex(p))
- runparams.flavor = LatexRunParams::PDFLATEX;
+ runparams.flavor = converters.getFlavor(p);
backend_format = *it;
break;
}
backend_format = format;
string filename = buffer->getLatexName(false);
- if (!buffer->tmppath.empty())
- filename = AddName(buffer->tmppath, filename);
+ if (!buffer->temppath().empty())
+ filename = AddName(buffer->temppath(), filename);
filename = ChangeExtension(filename,
formats.extension(backend_format));
// Ascii backend
if (backend_format == "text")
- buffer->writeFileAscii(filename, lyxrc.ascii_linelen);
+ writeFileAscii(*buffer, filename, runparams);
// Linuxdoc backend
- else if (buffer->isLinuxDoc())
- buffer->makeLinuxDocFile(filename, !put_in_tempdir);
+ else if (buffer->isLinuxDoc()) {
+ runparams.nice = !put_in_tempdir;
+ buffer->makeLinuxDocFile(filename, runparams);
+ }
// Docbook backend
- else if (buffer->isDocBook())
- buffer->makeDocBookFile(filename, !put_in_tempdir);
+ else if (buffer->isDocBook()) {
+ runparams.nice = !put_in_tempdir;
+ buffer->makeDocBookFile(filename, runparams);
+ }
// LaTeX backend
else if (backend_format == format) {
runparams.nice = true;
return false;
if (!put_in_tempdir)
- ShowMessage(buffer,
- _("Document exported as ")
- + formats.prettyName(format)
- + _(" to file `")
- + MakeDisplayPath(result_file) +'\'');
+ buffer->message(_("Document exported as ")
+ + formats.prettyName(format)
+ + _(" to file `")
+ + MakeDisplayPath(result_file) +'\'');
return true;
}
string result_file;
if (!Export(buffer, format, true, result_file))
return false;
- return formats.view(buffer, result_file, format);
+ return formats.view(*buffer, result_file, format);
}
-bool Exporter::IsExportable(Buffer const * buffer, string const & format)
+bool Exporter::IsExportable(Buffer const & buffer, string const & format)
{
vector<string> backends = Backends(buffer);
for (vector<string>::const_iterator it = backends.begin();
vector<Format const *> const
-Exporter::GetExportableFormats(Buffer const * buffer, bool only_viewable)
+Exporter::GetExportableFormats(Buffer const & buffer, bool only_viewable)
{
vector<string> backends = Backends(buffer);
vector<Format const *> result =
}
return result;
}
-