-string expandLabel(Buffer const & buf,
- LyXLayout_ptr const & layout, bool appendix)
-{
- LyXTextClass const & tclass = buf.params().getLyXTextClass();
-
- string fmt = buf.B_(appendix ? layout->labelstring_appendix()
- : layout->labelstring());
-
- // handle 'inherited level parts' in 'fmt',
- // i.e. the stuff between '@' in '@Section@.\arabic{subsection}'
- size_t const i = fmt.find('@', 0);
- if (i != string::npos) {
- size_t const j = fmt.find('@', i + 1);
- if (j != string::npos) {
- string parent(fmt, i + 1, j - i - 1);
- string label = expandLabel(buf, tclass[parent], appendix);
- fmt = string(fmt, 0, i) + label + string(fmt, j + 1, string::npos);
- }
- }
-
- return tclass.counters().counterLabel(fmt);
-}