]> git.lyx.org Git - lyx.git/blob - src/ParagraphList.h
Avoid full metrics computation with Update:FitCursor
[lyx.git] / src / ParagraphList.h
1 // -*- C++ -*-
2 /**
3  * \file ParagraphList.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef PARAGRAPH_LIST_H
13 #define PARAGRAPH_LIST_H
14
15 #include "Paragraph.h"
16
17 #include "support/RandomAccessList.h"
18
19
20 namespace lyx {
21
22 /// Container for all kind of Paragraphs used in LyX.
23 class ParagraphList : public RandomAccessList<Paragraph> {
24 public:
25         ///
26         ParagraphList() {}
27         ///
28         template<class InputIterator>
29         ParagraphList(InputIterator first, InputIterator last)
30                 : RandomAccessList<Paragraph>(first, last)
31         {}
32
33         const Paragraph * getParagraphBefore(const_iterator const & par) const
34         {
35                 // No previous paragraph.
36                 if (par == begin())
37                         return nullptr;
38
39                 auto prevpar = par;
40                 --prevpar;
41                 return &*prevpar;
42         }
43 };
44
45 } // namespace lyx
46
47 #endif