]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiInclude.h
Some comments and cosmetics.
[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 //FIXME This could, and therefore probably should, inherit from
29 //GuiCommand.
30 class GuiInclude : public GuiDialog, public Ui::IncludeUi
31 {
32         Q_OBJECT
33
34 public:
35         GuiInclude(LyXView & lv);
36
37 private Q_SLOTS:
38         void change_adaptor();
39         /// edit the child document, .lyx file will be opened in lyx
40         /// other formats will be edited by external applications.
41         void edit();
42         /// browse for a file
43         void browse();
44         ///
45         void typeChanged(int v);
46         /// AFAIK, QValidator only works for QLineEdit so
47         /// I have to validate listingsED (QTextEdit) manually.
48         /// This function displays a hint or error message returned by
49         /// validate_listings_params
50         void set_listings_msg();
51
52 private:
53         void closeEvent(QCloseEvent * e);
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