]> git.lyx.org Git - lyx.git/commitdiff
parlist-a-1.diff
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 2 Apr 2003 17:11:38 +0000 (17:11 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 2 Apr 2003 17:11:38 +0000 (17:11 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6683 a592a061-630c-0410-9148-cb99ea01b6c8

14 files changed:
src/BufferView.C
src/ChangeLog
src/insets/ChangeLog
src/insets/insetert.C
src/insets/insetfloat.C
src/insets/insettabular.C
src/insets/insettext.C
src/insets/insettext.h
src/insets/insetwrap.C
src/lyxtext.h
src/tabular.C
src/text2.C
src/text3.C
src/undo_funcs.C

index 63f08f73718c95a4a9285ae43426268ed3cc0c7f..9b554b00724a0352dcad54c9a3f8aba5c03a6e01 100644 (file)
@@ -472,7 +472,7 @@ bool BufferView::removeAutoInsets()
        // It is possible that the last line is empty if it was cursor_par
        // and/or only had an error inset on it.  So we set the cursor to the
        // start of the doc to force its removal and ensure a valid saved cursor
-       if (text->setCursor(text->ownerParagraph(), 0)
+       if (text->setCursor(&*text->ownerParagraphs().begin(), 0)
            && 0 == cursor_par_next) {
                cursor_par = cursor_par_prev;
                cursor_pos = cursor_par->size();
@@ -515,7 +515,7 @@ void BufferView::insertErrors(TeXErrors & terr)
                Paragraph * texrowpar = 0;
 
                if (tmpid == -1) {
-                       texrowpar = text->ownerParagraph();
+                       texrowpar = &*text->ownerParagraphs().begin();
                        tmppos = 0;
                } else {
                        texrowpar = buffer()->getParFromID(tmpid);
@@ -546,7 +546,7 @@ void BufferView::setCursorFromRow(int row)
        Paragraph * texrowpar;
 
        if (tmpid == -1) {
-               texrowpar = text->ownerParagraph();
+               texrowpar = &*text->ownerParagraphs().begin();
                tmppos = 0;
        } else {
                texrowpar = buffer()->getParFromID(tmpid);
index ed6bb618132092c4cab7ba939648258b398023b2..33c6e5cd92e4b130ca09e57e275961781a7dd6d0 100644 (file)
@@ -1,3 +1,26 @@
+2003-04-02  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * undo_funcs.C (firstUndoParagraph): adjust
+
+       * text3.C (gotoInset): adjust
+       (dispatch): adjust, and rewrite loop.
+
+       * text2.C (init): adjust, and rewrite loop.
+       (redoParagraphs): adjust
+       (updateInset): adjust, and rewrite loop.
+       (deleteEmptyParagraphMechanism): adjust
+
+       * tabular.C (LyXTabular): adjust
+       (SetMultiColumn): adjust
+       (TeXRow): adjust
+
+       * lyxtext.[Ch] (ownerParagraph): delete function
+       (ownerParagraphs): new function returns a ParagraphList.
+
+       * BufferView.C (removeAutoInsets): adjust
+       (insertErrors): adjust
+       (setCursorFromRow): adjust
+
 2003-04-01  Angus Leeming  <leeming@lyx.org>
 
        * BufferView_pimpl.C (buffer): ensure that the Layout is correct
@@ -20,7 +43,7 @@
        * text.C: adjust
        * text2.C: adjust
        * text3.C: adjust
-       
+
        * lyxrow_funcs. [Ch]: new files
 
        * lyxrow.[Ch]: remove next and previous pointers
index 42453bd643e0c6b085fd0de727e827bd61588472..72d22b0eac6a2b47e574c1f66c9b93145fc86ac0 100644 (file)
@@ -1,8 +1,30 @@
+2003-04-02  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * insetwrap.C (InsetWrap): adjust
+       (addToToc): adjust and rewrite loop
+
+       * insettext.[Ch] (paragraph): delete function
+
+       * insettabular.C (moveNextCell): adjust
+       (movePrevCell): adjust
+       (insertAsciiString): adjust
+
+       * insetfloat.C (InsetFloat): adjust
+       (addToToc): adjust
+
+       * insetert.C (InsetERT): adjust
+       (write): adjust, and rewrite loop
+       (latex): adjust, and rewrite loop
+       (linuxdoc): adjust, and rewrite loop
+       (docbook): adjust, and rewrite loop
+       (localDispatch): adjust
+       (get_new_label): adjust
+
 2003-04-01  John Levon  <levon@movementarian.org>
 
        From Alfredo Braunstein
 
-       * insetbutton.h:        
+       * insetbutton.h:
        * insetbutton.C: add localDispatch()
 
        * insetcommand.C: return DISPATCHED when edit() called
@@ -12,7 +34,7 @@
 2003-04-01  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * insettext.C: adjust
-       
+
 2003-04-01  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * insettext.C (draw): adjust
index 37fc79acc64456f9aa8825f7a73db9708581581b..15c01498c6bf3adab0a9acfd3ca46a8a5e315a9c 100644 (file)
@@ -95,7 +95,7 @@ InsetERT::InsetERT(BufferParams const & bp,
        string::const_iterator end = contents.end();
        pos_type pos = 0;
        for (; cit != end; ++cit) {
-               inset.paragraph()->insertChar(pos++, *cit, font);
+               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).
@@ -200,8 +200,9 @@ void InsetERT::write(Buffer const * buf, ostream & os) const
 
        //inset.writeParagraphData(buf, os);
        string const layout(buf->params.getLyXTextClass().defaultLayoutName());
-       Paragraph * par = inset.paragraph();
-       while (par) {
+       ParagraphList::iterator par = inset.paragraphs.begin();
+       ParagraphList::iterator end = inset.paragraphs.end();
+       for (; par != end; ++par) {
                os << "\n\\layout " << layout << "\n";
                pos_type siz = par->size();
                for (pos_type i = 0; i < siz; ++i) {
@@ -224,7 +225,6 @@ void InsetERT::write(Buffer const * buf, ostream & os) const
                                break;
                        }
                }
-               par = par->next();
        }
 }
 
@@ -349,9 +349,11 @@ void InsetERT::lfunMouseMotion(FuncRequest const & cmd)
 int InsetERT::latex(Buffer const *, ostream & os, bool /*fragile*/,
                    bool /*free_spc*/) const
 {
-       Paragraph * par = inset.paragraph();
+       ParagraphList::iterator par = inset.paragraphs.begin();
+       ParagraphList::iterator end = inset.paragraphs.end();
+
        int lines = 0;
-       while (par) {
+       while (par != end) {
                pos_type siz = par->size();
                for (pos_type i = 0; i < siz; ++i) {
                        // ignore all struck out text
@@ -365,8 +367,8 @@ int InsetERT::latex(Buffer const *, ostream & os, bool /*fragile*/,
                                os << par->getChar(i);
                        }
                }
-               par = par->next();
-               if (par) {
+               ++par;
+               if (par != end) {
                        os << "\n\n";
                        lines += 2;
                }
@@ -384,9 +386,11 @@ int InsetERT::ascii(Buffer const *, ostream &, int /*linelen*/) const
 
 int InsetERT::linuxdoc(Buffer const *, ostream & os) const
 {
-       Paragraph * par = inset.paragraph();
+       ParagraphList::iterator par = inset.paragraphs.begin();
+       ParagraphList::iterator end = inset.paragraphs.end();
+
        int lines = 0;
-       while (par) {
+       while (par != end) {
                pos_type siz = par->size();
                for (pos_type i = 0; i < siz; ++i) {
                        if (par->isNewline(i)) {
@@ -396,8 +400,8 @@ int InsetERT::linuxdoc(Buffer const *, ostream & os) const
                                os << par->getChar(i);
                        }
                }
-               par = par->next();
-               if (par) {
+               ++par;
+               if (par != end) {
                        os << "\n";
                        lines ++;
                }
@@ -409,9 +413,11 @@ int InsetERT::linuxdoc(Buffer const *, ostream & os) const
 
 int InsetERT::docbook(Buffer const *, ostream & os, bool) const
 {
-       Paragraph * par = inset.paragraph();
+       ParagraphList::iterator par = inset.paragraphs.begin();
+       ParagraphList::iterator end = inset.paragraphs.end();
+
        int lines = 0;
-       while (par) {
+       while (par != end) {
                pos_type siz = par->size();
                for (pos_type i = 0; i < siz; ++i) {
                        if (par->isNewline(i)) {
@@ -421,8 +427,8 @@ int InsetERT::docbook(Buffer const *, ostream & os, bool) const
                                os << par->getChar(i);
                        }
                }
-               par = par->next();
-               if (par) {
+               ++par;
+               if (par != end) {
                        os << "\n";
                        lines ++;
                }
@@ -437,7 +443,7 @@ Inset::RESULT InsetERT::localDispatch(FuncRequest const & cmd)
        Inset::RESULT result = UNDISPATCHED;
        BufferView * bv = cmd.view();
 
-       if (inset.paragraph()->empty()) {
+       if (inset.paragraphs.begin()->empty()) {
                set_latex_font(bv);
        }
 
@@ -480,7 +486,7 @@ Inset::RESULT InsetERT::localDispatch(FuncRequest const & cmd)
                break;
 
        case LFUN_LAYOUT:
-               bv->owner()->setLayout(inset.paragraph()->layout()->name());
+               bv->owner()->setLayout(inset.paragraphs.begin()->layout()->name());
                result = DISPATCHED_NOUPDATE;
                break;
 
@@ -511,17 +517,18 @@ string const InsetERT::get_new_label() const
 {
        string la;
        pos_type const max_length = 15;
-       pos_type const p_siz = inset.paragraph()->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.paragraph()->isInset(j))
+               if (inset.paragraphs.begin()->isInset(j))
                        continue;
-               la += inset.paragraph()->getChar(j);
+               la += inset.paragraphs.begin()->getChar(j);
                ++i;
        }
-       if (inset.paragraph()->next() || (i > 0 && j < p_siz)) {
+       if (boost::next(inset.paragraphs.begin()) != inset.paragraphs.end() ||
+           (i > 0 && j < p_siz)) {
                la += "...";
        }
        if (la.empty()) {
index 178994a023babcbb3bbcc07057349260cde26278..841b41943a63ad75c57e66e4a4a184e103666706 100644 (file)
@@ -137,7 +137,7 @@ InsetFloat::InsetFloat(BufferParams const & bp, string const & type)
        setInsetName(type);
        LyXTextClass const & tclass = bp.getLyXTextClass();
        if (tclass.hasLayout(caplayout))
-               inset.paragraph()->layout(tclass[caplayout]);
+               inset.paragraphs.begin()->layout(tclass[caplayout]);
 }
 
 
@@ -364,7 +364,7 @@ void InsetFloat::wide(bool w, BufferParams const & bp)
 
 void InsetFloat::addToToc(toc::TocList & toclist, Buffer const * buf) const
 {
-       ParIterator pit(inset.paragraph());
+       ParIterator pit(&*inset.paragraphs.begin());
        ParIterator end;
 
        // Find a caption layout in one of the (child inset's) pars
index 07cad76bc4d91bdfa076cee18682c9ae1facbec1..2c0e3aff52eb9f729322fad23d0aba79fc259865 100644 (file)
@@ -1631,7 +1631,7 @@ bool InsetTabular::moveNextCell(BufferView * bv, bool lock)
                ++actcell;
        }
        if (lock) {
-               bool rtl = tabular->GetCellInset(actcell)->paragraph()->
+               bool rtl = tabular->GetCellInset(actcell)->paragraphs.begin()->
                        isRightToLeftPar(bv->buffer()->params);
                activateCellInset(bv, 0, 0, mouse_button::none, !rtl);
        }
@@ -1660,7 +1660,7 @@ bool InsetTabular::movePrevCell(BufferView * bv, bool lock)
                --actcell;
        }
        if (lock) {
-               bool rtl = tabular->GetCellInset(actcell)->paragraph()->
+               bool rtl = tabular->GetCellInset(actcell)->paragraphs.begin()->
                        isRightToLeftPar(bv->buffer()->params);
                activateCellInset(bv, 0, 0, mouse_button::none, !rtl);
        }
@@ -2852,8 +2852,8 @@ bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
                        if (cols < columns) {
                                InsetText * ti = loctab->GetCellInset(cell);
                                LyXFont const font = ti->getLyXText(bv)->
-                                       getFont(bv->buffer(), ti->paragraph(), 0);
-                               ti->setText(buf.substr(op, p-op), font);
+                                       getFont(bv->buffer(), &*ti->paragraphs.begin(), 0);
+                               ti->setText(buf.substr(op, p - op), font);
                                ++cols;
                                ++cell;
                        }
@@ -2863,8 +2863,8 @@ bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
                        if (cols < columns) {
                                InsetText * ti = loctab->GetCellInset(cell);
                                LyXFont const font = ti->getLyXText(bv)->
-                                       getFont(bv->buffer(), ti->paragraph(), 0);
-                               ti->setText(buf.substr(op, p-op), font);
+                                       getFont(bv->buffer(), &*ti->paragraphs.begin(), 0);
+                               ti->setText(buf.substr(op, p - op), font);
                        }
                        cols = ocol;
                        ++row;
@@ -2879,8 +2879,8 @@ bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
        if ((cell < cells) && (op < len)) {
                InsetText * ti = loctab->GetCellInset(cell);
                LyXFont const font = ti->getLyXText(bv)->
-                       getFont(bv->buffer(), ti->paragraph(), 0);
-               ti->setText(buf.substr(op, len-op), font);
+                       getFont(bv->buffer(), &*ti->paragraphs.begin(), 0);
+               ti->setText(buf.substr(op, len - op), font);
        }
 
        return true;
index c94ac1666b04bc57b185c803d6e563978c45a77a..0d1858322f3d73d9f3f26797cb5d32ee45e0ed3f 100644 (file)
@@ -2428,12 +2428,6 @@ LyXCursor const & InsetText::cursor(BufferView * bv) const
 }
 
 
-Paragraph * InsetText::paragraph() const
-{
-       return &*(paragraphs.begin());
-}
-
-
 void InsetText::paragraph(Paragraph * p)
 {
        // GENERAL COMMENT: We don't have to free the old paragraphs as the
index 4baca69ed5c4223af54fa5ce2ae5b14a0a9929ee..28d3aa7ce2d1876f1f6fd62e94a96baf462393e2 100644 (file)
@@ -208,8 +208,6 @@ public:
        ///
        LyXCursor const & cursor(BufferView *) const;
        ///
-       Paragraph * paragraph() const;
-       ///
        void paragraph(Paragraph *);
        ///
        bool allowSpellcheck() const { return true; }
index 1699bb263d56363042b71a342c83c8ba1036880c..96f261b5c2d7ae5a305cccb02a588b65901948d2 100644 (file)
@@ -67,7 +67,7 @@ InsetWrap::InsetWrap(BufferParams const & bp, string const & type)
        setInsetName(type);
        LyXTextClass const & tclass = bp.getLyXTextClass();
        if (tclass.hasLayout(caplayout))
-               inset.paragraph()->layout(tclass[caplayout]);
+               inset.paragraphs.begin()->layout(tclass[caplayout]);
 }
 
 
@@ -269,8 +269,10 @@ void InsetWrap::addToToc(toc::TocList & toclist, Buffer const * buf) const
        // Now find the caption in the float...
        // We now tranverse the paragraphs of
        // the inset...
-       Paragraph * tmp = inset.paragraph();
-       while (tmp) {
+       ParagraphList::iterator tmp = inset.paragraphs.begin();
+       ParagraphList::iterator end = inset.paragraphs.end();
+
+       for (; tmp != end; ++tmp) {
                if (tmp->layout()->name() == caplayout) {
                        string const name = floatname(params_.type, buf->params);
                        string const str =
@@ -279,7 +281,7 @@ void InsetWrap::addToToc(toc::TocList & toclist, Buffer const * buf) const
                        toc::TocItem const item(tmp->id(), 0 , str);
                        toclist[name].push_back(item);
                }
-               tmp = tmp->next();
+               ++tmp;
        }
 }
 
index 9b5acd10d0d70fb5c891e390441a0be691565776..f416f5e3e9344a595bed155cc872b8db44ad8d15 100644 (file)
@@ -626,7 +626,7 @@ public:
        //
        // special owner functions
        ///
-       Paragraph * ownerParagraph() const;
+       ParagraphList & ownerParagraphs() const;
        //
        void ownerParagraph(Paragraph *) const;
        // set it searching first for the right owner using the paragraph id
index 447ba82638d0a26858738d4ddddce844586171bd..f982b67b9ea29bfcab8f87358c345b285203abd6 100644 (file)
@@ -129,7 +129,7 @@ LyXTabular::LyXTabular(BufferParams const & bp,
                for (int i = 0; i < rows_; ++i) {
                        for (int j = 0; j < columns_; ++j) {
                                cell_info[i][j].inset.id(lt.cell_info[i][j].inset.id());
-                               cell_info[i][j].inset.setParagraphData(lt.cell_info[i][j].inset.paragraph(),true);
+                               cell_info[i][j].inset.setParagraphData(&*lt.cell_info[i][j].inset.paragraphs.begin(), true);
                        }
                }
        }
@@ -1338,7 +1338,7 @@ void LyXTabular::SetMultiColumn(Buffer * buffer, int cell, int number)
        for (int i = 1; i < number; ++i) {
                cellinfo_of_cell(cell+i)->multicolumn = CELL_PART_OF_MULTICOLUMN;
                cellinfo_of_cell(cell)->inset.appendParagraphs(buffer,
-                       cellinfo_of_cell(cell+i)->inset.paragraph());
+                       &*cellinfo_of_cell(cell+i)->inset.paragraphs.begin());
                cellinfo_of_cell(cell+i)->inset.clear(false);
        }
 #else
@@ -1983,8 +1983,8 @@ int LyXTabular::TeXRow(ostream & os, int const i, Buffer const * buf,
                ret += TeXCellPreamble(os, cell);
                InsetText * inset = GetCellInset(cell);
 
-               bool rtl = inset->paragraph()->isRightToLeftPar(buf->params) &&
-                       !inset->paragraph()->empty() && GetPWidth(cell).zero();
+               bool rtl = inset->paragraphs.begin()->isRightToLeftPar(buf->params) &&
+                       !inset->paragraphs.begin()->empty() && GetPWidth(cell).zero();
 
                if (rtl)
                        os << "\\R{";
index 043605db46d8963c44b8df2a4a370a9193977c4c..58de5b4e31e252c62231f90dc4776a9b045cc386 100644 (file)
@@ -88,12 +88,13 @@ void LyXText::init(BufferView * bview, bool reinit)
        } else if (!rowlist_.empty())
                return;
 
-       Paragraph * par = ownerParagraph();
-       current_font = getFont(bview->buffer(), par, 0);
+       ParagraphList::iterator par = ownerParagraphs().begin();
+       ParagraphList::iterator end = ownerParagraphs().end();
 
-       while (par) {
-               insertParagraph(par, rowlist_.end());
-               par = par->next();
+       current_font = getFont(bview->buffer(), &*par, 0);
+
+       for (; par != end; ++par) {
+               insertParagraph(&*par, rowlist_.end());
        }
        setCursorIntern(rowlist_.begin()->par(), 0);
        selection.cursor = cursor;
@@ -694,7 +695,7 @@ void LyXText::redoParagraphs(LyXCursor const & cur,
                // changed the ownerParagrah() so the paragraph inside
                // the row is NOT my really first par anymore.
                // Got it Lars ;) (Jug 20011206)
-               first_phys_par = ownerParagraph();
+               first_phys_par = &*ownerParagraphs().begin();
 #warning FIXME
                // In here prevrit could be set to rows().end(). (Lgb)
        } else {
@@ -1646,15 +1647,17 @@ bool LyXText::updateInset(Inset * inset)
 
        // check every paragraph
 
-       Paragraph * par = ownerParagraph();
+       ParagraphList::iterator par = ownerParagraphs().begin();
+       ParagraphList::iterator end = ownerParagraphs().end();
+
        do {
                pos = par->getPositionOfInset(inset);
                if (pos != -1) {
-                       checkParagraph(par, pos);
+                       checkParagraph(&*par, pos);
                        return true;
                }
-               par = par->next();
-       } while (par);
+               ++par;
+       } while (par != end);
 
        return false;
 }
@@ -2283,8 +2286,8 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor)
 
                        // delete old row
                        removeRow(old_cursor.row());
-                       if (ownerParagraph() == old_cursor.par()) {
-                               ownerParagraph(ownerParagraph()->next());
+                       if (ownerParagraphs().begin() == old_cursor.par()) {
+                               ownerParagraph(&*boost::next(ownerParagraphs().begin()));
                        }
                        // delete old par
                        delete old_cursor.par();
@@ -2319,8 +2322,8 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor)
                        // delete old row
                        removeRow(old_cursor.row());
                        // delete old par
-                       if (ownerParagraph() == old_cursor.par()) {
-                               ownerParagraph(ownerParagraph()->next());
+                       if (ownerParagraphs().begin() == old_cursor.par()) {
+                               ownerParagraph(&*boost::next(ownerParagraphs().begin()));
                        }
 
                        delete old_cursor.par();
@@ -2357,12 +2360,12 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor)
 }
 
 
-Paragraph * LyXText::ownerParagraph() const
+ParagraphList & LyXText::ownerParagraphs() const
 {
        if (inset_owner) {
-               return inset_owner->paragraph();
+               return inset_owner->paragraphs;
        }
-       return &*(bv_owner->buffer()->paragraphs.begin());
+       return bv_owner->buffer()->paragraphs;
 }
 
 
index ddcfe77eb0f21864d262ae89fb272a4503bc5b03..1e445f459f02049472c507ea3b69671ddf1a6313 100644 (file)
@@ -214,9 +214,9 @@ void LyXText::gotoInset(vector<Inset::Code> const & codes,
        }
 
        if (!gotoNextInset(codes, contents)) {
-               if (cursor.pos() || cursor.par() != ownerParagraph()) {
+               if (cursor.pos() || cursor.par() != ownerParagraphs().begin()) {
                        LyXCursor tmp = cursor;
-                       cursor.par(ownerParagraph());
+                       cursor.par(&*ownerParagraphs().begin());
                        cursor.pos(0);
                        if (!gotoNextInset(codes, contents)) {
                                cursor = tmp;
@@ -411,13 +411,15 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
                bool start = !par->params().startOfAppendix();
 
                // ensure that we have only one start_of_appendix in this document
-               Paragraph * tmp = ownerParagraph();
-               for (; tmp; tmp = tmp->next()) {
+               ParagraphList::iterator tmp = ownerParagraphs().begin();
+               ParagraphList::iterator end = ownerParagraphs().end();
+
+               for (; tmp != end; ++tmp) {
                        if (tmp->params().startOfAppendix()) {
-                               setUndo(bv, Undo::EDIT, tmp, tmp->next());
+                               setUndo(bv, Undo::EDIT, &*tmp, &*boost::next(tmp));
                                tmp->params().startOfAppendix(false);
                                int tmpy;
-                               setHeightOfRow(getRow(tmp, 0, tmpy));
+                               setHeightOfRow(getRow(&*tmp, 0, tmpy));
                                break;
                        }
                }
index 882f5e166882f99d12d56fdd10f9472dea92378d..8d15fed249e471e83c8f8e7406f3aefab029e192 100644 (file)
@@ -53,7 +53,7 @@ Paragraph * firstUndoParagraph(BufferView * bv, int inset_id)
                if (result)
                        return result;
        }
-       return bv->text->ownerParagraph();
+       return &*bv->text->ownerParagraphs().begin();
 }