]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiRef.h
booktabs: support for \cmidrule trimming
[lyx.git] / src / frontends / qt4 / GuiRef.h
1 // -*- C++ -*-
2 /**
3  * \file GuiRef.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  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef GUIREF_H
13 #define GUIREF_H
14
15 #include "GuiDialog.h"
16 #include "ui_RefUi.h"
17 #include "FancyLineEdit.h"
18
19 #include "insets/InsetCommandParams.h"
20
21 #include <vector>
22
23 class QTreeWidgetItem;
24
25 namespace lyx {
26 namespace frontend {
27
28 class GuiRef : public GuiDialog, public Ui::RefUi
29 {
30         Q_OBJECT
31
32 public:
33         GuiRef(GuiView & lv);
34         /// Dialog inherited methods
35         //@{
36         void enableView(bool enable);
37         //@}
38
39 private Q_SLOTS:
40         void changed_adaptor();
41         void gotoClicked();
42         void filterLabels();
43         void resetFilter();
44         void refHighlighted(QTreeWidgetItem *);
45         void selectionChanged();
46         void refTextChanged(QString const &);
47         void refSelected(QTreeWidgetItem *);
48         void sortToggled();
49         void groupToggled();
50         void on_buttonBox_clicked(QAbstractButton *);
51         void updateClicked();
52         void resetDialog();
53         void dialogRejected();
54
55 private:
56         ///
57         bool isBufferDependent() const { return true; }
58         /** disconnect from the inset when the Apply button is pressed.
59          Allows easy insertion of multiple references. */
60         bool disconnectOnApply() const { return true; }
61         ///
62         void gotoRef(std::string const &);
63         ///
64         void gotoBookmark();
65         ///
66         void closeEvent(QCloseEvent * e);
67         ///
68         bool isValid();
69         /// apply changes
70         void applyView();
71         /// update dialog
72         void updateContents();
73         ///
74         void enableBoxes();
75
76         /// is name allowed for this ?
77         bool nameAllowed();
78         /// is type allowed for this ?
79         bool typeAllowed();
80         /// go to current reference
81         void gotoRef();
82         /// set go back button
83         void setGoBack();
84         /// set goto ref button
85         void setGotoRef();
86         /// re-enter references
87         void redoRefs();
88         /// update references
89         void updateRefs();
90         ///
91         bool initialiseParams(std::string const & data);
92         /// clean-up on hide.
93         void clearParams() { params_.clear(); }
94         /// clean-up on hide.
95         void dispatchParams();
96
97 private:
98         ///
99         InsetCommandParams params_;
100
101         /// contains the search box
102         FancyLineEdit * filter_;
103
104         /// went to a reference ?
105         bool at_ref_;
106         /// the last reference entered or examined
107         QString last_reference_;
108         /// store the buffer settings
109         int restored_buffer_;
110         /// store the last active buffer
111         int active_buffer_;
112         /// the references
113         std::vector<docstring> refs_;
114 };
115
116 } // namespace frontend
117 } // namespace lyx
118
119 #endif // GUIREF_H