X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FParagraphList.h;h=7e5cc1a869ff50b54150f09d1c85d2448731ba9c;hb=3bf1b97ae547aea5d0243e41b2d8af463a6e40c5;hp=70c0ff1066ed164676fc22f65cb055c5de63df44;hpb=9d6cad3fe60696d795280a886623fdc9a89f9de6;p=features.git diff --git a/src/ParagraphList.h b/src/ParagraphList.h index 70c0ff1066..7e5cc1a869 100644 --- a/src/ParagraphList.h +++ b/src/ParagraphList.h @@ -1,6 +1,6 @@ // -*- C++ -*- /** - * \file ParagraphList_fwd.h + * \file ParagraphList.h * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * @@ -12,11 +12,36 @@ #ifndef PARAGRAPH_LIST_H #define PARAGRAPH_LIST_H -#include "paragraph.h" +#include "Paragraph.h" #include "support/RandomAccessList.h" -/// Container for all kind of Paragraphs used in Lyx. -typedef RandomAccessList ParagraphList; + +namespace lyx { + +/// Container for all kind of Paragraphs used in LyX. +class ParagraphList : public RandomAccessList { +public: + /// + ParagraphList() {} + /// + template + ParagraphList(InputIterator first, InputIterator last) + : RandomAccessList(first, last) + {} + + const Paragraph * getParagraphBefore(const_iterator const & par) const + { + // No previous paragraph. + if (par == begin()) + return nullptr; + + auto prevpar = par; + --prevpar; + return &*prevpar; + } +}; + +} // namespace lyx #endif