]> git.lyx.org Git - features.git/commitdiff
merge common code
authorAndré Pönitz <poenitz@gmx.net>
Tue, 2 Dec 2003 12:39:14 +0000 (12:39 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 2 Dec 2003 12:39:14 +0000 (12:39 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8183 a592a061-630c-0410-9148-cb99ea01b6c8

src/buffer.C
src/insets/insetcaption.C
src/insets/insetcollapsable.C
src/insets/insettext.C
src/insets/insettext.h
src/lyxtext.h
src/text.C

index 96d5cc2519c294fb1f202da05e481a8f8ae9421b..d159f095680c0541338860d102a738c6719adf43 100644 (file)
@@ -839,19 +839,13 @@ bool Buffer::do_writeFile(ostream & ofs) const
            << " created this file. For more info see http://www.lyx.org/\n"
            << "\\lyxformat " << LYX_FORMAT << "\n";
 
-       // now write out the buffer paramters.
+       // now write out the buffer parameters.
        params().writeFile(ofs);
 
        ofs << "\\end_header\n";
 
-       Paragraph::depth_type depth = 0;
-
-       // this will write out all the paragraphs
-       // using recursive descent.
-       ParagraphList::const_iterator pit = paragraphs().begin();
-       ParagraphList::const_iterator pend = paragraphs().end();
-       for (; pit != pend; ++pit)
-               pit->write(*this, ofs, params(), depth);
+       // write the text
+       text().write(*this, ofs);
 
        // Write marker that shows file is complete
        ofs << "\n\\end_document" << endl;
index 132af638fc50e37bb6beb0066f23168d2e71fa6a..2b4d0bf7a0667464aa659e0a44140ba8ee97ba71 100644 (file)
@@ -52,7 +52,7 @@ InsetCaption::InsetCaption(BufferParams const & bp)
 void InsetCaption::write(Buffer const & buf, ostream & os) const
 {
        os << "Caption\n";
-       writeParagraphData(buf, os);
+       text_.write(buf, os);
 }
 
 
index 285d8f4ae3e2addebee532090ab4831886502c76..9f8cac0f42738a934c3f55c3413c40debb771553 100644 (file)
@@ -79,7 +79,7 @@ bool InsetCollapsable::insertInset(BufferView * bv, InsetOld * in)
 void InsetCollapsable::write(Buffer const & buf, ostream & os) const
 {
        os << "collapsed " << (status_ == Collapsed ? "true" : "false") << "\n";
-       inset.writeParagraphData(buf, os);
+       inset.text_.write(buf, os);
 }
 
 
index b1b61522eaa1ea24709c36d03664ce5e5841d084..428533bbcaf5651085131c5861ab624f7fa4a543 100644 (file)
@@ -143,18 +143,7 @@ auto_ptr<InsetBase> InsetText::clone() const
 void InsetText::write(Buffer const & buf, ostream & os) const
 {
        os << "Text\n";
-       writeParagraphData(buf, os);
-}
-
-
-void InsetText::writeParagraphData(Buffer const & buf, ostream & os) const
-{
-       ParagraphList::const_iterator it = paragraphs().begin();
-       ParagraphList::const_iterator end = paragraphs().end();
-       Paragraph::depth_type dth = 0;
-       for (; it != end; ++it) {
-               it->write(buf, os, buf.params(), dth);
-       }
+       text_.write(buf, os);
 }
 
 
index 8085e615e3182e094e60df8af6edb48bdc12c554..46708539d0ba2ebb0af0fd411fa8a863ed4a33c0 100644 (file)
@@ -97,8 +97,6 @@ public:
                     bool toggleall = false,
                     bool selectall = false);
        ///
-       void writeParagraphData(Buffer const &, std::ostream &) const;
-       ///
        void setText(std::string const &, LyXFont const &);
        ///
        void setAutoBreakRows(bool);
index bf27dc44f94ac0b70411e70b2b71c26076241b00..d70eb49ea8c2fe82ba09ce4e25846763291cf6e2 100644 (file)
@@ -25,6 +25,8 @@
 
 #include "insets/inset.h"
 
+#include <iosfwd>
+
 class Buffer;
 class BufferParams;
 class BufferView;
@@ -389,6 +391,8 @@ public:
        ///
        bool checkAndActivateInset(bool front);
 
+       ///
+       void write(Buffer const & buf, std::ostream & os) const;
 
 public:
        ///
index 7b206d8ba97ccf9826cdaa8784c77672d67e5245..a474fb75369d550c176f500892822be1147ec530 100644 (file)
@@ -1757,3 +1757,13 @@ void LyXText::getWord(LyXCursor & from, LyXCursor & to, word_location const loc)
                to.pos(to.pos() + 1);
        }
 }
+
+
+void LyXText::write(Buffer const & buf, std::ostream & os) const
+{
+       ParagraphList::const_iterator pit = paragraphs().begin();
+       ParagraphList::const_iterator end = paragraphs().end();
+       Paragraph::depth_type dth = 0;
+       for (; pit != end; ++pit)
+               pit->write(buf, os, buf.params(), dth);
+}