*
* \author Angus Leeming
* \author Kalle Dalheimer
+ * \author Abdelrazak Younes
*
* Full author contact details are available in file CREDITS.
*/
#ifndef QCITATION_H
#define QCITATION_H
-#include "ControlCitation.h"
+#include "frontends/controllers/ControlCitation.h"
+#include <QStringList>
#include <QStringListModel>
namespace lyx {
public:
///
QCitation(Dialog &);
+ virtual ~QCitation() {}
+ virtual bool initialiseParams(std::string const & data);
- QStringListModel * available()
- { return &available_keys_; }
+ ///
+ void init();
- QStringListModel * selected()
- { return &selected_keys_; }
+ /// Available keys
+ QStringListModel * available() { return &available_model_; }
- QStringListModel * found()
- { return &found_keys_; }
+ /// Selected keys
+ QStringListModel * selected() { return &selected_model_; }
+ /// Text before cite
QString textBefore();
- QString textAfter();
-
- QModelIndex findKey(QString const & str, QModelIndex const & index) const;
- QModelIndex findKey(QString const & str) const;
-
- void addKeys(QModelIndexList const & indexes);
- void deleteKeys(QModelIndexList const & indexes);
- void upKey(QModelIndexList const & indexes);
- void downKey(QModelIndexList const & indexes);
-
- QStringList citationStyles(int sel);
+ /// Text after cite
+ QString textAfter();
- virtual bool isValid();
-
- /// Set the Params variable for the Controller.
- virtual void apply(int const choice, bool const full, bool const force,
- QString before, QString After);
+ /// Get key description
+ QString getKeyInfo(QString const &);
- /// Update dialog before/whilst showing it.
- virtual void updateModel();
+ /// Clear selected keys
+ void clearSelection();
-private:
- /// available keys
- QStringListModel available_keys_;
+ /// Find keys containing a string.
+ void findKey(
+ QString const & str, //< string expression
+ bool only_keys, //< set to true if only keys shall be searched.
+ bool case_sensitive, //< set to true for case sensitive search.
+ bool reg_exp //< set to true if \c str is a regular expression.
+ );
- /// selected keys
- QStringListModel selected_keys_;
+ /// Add key to selected keys
+ void addKey(QModelIndex const &);
- /// found keys
- QStringListModel found_keys_;
-};
+ /// Delete key from selected keys
+ void deleteKey(QModelIndex const &);
+ /// Move selected key one place up
+ void upKey(QModelIndex const &);
-#if 0
-/** A controller for Citation dialogs.
- */
-class Citation {
-public:
- ///
- Citation();
+ /// Move selected key one place down
+ void downKey(QModelIndex const &);
- ///
- virtual bool initialiseParams(std::string const & data);
+ /// List of example cite strings
+ QStringList citationStyles(int);
- /// clean-up on hide.
- virtual void clearParams();
+ /// Set the Params variable for the Controller.
+ virtual void apply(int const choice, bool const full, bool const force,
+ QString before, QString after);
- /** Disconnect from the inset when the Apply button is pressed.
- * Allows easy insertion of multiple citations.
- */
- virtual bool disconnectOnApply() const { return true; }
+private:
+ /// available keys.
+ QStringListModel available_model_;
- /// Returns a reference to the map of stored keys
- biblio::InfoMap const & bibkeysInfo() const;
+ /// selected keys.
+ QStringListModel selected_model_;
- ///
- biblio::CiteEngine_enum getEngine() const;
+ /// All keys.
+ QStringList all_keys_;
- /// Possible citations based on this key
- std::vector<std::string> const getCiteStrings(std::string const & key) const;
+ /// Cited keys.
+ QStringList cited_keys_;
+};
- /// available CiteStyle-s (depends on availability of Natbib/Jurabib)
- static std::vector<biblio::CiteStyle> const & getCiteStyles() {
- return citeStyles_;
- }
-private:
- /// The info associated with each key
- biblio::InfoMap bibkeysInfo_;
- ///
- static std::vector<biblio::CiteStyle> citeStyles_;
-};
-#endif
} // namespace frontend
} // namespace lyx