+
+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
class LyXText;
class LyXLex;
class Paragraph;
+class ParagraphList;
class LyXCursor;
class FuncRequest;
class WordLangTuple;
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;
}
-Paragraph * InsetCollapsable::getFirstParagraph(int i) const
+ParagraphList * InsetCollapsable::getParagraphs(int i) const
{
- return inset.getFirstParagraph(i);
+ return inset.getParagraphs(i);
}
///
Inset * getInsetFromID(int id) const;
///
- Paragraph * getFirstParagraph(int) const;
+ ParagraphList * getParagraphs(int) const;
///
LyXCursor const & cursor(BufferView *) const;
///
}
-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;
}
///
Inset * getInsetFromID(int id) const;
///
- Paragraph * getFirstParagraph(int) const;
+ ParagraphList * getParagraphs(int) const;
///
LyXCursor const & cursor(BufferView *) 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*>(¶graphs) : 0;
}
///
Inset * getInsetFromID(int id) const;
///
- Paragraph * getFirstParagraph(int) const;
+ ParagraphList * getParagraphs(int) const;
///
LyXCursor const & cursor(BufferView *) const;
///
// 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;
// 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;
}
}
// 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;
// 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;
}
}
#include "insets/insettext.h"
#include "debug.h"
#include "support/LAssert.h"
-
#include "iterators.h"
#include <vector>
{
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();
}