]> git.lyx.org Git - lyx.git/blobdiff - src/Counters.h
Amend 6c3447c8: FindAdv: sometimes a space is added on some math symbols
[lyx.git] / src / Counters.h
index e6554a284f37ae150e6fc709eab8c68a6567e98a..67a790fc0c93b3c5a96f6d6387cb0d5883dd2195 100644 (file)
@@ -26,7 +26,8 @@
 namespace lyx {
 
 class Layout;
-class Lexer;
+
+namespace support { class Lexer; }
 
 /// This represents a single counter.
 class Counter {
@@ -35,9 +36,10 @@ public:
        Counter();
        ///
        Counter(docstring const & mc, docstring const & ls,
-               docstring const & lsa, docstring const & guiname);
+               docstring const & lsa, docstring const & prettyformat,
+               docstring const & guiname);
        /// \return true on success
-       bool read(Lexer & lex);
+       bool read(support::Lexer & lex);
        ///
        void set(int v);
        ///
@@ -68,7 +70,11 @@ public:
        /// E.g., for a section counter it might be "section \thesection"
        docstring const & prettyFormat() const { return prettyformat_; }
        ///
+       docstring const & refFormat(docstring const & prefix) const;
+       ///
        docstring const & guiName() const { return guiname_; }
+       ///
+       docstring const & latexName() const { return latexname_; }
 
        /// Returns a map of LaTeX-like strings to format the counter.
        /** For each language, the string is similar to what one gets
@@ -100,7 +106,11 @@ private:
        /// Similar, but used for formatted references in XHTML output
        docstring prettyformat_;
        ///
+       std::map<docstring, docstring> ref_formats_;
+       ///
        docstring guiname_;
+       /// The name used for the counter in LaTeX
+       docstring latexname_;
        /// Cache of the labelstring with \\the<counter> expressions expanded,
        /// indexed by language
        mutable StringMap flatlabelstring_;
@@ -125,6 +135,7 @@ public:
                        docstring const & parentc,
                        docstring const & ls,
                        docstring const & lsa,
+                       docstring const & prettyformat,
                        docstring const & guiname);
        /// Checks whether the given counter exists.
        bool hasCounter(docstring const & c) const;
@@ -132,7 +143,7 @@ public:
        /// \param makeNew whether to make a new counter if one
        ///        doesn't already exist
        /// \return true on success
-       bool read(Lexer & lex, docstring const & name, bool makenew);
+       bool read(support::Lexer & lex, docstring const & name, bool makenew);
        ///
        void set(docstring const & ctr, int val);
        ///
@@ -158,12 +169,10 @@ public:
        void reset();
        /// Reset counters matched by match string.
        void reset(docstring const & match);
+       /// Copy counter \p cnt to \p newcnt.
+       bool copy(docstring const & cnt, docstring const & newcnt);
        /// Remove counter \p cnt.
        bool remove(docstring const & cnt);
-       /// Copy counters whose name matches match from the &from to
-       /// the &to array of counters. Empty string matches all.
-       void copy(Counters const & from, Counters & to,
-                 docstring const & match = docstring()) const;
        /** returns the expanded string representation of counter \c
         *  c. The \c lang code is used to translate the string.
         */
@@ -179,8 +188,15 @@ public:
        /// format given by Counter::prettyFormat().
        docstring prettyCounter(docstring const & cntr,
                               std::string const & lang) const;
+       /// returns a formatted version of the counter, using the
+       /// format given by Counter::prettyFormat().
+       docstring formattedCounter(docstring const & cntr,
+                                       docstring const & prefix,
+                                       std::string const & lang) const;
        ///
        docstring const & guiName(docstring const & cntr) const;
+       ///
+       docstring const & latexName(docstring const & cntr) const;
        /// Are we in appendix?
        bool appendix() const { return appendix_; }
        /// Set the state variable indicating whether we are in appendix.