]> git.lyx.org Git - features.git/commitdiff
* InsetMathMBox: cleanup in order to avoid Buffer and BufferView dependencies.
authorAbdelrazak Younes <younes@lyx.org>
Fri, 23 Feb 2007 08:10:13 +0000 (08:10 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Fri, 23 Feb 2007 08:10:13 +0000 (08:10 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17308 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathMBox.C
src/mathed/InsetMathMBox.h

index 13fdc76bad87688c0ad690739344bbfe10a0ac05..57bcef336968043383b6571a7b21539fb73aa330 100644 (file)
@@ -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 << "}";
        }
index e1c34e8acf1cb9ce8126a147054c077f9c766451..3581efa495ea7293c4b9c933eaf6835ffffa2690 100644 (file)
 
 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<InsetBase> doClone() const;
 };