}
delete inset;
}
-
+
/// search for macro in local (buffer) table or in children
MacroData const * getBufferMacro(docstring const & name,
DocIterator const & pos) const;
/// Update macro table starting with position of it \param it in some
/// text inset.
- void updateMacros(DocIterator & it, DocIterator & scope,
- bool record_docits = false);
+ void updateMacros(DocIterator & it, DocIterator & scope);
///
void setLabel(ParIterator & it, UpdateType utype) const;
///
/// If non zero, this buffer is a clone of existing buffer \p cloned_buffer_
/// This one is useful for preview detached in a thread.
Buffer const * cloned_buffer_;
-
+ /// are we in the process of exporting this buffer?
+ mutable bool doing_export;
+
private:
/// So we can force access via the accessors.
mutable Buffer const * parent_buffer;
read_only(readonly_), filename(file), file_fully_loaded(false),
toc_backend(owner), macro_lock(false), timestamp_(0),
checksum_(0), wa_(0), gui_(0), undo_(*owner), bibinfo_cache_valid_(false),
- cloned_buffer_(cloned_buffer), parent_buffer(0)
+ cloned_buffer_(cloned_buffer), doing_export(false), parent_buffer(0)
{
if (!cloned_buffer_) {
temppath = createBufferTmpDir();
updateBuffer(UpdateMaster, OutputUpdate);
checkBibInfoCache();
d->bibinfo_.makeCitationLabels(*this);
- updateMacros(true);
+ updateMacros();
updateMacroInstances();
if (!only_body) {
// if the .lyx file has been saved, we don't need an
// autosave
d->bak_clean = true;
+ d->undo_.markDirty();
}
}
-void Buffer::Impl::updateMacros(DocIterator & it, DocIterator & scope,
- bool record_docits)
+void Buffer::Impl::updateMacros(DocIterator & it, DocIterator & scope)
{
pit_type const lastpit = it.lastpit();
continue;
}
- if (record_docits && iit->inset->asInsetMath()) {
+ if (doing_export && iit->inset->asInsetMath()) {
InsetMath * im = static_cast<InsetMath *>(iit->inset);
if (im->asHullInset()) {
InsetMathHull * hull = static_cast<InsetMathHull *>(im);
}
-void Buffer::updateMacros(bool record_docit) const
+void Buffer::updateMacros() const
{
if (d->macro_lock)
return;
DocIterator it = par_iterator_begin();
DocIterator outerScope = it;
outerScope.pit() = outerScope.lastpit() + 2;
- d->updateMacros(it, outerScope, record_docit);
+ d->updateMacros(it, outerScope);
}
}
+namespace {
+ // helper class, to guarantee this gets reset properly
+ class MarkAsExporting {
+ public:
+ MarkAsExporting(Buffer const * buf) : buf_(buf)
+ {
+ LASSERT(buf_, /* */);
+ buf_->setExportStatus(true);
+ }
+ ~MarkAsExporting()
+ {
+ buf_->setExportStatus(false);
+ }
+ private:
+ Buffer const * const buf_;
+ };
+}
+
+
+void Buffer::setExportStatus(bool e) const
+{
+ d->doing_export = e;
+}
+
+
+bool Buffer::isExporting() const
+{
+ return d->doing_export;
+}
+
bool Buffer::doExport(string const & format, bool put_in_tempdir,
bool includeall, string & result_file) const
{
+ MarkAsExporting exporting(this);
string backend_format;
OutputParams runparams(¶ms().encoding());
runparams.flavor = OutputParams::LATEX;
bool Buffer::preview(string const & format, bool includeall) const
{
+ MarkAsExporting exporting(this);
string result_file;
// (1) export with all included children (omit \includeonly)
if (includeall && !doExport(format, true, true))
if (from == end)
break;
to = from;
- if (from.paragraph().spellCheck(from.pos(), to.pos(), wl, suggestions)) {
+ SpellChecker::Result res = from.paragraph().spellCheck(from.pos(), to.pos(), wl, suggestions);
+ if (SpellChecker::misspelled(res)) {
word_lang = wl;
break;
}