X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBuffer.h;h=386625e18d2906896a943d84cf5777c5edf29378;hb=4db3e641ed6765e005343010cb90ee8af26f8f99;hp=18e57f94b0c4e4670789219022ed1a860077875a;hpb=d750b6610f9104d9a32e6e71d86cc309d913830f;p=lyx.git diff --git a/src/Buffer.h b/src/Buffer.h index 18e57f94b0..386625e18d 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -15,8 +15,6 @@ #include "OutputEnums.h" #include "OutputParams.h" -#include "insets/InsetCode.h" - #include "support/strfwd.h" #include "support/types.h" @@ -94,6 +92,9 @@ typedef std::set CloneList; * minimal, probably not. * \author Lars Gullik Bjønnes */ + +class MarkAsExporting; + class Buffer { public: /// What type of log will \c getLogName() return? @@ -588,8 +589,7 @@ public: /// Replace the inset contents for insets which InsetCode is equal /// to the passed \p inset_code. - void changeRefsIfUnique(docstring const & from, docstring const & to, - InsetCode code); + void changeRefsIfUnique(docstring const & from, docstring const & to); /// get source code (latex/docbook) for some paragraphs, or all paragraphs /// including preamble @@ -717,7 +717,6 @@ public: int charCount(bool with_blanks) const; private: - class MarkAsExporting; friend class MarkAsExporting; /// mark the buffer as busy exporting something, or not void setExportStatus(bool e) const; @@ -753,6 +752,25 @@ private: }; +/// Helper class, to guarantee that the export status +/// gets reset properly. To use, simply create a local variable: +/// MarkAsExporting mex(bufptr); +/// and leave the rest to us. +class MarkAsExporting { +public: + MarkAsExporting(Buffer const * buf) : buf_(buf) + { + buf_->setExportStatus(true); + } + ~MarkAsExporting() + { + buf_->setExportStatus(false); + } +private: + Buffer const * const buf_; +}; + + } // namespace lyx #endif