]> git.lyx.org Git - lyx.git/blob - src/FontIterator.C
fix two crashes related to dEPM. Some crashes remain
[lyx.git] / src / FontIterator.C
1 /**
2  * \file src/FontIterator.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Alfredo Braunstein
7  *
8  * Full author contact details are available in file CREDITS.
9  *
10  */
11
12
13 #include <config.h>
14
15 #include "FontIterator.h"
16
17 #include "lyxtext.h"
18 #include "paragraph.h"
19
20
21 FontIterator::FontIterator(LyXText const & text, Paragraph const & par,
22                            lyx::pos_type pos)
23         : text_(text), par_(par), pos_(pos),
24           font_(text.getFont(par, pos)),
25           endspan_(par.fontSpan(pos).last),
26           bodypos_(par.beginOfBody())
27 {}
28
29
30 LyXFont const & FontIterator::operator*() const
31 {
32         return font_;
33 }
34
35
36 LyXFont * FontIterator::operator->()
37 {
38         return &font_;
39 }
40
41
42 FontIterator & FontIterator::operator++()
43 {
44         ++pos_;
45         if (pos_ > endspan_ || pos_ == bodypos_) {
46                 font_ = text_.getFont(par_, pos_);
47                 endspan_ = par_.fontSpan(pos_).last;
48         }
49         return *this;
50 }