2000-08-30 03:40:51 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file exporter.h
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author Jean-Marc Lasgouttes
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
2000-08-30 03:40:51 +00:00
|
|
|
|
|
|
|
|
|
#ifndef EXPORTER_H
|
|
|
|
|
#define EXPORTER_H
|
|
|
|
|
|
2004-06-01 13:39:33 +00:00
|
|
|
|
#include <map>
|
2003-10-07 06:45:25 +00:00
|
|
|
|
#include <string>
|
2000-08-30 03:40:51 +00:00
|
|
|
|
#include <vector>
|
2003-10-06 15:43:21 +00:00
|
|
|
|
|
2000-08-30 03:40:51 +00:00
|
|
|
|
|
|
|
|
|
class Buffer;
|
2000-11-13 10:35:02 +00:00
|
|
|
|
class Format;
|
2000-08-30 03:40:51 +00:00
|
|
|
|
|
|
|
|
|
class Exporter {
|
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
static
|
2003-10-06 15:43:21 +00:00
|
|
|
|
bool Export(Buffer * buffer, std::string const & format,
|
|
|
|
|
bool put_in_tempdir, std::string & result_file);
|
2000-10-23 12:16:05 +00:00
|
|
|
|
///
|
|
|
|
|
static
|
2003-10-06 15:43:21 +00:00
|
|
|
|
bool Export(Buffer * buffer, std::string const & format,
|
2000-10-23 12:16:05 +00:00
|
|
|
|
bool put_in_tempdir);
|
2000-08-30 03:40:51 +00:00
|
|
|
|
///
|
|
|
|
|
static
|
2006-04-09 00:26:19 +00:00
|
|
|
|
bool preview(Buffer * buffer, std::string const & format);
|
2000-08-30 03:40:51 +00:00
|
|
|
|
///
|
|
|
|
|
static
|
2006-04-09 00:26:19 +00:00
|
|
|
|
bool isExportable(Buffer const & buffer, std::string const & format);
|
2000-10-02 16:44:47 +00:00
|
|
|
|
///
|
|
|
|
|
static
|
2000-11-13 10:35:02 +00:00
|
|
|
|
std::vector<Format const *> const
|
2006-04-09 00:26:19 +00:00
|
|
|
|
getExportableFormats(Buffer const & buffer, bool only_viewable);
|
2000-08-30 03:40:51 +00:00
|
|
|
|
///
|
|
|
|
|
};
|
2004-06-01 13:39:33 +00:00
|
|
|
|
|
|
|
|
|
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class ExportedFile {
|
|
|
|
|
public:
|
2004-06-01 13:39:33 +00:00
|
|
|
|
ExportedFile(std::string const &, std::string const &);
|
|
|
|
|
/// absolute name of the source file
|
|
|
|
|
std::string sourceName;
|
|
|
|
|
/// final name that the exported file should get (absolute name or
|
|
|
|
|
/// relative to the directory of the master document)
|
|
|
|
|
std::string exportName;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool operator==(ExportedFile const &, ExportedFile const &);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ExportData {
|
|
|
|
|
public:
|
|
|
|
|
/** add a referenced file for one format.
|
|
|
|
|
* No inset should ever write any file outside the tempdir.
|
|
|
|
|
* Instead, files that need to be exported have to be registered
|
|
|
|
|
* with this method.
|
|
|
|
|
* Then the exporter mechanism copies them to the right place, asks
|
|
|
|
|
* for confirmation before overwriting existing files etc.
|
2004-11-01 08:50:42 +00:00
|
|
|
|
* \param format format that references the given file
|
|
|
|
|
* \param sourceName source file name. Needs to be absolute
|
|
|
|
|
* \param exportName resulting file name. Can be either absolute
|
|
|
|
|
* or relative to the exported document.
|
2004-06-01 13:39:33 +00:00
|
|
|
|
*/
|
2004-11-01 08:50:42 +00:00
|
|
|
|
void addExternalFile(std::string const & format,
|
2006-04-05 23:56:29 +00:00
|
|
|
|
std::string const & sourceName,
|
|
|
|
|
std::string const & exportName);
|
2004-11-01 08:50:42 +00:00
|
|
|
|
/** add a referenced file for one format.
|
|
|
|
|
* The final name is the source file name without path.
|
|
|
|
|
* \param format format that references the given file
|
|
|
|
|
* \param sourceName source file name. Needs to be absolute
|
|
|
|
|
*/
|
|
|
|
|
void addExternalFile(std::string const & format,
|
2006-04-05 23:56:29 +00:00
|
|
|
|
std::string const & sourceName);
|
2004-11-01 08:50:42 +00:00
|
|
|
|
/// get referenced files for \p format
|
2004-06-01 13:39:33 +00:00
|
|
|
|
std::vector<ExportedFile> const
|
2004-11-01 08:50:42 +00:00
|
|
|
|
externalFiles(std::string const & format) const;
|
2004-06-01 13:39:33 +00:00
|
|
|
|
private:
|
|
|
|
|
typedef std::map<std::string, std::vector<ExportedFile> > FileMap;
|
|
|
|
|
/** Files that are referenced by the export result in the
|
|
|
|
|
* different formats.
|
|
|
|
|
*/
|
|
|
|
|
FileMap externalfiles;
|
|
|
|
|
};
|
|
|
|
|
|
2000-08-30 03:40:51 +00:00
|
|
|
|
#endif
|