2006-03-05 17:24:44 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiCitation.h
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Angus Leeming
|
|
|
|
* \author Kalle Dalheimer
|
2007-03-25 01:32:12 +00:00
|
|
|
* \author Abdelrazak Younes
|
2007-08-31 22:16:11 +00:00
|
|
|
* \author Richard Heck
|
2006-03-05 17:24:44 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#ifndef GUICITATION_H
|
|
|
|
#define GUICITATION_H
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2008-05-06 13:50:37 +00:00
|
|
|
#include "DialogView.h"
|
2007-08-31 22:37:05 +00:00
|
|
|
#include "ui_CitationUi.h"
|
2016-09-16 07:21:04 +00:00
|
|
|
#include "FancyLineEdit.h"
|
2008-04-20 15:00:11 +00:00
|
|
|
|
2008-04-20 09:24:14 +00:00
|
|
|
#include "insets/InsetCommandParams.h"
|
|
|
|
|
2017-06-10 12:29:07 +00:00
|
|
|
#include "BiblioInfo.h"
|
2008-05-06 13:50:37 +00:00
|
|
|
#include "Citation.h"
|
|
|
|
|
Support for "qualified citation lists"
These are biblatex-specific multicite commands that allow for multiple
pre- and postnotes, as in:
\cites(pre)(post)[pre1][post1]{key1}[pre2][post2]{key2}...
with an optional general pre- and postnote, which applies to the whole
list (like [][] in normal cite commands) and an optional pre- and
postnotes for each item, so that pagination can actually be specified in
multi-cite references, as in:
(cf. Miller 2015, 2; furthermore Smith 2013, 23-23; Jenkins 2012, 103,
also refer to chapter 6 in this book)
See the biblatex manual, sec. 3.8.3., for details.
File format change.
2017-01-21 13:25:17 +00:00
|
|
|
#include <QAbstractListModel>
|
|
|
|
#include <QStandardItemModel>
|
2007-03-25 01:32:12 +00:00
|
|
|
#include <QStringList>
|
2006-03-25 21:26:09 +00:00
|
|
|
#include <QStringListModel>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
2008-05-06 13:50:37 +00:00
|
|
|
|
|
|
|
class BiblioInfo;
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
namespace frontend {
|
|
|
|
|
2008-05-06 13:50:37 +00:00
|
|
|
class GuiSelectionManager;
|
|
|
|
|
Support for "qualified citation lists"
These are biblatex-specific multicite commands that allow for multiple
pre- and postnotes, as in:
\cites(pre)(post)[pre1][post1]{key1}[pre2][post2]{key2}...
with an optional general pre- and postnote, which applies to the whole
list (like [][] in normal cite commands) and an optional pre- and
postnotes for each item, so that pagination can actually be specified in
multi-cite references, as in:
(cf. Miller 2015, 2; furthermore Smith 2013, 23-23; Jenkins 2012, 103,
also refer to chapter 6 in this book)
See the biblatex manual, sec. 3.8.3., for details.
File format change.
2017-01-21 13:25:17 +00:00
|
|
|
|
2008-05-06 13:50:37 +00:00
|
|
|
class GuiCitation : public DialogView, public Ui::CitationUi
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2007-09-05 20:33:29 +00:00
|
|
|
///
|
2007-11-23 09:44:02 +00:00
|
|
|
GuiCitation(GuiView & lv);
|
2007-08-31 22:37:05 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
private Q_SLOTS:
|
2007-08-31 22:37:05 +00:00
|
|
|
void on_okPB_clicked();
|
|
|
|
void on_cancelPB_clicked();
|
|
|
|
void on_restorePB_clicked();
|
|
|
|
void on_applyPB_clicked();
|
2017-05-30 02:53:11 +00:00
|
|
|
void on_literalCB_clicked();
|
2016-09-16 07:21:04 +00:00
|
|
|
void filterPressed();
|
|
|
|
void filterChanged(const QString & text);
|
2007-08-31 22:37:05 +00:00
|
|
|
void on_fieldsCO_currentIndexChanged(int index);
|
|
|
|
void on_entriesCO_currentIndexChanged(int index);
|
2007-12-20 15:46:14 +00:00
|
|
|
void on_citationStyleCO_currentIndexChanged(int index);
|
2016-09-16 07:21:04 +00:00
|
|
|
void resetFilter();
|
|
|
|
void caseChanged();
|
|
|
|
void regexChanged();
|
|
|
|
void instantChanged(bool checked);
|
2007-09-05 20:33:29 +00:00
|
|
|
void changed();
|
2012-03-01 00:41:30 +00:00
|
|
|
/// set the citation keys, mark as changed
|
2007-08-31 22:37:05 +00:00
|
|
|
void setCitedKeys();
|
2012-03-01 00:41:30 +00:00
|
|
|
/// update the styles for the style combo, mark as changed
|
|
|
|
void updateStyles();
|
2007-08-31 22:37:05 +00:00
|
|
|
/// performs a limited update, suitable for internal call
|
2008-05-06 13:50:37 +00:00
|
|
|
void updateControls();
|
2011-12-03 22:15:11 +00:00
|
|
|
|
2008-05-06 14:33:38 +00:00
|
|
|
|
2007-08-31 22:37:05 +00:00
|
|
|
private:
|
2008-05-06 14:33:38 +00:00
|
|
|
/// Dialog inherited methods
|
|
|
|
//@{
|
|
|
|
void applyView();
|
|
|
|
void updateView() {}
|
|
|
|
bool initialiseParams(std::string const & data);
|
|
|
|
void clearParams();
|
|
|
|
void dispatchParams();
|
|
|
|
bool isBufferDependent() const { return true; }
|
2008-05-14 14:37:33 +00:00
|
|
|
void saveSession() const;
|
|
|
|
void restoreSession();
|
2008-05-06 14:33:38 +00:00
|
|
|
/** Disconnect from the inset when the Apply button is pressed.
|
|
|
|
* Allows easy insertion of multiple citations.
|
|
|
|
*/
|
|
|
|
bool disconnectOnApply() const { return true; }
|
|
|
|
//@}
|
|
|
|
|
|
|
|
///
|
|
|
|
void showEvent(QShowEvent * e);
|
|
|
|
///
|
|
|
|
void closeEvent(QCloseEvent * e);
|
|
|
|
/// prepares a call to GuiCitation::searchKeys when we
|
|
|
|
/// are ready to search the BibTeX entries
|
|
|
|
void findText(QString const & text, bool reset = false);
|
|
|
|
/// check whether key is already selected
|
|
|
|
bool isSelected(const QModelIndex &);
|
|
|
|
/// update the display of BibTeX information
|
2008-07-19 17:23:13 +00:00
|
|
|
void updateInfo(BiblioInfo const & bi, QModelIndex const &);
|
2007-08-31 22:37:05 +00:00
|
|
|
/// enable/disable buttons
|
|
|
|
void setButtons();
|
|
|
|
/// fill the fields combo
|
2008-07-19 17:23:13 +00:00
|
|
|
void fillFields(BiblioInfo const & bi);
|
2007-08-31 22:37:05 +00:00
|
|
|
/// fill the entries combo
|
2008-07-19 17:23:13 +00:00
|
|
|
void fillEntries(BiblioInfo const & bi);
|
2007-08-31 22:37:05 +00:00
|
|
|
/// set the styles combo
|
2012-03-01 00:41:30 +00:00
|
|
|
void updateStyles(BiblioInfo const & bi);
|
2007-12-20 15:46:14 +00:00
|
|
|
/// set the formatting widgets
|
2017-03-24 14:06:13 +00:00
|
|
|
void updateFormatting(CitationStyle const & currentStyle);
|
2007-03-25 01:32:12 +00:00
|
|
|
///
|
2008-07-19 17:23:13 +00:00
|
|
|
void updateControls(BiblioInfo const & bi);
|
2016-09-16 07:21:04 +00:00
|
|
|
/// Set the appropriate hinting text on the filter bar
|
|
|
|
void updateFilterHint();
|
2008-07-19 17:23:13 +00:00
|
|
|
///
|
2007-03-25 01:32:12 +00:00
|
|
|
void init();
|
2006-12-15 09:58:44 +00:00
|
|
|
/// Clear selected keys
|
|
|
|
void clearSelection();
|
2011-12-03 22:15:11 +00:00
|
|
|
|
Support for "qualified citation lists"
These are biblatex-specific multicite commands that allow for multiple
pre- and postnotes, as in:
\cites(pre)(post)[pre1][post1]{key1}[pre2][post2]{key2}...
with an optional general pre- and postnote, which applies to the whole
list (like [][] in normal cite commands) and an optional pre- and
postnotes for each item, so that pagination can actually be specified in
multi-cite references, as in:
(cf. Miller 2015, 2; furthermore Smith 2013, 23-23; Jenkins 2012, 103,
also refer to chapter 6 in this book)
See the biblatex manual, sec. 3.8.3., for details.
File format change.
2017-01-21 13:25:17 +00:00
|
|
|
/// Set selected keys
|
|
|
|
void setSelectedKeys(QStringList const);
|
|
|
|
/// Get selected keys
|
|
|
|
QStringList selectedKeys();
|
|
|
|
/// Set pre texts of qualified lists
|
|
|
|
void setPreTexts(std::vector<docstring> const m);
|
|
|
|
/// Get pre texts of qualified lists
|
|
|
|
std::vector<docstring> getPreTexts();
|
|
|
|
/// Set post texts of qualified lists
|
|
|
|
void setPostTexts(std::vector<docstring> const m);
|
|
|
|
/// Get post texts of qualified lists
|
|
|
|
std::vector<docstring> getPostTexts();
|
|
|
|
|
2007-03-25 01:32:12 +00:00
|
|
|
/// Find keys containing a string.
|
|
|
|
void findKey(
|
2008-07-19 17:23:13 +00:00
|
|
|
BiblioInfo const & bi, //< optimize by passing this
|
2007-03-25 01:32:12 +00:00
|
|
|
QString const & str, //< string expression
|
|
|
|
bool only_keys, //< set to true if only keys shall be searched.
|
2007-08-20 16:30:02 +00:00
|
|
|
docstring field, //<field to search, empty for all fields
|
|
|
|
docstring entryType, //<entry type to display, empty for all
|
2007-03-25 01:32:12 +00:00
|
|
|
bool case_sensitive, //< set to true for case sensitive search.
|
2007-08-20 16:30:02 +00:00
|
|
|
bool reg_exp, //< set to true if \c str is a regular expression.
|
|
|
|
bool reset = false //< whether to reset and search all keys
|
2007-03-25 01:32:12 +00:00
|
|
|
);
|
2006-06-28 08:28:16 +00:00
|
|
|
|
2017-06-10 12:29:07 +00:00
|
|
|
/// List of example cite strings and their correlating lyx name
|
|
|
|
BiblioInfo::CiteStringMap citationStyles(BiblioInfo const & bi,
|
|
|
|
size_t max_size);
|
2006-04-11 08:26:43 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
/// Set the Params variable for the Controller.
|
2014-12-19 10:35:37 +00:00
|
|
|
void applyParams(int const choice, bool const full, bool const force,
|
2006-06-28 08:28:16 +00:00
|
|
|
QString before, QString after);
|
2007-10-06 11:33:33 +00:00
|
|
|
|
|
|
|
///
|
2008-07-19 17:23:13 +00:00
|
|
|
void filterByEntryType(BiblioInfo const & bi,
|
2007-10-06 11:33:33 +00:00
|
|
|
std::vector<docstring> & keyVector, docstring entryType);
|
|
|
|
|
|
|
|
/// Search a given string within the passed keys.
|
|
|
|
/// \return the vector of matched keys.
|
|
|
|
std::vector<docstring> searchKeys(
|
2008-07-19 17:23:13 +00:00
|
|
|
BiblioInfo const & bi, //< optimize by passing this
|
2007-10-06 11:33:33 +00:00
|
|
|
std::vector<docstring> const & keys_to_search, //< Keys to search.
|
|
|
|
bool only_keys, //< whether to search only the keys
|
|
|
|
docstring const & search_expression, //< Search expression (regex possible)
|
|
|
|
docstring field, //< field to search, empty for all fields
|
|
|
|
bool case_sensitive = false, //< set to true is the search should be case sensitive
|
|
|
|
bool regex = false //< \set to true if \c search_expression is a regex
|
|
|
|
); //
|
|
|
|
|
|
|
|
/// The BibTeX information available to the dialog
|
2011-12-03 22:15:11 +00:00
|
|
|
/// Calls to this method will lead to checks of modification times and
|
2008-07-19 17:23:13 +00:00
|
|
|
/// the like, so it should be avoided.
|
2008-04-25 20:03:03 +00:00
|
|
|
BiblioInfo const & bibInfo() const;
|
2008-05-06 14:33:38 +00:00
|
|
|
|
2016-09-16 07:21:04 +00:00
|
|
|
/// contains the search box
|
|
|
|
FancyLineEdit * filter_;
|
|
|
|
|
|
|
|
/// Regexp action
|
|
|
|
QAction * regexp_;
|
|
|
|
/// Case sensitive action
|
|
|
|
QAction * casesense_;
|
|
|
|
/// Search as you type action
|
|
|
|
QAction * instant_;
|
|
|
|
|
2008-05-06 14:33:38 +00:00
|
|
|
/// last used citation style
|
2017-06-10 12:29:07 +00:00
|
|
|
QString style_;
|
2017-05-30 02:53:11 +00:00
|
|
|
/// last set value for literal
|
|
|
|
/// this is used only for new citations
|
|
|
|
bool literal_;
|
2008-05-06 14:33:38 +00:00
|
|
|
///
|
|
|
|
GuiSelectionManager * selectionManager;
|
|
|
|
/// available keys.
|
|
|
|
QStringListModel available_model_;
|
|
|
|
/// selected keys.
|
Support for "qualified citation lists"
These are biblatex-specific multicite commands that allow for multiple
pre- and postnotes, as in:
\cites(pre)(post)[pre1][post1]{key1}[pre2][post2]{key2}...
with an optional general pre- and postnote, which applies to the whole
list (like [][] in normal cite commands) and an optional pre- and
postnotes for each item, so that pagination can actually be specified in
multi-cite references, as in:
(cf. Miller 2015, 2; furthermore Smith 2013, 23-23; Jenkins 2012, 103,
also refer to chapter 6 in this book)
See the biblatex manual, sec. 3.8.3., for details.
File format change.
2017-01-21 13:25:17 +00:00
|
|
|
QStandardItemModel selected_model_;
|
2008-05-06 14:33:38 +00:00
|
|
|
/// All keys.
|
|
|
|
QStringList all_keys_;
|
|
|
|
/// Cited keys.
|
|
|
|
QStringList cited_keys_;
|
|
|
|
///
|
|
|
|
InsetCommandParams params_;
|
2007-10-06 11:33:33 +00:00
|
|
|
};
|
2006-04-11 08:26:43 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#endif // GUICITATION_H
|