4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Jürgen Spitzmüller
9 * Full author contact details are available in file CREDITS.
15 #include "ColorCode.h"
17 #include "support/docstring.h"
27 * A class describing an Index type, such as "Index of Names".
28 * Different Index types are used in split Indices
30 * An Index has a name and a shortcut notation. It uses a
31 * user-specifiable GUI colour. All these can be set and
36 * A class containing a vector of all defined indices within a
37 * document. It has methods for outputting a '|'-separated string
38 * of all elements, and for adding, removing and renaming elements.
46 docstring const & index() const;
48 void setIndex(docstring const &);
50 docstring const & shortcut() const;
52 void setShortcut(docstring const &);
54 RGBColor const & color() const;
56 void setColor(RGBColor const &);
58 * Set color from a string "#rrggbb".
59 * Use Color:background if the string is no valid color.
60 * This ensures compatibility with LyX 1.4.0 that had the symbolic
61 * color "none" that was displayed as Color:background.
63 void setColor(std::string const &);
77 typedef std::list<Index> List;
79 typedef List::const_iterator const_iterator;
82 IndicesList() : separator_(from_ascii("|")) {}
85 bool empty() const { return list.empty(); }
87 void clear() { list.clear(); }
89 const_iterator begin() const { return list.begin(); }
90 const_iterator end() const { return list.end(); }
92 /** \returns the Index with \c name. If not found, returns 0.
94 Index * find(docstring const & name);
95 Index const * find(docstring const & name) const;
97 /** \returns the Index with the shortcut \c shortcut.
98 * If not found, returns 0.
100 Index * findShortcut(docstring const & shortcut);
101 Index const * findShortcut(docstring const & shortcut) const;
103 /** Add (possibly multiple (separated by separator())) indices to list
104 * \returns true if an index is added.
106 bool add(docstring const & n, docstring const & s = docstring());
107 /** Add the default index (if not already there)
108 * \returns true if an index is added.
110 bool addDefault(docstring const & n);
111 /** remove an index from list by name
112 * \returns true if an index is removed.
114 bool remove(docstring const &);
115 /** rename an index in list
116 * \returns true if renaming succeeded.
118 bool rename(docstring const &, docstring const &);
124 docstring separator_;
129 #endif // INDICESLIST_H