]> git.lyx.org Git - features.git/commitdiff
replace getFirstParagraph() by getParagraphs()
authorAndré Pönitz <poenitz@gmx.net>
Mon, 5 May 2003 15:39:48 +0000 (15:39 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Mon, 5 May 2003 15:39:48 +0000 (15:39 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6934 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/insets/inset.h
src/insets/insetcollapsable.C
src/insets/insetcollapsable.h
src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.C
src/insets/insettext.h
src/iterators.C
src/undo_funcs.C

index 585dd409ee25b1a9a597dd33c4b25683d522a060..bf6a53afafe447561c89a9d9969ea10e3a62dd36 100644 (file)
@@ -1,3 +1,9 @@
+
+2003-05-05 André Pönitz <poenitz@gmx.net>
+
+       * iterator.C: 
+       * undo_funcs.C: use getParagraphs() instead of getFirstParagraph()
+
 2003-05-02  Michael Schmitt  <michael.schmitt@teststep.org>
 
        * bufferparams.C: Output warning if a document with missing
index 9f7aafa3c56a6637596c4a70b38f0f358902bac0..a1e36f39c857fd0190c54deabee9213bbf1661e9 100644 (file)
@@ -29,6 +29,7 @@ class Painter;
 class LyXText;
 class LyXLex;
 class Paragraph;
+class ParagraphList;
 class LyXCursor;
 class FuncRequest;
 class WordLangTuple;
@@ -267,7 +268,7 @@ public:
        virtual Inset * getInsetFromID(int /*id*/) const { return 0; }
        /// if this insets owns paragraphs (f.ex. InsetText) then it
        /// should return it's very first one!
-       virtual Paragraph * getFirstParagraph(int /*num*/) const { return 0; }
+       virtual ParagraphList * getParagraphs(int /*num*/) const { return 0; }
        ///
        virtual bool haveParagraphs() const {
                return false;
index 9c8d1ac4465a5d7df65695855c47d695bd2913c0..5f5da107d4c2600187ee1fb25ea2524bb3c08d43 100644 (file)
@@ -571,9 +571,9 @@ int InsetCollapsable::scroll(bool recursive) const
 }
 
 
-Paragraph * InsetCollapsable::getFirstParagraph(int i) const
+ParagraphList * InsetCollapsable::getParagraphs(int i) const
 {
-       return inset.getFirstParagraph(i);
+       return inset.getParagraphs(i);
 }
 
 
index f5b05f62116153bac57d107d9cb6bb09760d50cd..b1d84ce018ddb753704a6886be1ccad4e5a4d531 100644 (file)
@@ -142,7 +142,7 @@ public:
        ///
        Inset * getInsetFromID(int id) const;
        ///
-       Paragraph * getFirstParagraph(int) const;
+       ParagraphList * getParagraphs(int) const;
        ///
        LyXCursor const & cursor(BufferView *) const;
        ///
index 0d1ec665432078c5badfd9156fa14195e5c1c8f9..155d53fad2091d19d71a52e41f005d717c228452 100644 (file)
@@ -2522,10 +2522,10 @@ void InsetTabular::getSelection(int & srow, int & erow,
 }
 
 
-Paragraph * InsetTabular::getFirstParagraph(int i) const
+ParagraphList * InsetTabular::getParagraphs(int i) const
 {
        return (i < tabular->GetNumberOfCells())
-               ? tabular->GetCellInset(i)->getFirstParagraph(0)
+               ? tabular->GetCellInset(i)->getParagraphs(0)
                : 0;
 }
 
index 176e8daf0f4454fbf96d6eed88f114d2c3caa7f5..116c5a73b0f567a512be28ff22b2255a47165837 100644 (file)
@@ -195,7 +195,7 @@ public:
        ///
        Inset * getInsetFromID(int id) const;
        ///
-       Paragraph * getFirstParagraph(int) const;
+       ParagraphList * getParagraphs(int) const;
        ///
        LyXCursor const & cursor(BufferView *) const;
        ///
index 3b2231bd479aa1c0f66f2fd598daf873d66e45f7..3ada4ab47cf517077e65a2457e3561f0a55e0447 100644 (file)
@@ -2382,9 +2382,9 @@ void InsetText::clearInset(BufferView * bv, int start_x, int baseline) const
 }
 
 
-Paragraph * InsetText::getFirstParagraph(int i) const
+ParagraphList * InsetText::getParagraphs(int i) const
 {
-       return (i == 0) ? &*(paragraphs.begin()) : 0;
+       return (i == 0) ? const_cast<ParagraphList*>(&paragraphs) : 0;
 }
 
 
index b2dc28b551c269c37380697bf3c2b183f2124f7c..7521131001eb6ba6fe9704e132f5673276b939d8 100644 (file)
@@ -198,7 +198,7 @@ public:
        ///
        Inset * getInsetFromID(int id) const;
        ///
-       Paragraph * getFirstParagraph(int) const;
+       ParagraphList * getParagraphs(int) const;
        ///
        LyXCursor const & cursor(BufferView *) const;
        ///
index 6622fd31ac481531374a231325e57a163318f43e..9521313243cbf24a37717ead27b5fbedb858beaa 100644 (file)
@@ -10,9 +10,9 @@ ParIterator & ParIterator::operator++()
                // Does the current inset contain more "cells" ?
                if (p.index >= 0) {
                        ++p.index;
-                       Paragraph * par = p.it.getInset()->getFirstParagraph(p.index);
-                       if (par) {
-                               positions.push(ParPosition(par));
+                       ParagraphList * plist = p.it.getInset()->getParagraphs(p.index);
+                       if (plist && !plist->empty()) {
+                               positions.push(ParPosition(&plist->front()));
                                return *this;
                        }
                        ++p.it;
@@ -25,10 +25,10 @@ ParIterator & ParIterator::operator++()
                // Try to find the next inset that contains paragraphs
                InsetList::iterator end = p.par->insetlist.end();
                for (; p.it != end; ++p.it) {
-                       Paragraph * par = p.it.getInset()->getFirstParagraph(0);
-                       if (par) {
+                       ParagraphList * plist = p.it.getInset()->getParagraphs(0);
+                       if (plist && !plist->empty()) {
                                p.index = 0;
-                               positions.push(ParPosition(par));
+                               positions.push(ParPosition(&plist->front()));
                                return *this;
                        }
                }
@@ -52,9 +52,9 @@ ParConstIterator & ParConstIterator::operator++()
                // Does the current inset contain more "cells" ?
                if (p.index >= 0) {
                        ++p.index;
-                       Paragraph * par = p.it.getInset()->getFirstParagraph(p.index);
-                       if (par) {
-                               positions.push(ParPosition(par));
+                       ParagraphList * plist = p.it.getInset()->getParagraphs(p.index);
+                       if (plist && !plist->empty()) {
+                               positions.push(ParPosition(&plist->front()));
                                return *this;
                        }
                        ++p.it;
@@ -67,10 +67,10 @@ ParConstIterator & ParConstIterator::operator++()
                // Try to find the next inset that contains paragraphs
                InsetList::iterator end = p.par->insetlist.end();
                for (; p.it != end; ++p.it) {
-                       Paragraph * par = p.it.getInset()->getFirstParagraph(0);
-                       if (par) {
+                       ParagraphList * plist = p.it.getInset()->getParagraphs(0);
+                       if (plist && !plist->empty()) {
                                p.index = 0;
-                               positions.push(ParPosition(par));
+                               positions.push(ParPosition(&plist->front()));
                                return *this;
                        }
                }
index 24d4571d6c86bb05519f8aa999c4132eaf7790e4..71467a6dafb74501dc97162ff089f66683f14bcb 100644 (file)
@@ -17,7 +17,6 @@
 #include "insets/insettext.h"
 #include "debug.h"
 #include "support/LAssert.h"
-
 #include "iterators.h"
 
 #include <vector>
@@ -51,11 +50,11 @@ Paragraph * firstUndoParagraph(BufferView * bv, int inset_id)
 {
        Inset * inset = bv->buffer()->getInsetFromID(inset_id);
        if (inset) {
-               Paragraph * result = inset->getFirstParagraph(0);
-               if (result)
-                       return result;
+               ParagraphList * result = inset->getParagraphs(0);
+               if (result && !result->empty())
+                       return &result->front();
        }
-       return &*bv->text->ownerParagraphs().begin();
+       return &bv->text->ownerParagraphs().front();
 }