Impl::BufferPositionMap::iterator end = d->children_positions.end();
for (; it != end; ++it) {
Buffer * child = const_cast<Buffer *>(it->first);
- if (d->cloned_buffer_)
+ if (isClone())
delete child;
// The child buffer might have been closed already.
else if (theBufferList().isLoaded(child))
docstring const & doctitle = features.htmlTitle();
os << "<title>"
- << (doctitle.empty() ? from_ascii("LyX Document") : doctitle)
+ << (doctitle.empty() ?
+ from_ascii("LyX Document") :
+ html::htmlize(doctitle, XHTMLStream::ESCAPE_ALL))
<< "</title>\n";
os << "\n<!-- Text Class Preamble -->\n"
break;
case LFUN_BUFFER_EXPORT: {
- ExportStatus const status = doExport(argument, false, false);
+ ExportStatus const status = doExport(argument, false);
dr.setError(status != ExportSuccess);
if (status != ExportSuccess)
dr.setMessage(bformat(_("Error exporting to format: %1$s."),
}
case LFUN_BUILD_PROGRAM:
- doExport("program", true, false);
+ doExport("program", true);
break;
case LFUN_BUFFER_CHKTEX:
break;
} else {
- doExport(format_name, true, false, filename);
+ doExport(format_name, true, filename);
}
// Substitute $$FName for filename
}
-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_;
- };
-}
+// helper class, to guarantee this gets reset properly
+class Buffer::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
}
-Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir) const
+Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir)
+ const
+{
+ string result_file;
+ return doExport(target, put_in_tempdir, result_file);
+}
+
+Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir,
+ string & result_file) const
{
bool const update_unincluded =
params().maintain_unincluded_children
&& !params().getIncludedChildren().empty();
- return doExport(target, put_in_tempdir, update_unincluded);
+
+ // (1) export with all included children (omit \includeonly)
+ if (update_unincluded) {
+ ExportStatus const status =
+ doExport(target, put_in_tempdir, true, result_file);
+ if (status != ExportSuccess)
+ return status;
+ }
+ // (2) export with included children only
+ return doExport(target, put_in_tempdir, false, result_file);
}
if (status == CANCEL) {
message(_("Document export cancelled."));
- } else if (tmp_result_file.exists()) {
+ return ExportCancel;
+ }
+
+ if (tmp_result_file.exists()) {
// Finally copy the main file
use_force = use_gui ? lyxrc.export_overwrite != NO_FILES
: force_overwrite != NO_FILES;
status = copyFile(format, tmp_result_file,
FileName(result_file), result_file,
status == FORCE);
- message(bformat(_("Document exported as %1$s "
- "to file `%2$s'"),
- formats.prettyName(format),
- makeDisplayPath(result_file)));
+ if (status == CANCEL) {
+ message(_("Document export cancelled."));
+ return ExportCancel;
+ } else {
+ message(bformat(_("Document exported as %1$s "
+ "to file `%2$s'"),
+ formats.prettyName(format),
+ makeDisplayPath(result_file)));
+ }
} else {
// This must be a dummy converter like fax (bug 1888)
message(bformat(_("Document exported as %1$s"),
}
-Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir,
- bool includeall) const
-{
- string result_file;
- // (1) export with all included children (omit \includeonly)
- if (includeall) {
- ExportStatus const status =
- doExport(target, put_in_tempdir, true, result_file);
- if (status != ExportSuccess)
- return status;
- }
- // (2) export with included children only
- return doExport(target, put_in_tempdir, false, result_file);
-}
-
-
Buffer::ExportStatus Buffer::preview(string const & format) const
{
bool const update_unincluded =
string result_file;
// (1) export with all included children (omit \includeonly)
if (includeall) {
- ExportStatus const status = doExport(format, true, true);
+ ExportStatus const status = doExport(format, true, true, result_file);
if (status != ExportSuccess)
return status;
}