]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiRef.h
Clean up the crossrefs dialog.
[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 refHighlighted(QTreeWidgetItem *);
44         void selectionChanged();
45         void refTextChanged(QString const &);
46         void refSelected(QTreeWidgetItem *);
47         void sortToggled();
48         void groupToggled();
49         void updateClicked();
50         void resetDialog();
51         void dialogRejected();
52
53 private:
54         ///
55         bool isBufferDependent() const { return true; }
56         /** disconnect from the inset when the Apply button is pressed.
57          Allows easy insertion of multiple references. */
58         bool disconnectOnApply() const { return true; }
59         ///
60         void gotoRef(std::string const &);
61         ///
62         void gotoBookmark();
63         ///
64         void closeEvent(QCloseEvent * e);
65         ///
66         bool isValid();
67         /// apply changes
68         void applyView();
69         /// update dialog
70         void updateContents();
71
72         /// is name allowed for this ?
73         bool nameAllowed();
74         /// is type allowed for this ?
75         bool typeAllowed();
76         /// go to current reference
77         void gotoRef();
78         /// set go back button
79         void setGoBack();
80         /// set goto ref button
81         void setGotoRef();
82         /// re-enter references
83         void redoRefs();
84         /// update references
85         void updateRefs();
86         ///
87         bool initialiseParams(std::string const & data);
88         /// clean-up on hide.
89         void clearParams() { params_.clear(); }
90         /// clean-up on hide.
91         void dispatchParams();
92
93 private:
94         ///
95         InsetCommandParams params_;
96
97         /// contains the search box
98         FancyLineEdit * filter_;
99
100         /// went to a reference ?
101         bool at_ref_;
102         /// the last reference entered or examined
103         QString last_reference_;
104         /// store the buffer settings
105         int restored_buffer_;
106         /// store the last active buffer
107         int active_buffer_;
108         /// the references
109         std::vector<docstring> refs_;
110 };
111
112 } // namespace frontend
113 } // namespace lyx
114
115 #endif // GUIREF_H