]> git.lyx.org Git - lyx.git/blob - src/insets/inseterror.h
Enable the external inset to handle unknown templates gracefully.
[lyx.git] / src / insets / inseterror.h
1 // -*- C++ -*-
2 /**
3  * \file inseterror.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS
10  */
11
12 #ifndef INSET_ERROR_H
13 #define INSET_ERROR_H
14
15 #include "inset.h"
16 #include "LString.h"
17 #include "dimension.h"
18
19 /** Used for error messages from LaTeX runs.
20
21   The edit-operation opens a
22   dialog with the text of the error-message. The inset is displayed as
23   "Error" in a box, and automatically deleted. */
24 class InsetError : public Inset {
25 public:
26         ///
27         explicit
28         InsetError(string const &);
29         ///
30         ~InsetError();
31         ///
32         virtual dispatch_result localDispatch(FuncRequest const & cmd);
33         ///
34         void metrics(MetricsInfo &, Dimension &) const;
35         ///
36         void draw(PainterInfo & pi, int x, int y) const;
37         ///
38         void write(Buffer const *, std::ostream &) const {}
39         ///
40         void read(Buffer const *, LyXLex &) {}
41         ///
42         int latex(Buffer const *, std::ostream &,
43                   LatexRunParams const &) const { return 0; }
44         ///
45         int ascii(Buffer const *, std::ostream &, int) const { return 0; }
46         ///
47         int linuxdoc(Buffer const *, std::ostream &) const { return 0; }
48         ///
49         int docbook(Buffer const *, std::ostream &, bool) const { return 0; }
50         ///
51         bool autoDelete() const { return true; }
52         /// what appears in the minibuffer when opening
53         string const editMessage() const;
54         ///
55         EDITABLE editable() const { return IS_EDITABLE; }
56         ///
57         Inset * clone() const {
58                 return new InsetError(contents);
59         }
60         ///
61         Inset::Code lyxCode() const { return Inset::ERROR_CODE; }
62         /// We don't want "begin" and "end inset" in lyx-file
63         bool directWrite() const { return true; };
64         ///
65         string const & getContents() const { return contents; }
66 private:
67         ///
68         string contents;
69         ///
70         mutable Dimension dim_;
71 };
72 #endif