// if parent_buffer is not loaded, then it has been unloaded,
// which means that parent_buffer is an invalid pointer. So we
// set it to null in that case.
- if (!theBufferList().isLoaded(parent_buffer))
+ // however, the BufferList doesn't know about cloned buffers, so
+ // they will always be regarded as unloaded. in that case, we hope
+ // for the best.
+ if (!cloned_buffer_ && !theBufferList().isLoaded(parent_buffer))
parent_buffer = 0;
return parent_buffer;
}
{
LaTeXFeatures features(*this, params(), runparams);
validate(features);
- updateLabels(UpdateMaster, true);
+ updateLabels(UpdateMaster, OutputUpdate);
checkBibInfoCache();
d->bibinfo_.makeCitationLabels(*this);
updateMacros();
runparams.exportdata->externalFiles(format);
string const dest = onlyPath(result_file);
CopyStatus status = SUCCESS;
- for (vector<ExportedFile>::const_iterator it = files.begin();
- it != files.end() && status != CANCEL; ++it) {
+
+ vector<ExportedFile>::const_iterator it = files.begin();
+ vector<ExportedFile>::const_iterator const en = files.end();
+ for (; it != en && status != CANCEL; ++it) {
string const fmt = formats.getFormatFromFile(it->sourceName);
status = copyFile(fmt, it->sourceName,
makeAbsPath(it->exportName, dest),
it->exportName, status == FORCE);
}
+
if (status == CANCEL) {
message(_("Document export cancelled."));
} else if (tmp_result_file.exists()) {
}
-void Buffer::updateLabels(UpdateScope scope, bool out) const
+void Buffer::updateLabels(UpdateScope scope, UpdateType utype) const
{
// Use the master text class also for child documents
Buffer const * const master = masterBuffer();
// If this is a child document start with the master
if (master != this) {
bufToUpdate.insert(this);
- master->updateLabels(UpdateMaster, out);
+ master->updateLabels(UpdateMaster, utype);
// Do this here in case the master has no gui associated with it. Then,
// the TocModel is not updated and TocModel::toc_ is invalid (bug 5699).
if (!master->gui_)
// do the real work
ParIterator parit = cbuf.par_iterator_begin();
- updateLabels(parit, out);
+ updateLabels(parit, utype);
if (master != this)
// TocBackend update will be done later.
// set the label of a paragraph. This includes the counters.
-void Buffer::setLabel(ParIterator & it) const
+void Buffer::setLabel(ParIterator & it, UpdateType utype) const
{
BufferParams const & bp = this->masterBuffer()->params();
DocumentClass const & textclass = bp.documentClass();
if (layout.toclevel <= bp.secnumdepth
&& (layout.latextype != LATEX_ENVIRONMENT
|| it.text()->isFirstInSequence(it.pit()))) {
- counters.step(layout.counter);
+ counters.step(layout.counter, utype);
par.params().labelString(
par.expandLabel(layout, bp));
} else
// Maybe we have to reset the enumeration counter.
if (needEnumCounterReset(it))
counters.reset(enumcounter);
- counters.step(enumcounter);
+ counters.step(enumcounter, utype);
string const & lang = par.getParLanguage(bp)->code();
par.params().labelString(counters.theCounter(enumcounter, lang));
docstring name = this->B_(textclass.floats().getType(type).name());
if (counters.hasCounter(from_utf8(type))) {
string const & lang = par.getParLanguage(bp)->code();
- counters.step(from_utf8(type));
+ counters.step(from_utf8(type), utype);
full_label = bformat(from_ascii("%1$s %2$s:"),
name,
counters.theCounter(from_utf8(type), lang));
}
-void Buffer::updateLabels(ParIterator & parit, bool out) const
+void Buffer::updateLabels(ParIterator & parit, UpdateType utype) const
{
LASSERT(parit.pit() == 0, /**/);
parit->params().depth(min(parit->params().depth(), maxdepth));
maxdepth = parit->getMaxDepthAfter();
+ if (utype == OutputUpdate) {
+ // track the active counters
+ // we have to do this for the master buffer, since the local
+ // buffer isn't tracking anything.
+ masterBuffer()->params().documentClass().counters().
+ setActiveLayout(parit->layout());
+ }
+
// set the counter for this paragraph
- setLabel(parit);
+ setLabel(parit, utype);
- // Now the insets
+ // now the insets
InsetList::const_iterator iit = parit->insetList().begin();
InsetList::const_iterator end = parit->insetList().end();
for (; iit != end; ++iit) {
parit.pos() = iit->pos;
- iit->inset->updateLabels(parit, out);
+ iit->inset->updateLabels(parit, utype);
}
}
}