From 36f6966af7603a497c8abae47c438e7f8b9503d8 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Fri, 23 Feb 2007 08:10:13 +0000 Subject: [PATCH] * InsetMathMBox: cleanup in order to avoid Buffer and BufferView dependencies. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17308 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/InsetMathMBox.C | 13 +++++-------- src/mathed/InsetMathMBox.h | 9 +++++---- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/mathed/InsetMathMBox.C b/src/mathed/InsetMathMBox.C index 13fdc76bad..57bcef3369 100644 --- a/src/mathed/InsetMathMBox.C +++ b/src/mathed/InsetMathMBox.C @@ -34,13 +34,11 @@ using std::auto_ptr; using std::endl; -InsetMathMBox::InsetMathMBox(BufferView & bv) - : text_(), bv_(&bv) +InsetMathMBox::InsetMathMBox(LyXLayout_ptr const & layout) { text_.paragraphs().clear(); text_.paragraphs().push_back(Paragraph()); - text_.paragraphs().back(). - layout(bv.buffer()->params().getLyXTextClass().defaultLayout()); + text_.paragraphs().back().layout(layout); } @@ -69,20 +67,19 @@ void InsetMathMBox::draw(PainterInfo & pi, int x, int y) const } -void InsetMathMBox::write(WriteStream & ws) const +void InsetMathMBox::write(Buffer const & buf, WriteStream & ws) const { if (ws.latex()) { ws << "\\mbox{\n"; TexRow texrow; OutputParams runparams; - latexParagraphs(*bv_->buffer(), text_.paragraphs(), - ws.os(), texrow, runparams); + latexParagraphs(buf, text_.paragraphs(), ws.os(), texrow, runparams); ws.addlines(texrow.rows()); ws << "}"; } else { ws << "\\mbox{\n"; std::ostringstream os; - text_.write(*bv_->buffer(), os); + text_.write(buf, os); ws.os() << from_utf8(os.str()); ws << "}"; } diff --git a/src/mathed/InsetMathMBox.h b/src/mathed/InsetMathMBox.h index e1c34e8acf..3581efa495 100644 --- a/src/mathed/InsetMathMBox.h +++ b/src/mathed/InsetMathMBox.h @@ -18,13 +18,15 @@ namespace lyx { +class Buffer; +class BufferView; // almost a substitute for the real text inset... class InsetMathMBox : public InsetMathDim { public: /// - explicit InsetMathMBox(BufferView & bv); + explicit InsetMathMBox(LyXLayout_ptr const & layout); /// this stores metrics information in cache_ bool metrics(MetricsInfo & mi, Dimension & dim) const; /// draw according to cached metrics @@ -37,7 +39,7 @@ public: bool isActive() const { return true; } /// - void write(WriteStream & os) const; + void write(Buffer const & buf, WriteStream & os) const; /// int latex(Buffer const &, odocstream & os, OutputParams const & runparams) const; @@ -51,8 +53,7 @@ protected: /// mutable LyXText text_; - /// - BufferView * const bv_; + private: virtual std::auto_ptr doClone() const; }; -- 2.39.2