]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiBibtex.h
merge GuiCommand into its users.
[lyx.git] / src / frontends / qt4 / GuiBibtex.h
1 // -*- C++ -*-
2 /**
3  * \file GuiBibtex.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  * \author Angus Leeming
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef GUIBIBTEX_H
14 #define GUIBIBTEX_H
15
16 #include "GuiDialog.h"
17 #include "ButtonController.h"
18 #include "ui_BibtexUi.h"
19 #include "ui_BibtexAddUi.h"
20
21 #include "insets/InsetCommandParams.h"
22
23
24 namespace lyx {
25 namespace frontend {
26
27 class GuiBibtexAddDialog : public QDialog, public Ui::BibtexAddUi
28 {
29 public:
30         GuiBibtexAddDialog(QWidget * parent) : QDialog(parent)
31         {
32                 Ui::BibtexAddUi::setupUi(this);
33                 QDialog::setModal(true);
34         }
35 };
36
37
38 class GuiBibtex : public GuiDialog, public Ui::BibtexUi
39 {
40         Q_OBJECT
41
42 public:
43         explicit GuiBibtex(GuiView & lv);
44
45 private Q_SLOTS:
46         void change_adaptor();
47         void browsePressed();
48         void browseBibPressed();
49         void addPressed();
50         void addDatabase();
51         void deletePressed();
52         void upPressed();
53         void downPressed();
54         void databaseChanged();
55         void availableChanged();
56         void bibEDChanged();
57
58 private:
59         ///
60         bool isValid();
61         /// Apply changes
62         void applyView();
63         /// update
64         void updateContents();
65
66         /// Browse for a .bib file
67         QString browseBib(QString const & in_name) const;
68         /// Browse for a .bst file
69         QString browseBst(QString const & in_name) const;
70         /// get the list of bst files
71         QStringList bibStyles() const;
72         /// get the list of bib files
73         QStringList bibFiles() const;
74         /// build filelists of all availabe bib/bst/cls/sty-files. done through
75         /// kpsewhich and an external script, saved in *Files.lst
76         void rescanBibStyles() const;
77         /// do we use bibtopic (for sectioned bibliography)?
78         bool usingBibtopic() const;
79         /// should we put the bibliography to the TOC?
80         bool bibtotoc() const;
81         /// which stylefile do we use?
82         QString styleFile() const;
83
84         ///
85         bool initialiseParams(std::string const & data);
86         /// clean-up on hide.
87         void clearParams() { params_.clear(); }
88         /// clean-up on hide.
89         void dispatchParams();
90         ///
91         bool isBufferDependent() const { return true; }
92
93 private:
94         ///
95         InsetCommandParams params_;
96         ///
97         GuiBibtexAddDialog * add_;
98         ///
99         ButtonController add_bc_;
100 };
101
102 } // namespace frontend
103 } // namespace lyx
104
105 #endif // GUIBIBTEX_H