]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiInclude.h
move Controller inheritance further up the tree
[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
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         ///
53         void updateLists();
54         /// validate listings parameters and return an error message, if any
55         docstring validate_listings_params();
56         ///
57         void edit(std::string const & file);
58
59         ///
60         bool isValid();
61         /// Apply changes
62         void applyView();
63         /// update
64         void updateContents();
65
66         ///
67         enum Type {
68                 ///
69                 INPUT,
70                 ///
71                 VERBATIM,
72                 ///
73                 INCLUDE,
74                 ///
75                 LISTINGS,
76         };
77
78         ///
79         bool initialiseParams(std::string const & data);
80         /// clean-up on hide.
81         void clearParams();
82         /// clean-up on hide.
83         void dispatchParams();
84         ///
85         bool isBufferDependent() const { return true; }
86
87         /// Browse for a file
88         docstring browse(docstring const &, Type) const;
89
90 private:
91         ///
92         InsetCommandParams params_;
93 };
94
95 } // namespace frontend
96 } // namespace lyx
97
98 #endif // GUIINCLUDE_H