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 "GuiSelectionManager.h"
20 #include "ui_CitationUi.h"
21 #include "ControlCitation.h"
22 #include "support/docstring.h"
25 #include <QStringList>
26 #include <QStringListModel>
33 class GuiCitationDialog : public QDialog,
34 public Ui::CitationUi, public Dialog::View
39 GuiCitationDialog(Dialog &, GuiCitation * form );
41 virtual ~GuiCitationDialog();
43 virtual void applyView();
45 /// Hide the dialog from sight
48 /// Redraw the dialog (e.g. if the colors have been remapped).
51 /// Create the dialog if necessary, update it and display it.
54 /// \return true if the dialog is visible.
55 bool isVisibleView() const;
58 /// Update the display of the dialog whilst it is still visible.
62 void closeEvent(QCloseEvent * e);
63 /// prepares a call to GuiCitation::searchKeys when we
64 /// are ready to search the BibTeX entries
65 void findText(QString const & text, bool reset = false);
66 /// check whether key is already selected
67 bool isSelected(const QModelIndex &);
68 /// update the display of BibTeX information
69 void updateInfo(QModelIndex const &);
73 void on_okPB_clicked();
74 void on_cancelPB_clicked();
75 void on_restorePB_clicked();
76 void on_applyPB_clicked();
77 void on_findLE_textChanged(const QString & text);
78 void on_fieldsCO_currentIndexChanged(int index);
79 void on_entriesCO_currentIndexChanged(int index);
80 void on_caseCB_stateChanged(int);
81 void on_regexCB_stateChanged(int);
82 virtual void changed();
85 /// performs a limited update, suitable for internal call
89 /// enable/disable buttons
91 /// fill the styles combo
93 /// fill the fields combo
95 /// fill the entries combo
97 /// set the styles combo
99 /// last used citation style
104 GuiSelectionManager * selectionManager;
108 class GuiCitation : public ControlCitation
112 GuiCitation(GuiDialog &);
113 virtual ~GuiCitation() {}
114 virtual bool initialiseParams(std::string const & data);
120 QStringListModel * available() { return &available_model_; }
123 QStringListModel * selected() { return &selected_model_; }
126 QString textBefore();
131 /// Get key description
132 QString getKeyInfo(QString const &);
134 /// Clear selected keys
135 void clearSelection();
137 /// Return a list of available fields
138 QStringList getFieldsAsQStringList();
140 /// Return a list of available fields
141 QStringList getEntriesAsQStringList();
143 /// Find keys containing a string.
145 QString const & str, //< string expression
146 bool only_keys, //< set to true if only keys shall be searched.
147 docstring field, //<field to search, empty for all fields
148 docstring entryType, //<entry type to display, empty for all
149 bool case_sensitive, //< set to true for case sensitive search.
150 bool reg_exp, //< set to true if \c str is a regular expression.
151 bool reset = false //< whether to reset and search all keys
154 /// List of example cite strings
155 QStringList citationStyles(int);
157 /// Set the Params variable for the Controller.
158 virtual void apply(int const choice, bool const full, bool const force,
159 QString before, QString after);
165 QStringListModel available_model_;
167 QStringListModel selected_model_;
169 QStringList all_keys_;
171 QStringList cited_keys_;
175 } // namespace frontend
178 #endif // GUICITATION_H