]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiInclude.h
math stuff
[lyx.git] / src / frontends / qt4 / GuiInclude.h
1 // -*- C++ -*-
2 /**
3  * \file GuiInclude.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Alejandro Aguilar Sierra
8  * \author Angus Leeming
9  * \author John Levon
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef GUIINCLUDE_H
15 #define GUIINCLUDE_H
16
17 #include "GuiDialog.h"
18 #include "ui_IncludeUi.h"
19
20 #include "insets/InsetCommandParams.h"
21
22 #include "support/docstring.h"
23
24
25 namespace lyx {
26 namespace frontend {
27
28 class GuiInclude : public GuiDialog, public Ui::IncludeUi, public Controller
29 {
30         Q_OBJECT
31
32 public:
33         GuiInclude(LyXView & lv);
34
35 private Q_SLOTS:
36         void change_adaptor();
37         /// edit the child document, .lyx file will be opened in lyx
38         /// other formats will be edited by external applications.
39         void edit();
40         /// browse for a file
41         void browse();
42         ///
43         void typeChanged(int v);
44         /// AFAIK, QValidator only works for QLineEdit so
45         /// I have to validate listingsED (QTextEdit) manually.
46         /// This function displays a hint or error message returned by
47         /// validate_listings_params
48         void set_listings_msg();
49
50 private:
51         void closeEvent(QCloseEvent * e);
52         /// parent controller
53         Controller & controller() { return *this; }
54         ///
55         void updateLists();
56         /// validate listings parameters and return an error message, if any
57         docstring validate_listings_params();
58         ///
59         void edit(std::string const & file);
60
61         ///
62         bool isValid();
63         /// Apply changes
64         void applyView();
65         /// update
66         void updateContents();
67
68         ///
69         enum Type {
70                 ///
71                 INPUT,
72                 ///
73                 VERBATIM,
74                 ///
75                 INCLUDE,
76                 ///
77                 LISTINGS,
78         };
79
80         ///
81         bool initialiseParams(std::string const & data);
82         /// clean-up on hide.
83         void clearParams();
84         /// clean-up on hide.
85         void dispatchParams();
86         ///
87         bool isBufferDependent() const { return true; }
88
89         /// Browse for a file
90         docstring browse(docstring const &, Type) const;
91
92 private:
93         ///
94         InsetCommandParams params_;
95 };
96
97 } // namespace frontend
98 } // namespace lyx
99
100 #endif // GUIINCLUDE_H