#include "LaTeX.h"
#include "lyxtextclass.h"
#include "paragraph.h"
+#include "paragraph_funcs.h"
#include "ParagraphList_fwd.h"
#include "ParagraphParameters.h"
#include "pariterator.h"
TeXErrors::Errors::const_iterator end = terr.end();
for (; cit != end; ++cit) {
- int par_id = -1;
- int posstart = -1;
- int const errorrow = cit->error_in_line;
- buf.texrow().getIdFromRow(errorrow, par_id, posstart);
- int posend = -1;
- buf.texrow().getIdFromRow(errorrow + 1, par_id, posend);
- buf.error(ErrorItem(cit->error_desc,
- cit->error_text,
- par_id, posstart, posend));
+ int id_start = -1;
+ int pos_start = -1;
+ int errorrow = cit->error_in_line;
+ buf.texrow().getIdFromRow(errorrow, id_start, pos_start);
+ int id_end = -1;
+ int pos_end = -1;
+ do {
+ ++errorrow;
+ buf.texrow().getIdFromRow(errorrow, id_end, pos_end);
+ } while (id_start == id_end && pos_start == pos_end);
+
+ buf.error(ErrorItem(cit->error_desc, cit->error_text,
+ id_start, pos_start, pos_end));
}
}
// is it a layout that has an automatic label?
if (layout->labeltype == LABEL_COUNTER) {
- counters.step(layout->counter);
- string label = expandLabel(textclass, layout, par.params().appendix());
- par.params().labelString(label);
+ if (layout->toclevel <= buf.params().secnumdepth
+ && (layout->latextype != LATEX_ENVIRONMENT
+ || isFirstInSequence(it.pit(), it.plist()))) {
+ counters.step(layout->counter);
+ string label = expandLabel(buf, layout,
+ par.params().appendix());
+ par.params().labelString(label);
+ }
} else if (layout->labeltype == LABEL_ITEMIZE) {
// At some point of time we should do something more
// clever here, like:
} else if (layout->labeltype == LABEL_BIBLIO) {// ale970302
counters.step("bibitem");
int number = counters.value("bibitem");
- if (par.bibitem()) {
+ if (par.bibitem())
par.bibitem()->setCounter(number);
- par.params().labelString(layout->labelstring());
- }
+ par.params().labelString(buf.B_(layout->labelstring()));
// In biblio should't be following counters but...
} else if (layout->labeltype == LABEL_SENSITIVE) {
// Search for the first float or wrap inset in the iterator
--i;
InsetBase * const in = &it[i].inset();
if (in->lyxCode() == InsetBase::FLOAT_CODE
- || in->lyxCode() == InsetBase::WRAP_CODE)
+ || in->lyxCode() == InsetBase::WRAP_CODE)
type = in->getInsetName();
break;
}
}
-string expandLabel(LyXTextClass const & textclass,
+string expandLabel(Buffer const & buf,
LyXLayout_ptr const & layout, bool appendix)
{
- string fmt = appendix ?
- layout->labelstring_appendix() : layout->labelstring();
+ 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 j = fmt.find('@', i + 1);
if (j != string::npos) {
string parent(fmt, i + 1, j - i - 1);
- string label = expandLabel(textclass, textclass[parent], appendix);
+ string label = expandLabel(buf, tclass[parent], appendix);
fmt = string(fmt, 0, i) + label + string(fmt, j + 1, string::npos);
}
}
- return textclass.counters().counterLabel(fmt);
+ return tclass.counters().counterLabel(fmt);
}