X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fcounters.C;h=cc5d3328ee46609ca81cc402ebdc53b0efb3cfe9;hb=1b0cfa4381f8efa0f724bfc661c108d73242d1d6;hp=8415c45081c5aa0483227dbbd1e282cc593168ad;hpb=0959028211a8a8cfaf56cc2f07ab1c159f2153ff;p=lyx.git diff --git a/src/counters.C b/src/counters.C index 8415c45081..cc5d3328ee 100644 --- a/src/counters.C +++ b/src/counters.C @@ -17,6 +17,7 @@ #include "counters.h" #include "debug.h" + #include "support/lstrings.h" #include "support/LAssert.h" @@ -59,45 +60,19 @@ void Counter::reset() value_ = 0; } + string Counter::master() const { return master_; } + void Counter::setMaster(string const & m) { master_ = m; } -Counters::Counters() -{ - // Ehh, should this take a textclass arg? - - // Sectioning counters: - newCounter("part"); - newCounter("chapter"); - newCounter("section", "chapter"); - newCounter("subsection", "section"); - newCounter("subsubsection", "subsection"); - newCounter("paragraph", "subsubsection"); - newCounter("subparagraph", "paragraph"); - - // Enumeration counters: - newCounter("enumi"); - newCounter("enumii", "enumi"); - newCounter("enumiii", "enumii"); - newCounter("enumiv", "enumiii"); - - // Biblio: - newCounter("bibitem"); - - // Float counters: - newCounter("figure"); - newCounter("table"); - newCounter("algorithm"); -} - void Counters::newCounter(string const & newc) { @@ -109,8 +84,6 @@ void Counters::newCounter(string const & newc) return; } counterList[newc]; - cit = counterList.find(newc); - cit->second.setMaster(""); } @@ -131,9 +104,7 @@ void Counters::newCounter(string const & newc, string const & masterc) return; } - counterList[newc]; - cit = counterList.find(newc); - cit->second.setMaster(masterc); + counterList[newc].setMaster(masterc); } @@ -307,7 +278,8 @@ string Counters::labelItem(string const & ctr, } s << o.str(); } - return s.str(); + + return STRCONV(s.str()); } @@ -316,7 +288,8 @@ string Counters::numberLabel(string const & ctr, string const & langtype, int head) { - ostringstream s, o; + ostringstream s; + if (numbertype == "sectioning" || numbertype == "appendix") { if (ctr == "chapter" && head == 0) { s << labelItem("chapter", numbertype, langtype, true); @@ -343,9 +316,11 @@ string Counters::numberLabel(string const & ctr, } } else if (numbertype == "enumeration") { - ostringstream ei, eii, eiii, eiv; - //string ei, eiii, eiv; - //char eii; + ostringstream ei; + ostringstream eii; + ostringstream eiii; + ostringstream eiv; + if (langtype == "hebrew") { ei << '.' << value("enumi"); eii << '(' << hebrewCounter(value("enumii")) << ')'; @@ -367,5 +342,6 @@ string Counters::numberLabel(string const & ctr, s << eiv.str(); } } - return s.str(); + + return STRCONV(s.str()); }