Step 2. Almost mechanical.

Andre'

-- 
Those who desire to give up Freedom in order to gain Security, will not have,
nor do they deserve, either one.     (T. Jefferson or B. Franklin or both...)
Index: BufferView.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView.C,v
retrieving revision 1.212
diff -u -p -r1.212 BufferView.C
--- BufferView.C        28 Nov 2003 15:08:35 -0000      1.212
+++ BufferView.C        28 Nov 2003 17:14:27 -0000
@@ -308,7 +308,7 @@ void BufferView::gotoLabel(string const 
                if (find(labels.begin(),labels.end(),label) != labels.end()) {
                        text()->clearSelection();
                        text()->setCursor(
-                               std::distance(text()->ownerParagraphs().begin(), 
it.getPar()),
+                               std::distance(text()->paragraphs().begin(), 
it.getPar()),
                                it.getPos());
                        text()->selection.cursor = text()->cursor;
                        update();
@@ -413,7 +413,7 @@ Encoding const * BufferView::getEncoding
        return t->cursorPar()->getFont(
                buffer()->params(),
                t->cursor.pos(),
-               outerFont(t->cursorPar(), t->ownerParagraphs())
+               outerFont(t->cursorPar(), t->paragraphs())
        ).language()->encoding();
 }
 
Index: buffer.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
retrieving revision 1.545
diff -u -p -r1.545 buffer.C
--- buffer.C    28 Nov 2003 15:08:38 -0000      1.545
+++ buffer.C    28 Nov 2003 17:14:27 -0000
@@ -146,7 +146,6 @@ struct Buffer::Impl
        limited_stack<Undo> undostack;
        limited_stack<Undo> redostack;
        BufferParams params;
-       ParagraphList paragraphs;
        LyXVC lyxvc;
        string temppath;
        bool nicefile;
@@ -190,7 +189,7 @@ Buffer::Impl::Impl(Buffer & parent, stri
        : nicefile(true),
          lyx_clean(true), bak_clean(true), unnamed(false), read_only(readonly_),
          filename(file), filepath(OnlyPath(file)), file_fully_loaded(false),
-               text(0, 0, 0, paragraphs)
+               text(0, 0, 0)
 {
        lyxvc.buffer(&parent);
        if (readonly_ || lyxrc.use_tempdir)
@@ -218,8 +217,6 @@ Buffer::~Buffer()
                        bformat(_("Could not remove the temporary directory %1$s"), 
temppath()));
        }
 
-       paragraphs().clear();
-
        // Remove any previewed LaTeX snippets associated with this buffer.
        lyx::graphics::Previews::get().removeLoader(*this);
 }
@@ -269,13 +266,13 @@ BufferParams const & Buffer::params() co
 
 ParagraphList & Buffer::paragraphs()
 {
-       return pimpl_->paragraphs;
+       return pimpl_->text.paragraphs();
 }
 
 
 ParagraphList const & Buffer::paragraphs() const
 {
-       return pimpl_->paragraphs;
+       return pimpl_->text.paragraphs();
 }
 
 
