X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FCounters.h;h=28e7b686322791d3236f7b056c50a0893965d744;hb=d8ab0622c5354ae2d181e9eae56764211285706c;hp=f2d4df71573f7abbec790e690f9471b0ff5ca813;hpb=d3463fed605e8a1a44a05b30811ed13ca8a18023;p=lyx.git diff --git a/src/Counters.h b/src/Counters.h index f2d4df7157..28e7b68632 100644 --- a/src/Counters.h +++ b/src/Counters.h @@ -18,6 +18,7 @@ #include "support/docstring.h" #include +#include namespace lyx { @@ -72,6 +73,8 @@ private: /// Every instantiation is an array of counters of type Counter. class Counters { public: + /// + Counters() : appendix_(false), subfloat_(false) {} /// Add a new counter to array. void newCounter(docstring const & newc); /// Add new counter having oldc as its master and ls as its label. @@ -105,7 +108,8 @@ public: docstring theCounter(docstring const & c); /// Replace om format all the LaTeX-like macros that depend on /// counters. - docstring counterLabel(docstring const & format); + docstring counterLabel(docstring const & format, + std::set * callers = 0); /// Are we in apendix? bool appendix() const { return appendix_; }; /// Set the state variable indicating whether we are in appendix. @@ -114,7 +118,15 @@ public: std::string const & current_float() const { return current_float_; } /// Sets the current enclosing float. void current_float(std::string const & f) { current_float_ = f; } + /// Are we in a subfloat? + bool isSubfloat() const { return subfloat_; } + /// Set the state variable indicating whether we are in a subfloat. + void isSubfloat(bool s) { subfloat_ = s; }; private: + /// returns the expanded string representation of the counter + /// with recursion protection through callers. + docstring theCounter(docstring const & c, + std::set & callers); /// Returns the value of the counter according to the /// numbering scheme numbertype. /* Available numbering schemes are arabic (1, 2,...), roman @@ -131,6 +143,8 @@ private: bool appendix_; /// The current enclosing float. std::string current_float_; + /// Are we in a subfloat? + bool subfloat_; };