X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FCounters.cpp;h=519cb2734668e9a39c440bec0236d5208cde0919;hb=21eb2c4f74c5665e6516cf900acf4f5acba21c69;hp=8477d5283ad90831ee366aa65835d3039d2d5350;hpb=39f997048e40e8ee965b4abbb88d41a11b3f8069;p=lyx.git diff --git a/src/Counters.cpp b/src/Counters.cpp index 8477d5283a..519cb27346 100644 --- a/src/Counters.cpp +++ b/src/Counters.cpp @@ -6,7 +6,7 @@ * \author Lars Gullik Bjønnes * \author Martin Vermeer * \author André Pönitz - * \author Richard Heck (roman numerals) + * \author Richard Kimberly Heck (roman numerals) * * Full author contact details are available in file CREDITS. */ @@ -59,6 +59,7 @@ bool Counter::read(Lexer & lex) CT_PRETTYFORMAT, CT_INITIALVALUE, CT_GUINAME, + CT_LATEXNAME, CT_END }; @@ -68,6 +69,7 @@ bool Counter::read(Lexer & lex) { "initialvalue", CT_INITIALVALUE}, { "labelstring", CT_LABELSTRING }, { "labelstringappendix", CT_LABELSTRING_APPENDIX }, + { "latexname", CT_LATEXNAME }, { "prettyformat", CT_PRETTYFORMAT }, { "within", CT_WITHIN } }; @@ -120,6 +122,10 @@ bool Counter::read(Lexer & lex) lex.next(); guiname_ = lex.getDocString(); break; + case CT_LATEXNAME: + lex.next(); + latexname_ = lex.getDocString(); + break; case CT_END: getout = true; break; @@ -374,6 +380,22 @@ docstring const & Counters::guiName(docstring const & cntr) const } +docstring const & Counters::latexName(docstring const & cntr) const +{ + CounterList::const_iterator it = counterList_.find(cntr); + if (it == counterList_.end()) { + lyxerr << "step: Counter does not exist: " + << to_utf8(cntr) << endl; + return empty_docstring(); + } + + docstring const & latexname = it->second.latexName(); + if (latexname.empty()) + return cntr; + return latexname; +} + + void Counters::reset() { appendix_ = false; @@ -413,16 +435,6 @@ bool Counters::remove(docstring const & cnt) } -void Counters::copy(Counters const & from, Counters & to, docstring const & match) -{ - for (auto const & ctr : counterList_) { - if (ctr.first.find(match) != string::npos || match == "") { - to.set(ctr.first, from.value(ctr.first)); - } - } -} - - docstring Counters::labelItem(docstring const & ctr, docstring const & numbertype) const {