]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
Minor cleanup.
[lyx.git] / src / Buffer.cpp
index bc86f8a5bf866618b57dcbcd8e1894f5596f5d56..aa6d936aec8e6fa00b4c92a4e71c386280e21078 100644 (file)
@@ -400,7 +400,7 @@ Buffer::~Buffer()
        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))
@@ -1714,7 +1714,9 @@ void Buffer::writeLyXHTMLSource(odocstream & os,
 
                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"
@@ -3475,23 +3477,22 @@ bool Buffer::autoSave() const
 }
 
 
-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
@@ -3746,7 +3747,10 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir
 
        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;
@@ -3755,10 +3759,15 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir
                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"),