#include "DispatchResult.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "LyX.h" // quitting
#include "MetricsInfo.h"
#include "Text.h"
#include "TextClass.h"
#include "support/convert.h"
#include "support/debug.h"
+#include "support/docstream.h"
+#include "support/ExceptionMessage.h"
#include "support/gettext.h"
#include <map>
using namespace std;
+using namespace lyx::support;
namespace lyx {
}
+void Inset::setBuffer(Buffer & buffer)
+{
+ buffer_ = &buffer;
+}
+
+
+Buffer & Inset::buffer()
+{
+ if (!buffer_) {
+ odocstringstream s;
+ s << "LyX Code: " << lyxCode() << " name: " << name();
+ throw ExceptionMessage(BufferException,
+ from_ascii("Inset::buffer_ member not initialized!"), s.str());
+ }
+ return *buffer_;
+}
+
+
+Buffer const & Inset::buffer() const
+{
+ return const_cast<Inset *>(this)->buffer();
+}
+
+
docstring Inset::name() const
{
return from_ascii("unknown");
}
-int Inset::docbook(Buffer const &,
- odocstream &, OutputParams const &) const
+int Inset::docbook(odocstream &, OutputParams const &) const
{
return 0;
}
}
-docstring const Inset::editMessage() const
+docstring Inset::editMessage() const
{
return _("Opened inset");
}
InsetLayout const & Inset::getLayout(BufferParams const & bp) const
{
- return bp.textClass().insetlayout(name());
+ return bp.documentClass().insetLayout(name());
}
void Inset::dump() const
{
- Buffer buf("foo", 1);
- write(buf, lyxerr);
+ write(lyxerr);
}
Buffer const * Inset::updateFrontend() const
{
- if (quitting)
- return 0;
- return theApp()->updateInset(this);
+ return theApp() ? theApp()->updateInset(this) : 0;
}
} // namespace lyx