Not so soon, I guess, since that FIXME was from r6305.
[lyx.git] / src / Exporter.h
blob28ecb630724c68e1f135d56c34e80b18de17ecb4
1 // -*- C++ -*-
2 /**
3 * \file Exporter.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
10 * Full author contact details are available in file CREDITS.
13 #ifndef EXPORTER_H
14 #define EXPORTER_H
16 #include "support/FileName.h"
18 #include <map>
19 #include <string>
20 #include <vector>
23 namespace lyx {
25 enum CopyStatus {
26 SUCCESS,
27 FORCE,
28 CANCEL
32 /** copy file \p sourceFile to \p destFile. If \p force is false, the user
33 * will be asked before existing files are overwritten.
34 * \return
35 * - SUCCESS if this file got copied
36 * - FORCE if subsequent calls should not ask for confirmation before
37 * overwriting files anymore.
38 * - CANCEL if the export should be cancelled
40 CopyStatus copyFile(std::string const & format,
41 support::FileName const & sourceFile, support::FileName const & destFile,
42 std::string const & latexFile, bool force);
45 class ExportedFile {
46 public:
47 ExportedFile(support::FileName const &, std::string const &);
48 /// absolute name of the source file
49 support::FileName sourceName;
50 /// final name that the exported file should get (absolute name or
51 /// relative to the directory of the master document)
52 std::string exportName;
56 bool operator==(ExportedFile const &, ExportedFile const &);
59 class ExportData {
60 public:
61 /** add a referenced file for one format.
62 * No inset should ever write any file outside the tempdir.
63 * Instead, files that need to be exported have to be registered
64 * with this method.
65 * Then the exporter mechanism copies them to the right place, asks
66 * for confirmation before overwriting existing files etc.
67 * \param format format that references the given file
68 * \param sourceName source file name. Needs to be absolute
69 * \param exportName resulting file name. Can be either absolute
70 * or relative to the exported document.
72 void addExternalFile(std::string const & format,
73 support::FileName const & sourceName,
74 std::string const & exportName);
75 /** add a referenced file for one format.
76 * The final name is the source file name without path.
77 * \param format format that references the given file
78 * \param sourceName source file name. Needs to be absolute
80 void addExternalFile(std::string const & format,
81 support::FileName const & sourceName);
82 /// get referenced files for \p format
83 std::vector<ExportedFile> const
84 externalFiles(std::string const & format) const;
85 private:
86 typedef std::map<std::string, std::vector<ExportedFile> > FileMap;
87 /** Files that are referenced by the export result in the
88 * different formats.
90 FileMap externalfiles;
94 } // namespace lyx
96 #endif