-
- // is it a layout that has an automatic label?
- if (layout.labeltype >= LABEL_COUNTER_CHAPTER) {
-
- int i = layout.labeltype - LABEL_COUNTER_CHAPTER;
- if (i >= 0 && i<= buf->params.secnumdepth) {
- par->incCounter(i); // increment the counter
-
- // Is there a label? Useful for Chapter layout
- if (!par->params().appendix()) {
- if (!layout.labelstring().empty())
- par->params().labelString(layout.labelstring());
- else
- par->params().labelString(string());
- } else {
- if (!layout.labelstring_appendix().empty())
- par->params().labelString(layout.labelstring_appendix());
- else
- par->params().labelString(string());
- }
-
- ostringstream s;
-
- if (!par->params().appendix()) {
- switch (2 * LABEL_COUNTER_CHAPTER -
- textclass.maxcounter() + i) {
- case LABEL_COUNTER_CHAPTER:
- s << par->getCounter(i);
- break;
- case LABEL_COUNTER_SECTION:
- s << par->getCounter(i - 1) << '.'
- << par->getCounter(i);
- break;
- case LABEL_COUNTER_SUBSECTION:
- s << par->getCounter(i - 2) << '.'
- << par->getCounter(i - 1) << '.'
- << par->getCounter(i);
- break;
- case LABEL_COUNTER_SUBSUBSECTION:
- s << par->getCounter(i - 3) << '.'
- << par->getCounter(i - 2) << '.'
- << par->getCounter(i - 1) << '.'
- << par->getCounter(i);
-
- break;
- case LABEL_COUNTER_PARAGRAPH:
- s << par->getCounter(i - 4) << '.'
- << par->getCounter(i - 3) << '.'
- << par->getCounter(i - 2) << '.'
- << par->getCounter(i - 1) << '.'
- << par->getCounter(i);
- break;
- case LABEL_COUNTER_SUBPARAGRAPH:
- s << par->getCounter(i - 5) << '.'
- << par->getCounter(i - 4) << '.'
- << par->getCounter(i - 3) << '.'
- << par->getCounter(i - 2) << '.'
- << par->getCounter(i - 1) << '.'
- << par->getCounter(i);
-
- break;
- default:
- // Can this ever be reached? And in the
- // case it is, how can this be correct?
- // (Lgb)
- s << par->getCounter(i) << '.';
- break;
- }
- } else { // appendix
- switch (2 * LABEL_COUNTER_CHAPTER - textclass.maxcounter() + i) {
- case LABEL_COUNTER_CHAPTER:
- if (par->isRightToLeftPar(buf->params))
- s << hebrewCounter(par->getCounter(i));
- else
- s << alphaCounter(par->getCounter(i));
- break;
- case LABEL_COUNTER_SECTION:
- if (par->isRightToLeftPar(buf->params))
- s << hebrewCounter(par->getCounter(i - 1));
- else
- s << alphaCounter(par->getCounter(i - 1));
-
- s << '.'
- << par->getCounter(i);
-
- break;
- case LABEL_COUNTER_SUBSECTION:
- if (par->isRightToLeftPar(buf->params))
- s << hebrewCounter(par->getCounter(i - 2));
- else
- s << alphaCounter(par->getCounter(i - 2));