]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiExternal.h
b5ae2becee616537a37445655a1a2a892b44083f
[lyx.git] / src / frontends / qt4 / GuiExternal.h
1 // -*- C++ -*-
2 /**
3  * \file GuiExternal.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Asger Alstrup
8  * \author John Levon
9  * \author Angus Leeming
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef GUIEXTERNAL_H
15 #define GUIEXTERNAL_H
16
17 #include "GuiDialog.h"
18 #include "ui_ExternalUi.h"
19
20 #include "support/types.h"
21
22 #include "insets/InsetExternal.h"
23
24 #include <string>
25 #include <vector>
26 #include <map>
27
28 namespace lyx {
29
30 namespace external {
31
32 class Template;
33 class RotationDataType;
34
35 } // namespace external
36
37 namespace frontend {
38
39 class GuiExternal : public GuiDialog, public Ui::ExternalUi
40 {
41         Q_OBJECT
42
43 public:
44         GuiExternal(LyXView & lv);
45
46 private Q_SLOTS:
47         void bbChanged();
48         void browseClicked();
49         void change_adaptor();
50         void editClicked();
51         void extraChanged(const QString&);
52         void formatChanged(const QString&);
53         void getbbClicked();
54         void sizeChanged();
55         void templateChanged();
56         void widthUnitChanged();
57
58 public:
59         ///
60         typedef std::map<std::string, QString> MapType;
61
62 private:
63         void closeEvent(QCloseEvent * e);
64         //
65         bool activateAspectratio() const;
66         /// Apply changes
67         void applyView();
68         /// update
69         void updateContents();
70         /// Helper function called when the template is changed.
71         void updateTemplate();
72         /// get bounding box from file
73         void getBB();
74
75         ///
76         MapType extra_;
77         ///
78         bool initialiseParams(std::string const & data);
79         /// clean-up on hide.
80         void clearParams();
81         /// clean-up on hide.
82         void dispatchParams();
83         ///
84         bool isBufferDependent() const { return true; }
85
86         ///
87         void editExternal();
88         ///
89         std::vector<std::string> const getTemplates() const;
90         ///
91         int getTemplateNumber(std::string const &) const;
92         ///
93         external::Template getTemplate(int) const;
94         ///
95         std::string const
96         getTemplateFilters(std::string const & template_name) const;
97         ///
98         docstring const browse(docstring const & input_file,
99                                  docstring const & template_name) const;
100
101         /// Read the Bounding Box from a eps or ps-file
102         std::string const readBB(std::string const & file);
103         ///
104 private:
105         ///
106         InsetExternalParams params_;
107         bool bbChanged_;
108 };
109
110 } // namespace frontend
111 } // namespace lyx
112
113 #endif // GUIEXTERNAL_H