]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlCitation.h
The reference dialog now disconnects from the inset on Apply. Its behaviour
[lyx.git] / src / frontends / controllers / ControlCitation.h
index 166264ec5ed297fefd4fe3d7fa0212ef6ed3b705..c0d26e745656fbf6db680f313d05237f42efac41 100644 (file)
 #endif
 
 #include "ControlCommand.h"
+#include "biblio.h" // biblio::InfoMap
 
-/** A controller for Citation dialogs. All citation-specific functionality
-    should go in here.
+/** A controller for Citation dialogs.
  */
 class ControlCitation : public ControlCommand
 {
 public:
-       ///
-       typedef std::map<string, string> InfoMap;
-       ///
-       typedef std::map<string, string>::value_type InfoMapValue;
-       ///
-       enum Search {
-               ///
-               SIMPLE,
-               ///
-               REGEX
-       };
-       ///
-       enum Direction {
-               ///
-               FORWARD,
-               ///
-               BACKWARD
-       };
        ///
        ControlCitation(LyXView &, Dialogs &);
-       /// A vector of bibliography keys
-       std::vector<string> const getBibkeys();
-       /// Returns a reference to the map of stored keys
-       InfoMap const & bibkeysInfo() const { return bibkeysInfo_; }
-       /** Returns the BibTeX data associated with a given key.
-           Empty if no info exists. */
-       string const getBibkeyInfo(string const &);
-private:
-       /// Clean up, then hide dialog.
-       virtual void clearParams();
-       /// The info associated with each key
-       InfoMap bibkeysInfo_;
-};
-
-/** Helper functions, of possible use to all frontends
- */
 
-/** Search a BibTeX info field for the given key and return the
-    associated field. */
-string const parseBibTeX(string data, string const & findkey);
+       /// Returns a reference to the map of stored keys
+       biblio::InfoMap const & bibkeysInfo() const;
 
-/** Returns an iterator to the first key that meets the search criterion,
-    or end() if unsuccessful.
+       ///
+       bool usingNatbib() const;
+       /// Possible citations based on this key
+       std::vector<string> const getCiteStrings(string const & key) const;
 
-    User supplies :
-    the controller with the map of bibkeys info,
-    the vector of keys to be searched,
-    the search criterion,
-    an iterator defining the starting point of the search,
-    an enum defining a Simple or Regex search,
-    an enum defining the search direction.
-*/
+       /// available CiteStyle-s (depends on availability of Natbib
+       static std::vector<biblio::CiteStyle> const & getCiteStyles()
+               { return citeStyles_; }
 
-std::vector<string>::const_iterator
-searchKeys(ControlCitation const & controller,
-          std::vector<string> const & keys_to_search,
-          string const & search_expression,
-          std::vector<string>::const_iterator start,
-          ControlCitation::Search,
-          ControlCitation::Direction,
-          bool caseSensitive=false);
+private:
+       /// create the InfoMap of keys and data
+       virtual void setDaughterParams();
+       /// 
+       virtual void clearDaughterParams();
 
-/// Do the dirty work for the search. Should use through the function above
-std::vector<string>::const_iterator
-simpleSearch(ControlCitation const & controller,
-            std::vector<string> const & keys_to_search,
-            string const & search_expression,
-            std::vector<string>::const_iterator start,
-            ControlCitation::Direction,
-            bool caseSensitive=false);
+       /** disconnect from the inset when the Apply button is pressed.
+        Allows easy insertion of multiple citations. */
+       virtual bool disconnectOnApply() { return true; }
 
-/// Should use through the function above
-std::vector<string>::const_iterator
-regexSearch(ControlCitation const & controller,
-           std::vector<string> const & keys_to_search,
-           string const & search_expression,
-           std::vector<string>::const_iterator start,
-           ControlCitation::Direction);
-#endif // CONTROLCITATION_H
+       /// The info associated with each key
+       biblio::InfoMap bibkeysInfo_;
 
+       ///
+       static std::vector<biblio::CiteStyle> citeStyles_;
+};
 
 
+#endif // CONTROLCITATION_H