X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fexporter.h;h=9bd2d038aca805b2b610a5de3e09617c75e1c80b;hb=b59621bc59584fb3496459a2be79acfc8476a9a1;hp=f02e8472a00df54c53e2c2b3677fb38cce803de4;hpb=99d1627a471b92f403598d03dfc861ddc3c11be0;p=lyx.git diff --git a/src/exporter.h b/src/exporter.h index f02e8472a0..9bd2d038ac 100644 --- a/src/exporter.h +++ b/src/exporter.h @@ -1,19 +1,22 @@ // -*- C++ -*- -/* This file is part of - * ====================================================== +/** + * \file exporter.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * LyX, The Document Processor + * \author Lars Gullik Bjønnes + * \author Jean-Marc Lasgouttes * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. - * - * ====================================================== */ + * Full author contact details are available in file CREDITS. + */ #ifndef EXPORTER_H #define EXPORTER_H +#include +#include #include -#include "LString.h" + class Buffer; class Format; @@ -22,28 +25,72 @@ class Exporter { public: /// static - bool Export(Buffer * buffer, string const & format, - bool put_in_tempdir, string & result_file); + bool Export(Buffer * buffer, std::string const & format, + bool put_in_tempdir, std::string & result_file); /// static - bool Export(Buffer * buffer, string const & format, + bool Export(Buffer * buffer, std::string const & format, bool put_in_tempdir); /// static - bool Preview(Buffer * buffer, string const & format); + bool Preview(Buffer * buffer, std::string const & format); /// static - bool IsExportable(Buffer const * buffer, 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: - static - string const BufferFormat(Buffer const * buffer); - /// - static - std::vector const Backends(Buffer const * buffer); + typedef std::map > FileMap; + /** Files that are referenced by the export result in the + * different formats. + */ + FileMap externalfiles; }; + #endif