]> git.lyx.org Git - lyx.git/blob - src/ParIterator.h
Avoid full metrics computation with Update:FitCursor
[lyx.git] / src / ParIterator.h
1 // -*- C++ -*-
2 /* \file ParIterator.h
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author unknown
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef PARITERATOR_H
13 #define PARITERATOR_H
14
15 #include "DocIterator.h"
16
17 #include "support/types.h"
18
19
20 namespace lyx {
21
22 class Buffer;
23 class Inset;
24 class Paragraph;
25 class ParagraphList;
26
27
28 class ParIterator : public DocIterator
29 {
30 public:
31         ///
32         ParIterator(Buffer * buf) : DocIterator(buf) {}
33         ///
34         ParIterator(ParIterator const & pi) :
35                 DocIterator(DocIterator(pi)) {}
36         ///
37         explicit ParIterator(DocIterator const & dit) :
38                 DocIterator(dit) {}
39
40         /// This really should be implemented...
41         //ParIterator & operator=(ParIterator const &);
42         ///
43         ParIterator & operator++();
44         ///
45         ParIterator operator++(int);
46         /// See comment in ParIterator.cpp
47         //ParIterator & operator--();
48         ///
49         Paragraph & operator*() const;
50         ///
51         Paragraph * operator->() const;
52         /// This gives us the top-most parent paragraph
53         pit_type outerPar() const;
54         ///
55         pit_type pit() const;
56         ///
57         /// return the paragraph this cursor is in
58         pit_type & pit() { return DocIterator::pit(); }
59
60         ParagraphList & plist() const;
61 };
62
63
64 ParIterator par_iterator_begin(Inset & inset);
65
66 ParIterator par_iterator_end(Inset & inset);
67
68
69 ///
70 //bool operator==(ParIterator const & it1, ParIterator const & it2);
71
72 // FIXME: Unfortunately operator!=(ParIterator &, ParIterator &) is
73 // implemented with operator!=(DocIterator &, DocIterator &) that gives
74 // false if the positions are different, even if the pars are the same.
75 // So ultimately it's a bug in operator!=(ParIterator &, ParIterator &)
76 // I'd say (nevertheless, I would be reluctant to change it, because I
77 // fear that some part of the code could rely on this "bug". --Alfredo
78 //bool operator!=(ParIterator const & it1, ParIterator const & it2);
79
80
81 class ParConstIterator : public DocIterator
82 {
83 public:
84         ///
85         ParConstIterator(Buffer const * buf)
86                 : DocIterator(const_cast<Buffer *>(buf)) {}
87         ///
88         ParConstIterator(ParConstIterator const & pi)
89                 : DocIterator(DocIterator(pi)) {}
90         ///
91         explicit ParConstIterator(DocIterator const & dit)
92                 : DocIterator(dit) {}
93         ///
94         void push_back(Inset const &);
95
96         ParConstIterator & operator++();
97         ///
98         ParConstIterator & operator--();
99         ///
100         Paragraph const & operator*() const;
101         ///
102         Paragraph const * operator->() const;
103         ///
104         ParagraphList const & plist() const;
105 };
106
107 //bool operator==(ParConstIterator const & it1, ParConstIterator const & it2);
108
109 //bool operator!=(ParConstIterator const & it1, ParConstIterator const & it2);
110
111
112 } // namespace lyx
113
114 #endif