4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
8 * \author Kalle Dalheimer
9 * \author Abdelrazak Younes
10 * \author Richard Heck
12 * Full author contact details are available in file CREDITS.
18 #include "GuiDialog.h"
19 #include "ControlCitation.h"
20 #include "GuiSelectionManager.h"
21 #include "ui_CitationUi.h"
22 #include "support/docstring.h"
25 #include <QStringList>
26 #include <QStringListModel>
31 class GuiCitationDialog : public GuiDialog, public Ui::CitationUi
37 GuiCitationDialog(LyXView & lv);
41 /// Hide the dialog from sight
43 /// Redraw the dialog (e.g. if the colors have been remapped).
45 /// Create the dialog if necessary, update it and display it.
47 /// \return true if the dialog is visible.
48 bool isVisibleView() const;
51 /// Update the display of the dialog whilst it is still visible.
56 ControlCitation & controller();
58 void closeEvent(QCloseEvent * e);
59 /// prepares a call to GuiCitation::searchKeys when we
60 /// are ready to search the BibTeX entries
61 void findText(QString const & text, bool reset = false);
62 /// check whether key is already selected
63 bool isSelected(const QModelIndex &);
64 /// update the display of BibTeX information
65 void updateInfo(QModelIndex const &);
69 void on_okPB_clicked();
70 void on_cancelPB_clicked();
71 void on_restorePB_clicked();
72 void on_applyPB_clicked();
73 void on_findLE_textChanged(const QString & text);
74 void on_fieldsCO_currentIndexChanged(int index);
75 void on_entriesCO_currentIndexChanged(int index);
76 void on_caseCB_stateChanged(int);
77 void on_regexCB_stateChanged(int);
81 /// performs a limited update, suitable for internal call
85 /// enable/disable buttons
87 /// fill the styles combo
89 /// fill the fields combo
91 /// fill the entries combo
93 /// set the styles combo
95 /// last used citation style
98 GuiSelectionManager * selectionManager;
101 bool initialiseParams(std::string const & data);
107 QStringListModel * available() { return &available_model_; }
110 QStringListModel * selected() { return &selected_model_; }
113 QString textBefore();
118 /// Get key description
119 QString getKeyInfo(QString const &);
121 /// Clear selected keys
122 void clearSelection();
124 /// Return a list of available fields
125 QStringList getFieldsAsQStringList();
127 /// Return a list of available fields
128 QStringList getEntriesAsQStringList();
130 /// Find keys containing a string.
132 QString const & str, //< string expression
133 bool only_keys, //< set to true if only keys shall be searched.
134 docstring field, //<field to search, empty for all fields
135 docstring entryType, //<entry type to display, empty for all
136 bool case_sensitive, //< set to true for case sensitive search.
137 bool reg_exp, //< set to true if \c str is a regular expression.
138 bool reset = false //< whether to reset and search all keys
141 /// List of example cite strings
142 QStringList citationStyles(int);
144 /// Set the Params variable for the Controller.
145 void apply(int const choice, bool const full, bool const force,
146 QString before, QString after);
150 QStringListModel available_model_;
152 QStringListModel selected_model_;
154 QStringList all_keys_;
156 QStringList cited_keys_;
160 } // namespace frontend
163 #endif // GUICITATION_H