-/// Container for all kind of Paragraphs used in Lyx.
-typedef RandomAccessList<Paragraph> ParagraphList;
+
+namespace lyx {
+
+/// Container for all kind of Paragraphs used in LyX.
+class ParagraphList : public RandomAccessList<Paragraph> {
+public:
+ ///
+ ParagraphList() {}
+ ///
+ template<class InputIterator>
+ ParagraphList(InputIterator first, InputIterator last)
+ : RandomAccessList<Paragraph>(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