Index: lyx_cb.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyx_cb.C,v
retrieving revision 1.232
diff -u -p -r1.232 lyx_cb.C
--- lyx_cb.C    28 Nov 2003 08:55:06 -0000      1.232
+++ lyx_cb.C    28 Nov 2003 17:14:28 -0000
@@ -428,7 +428,7 @@ string getContentsOfAsciiFile(BufferView
 string const getPossibleLabel(BufferView const & bv)
 {
        ParagraphList::iterator pit = bv.getLyXText()->cursorPar();
-       ParagraphList & plist = bv.getLyXText()->ownerParagraphs();
+       ParagraphList & plist = bv.getLyXText()->paragraphs();
 
        LyXLayout_ptr layout = pit->layout();
 
Index: lyxtext.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtext.h,v
retrieving revision 1.264
diff -u -p -r1.264 lyxtext.h
--- lyxtext.h   28 Nov 2003 15:53:23 -0000      1.264
+++ lyxtext.h   28 Nov 2003 17:14:28 -0000
@@ -53,7 +53,7 @@ class LyXText : public TextCursor {
        // Public Functions
 public:
        /// Constructor
-       LyXText(BufferView *, InsetText *, bool ininset, ParagraphList & plist);
+       LyXText(BufferView *, InsetText *, bool ininset);
        ///
        void init(BufferView *);
 
@@ -334,7 +334,7 @@ public:
        //
        // special owner functions
        ///
-       ParagraphList & ownerParagraphs() const;
+       ParagraphList & paragraphs() const;
 
        /// return true if this is owned by an inset.
        bool isInInset() const;
@@ -414,8 +414,6 @@ public:
        mutable Bidi bidi;
        ///
        bool in_inset_;
-       ///
-       ParagraphList * paragraphs_;
 
        /// absolute document pixel coordinates of this LyXText
        mutable int xo_;
@@ -473,6 +471,10 @@ private:
        void number();
        /// is the cursor paragraph right-to-left?
        bool rtl() const;
+
+
+       ///
+       ParagraphList paragraphs_;
 };
 
 /// return the default height of a row in pixels, considering font zoom
Index: rowpainter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.C,v
retrieving revision 1.102
diff -u -p -r1.102 rowpainter.C
--- rowpainter.C        28 Nov 2003 15:53:25 -0000      1.102
+++ rowpainter.C        28 Nov 2003 17:14:29 -0000
@@ -599,7 +599,7 @@ void RowPainter::paintFirst()
        LyXLayout_ptr const & layout = pit_->layout();
 
        if (buffer.params().paragraph_separation == BufferParams::PARSEP_SKIP) {
-               if (pit_ != text_.ownerParagraphs().begin()) {
+               if (pit_ != text_.paragraphs().begin()) {
                        if (layout->latextype == LATEX_PARAGRAPH
                                && !pit_->getDepth()) {
                                y_top += buffer.params().getDefSkip().inPixels(bv_);
@@ -618,7 +618,7 @@ void RowPainter::paintFirst()
        int const ww = bv_.workWidth();
 
        bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params());
-       bool const is_seq = isFirstInSequence(pit_, text_.ownerParagraphs());
+       bool const is_seq = isFirstInSequence(pit_, text_.paragraphs());
        //lyxerr << "paintFirst: " << pit_->id() << " is_seq: " << is_seq << std::endl;
 
        // should we print a label?
@@ -712,7 +712,7 @@ void RowPainter::paintLast()
 {
        int const ww = bv_.workWidth();
        bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params());
-       int const endlabel = getEndLabel(pit_, text_.ownerParagraphs());
+       int const endlabel = getEndLabel(pit_, text_.paragraphs());
 
        // draw an endlabel
        switch (endlabel) {
@@ -860,7 +860,7 @@ int paintPars(BufferView const & bv, LyX
        int const y2 = bv.painter().paperHeight();
        y -= bv.top_y();
 
-       ParagraphList::iterator end = text.ownerParagraphs().end();
+       ParagraphList::iterator end = text.paragraphs().end();
 
        for ( ; pit != end; ++pit) {
                RowList::iterator row = pit->rows.begin();
@@ -890,5 +890,5 @@ int paintText(BufferView const & bv)
 
 void paintTextInset(BufferView const & bv, LyXText const & text, int xo, int yo)
 {
-       paintPars(bv, text, text.ownerParagraphs().begin(), xo, yo, 0);
+       paintPars(bv, text, text.paragraphs().begin(), xo, yo, 0);
 }
Index: tabular.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tabular.C,v
retrieving revision 1.200
diff -u -p -r1.200 tabular.C
--- tabular.C   5 Nov 2003 12:06:05 -0000       1.200
+++ tabular.C   28 Nov 2003 17:14:29 -0000
@@ -1397,7 +1397,7 @@ void LyXTabular::setMultiColumn(Buffer *
        for (int i = 1; i < number; ++i) {
                cellstruct & cs1 = cellinfo_of_cell(cell + i);
                cs1.multicolumn = CELL_PART_OF_MULTICOLUMN;
-               cs.inset.appendParagraphs(buffer, cs1.inset.paragraphs);
+               cs.inset.appendParagraphs(buffer, cs1.inset.paragraphs());
                cs1.inset.clear(false);
        }
        set_row_column_number_info();
@@ -2018,8 +2018,8 @@ int LyXTabular::TeXRow(ostream & os, int
                ret += TeXCellPreamble(os, cell);
                InsetText & inset = getCellInset(cell);
 
-               bool rtl = inset.paragraphs.begin()->isRightToLeftPar(bufferparams) &&
-                       !inset.paragraphs.begin()->empty() && getPWidth(cell).zero();
+               bool rtl = inset.paragraphs().begin()->isRightToLeftPar(bufferparams) 
&&
+                       !inset.paragraphs().begin()->empty() && getPWidth(cell).zero();
 
                if (rtl)
                        os << "\\R{";
@@ -2601,7 +2601,7 @@ void LyXTabular::getLabelList(Buffer con
 
 LyXTabular::BoxType LyXTabular::useParbox(int cell) const
 {
-       ParagraphList const & parlist = getCellInset(cell).paragraphs;
+       ParagraphList const & parlist = getCellInset(cell).paragraphs();
        ParagraphList::const_iterator cit = parlist.begin();
        ParagraphList::const_iterator end = parlist.end();
 
Index: text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.503
diff -u -p -r1.503 text.C
--- text.C      28 Nov 2003 15:53:25 -0000      1.503
+++ text.C      28 Nov 2003 17:14:29 -0000
@@ -108,8 +108,8 @@ BufferView * LyXText::bv() const
 
 void LyXText::updateParPositions()
 {
-       ParagraphList::iterator pit = ownerParagraphs().begin();
-       ParagraphList::iterator end = ownerParagraphs().end();
+       ParagraphList::iterator pit = paragraphs().begin();
+       ParagraphList::iterator end = paragraphs().end();
        for (height = 0; pit != end; ++pit) {
                pit->y = height;
                height += pit->height;
@@ -192,9 +192,9 @@ int LyXText::leftMargin(ParagraphList::i
        if (pit->getDepth() == 0) {
                if (pit->layout() == tclass.defaultLayout()) {
                        // find the previous same level paragraph
-                       if (pit != ownerParagraphs().begin()) {
+                       if (pit != paragraphs().begin()) {
                                ParagraphList::iterator newpit =
-                                       depthHook(pit, ownerParagraphs(), 
pit->getDepth());
+                                       depthHook(pit, paragraphs(), pit->getDepth());
                                if (newpit == pit && newpit->layout()->nextnoindent)
                                        parindent.erase();
                        }
@@ -202,16 +202,16 @@ int LyXText::leftMargin(ParagraphList::i
        } else {
                // find the next level paragraph
                ParagraphList::iterator newpar =
-                       outerHook(pit, ownerParagraphs());
+                       outerHook(pit, paragraphs());
 
                // Make a corresponding row. Need to call leftMargin()
                // to check whether it is a sufficent paragraph.
-               if (newpar != ownerParagraphs().end()
+               if (newpar != paragraphs().end()
                    && newpar->layout()->isEnvironment()) {
                        x = leftMargin(newpar);
                }
 
-               if (newpar != ownerParagraphs().end()
+               if (newpar != paragraphs().end()
                    && pit->layout() == tclass.defaultLayout()) {
                        if (newpar->params().noindent())
                                parindent.erase();
@@ -266,7 +266,7 @@ int LyXText::leftMargin(ParagraphList::i
                           // theorems (JMarc)
                           || (layout->labeltype == LABEL_STATIC
                               && layout->latextype == LATEX_ENVIRONMENT
-                              && !isFirstInSequence(pit, ownerParagraphs()))) {
+                              && !isFirstInSequence(pit, paragraphs()))) {
                        x += font_metrics::signedWidth(layout->leftmargin,
                                                  labelfont);
                } else if (layout->labeltype != LABEL_TOP_ENVIRONMENT
@@ -318,7 +318,7 @@ int LyXText::leftMargin(ParagraphList::i
                     || layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT
                     || (layout->labeltype == LABEL_STATIC
                         && layout->latextype == LATEX_ENVIRONMENT
-                        && !isFirstInSequence(pit, ownerParagraphs())))
+                        && !isFirstInSequence(pit, paragraphs())))
                    && align == LYX_ALIGN_BLOCK
                    && !pit->params().noindent()
                        // in tabulars and ert paragraphs are never indented!
@@ -649,7 +649,7 @@ void LyXText::setHeightOfRow(ParagraphLi
                // some parksips VERY EASY IMPLEMENTATION
                if (bv()->buffer()->params().paragraph_separation
                    == BufferParams::PARSEP_SKIP
-                       && pit != ownerParagraphs().begin()
+                       && pit != paragraphs().begin()
                        && ((layout->isParagraph() && pit->getDepth() == 0)
                            || (boost::prior(pit)->layout()->isParagraph()
                                && boost::prior(pit)->getDepth() == 0)))
@@ -671,7 +671,7 @@ void LyXText::setHeightOfRow(ParagraphLi
                if ((layout->labeltype == LABEL_TOP_ENVIRONMENT
                     || layout->labeltype == LABEL_BIBLIO
                     || layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)
-                   && isFirstInSequence(pit, ownerParagraphs())
+                   && isFirstInSequence(pit, paragraphs())
                    && !pit->getLabelstring().empty())
                {
                        labeladdon = int(
@@ -686,22 +686,22 @@ void LyXText::setHeightOfRow(ParagraphLi
                // environment.
 
                ParagraphList::iterator prev =
-                       depthHook(pit, ownerParagraphs(), pit->getDepth());
+                       depthHook(pit, paragraphs(), pit->getDepth());
                if (prev != pit
                    && prev->layout() == layout
                    && prev->getDepth() == pit->getDepth()
                    && prev->getLabelWidthString() == pit->getLabelWidthString())
                {
                        layoutasc = layout->itemsep * dh;
-               } else if (pit != ownerParagraphs().begin() || row.pos() != 0) {
+               } else if (pit != paragraphs().begin() || row.pos() != 0) {
                        if (layout->topsep > 0)
                                layoutasc = layout->topsep * dh;
                }
 
-               prev = outerHook(pit, ownerParagraphs());
-               if (prev != ownerParagraphs().end()) {
+               prev = outerHook(pit, paragraphs());
+               if (prev != paragraphs().end()) {
                        maxasc += int(prev->layout()->parsep * dh);
-               } else if (pit != ownerParagraphs().begin()) {
+               } else if (pit != paragraphs().begin()) {
                        ParagraphList::iterator prior_pit = boost::prior(pit);
                        if (prior_pit->getDepth() != 0 ||
                                        prior_pit->layout() == layout) {
@@ -716,14 +716,14 @@ void LyXText::setHeightOfRow(ParagraphLi
                // a section, or between the items of a itemize or enumerate
                // environment
                ParagraphList::iterator nextpit = boost::next(pit);
-               if (nextpit != ownerParagraphs().end()) {
+               if (nextpit != paragraphs().end()) {
                        ParagraphList::iterator cpit = pit;
                        double usual = 0;
                        double unusual = 0;
 
                        if (cpit->getDepth() > nextpit->getDepth()) {
                                usual = cpit->layout()->bottomsep * dh;
-                               cpit = depthHook(cpit, ownerParagraphs(), 
nextpit->getDepth());
+                               cpit = depthHook(cpit, paragraphs(), 
nextpit->getDepth());
                                if (cpit->layout() != nextpit->layout()
                                        || nextpit->getLabelWidthString() != 
cpit->getLabelWidthString())
                                {
@@ -1242,7 +1242,7 @@ void LyXText::changeCase(LyXText::TextCa
        pos_type pos = from.pos();
        int par = from.par();
 
-       while (par != int(ownerParagraphs().size()) &&
+       while (par != int(paragraphs().size()) &&
               (pos != to.pos() || par != to.par())) {
                ParagraphList::iterator pit = getPar(par);
                if (pos == pit->size()) {
@@ -1400,8 +1400,8 @@ ParagraphList::iterator LyXText::getPar(
 ParagraphList::iterator LyXText::getPar(int par) const
 {
        BOOST_ASSERT(par >= 0);
-       BOOST_ASSERT(par < int(ownerParagraphs().size()));
-       ParagraphList::iterator pit = ownerParagraphs().begin();
+       BOOST_ASSERT(par < int(paragraphs().size()));
+       ParagraphList::iterator pit = paragraphs().begin();
        std::advance(pit, par);
        return pit;
 }
@@ -1413,8 +1413,8 @@ LyXText::getRowNearY(int y, ParagraphLis
        //lyxerr << "getRowNearY: y " << y << endl;
 #if 1
        ParagraphList::iterator const
-               pend = boost::prior(ownerParagraphs().end());
-       pit = ownerParagraphs().begin();
+               pend = boost::prior(paragraphs().end());
+       pit = paragraphs().begin();
        while (int(pit->y + pit->height) < y && pit != pend)
                ++pit;
 
@@ -1426,7 +1426,7 @@ LyXText::getRowNearY(int y, ParagraphLis
 
        return rit;
 #else
-       pit = boost::prior(ownerParagraphs().end());
+       pit = boost::prior(paragraphs().end());
 
        RowList::iterator rit = lastRow();
        RowList::iterator rbegin = firstRow();
@@ -1447,13 +1447,13 @@ int LyXText::getDepth() const
 
 RowList::iterator LyXText::firstRow() const
 {
-       return ownerParagraphs().front().rows.begin();
+       return paragraphs().front().rows.begin();
 }
 
 
 ParagraphList::iterator LyXText::firstPar() const
 {
-       return ownerParagraphs().begin();
+       return paragraphs().begin();
 }
 
 
@@ -1471,13 +1471,13 @@ ParagraphList::iterator LyXText::lastPar
 
 RowList::iterator LyXText::endRow() const
 {
-       return ownerParagraphs().back().rows.end();
+       return paragraphs().back().rows.end();
 }
 
 
 ParagraphList::iterator LyXText::endPar() const
 {
-       return ownerParagraphs().end();
+       return paragraphs().end();
 }
 
 
@@ -1487,7 +1487,7 @@ void LyXText::nextRow(ParagraphList::ite
        ++rit;
        if (rit == pit->rows.end()) {
                ++pit;
-               if (pit == ownerParagraphs().end())
+               if (pit == paragraphs().end())
                        --pit;
                else
                        rit = pit->rows.begin();
@@ -1501,7 +1501,7 @@ void LyXText::previousRow(ParagraphList:
        if (rit != pit->rows.begin())
                --rit;
        else {
-               BOOST_ASSERT(pit != ownerParagraphs().begin());
+               BOOST_ASSERT(pit != paragraphs().begin());
                --pit;
                rit = boost::prior(pit->rows.end());
        }
@@ -1540,7 +1540,7 @@ string LyXText::selectionAsString(Buffer
 
 int LyXText::parOffset(ParagraphList::iterator pit) const
 {
-       return std::distance(ownerParagraphs().begin(), pit);
+       return std::distance(paragraphs().begin(), pit);
 }
 
 
@@ -1603,7 +1603,7 @@ void LyXText::redoParagraph(ParagraphLis
 
 void LyXText::fullRebreak()
 {
-       redoParagraphs(ownerParagraphs().begin(), ownerParagraphs().end());
+       redoParagraphs(paragraphs().begin(), paragraphs().end());
        redoCursor();
        selection.cursor = cursor;
 }
@@ -1618,9 +1618,9 @@ void LyXText::metrics(MetricsInfo & mi, 
        //      << " textWidth: " << textWidth() << "\nfont: " << mi.base.font << endl;
 
        // Rebuild row cache. This recomputes height as well.
-       redoParagraphs(ownerParagraphs().begin(), ownerParagraphs().end());
+       redoParagraphs(paragraphs().begin(), paragraphs().end());
 
-       width = maxParagraphWidth(ownerParagraphs());
+       width = maxParagraphWidth(paragraphs());
 
        // final dimension
        dim.asc = firstRow()->ascent_of_text();
@@ -1641,13 +1641,13 @@ void LyXText::draw(PainterInfo & pi, int
 bool LyXText::isLastRow(ParagraphList::iterator pit, Row const & row) const
 {
        return row.endpos() >= pit->size()
-              && boost::next(pit) == ownerParagraphs().end();
+              && boost::next(pit) == paragraphs().end();
 }
 
 
 bool LyXText::isFirstRow(ParagraphList::iterator pit, Row const & row) const
 {
-       return row.pos() == 0 && pit == ownerParagraphs().begin();
+       return row.pos() == 0 && pit == paragraphs().begin();
 }
 
 
@@ -1671,7 +1671,7 @@ void LyXText::cursorLeftOneWord(LyXCurso
             pit->isHfill(pos - 1))) {
                --pos;
        } else if (!pos) {
-               if (pit != ownerParagraphs().begin()) {
+               if (pit != paragraphs().begin()) {
                        --pit;
                        pos = pit->size();
                }
@@ -1692,7 +1692,7 @@ void LyXText::cursorRightOneWord(LyXCurs
        pos_type pos = cursor.pos();
 
        if (pos == pit->size() &&
-               boost::next(pit) != ownerParagraphs().end()) {
+               boost::next(pit) != paragraphs().end()) {
                ++pit;
                pos = 0;
        } else {
Index: text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.516
diff -u -p -r1.516 text2.C
--- text2.C     28 Nov 2003 15:53:27 -0000      1.516
+++ text2.C     28 Nov 2003 17:14:29 -0000
@@ -71,11 +71,10 @@ using std::ostringstream;
 using std::string;
 
 
-LyXText::LyXText(BufferView * bv, InsetText * inset, bool in_inset,
-         ParagraphList & paragraphs)
+LyXText::LyXText(BufferView * bv, InsetText * inset, bool in_inset)
        : height(0), width(0), textwidth_(bv ? bv->workWidth() : 100),
          inset_owner(inset), bv_owner(bv),
-         in_inset_(in_inset), paragraphs_(&paragraphs), xo_(0), yo_(0)
+         in_inset_(in_inset), xo_(0), yo_(0), paragraphs_(1)
 {}
 
 
@@ -83,8 +82,8 @@ void LyXText::init(BufferView * bview)
 {
        bv_owner = bview;
 
-       ParagraphList::iterator const beg = ownerParagraphs().begin();
-       ParagraphList::iterator const end = ownerParagraphs().end();
+       ParagraphList::iterator const beg = paragraphs().begin();
+       ParagraphList::iterator const end = paragraphs().end();
        for (ParagraphList::iterator pit = beg; pit != end; ++pit)
                pit->rows.clear();
 
@@ -140,7 +139,7 @@ LyXFont LyXText::getFont(ParagraphList::
                pit->inInset()->getDrawFont(font);
 
        // Realize with the fonts of lesser depth.
-       //font.realize(outerFont(pit, ownerParagraphs()));
+       //font.realize(outerFont(pit, paragraphs()));
        font.realize(defaultfont_);
 
        return font;
@@ -156,7 +155,7 @@ LyXFont LyXText::getLayoutFont(Paragraph
 
        LyXFont font = layout->font;
        // Realize with the fonts of lesser depth.
-       //font.realize(outerFont(pit, ownerParagraphs()));
+       //font.realize(outerFont(pit, paragraphs()));
        font.realize(defaultfont_);
 
        return font;
@@ -172,7 +171,7 @@ LyXFont LyXText::getLabelFont(ParagraphL
 
        LyXFont font = layout->labelfont;
        // Realize with the fonts of lesser depth.
-       font.realize(outerFont(pit, ownerParagraphs()));
+       font.realize(outerFont(pit, paragraphs()));
        font.realize(defaultfont_);
 
        return font;
@@ -197,10 +196,10 @@ void LyXText::setCharFont(
        if (pit->getDepth()) {
                ParagraphList::iterator tp = pit;
                while (!layoutfont.resolved() &&
-                      tp != ownerParagraphs().end() &&
+                      tp != paragraphs().end() &&
                       tp->getDepth()) {
-                       tp = outerHook(tp, ownerParagraphs());
-                       if (tp != ownerParagraphs().end())
+                       tp = outerHook(tp, paragraphs());
+                       if (tp != paragraphs().end())
                                layoutfont.realize(tp->layout()->font);
                }
        }
@@ -283,7 +282,7 @@ LyXText::setLayout(LyXCursor & cur, LyXC
 {
        ParagraphList::iterator endpit = boost::next(getPar(send_cur));
        ParagraphList::iterator undoendpit = endpit;
-       ParagraphList::iterator pars_end = ownerParagraphs().end();
+       ParagraphList::iterator pars_end = paragraphs().end();
 
        if (endpit != pars_end && endpit->getDepth()) {
                while (endpit != pars_end && endpit->getDepth()) {
@@ -312,7 +311,7 @@ LyXText::setLayout(LyXCursor & cur, LyXC
                makeFontEntriesLayoutSpecific(bufparams, *pit);
                if (lyxlayout->margintype == MARGIN_MANUAL)
                        pit->setLabelWidthString(lyxlayout->labelstring());
-               cur.par(std::distance(ownerParagraphs().begin(), pit));
+               cur.par(std::distance(paragraphs().begin(), pit));
                ++pit;
        } while (pit != epit);
 
@@ -391,7 +390,7 @@ bool LyXText::changeDepthAllowed(bv_func
        ParagraphList::iterator beg, end; 
        getSelectionSpan(*this, beg, end);
        int max_depth = 0;
-       if (beg != ownerParagraphs().begin())
+       if (beg != paragraphs().begin())
                max_depth = boost::prior(beg)->getMaxDepthAfter();
 
        for (ParagraphList::iterator pit = beg; pit != end; ++pit) {
@@ -411,7 +410,7 @@ void LyXText::changeDepth(bv_funcs::DEPT
        recUndo(parOffset(beg), parOffset(end) - 1);
 
        int max_depth = 0;
-       if (beg != ownerParagraphs().begin())
+       if (beg != paragraphs().begin())
                max_depth = boost::prior(beg)->getMaxDepthAfter();
 
        for (ParagraphList::iterator pit = beg; pit != end; ++pit) {
@@ -464,8 +463,8 @@ void LyXText::setFont(LyXFont const & fo
        ParagraphList::iterator beg = getPar(selection.start.par());
        ParagraphList::iterator end = getPar(selection.end.par());
        
-       PosIterator pos(&ownerParagraphs(), beg, selection.start.pos());
-       PosIterator posend(&ownerParagraphs(), end, selection.end.pos());
+       PosIterator pos(&paragraphs(), beg, selection.start.pos());
+       PosIterator posend(&paragraphs(), end, selection.end.pos());
 
        BufferParams const & params = bv()->buffer()->params();
 
@@ -524,14 +523,14 @@ void LyXText::cursorEnd()
 
 void LyXText::cursorTop()
 {
-       setCursor(ownerParagraphs().begin(), 0);
+       setCursor(paragraphs().begin(), 0);
 }
 
 
 void LyXText::cursorBottom()
 {
        ParagraphList::iterator lastpit =
-               boost::prior(ownerParagraphs().end());
+               boost::prior(paragraphs().end());
        setCursor(lastpit, lastpit->size());
 }
 
@@ -615,7 +614,7 @@ void LyXText::setParagraph(
        // make sure that the depth behind the selection are restored, too
        ParagraphList::iterator endpit = boost::next(getPar(selection.end));
        ParagraphList::iterator undoendpit = endpit;
-       ParagraphList::iterator pars_end = ownerParagraphs().end();
+       ParagraphList::iterator pars_end = paragraphs().end();
 
        if (endpit != pars_end && endpit->getDepth()) {
                while (endpit != pars_end && endpit->getDepth()) {
@@ -765,7 +764,7 @@ void LyXText::setCounter(Buffer const & 
        BufferParams const & bufparams = buf.params();
        LyXTextClass const & textclass = bufparams.getLyXTextClass();
        LyXLayout_ptr const & layout = pit->layout();
-       ParagraphList::iterator first_pit = ownerParagraphs().begin();
+       ParagraphList::iterator first_pit = paragraphs().begin();
        Counters & counters = textclass.counters();
 
        // Always reset
@@ -866,7 +865,7 @@ void LyXText::setCounter(Buffer const & 
 
                // the caption hack:
                if (layout->labeltype == LABEL_SENSITIVE) {
-                       ParagraphList::iterator end = ownerParagraphs().end();
+                       ParagraphList::iterator end = paragraphs().end();
                        ParagraphList::iterator tmppit = pit;
                        InsetOld * in = 0;
                        bool isOK = false;
@@ -923,8 +922,8 @@ void LyXText::updateCounters()
 
        bool update_pos = false;
        
-       ParagraphList::iterator beg = ownerParagraphs().begin();
-       ParagraphList::iterator end = ownerParagraphs().end();
+       ParagraphList::iterator beg = paragraphs().begin();
+       ParagraphList::iterator end = paragraphs().end();
        for (ParagraphList::iterator pit = beg; pit != end; ++pit) {
                string const oldLabel = pit->params().labelString();
                size_t maxdepth = 0;
@@ -992,7 +991,7 @@ void LyXText::cutSelection(bool doclear,
        // make sure that the depth behind the selection are restored, too
        ParagraphList::iterator endpit = boost::next(getPar(selection.end.par()));
        ParagraphList::iterator undoendpit = endpit;
-       ParagraphList::iterator pars_end = ownerParagraphs().end();
+       ParagraphList::iterator pars_end = paragraphs().end();
 
        if (endpit != pars_end && endpit->getDepth()) {
                while (endpit != pars_end && endpit->getDepth()) {
@@ -1012,13 +1011,13 @@ void LyXText::cutSelection(bool doclear,
        BufferParams const & bufparams = bv()->buffer()->params();
        boost::tie(endpit, endpos) = realcut ?
                CutAndPaste::cutSelection(bufparams,
-                                         ownerParagraphs(),
+                                         paragraphs(),
                                          getPar(selection.start.par()), endpit,
                                          selection.start.pos(), endpos,
                                          bufparams.textclass,
                                          doclear)
                : CutAndPaste::eraseSelection(bufparams,
-                                             ownerParagraphs(),
+                                             paragraphs(),
                                              getPar(selection.start.par()), endpit,
                                              selection.start.pos(), endpos,
                                              doclear);
@@ -1083,7 +1082,7 @@ void LyXText::pasteSelection(size_t sel_
 
        boost::tie(ppp, endpit) =
                CutAndPaste::pasteSelection(*bv()->buffer(),
-                                           ownerParagraphs(),
+                                           paragraphs(),
                                            cursorPar(), cursor.pos(),
                                            bv()->buffer()->params().textclass,
                                            sel_index, el);
@@ -1228,14 +1227,14 @@ void LyXText::redoCursor()
 void LyXText::setCursor(LyXCursor & cur, paroffset_type par,
        pos_type pos, bool boundary)
 {
-       BOOST_ASSERT(par != int(ownerParagraphs().size()));
+       BOOST_ASSERT(par != int(paragraphs().size()));
 
        cur.par(par);
        cur.pos(pos);
        cur.boundary(boundary);
 
        // no rows, no fun...
-       if (ownerParagraphs().begin()->rows.empty())
+       if (paragraphs().begin()->rows.empty())
                return;
 
        // get the cursor y position in text
@@ -1557,7 +1556,7 @@ DispatchResult LyXText::moveLeft()
 DispatchResult LyXText::moveRightIntern(bool front, bool activate_inset, bool 
selecting)
 {
        ParagraphList::iterator c_par = cursorPar();
-       if (boost::next(c_par) == ownerParagraphs().end()
+       if (boost::next(c_par) == paragraphs().end()
                && cursor.pos() >= c_par->size())
                return DispatchResult(false, FINISHED_RIGHT);
        if (activate_inset && checkAndActivateInset(front))
@@ -1639,7 +1638,7 @@ bool LyXText::cursorRight(bool internal)
                return true;
        }
 
-       if (cursor.par() + 1 != int(ownerParagraphs().size())) {
+       if (cursor.par() + 1 != int(paragraphs().size())) {
                setCursor(cursor.par() + 1, 0);
                return true;
        }
@@ -1685,7 +1684,7 @@ void LyXText::cursorUpParagraph()
        ParagraphList::iterator cpit = cursorPar();
        if (cursor.pos() > 0)
                setCursor(cpit, 0);
-       else if (cpit != ownerParagraphs().begin())
+       else if (cpit != paragraphs().begin())
                setCursor(boost::prior(cpit), 0);
 }
 
@@ -1695,7 +1694,7 @@ void LyXText::cursorDownParagraph()
        ParagraphList::iterator pit = cursorPar();
        ParagraphList::iterator next_pit = boost::next(pit);
 
-       if (next_pit != ownerParagraphs().end())
+       if (next_pit != paragraphs().end())
                setCursor(next_pit, 0);
        else
                setCursor(pit, pit->size());
@@ -1794,7 +1793,7 @@ bool LyXText::deleteEmptyParagraphMechan
        }
 
        // don't delete anything if this is the ONLY paragraph!
-       if (ownerParagraphs().size() == 1)
+       if (paragraphs().size() == 1)
                return false;
 
        // Do not delete empty paragraphs with keepempty set.
@@ -1824,7 +1823,7 @@ bool LyXText::deleteEmptyParagraphMechan
                cursor = old_cursor; // that undo can restore the right cursor position
 
                ParagraphList::iterator endpit = boost::next(old_pit);
-               while (endpit != ownerParagraphs().end() && endpit->getDepth())
+               while (endpit != paragraphs().end() && endpit->getDepth())
                        ++endpit;
 
                recUndo(parOffset(old_pit), parOffset(endpit) - 1);
@@ -1833,7 +1832,7 @@ bool LyXText::deleteEmptyParagraphMechan
                // cache cursor pit
                ParagraphList::iterator tmppit = cursorPar();
                // delete old par
-               ownerParagraphs().erase(old_pit);
+               paragraphs().erase(old_pit);
                // update cursor par offset
                cursor.par(parOffset(tmppit));
                redoParagraph();
@@ -1860,9 +1859,9 @@ bool LyXText::deleteEmptyParagraphMechan
 }
 
 
-ParagraphList & LyXText::ownerParagraphs() const
+ParagraphList & LyXText::paragraphs() const
 {
-       return *paragraphs_;
+       return const_cast<ParagraphList&>(paragraphs_);
 }
 
 
@@ -1887,6 +1886,5 @@ bool LyXText::isInInset() const
 
 int defaultRowHeight()
 {
-       LyXFont const font(LyXFont::ALL_SANE);
-       return int(font_metrics::maxHeight(font) *  1.2);
+       return int(font_metrics::maxHeight(LyXFont(LyXFont::ALL_SANE)) * 1.2);
 }
Index: text3.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v
retrieving revision 1.191
diff -u -p -r1.191 text3.C
--- text3.C     28 Nov 2003 15:53:29 -0000      1.191
+++ text3.C     28 Nov 2003 17:14:29 -0000
@@ -258,7 +258,7 @@ InsetOld * LyXText::checkInsetHit(int x,
        ParagraphList::iterator pit;
        ParagraphList::iterator end;
 
-       getParsInRange(ownerParagraphs(),
+       getParsInRange(paragraphs(),
                       bv()->top_y() - yo_,
                       bv()->top_y() - yo_ + bv()->workHeight(),
                       pit, end);
@@ -293,7 +293,7 @@ InsetOld * LyXText::checkInsetHit(int x,
 bool LyXText::gotoNextInset(vector<InsetOld::Code> const & codes,
                            string const & contents)
 {
-       ParagraphList::iterator end = ownerParagraphs().end();
+       ParagraphList::iterator end = paragraphs().end();
        ParagraphList::iterator pit = cursorPar();
        pos_type pos = cursor.pos();
 
@@ -337,7 +337,7 @@ void LyXText::gotoInset(vector<InsetOld:
        }
 
        if (!gotoNextInset(codes, contents)) {
-               if (cursor.pos() || cursorPar() != ownerParagraphs().begin()) {
+               if (cursor.pos() || cursorPar() != paragraphs().begin()) {
                        LyXCursor tmp = cursor;
                        cursor.par(0);
                        cursor.pos(0);
@@ -467,8 +467,8 @@ DispatchResult LyXText::dispatch(FuncReq
                bool start = !pit->params().startOfAppendix();
 
                // ensure that we have only one start_of_appendix in this document
-               ParagraphList::iterator tmp = ownerParagraphs().begin();
-               ParagraphList::iterator end = ownerParagraphs().end();
+               ParagraphList::iterator tmp = paragraphs().begin();
+               ParagraphList::iterator end = paragraphs().end();
 
                for (; tmp != end; ++tmp) {
                        if (tmp->params().startOfAppendix()) {
Index: undo.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/undo.C,v
retrieving revision 1.30
diff -u -p -r1.30 undo.C
--- undo.C      28 Nov 2003 08:55:08 -0000      1.30
+++ undo.C      28 Nov 2003 17:14:29 -0000
@@ -102,7 +102,7 @@ void recordUndo(Undo::undo_kind kind,
 {
        Buffer * buf = text->bv()->buffer();
 
-       int const end_par = text->ownerParagraphs().size() - last_par;
+       int const end_par = text->paragraphs().size() - last_par;
 
        // Undo::ATOMIC are always recorded (no overlapping there).
        // overlapping only with insert and delete inside one paragraph:
@@ -129,7 +129,7 @@ void recordUndo(Undo::undo_kind kind,
        // record the relevant paragraphs
        ParagraphList & undo_pars = stack.top().pars;
 
-       ParagraphList & plist = text->ownerParagraphs();
+       ParagraphList & plist = text->paragraphs();
        ParagraphList::iterator first = plist.begin();
        advance(first, first_par);
        ParagraphList::iterator last = plist.begin();
@@ -150,7 +150,7 @@ bool performUndoOrRedo(BufferView * bv, 
        lyxerr << "undo, performing: " << undo << std::endl;
        ParIterator pit = num2pit(bv, undo.text);
        LyXText * text = pit.text(bv);
-       ParagraphList & plist = text->ownerParagraphs();
+       ParagraphList & plist = text->paragraphs();
 
        // remove new stuff between first and last
        {
Index: insets/insetcharstyle.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcharstyle.C,v
retrieving revision 1.4
diff -u -p -r1.4 insetcharstyle.C
--- insets/insetcharstyle.C     28 Nov 2003 10:12:04 -0000      1.4
+++ insets/insetcharstyle.C     28 Nov 2003 17:14:29 -0000
@@ -126,8 +126,8 @@ namespace {
 int outputVerbatim(std::ostream & os, InsetText inset)
 {
        int lines = 0;
-       ParagraphList::iterator par = inset.paragraphs.begin();
-       ParagraphList::iterator end = inset.paragraphs.end();
+       ParagraphList::iterator par = inset.paragraphs().begin();
+       ParagraphList::iterator end = inset.paragraphs().end();
        while (par != end) {
                lyx::pos_type siz = par->size();
                for (lyx::pos_type i = 0; i < siz; ++i) {
Index: insets/insetenv.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetenv.C,v
retrieving revision 1.23
diff -u -p -r1.23 insetenv.C
--- insets/insetenv.C   5 Nov 2003 12:06:07 -0000       1.23
+++ insets/insetenv.C   28 Nov 2003 17:14:29 -0000
@@ -71,7 +71,7 @@ int InsetEnvironment::latex(Buffer const
 {
        os << layout_->latexheader;
        TexRow texrow;
-       latexParagraphs(buf, paragraphs, os, texrow, runparams,
+       latexParagraphs(buf, paragraphs(), os, texrow, runparams,
                        layout_->latexparagraph);
        os << layout_->latexfooter;
        return texrow.rows();
Index: insets/insetert.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetert.C,v
retrieving revision 1.176
diff -u -p -r1.176 insetert.C
--- insets/insetert.C   27 Nov 2003 09:22:40 -0000      1.176
+++ insets/insetert.C   28 Nov 2003 17:14:29 -0000
@@ -92,10 +92,9 @@ InsetERT::InsetERT(BufferParams const & 
 
        string::const_iterator cit = contents.begin();
        string::const_iterator end = contents.end();
-       pos_type pos = 0;
-       for (; cit != end; ++cit) {
-               inset.paragraphs.begin()->insertChar(pos++, *cit, font);
-       }
+       for (pos_type pos = 0; cit != end; ++cit, ++pos)
+               inset.paragraphs().begin()->insertChar(pos, *cit, font);
+
        // the init has to be after the initialization of the paragraph
        // because of the label settings (draw_label for ert insets).
        init();
@@ -142,8 +141,8 @@ void InsetERT::read(Buffer const & buf, 
        font.setFamily(LyXFont::TYPEWRITER_FAMILY);
        font.setColor(LColor::latex);
 
-       ParagraphList::iterator pit = inset.paragraphs.begin();
-       ParagraphList::iterator pend = inset.paragraphs.end();
+       ParagraphList::iterator pit = inset.paragraphs().begin();
+       ParagraphList::iterator pend = inset.paragraphs().end();
        for (; pit != pend; ++pit) {
                pos_type siz = pit->size();
                for (pos_type i = 0; i < siz; ++i) {
@@ -182,8 +181,8 @@ void InsetERT::write(Buffer const & buf,
 
        //inset.writeParagraphData(buf, os);
        string const layout(buf.params().getLyXTextClass().defaultLayoutName());
-       ParagraphList::iterator par = inset.paragraphs.begin();
-       ParagraphList::iterator end = inset.paragraphs.end();
+       ParagraphList::iterator par = inset.paragraphs().begin();
+       ParagraphList::iterator end = inset.paragraphs().end();
        for (; par != end; ++par) {
                os << "\n\\begin_layout " << layout << "\n";
                pos_type siz = par->size();
@@ -296,8 +295,8 @@ void InsetERT::lfunMouseMotion(FuncReque
 int InsetERT::latex(Buffer const &, ostream & os,
                    OutputParams const &) const
 {
-       ParagraphList::iterator par = inset.paragraphs.begin();
-       ParagraphList::iterator end = inset.paragraphs.end();
+       ParagraphList::iterator par = inset.paragraphs().begin();
+       ParagraphList::iterator end = inset.paragraphs().end();
 
        int lines = 0;
        while (par != end) {
@@ -335,8 +334,8 @@ int InsetERT::plaintext(Buffer const &, 
 int InsetERT::linuxdoc(Buffer const &, ostream & os,
                       OutputParams const &)const
 {
-       ParagraphList::iterator par = inset.paragraphs.begin();
-       ParagraphList::iterator end = inset.paragraphs.end();
+       ParagraphList::iterator par = inset.paragraphs().begin();
+       ParagraphList::iterator end = inset.paragraphs().end();
 
        int lines = 0;
        while (par != end) {
@@ -363,8 +362,8 @@ int InsetERT::linuxdoc(Buffer const &, o
 int InsetERT::docbook(Buffer const &, ostream & os,
                      OutputParams const &) const
 {
-       ParagraphList::iterator par = inset.paragraphs.begin();
-       ParagraphList::iterator end = inset.paragraphs.end();
+       ParagraphList::iterator par = inset.paragraphs().begin();
+       ParagraphList::iterator end = inset.paragraphs().end();
 
        int lines = 0;
        while (par != end) {
@@ -405,7 +404,7 @@ InsetERT::priv_dispatch(FuncRequest cons
 {
        BufferView * bv = cmd.view();
 
-       if (inset.paragraphs.begin()->empty())
+       if (inset.paragraphs().begin()->empty())
                setLatexFont(bv);
 
        switch (cmd.action) {
@@ -431,7 +430,7 @@ InsetERT::priv_dispatch(FuncRequest cons
                return DispatchResult(true, true);
 
        case LFUN_LAYOUT:
-               bv->owner()->setLayout(inset.paragraphs.begin()->layout()->name());
+               bv->owner()->setLayout(inset.paragraphs().begin()->layout()->name());
                return DispatchResult(true);
 
        case LFUN_BREAKPARAGRAPH:
@@ -455,17 +454,17 @@ string const InsetERT::getNewLabel() con
 {
        string la;
        pos_type const max_length = 15;
-       pos_type const p_siz = inset.paragraphs.begin()->size();
+       pos_type const p_siz = inset.paragraphs().begin()->size();
        pos_type const n = min(max_length, p_siz);
        pos_type i = 0;
        pos_type j = 0;
        for( ; i < n && j < p_siz; ++j) {
-               if (inset.paragraphs.begin()->isInset(j))
+               if (inset.paragraphs().begin()->isInset(j))
                        continue;
-               la += inset.paragraphs.begin()->getChar(j);
+               la += inset.paragraphs().begin()->getChar(j);
                ++i;
        }
-       if (inset.paragraphs.size() > 1 || (i > 0 && j < p_siz)) {
+       if (inset.paragraphs().size() > 1 || (i > 0 && j < p_siz)) {
                la += "...";
        }
        if (la.empty()) {
Index: insets/insetfloat.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetfloat.C,v
retrieving revision 1.113
diff -u -p -r1.113 insetfloat.C
--- insets/insetfloat.C 10 Nov 2003 13:23:11 -0000      1.113
+++ insets/insetfloat.C 28 Nov 2003 17:14:29 -0000
@@ -145,7 +145,7 @@ InsetFloat::InsetFloat(BufferParams cons
        setInsetName(type);
        LyXTextClass const & tclass = bp.getLyXTextClass();
        if (tclass.hasLayout(caplayout))
-               inset.paragraphs.begin()->layout(tclass[caplayout]);
+               inset.paragraphs().begin()->layout(tclass[caplayout]);
 }
 
 
@@ -392,8 +392,8 @@ void InsetFloat::wide(bool w, BufferPara
 
 void InsetFloat::addToToc(lyx::toc::TocList & toclist, Buffer const & buf) const
 {
-       ParIterator pit(inset.paragraphs.begin(), inset.paragraphs);
-       ParIterator end(inset.paragraphs.end(), inset.paragraphs);
+       ParIterator pit(inset.paragraphs().begin(), inset.paragraphs());
+       ParIterator end(inset.paragraphs().end(), inset.paragraphs());
 
        // Find a caption layout in one of the (child inset's) pars
        for (; pit != end; ++pit) {
Index: insets/insettabular.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.C,v
retrieving revision 1.382
diff -u -p -r1.382 insettabular.C
--- insets/insettabular.C       28 Nov 2003 08:55:10 -0000      1.382
+++ insets/insettabular.C       28 Nov 2003 17:14:30 -0000
@@ -1160,7 +1160,7 @@ bool InsetTabular::moveNextCell(BufferVi
                ++actcell;
        }
        if (lock) {
-               bool rtl = tabular.getCellInset(actcell).paragraphs.begin()->
+               bool rtl = tabular.getCellInset(actcell).paragraphs().begin()->
                        isRightToLeftPar(bv->buffer()->params());
                activateCellInset(bv, 0, 0, !rtl);
        }
@@ -1193,7 +1193,7 @@ bool InsetTabular::movePrevCell(BufferVi
        }
        lyxerr << "move prevcell 2" << endl;
        if (lock) {
-               bool rtl = tabular.getCellInset(actcell).paragraphs.begin()->
+               bool rtl = tabular.getCellInset(actcell).paragraphs().begin()->
                        isRightToLeftPar(bv->buffer()->params());
                activateCellInset(bv, 0, 0, !rtl);
        }
@@ -2082,7 +2082,7 @@ bool InsetTabular::insertAsciiString(Buf
                        if (cols < columns) {
                                InsetText & inset = loctab->getCellInset(cell);
                                LyXFont const font = inset.text_.
-                                       getFont(inset.paragraphs.begin(), 0);
+                                       getFont(inset.paragraphs().begin(), 0);
                                inset.setText(buf.substr(op, p - op), font);
                                ++cols;
                                ++cell;
@@ -2093,7 +2093,7 @@ bool InsetTabular::insertAsciiString(Buf
                        if (cols < columns) {
                                InsetText & inset = tabular.getCellInset(cell);
                                LyXFont const font = inset.text_.
-                                       getFont(inset.paragraphs.begin(), 0);
+                                       getFont(inset.paragraphs().begin(), 0);
                                inset.setText(buf.substr(op, p - op), font);
                        }
                        cols = ocol;
@@ -2108,7 +2108,7 @@ bool InsetTabular::insertAsciiString(Buf
        // check for the last cell if there is no trailing '\n'
        if (cell < cells && op < len) {
                InsetText & inset = loctab->getCellInset(cell);
-               LyXFont const font = inset.text_.getFont(inset.paragraphs.begin(), 0);
+               LyXFont const font = inset.text_.getFont(inset.paragraphs().begin(), 
0);
                inset.setText(buf.substr(op, len - op), font);
        }
 
Index: insets/insettext.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v
retrieving revision 1.556
diff -u -p -r1.556 insettext.C
--- insets/insettext.C  28 Nov 2003 08:55:10 -0000      1.556
+++ insets/insettext.C  28 Nov 2003 17:14:30 -0000
@@ -72,22 +72,21 @@ using std::vector;
 
 InsetText::InsetText(BufferParams const & bp)
        : UpdatableInset(),
-         paragraphs(1),
          autoBreakRows_(false),
          drawFrame_(NEVER),
          frame_color_(LColor::insetframe),
-         text_(0, this, true, paragraphs)
+         text_(0, this, true)
 {
-       paragraphs.begin()->layout(bp.getLyXTextClass().defaultLayout());
+       paragraphs().begin()->layout(bp.getLyXTextClass().defaultLayout());
        if (bp.tracking_changes)
-               paragraphs.begin()->trackChanges();
+               paragraphs().begin()->trackChanges();
        init();
 }
 
 
 InsetText::InsetText(InsetText const & in)
        : UpdatableInset(in),
-         text_(in.text_.bv_owner, this, true, paragraphs)
+         text_(in.text_.bv_owner, this, true)
 {
        // this is ugly...
        operator=(in);
@@ -97,22 +96,20 @@ InsetText::InsetText(InsetText const & i
 void InsetText::operator=(InsetText const & in)
 {
        UpdatableInset::operator=(in);
-       paragraphs = in.paragraphs;
        autoBreakRows_ = in.autoBreakRows_;
        drawFrame_ = in.drawFrame_;
        frame_color_ = in.frame_color_;
-       text_ = LyXText(in.text_.bv_owner, this, true, paragraphs);
+       text_ = LyXText(in.text_.bv_owner, this, true);
        init();
 }
 
 
 void InsetText::init()
 {
-       ParagraphList::iterator pit = paragraphs.begin();
-       ParagraphList::iterator end = paragraphs.end();
+       ParagraphList::iterator pit = paragraphs().begin();
+       ParagraphList::iterator end = paragraphs().end();
        for (; pit != end; ++pit)
                pit->setInsetOwner(this);
-       text_.paragraphs_ = &paragraphs;
        old_par = -1;
        in_insetAllowed = false;
 }
@@ -121,20 +118,20 @@ void InsetText::init()
 void InsetText::clear(bool just_mark_erased)
 {
        if (just_mark_erased) {
-               ParagraphList::iterator it = paragraphs.begin();
-               ParagraphList::iterator end = paragraphs.end();
+               ParagraphList::iterator it = paragraphs().begin();
+               ParagraphList::iterator end = paragraphs().end();
                for (; it != end; ++it)
                        it->markErased();
                return;
        }
 
        // This is a gross hack...
-       LyXLayout_ptr old_layout = paragraphs.begin()->layout();
+       LyXLayout_ptr old_layout = paragraphs().begin()->layout();
 
-       paragraphs.clear();
-       paragraphs.push_back(Paragraph());
-       paragraphs.begin()->setInsetOwner(this);
-       paragraphs.begin()->layout(old_layout);
+       paragraphs().clear();
+       paragraphs().push_back(Paragraph());
+       paragraphs().begin()->setInsetOwner(this);
+       paragraphs().begin()->layout(old_layout);
 }
 
 
@@ -153,8 +150,8 @@ void InsetText::write(Buffer const & buf
 
 void InsetText::writeParagraphData(Buffer const & buf, ostream & os) const
 {
-       ParagraphList::const_iterator it = paragraphs.begin();
-       ParagraphList::const_iterator end = paragraphs.end();
+       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);
@@ -171,12 +168,12 @@ void InsetText::read(Buffer const & buf,
 
 #warning John, look here. Doesnt make much sense.
        if (buf.params().tracking_changes)
-               paragraphs.begin()->trackChanges();
+               paragraphs().begin()->trackChanges();
 
        // delete the initial paragraph
-       Paragraph oldpar = *paragraphs.begin();
-       paragraphs.clear();
-       ParagraphList::iterator pit = paragraphs.begin();
+       Paragraph oldpar = *paragraphs().begin();
+       paragraphs().clear();
+       ParagraphList::iterator pit = paragraphs().begin();
 
        while (lex.isOK()) {
                lex.nextToken();
@@ -193,11 +190,12 @@ void InsetText::read(Buffer const & buf,
                }
 
                // FIXME: ugly.
-               const_cast<Buffer&>(buf).readParagraph(lex, token, paragraphs, pit, 
depth);
+               const_cast<Buffer&>(buf).
+                       readParagraph(lex, token, paragraphs(), pit, depth);
        }
 
-       pit = paragraphs.begin();
-       ParagraphList::iterator const end = paragraphs.end();
+       pit = paragraphs().begin();
+       ParagraphList::iterator const end = paragraphs().end();
        for (; pit != end; ++pit)
                pit->setInsetOwner(this);
 
@@ -208,8 +206,8 @@ void InsetText::read(Buffer const & buf,
 
        // sanity check
        // ensure we have at least one par.
-       if (paragraphs.empty())
-               paragraphs.push_back(oldpar);
+       if (paragraphs().empty())
+               paragraphs().push_back(oldpar);
 }
 
 
@@ -270,7 +268,7 @@ void InsetText::updateLocal(BufferView *
        if (!bv)
                return;
 
-       if (!autoBreakRows_ && paragraphs.size() > 1)
+       if (!autoBreakRows_ && paragraphs().size() > 1)
                collapseParagraphs(bv);
 
        if (!text_.selection.set())
@@ -294,8 +292,8 @@ string const InsetText::editMessage() co
 
 void InsetText::sanitizeEmptyText(BufferView * bv)
 {
-       if (paragraphs.size() == 1
-           && paragraphs.begin()->empty()
+       if (paragraphs().size() == 1
+           && paragraphs().begin()->empty()
            && bv->getParentLanguage(this) != text_.current_font.language()) {
                LyXFont font(LyXFont::ALL_IGNORE);
                font.setLanguage(bv->getParentLanguage(this));
@@ -317,7 +315,7 @@ void InsetText::edit(BufferView * bv, bo
        if (left)
                text_.setCursorIntern(0, 0);
        else
-               text_.setCursor(paragraphs.size() - 1, paragraphs.back().size());
+               text_.setCursor(paragraphs().size() - 1, paragraphs().back().size());
 
        sanitizeEmptyText(bv);
        updateLocal(bv);
@@ -352,7 +350,7 @@ DispatchResult InsetText::priv_dispatch(
        DispatchResult result;
        result.dispatched(true);
 
-       bool was_empty = paragraphs.begin()->empty() && paragraphs.size() == 1;
+       bool was_empty = paragraphs().begin()->empty() && paragraphs().size() == 1;
 
        switch (cmd.action) {
        case LFUN_MOUSE_PRESS:
@@ -366,8 +364,8 @@ DispatchResult InsetText::priv_dispatch(
        // If the action has deleted all text in the inset, we need
        // to change the language to the language of the surronding
        // text.
-       if (!was_empty && paragraphs.begin()->empty() &&
-           paragraphs.size() == 1) {
+       if (!was_empty && paragraphs().begin()->empty() &&
+           paragraphs().size() == 1) {
                LyXFont font(LyXFont::ALL_IGNORE);
                font.setLanguage(bv->getParentLanguage(this));
                text_.setFont(font, false);
@@ -382,7 +380,7 @@ int InsetText::latex(Buffer const & buf,
                     OutputParams const & runparams) const
 {
        TexRow texrow;
-       latexParagraphs(buf, paragraphs, os, texrow, runparams);
+       latexParagraphs(buf, paragraphs(), os, texrow, runparams);
        return texrow.rows();
 }
 
@@ -390,8 +388,8 @@ int InsetText::latex(Buffer const & buf,
 int InsetText::plaintext(Buffer const & buf, ostream & os,
                     OutputParams const & runparams) const
 {
-       ParagraphList::const_iterator beg = paragraphs.begin();
-       ParagraphList::const_iterator end = paragraphs.end();
+       ParagraphList::const_iterator beg = paragraphs().begin();
+       ParagraphList::const_iterator end = paragraphs().end();
        ParagraphList::const_iterator it = beg;
        for (; it != end; ++it)
                asciiParagraph(buf, *it, os, runparams, it == beg);
@@ -404,7 +402,7 @@ int InsetText::plaintext(Buffer const & 
 int InsetText::linuxdoc(Buffer const & buf, ostream & os,
                        OutputParams const & runparams) const
 {
-       linuxdocParagraphs(buf, paragraphs, os, runparams);
+       linuxdocParagraphs(buf, paragraphs(), os, runparams);
        return 0;
 }
 
@@ -412,14 +410,14 @@ int InsetText::linuxdoc(Buffer const & b
 int InsetText::docbook(Buffer const & buf, ostream & os,
                       OutputParams const & runparams) const
 {
-       docbookParagraphs(buf, paragraphs, os, runparams);
+       docbookParagraphs(buf, paragraphs(), os, runparams);
        return 0;
 }
 
 
 void InsetText::validate(LaTeXFeatures & features) const
 {
-       for_each(paragraphs.begin(), paragraphs.end(),
+       for_each(paragraphs().begin(), paragraphs().end(),
                 boost::bind(&Paragraph::validate, _1, boost::ref(features)));
 }
 
@@ -467,8 +465,8 @@ bool InsetText::showInsetDialog(BufferVi
 void InsetText::getLabelList(Buffer const & buffer,
                             std::vector<string> & list) const
 {
-       ParagraphList::const_iterator pit = paragraphs.begin();
-       ParagraphList::const_iterator pend = paragraphs.end();
+       ParagraphList::const_iterator pit = paragraphs().begin();
+       ParagraphList::const_iterator pend = paragraphs().end();
        for (; pit != pend; ++pit) {
                InsetList::const_iterator beg = pit->insetlist.begin();
                InsetList::const_iterator end = pit->insetlist.end();
@@ -480,8 +478,8 @@ void InsetText::getLabelList(Buffer cons
 
 void InsetText::markNew(bool track_changes)
 {
-       ParagraphList::iterator pit = paragraphs.begin();
-       ParagraphList::iterator end = paragraphs.end();
+       ParagraphList::iterator pit = paragraphs().begin();
+       ParagraphList::iterator end = paragraphs().end();
        for (; pit != end; ++pit) {
                if (track_changes) {
                        pit->trackChanges();
@@ -497,7 +495,7 @@ void InsetText::setText(string const & d
 {
        clear(false);
        for (unsigned int i = 0; i < data.length(); ++i)
-               paragraphs.begin()->insertChar(i, data[i], font);
+               paragraphs().begin()->insertChar(i, data[i], font);
 }
 
 
@@ -541,8 +539,8 @@ void InsetText::setViewCache(BufferView 
 
 void InsetText::removeNewlines()
 {
-       ParagraphList::iterator it = paragraphs.begin();
-       ParagraphList::iterator end = paragraphs.end();
+       ParagraphList::iterator it = paragraphs().begin();
+       ParagraphList::iterator end = paragraphs().end();
        for (; it != end; ++it)
                for (int i = 0; i < it->size(); ++i)
                        if (it->isNewline(i))
@@ -576,7 +574,7 @@ void InsetText::clearInset(Painter & pai
 
 ParagraphList * InsetText::getParagraphs(int i) const
 {
-       return (i == 0) ? const_cast<ParagraphList*>(&paragraphs) : 0;
+       return (i == 0) ? const_cast<ParagraphList*>(&paragraphs()) : 0;
 }
 
 
@@ -594,8 +592,8 @@ bool InsetText::checkInsertChar(LyXFont 
 
 void InsetText::collapseParagraphs(BufferView * bv)
 {
-       while (paragraphs.size() > 1) {
-               ParagraphList::iterator const first = paragraphs.begin();
+       while (paragraphs().size() > 1) {
+               ParagraphList::iterator const first = paragraphs().begin();
                ParagraphList::iterator second = first;
                ++second;
                size_t const first_par_size = first->size();
@@ -618,7 +616,7 @@ void InsetText::collapseParagraphs(Buffe
                        }
                }
 
-               mergeParagraph(bv->buffer()->params(), paragraphs, first);
+               mergeParagraph(bv->buffer()->params(), paragraphs(), first);
        }
 }
 
@@ -636,20 +634,20 @@ void InsetText::appendParagraphs(Buffer 
 // And it probably does. You have to take a look at this John. (Lgb)
 #warning John, have a look here. (Lgb)
        ParagraphList::iterator pit = plist.begin();
-       ParagraphList::iterator ins = paragraphs.insert(paragraphs.end(), *pit);
+       ParagraphList::iterator ins = paragraphs().insert(paragraphs().end(), *pit);
        ++pit;
-       mergeParagraph(buffer->params(), paragraphs, boost::prior(ins));
+       mergeParagraph(buffer->params(), paragraphs(), boost::prior(ins));
 
        ParagraphList::iterator pend = plist.end();
        for (; pit != pend; ++pit)
-               paragraphs.push_back(*pit);
+               paragraphs().push_back(*pit);
 }
 
 
 void InsetText::addPreview(PreviewLoader & loader) const
 {
-       ParagraphList::const_iterator pit = paragraphs.begin();
-       ParagraphList::const_iterator pend = paragraphs.end();
+       ParagraphList::const_iterator pit = paragraphs().begin();
+       ParagraphList::const_iterator pend = paragraphs().end();
 
        for (; pit != pend; ++pit) {
                InsetList::const_iterator it  = pit->insetlist.begin();
@@ -657,4 +655,16 @@ void InsetText::addPreview(PreviewLoader
                for (; it != end; ++it)
                        it->inset->addPreview(loader);
        }
+}
+
+
+ParagraphList & InsetText::paragraphs()
+{
+       return text_.paragraphs();
+}
+
+
+ParagraphList const & InsetText::paragraphs() const
+{
+       return text_.paragraphs();
 }
Index: insets/insettext.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.h,v
retrieving revision 1.235
diff -u -p -r1.235 insettext.h
--- insets/insettext.h  28 Nov 2003 08:55:11 -0000      1.235
+++ insets/insettext.h  28 Nov 2003 17:14:30 -0000
@@ -160,7 +160,9 @@ public:
        ///
        int numParagraphs() const { return 1; }
        ///
-       mutable ParagraphList paragraphs;
+       ParagraphList & paragraphs();
+       ///
+       ParagraphList const & paragraphs() const;
 private:
        ///
        DispatchResult
Index: insets/insetwrap.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetwrap.C,v
retrieving revision 1.56
diff -u -p -r1.56 insetwrap.C
--- insets/insetwrap.C  10 Nov 2003 13:23:14 -0000      1.56
+++ insets/insetwrap.C  28 Nov 2003 17:14:30 -0000
@@ -69,7 +69,7 @@ InsetWrap::InsetWrap(BufferParams const 
        setInsetName(type);
        LyXTextClass const & tclass = bp.getLyXTextClass();
        if (tclass.hasLayout(caplayout))
-               inset.paragraphs.begin()->layout(tclass[caplayout]);
+               inset.paragraphs().begin()->layout(tclass[caplayout]);
 }
 
 
@@ -237,8 +237,8 @@ bool InsetWrap::showInsetDialog(BufferVi
 void InsetWrap::addToToc(lyx::toc::TocList & toclist, Buffer const & buf) const
 {
        // Now find the caption in the float...
-       ParagraphList::iterator tmp = inset.paragraphs.begin();
-       ParagraphList::iterator end = inset.paragraphs.end();
+       ParagraphList::iterator tmp = inset.paragraphs().begin();
+       ParagraphList::iterator end = inset.paragraphs().end();
 
        for (; tmp != end; ++tmp) {
                if (tmp->layout()->name() == caplayout) {

Reply via email to