X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fexporter.h;h=ec1c9d6495fdbae61cce1e21eee08f82de6a42e8;hb=35204f8f33d7400a5fefeffea533fb4cb4097211;hp=826ce82addbed93bbc99ccca5073a310ed37a58a;hpb=eb36b71ce3b9880a9b577f3db25d16e6a86cd338;p=lyx.git diff --git a/src/exporter.h b/src/exporter.h index 826ce82add..ec1c9d6495 100644 --- a/src/exporter.h +++ b/src/exporter.h @@ -13,10 +13,14 @@ #ifndef EXPORTER_H #define EXPORTER_H +#include #include #include +namespace lyx { + + class Buffer; class Format; @@ -32,14 +36,67 @@ public: bool put_in_tempdir); /// static - bool Preview(Buffer * buffer, std::string const & format); + bool preview(Buffer * buffer, std::string const & format); /// static - bool IsExportable(Buffer const & buffer, std::string const & format); + bool isExportable(Buffer const & buffer, std::string const & format); /// static std::vector const - GetExportableFormats(Buffer const & buffer, bool only_viewable); + getExportableFormats(Buffer const & buffer, bool only_viewable); /// }; + + +class ExportedFile { +public: + 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. + * \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. + */ + void addExternalFile(std::string const & format, + std::string const & sourceName, + std::string const & exportName); + /** 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, + std::string const & sourceName); + /// get referenced files for \p format + std::vector const + externalFiles(std::string const & format) const; +private: + typedef std::map > FileMap; + /** Files that are referenced by the export result in the + * different formats. + */ + FileMap externalfiles; +}; + + +} // namespace lyx + #endif