]> git.lyx.org Git - lyx.git/blob - src/RowPainter.h
f559eeb223a214a245746e5c45b5a38f68f665ea
[lyx.git] / src / RowPainter.h
1 // -*- C++ -*-
2 /**
3  * \file RowPainter.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author various
8  * \author John Levon
9  * \author André Pönitz
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef ROWPAINTER_H
15 #define ROWPAINTER_H
16
17 #include "Changes.h"
18
19 #include "support/types.h"
20
21 namespace lyx {
22
23 class BufferView;
24 class Font;
25 class FontInfo;
26 class Inset;
27 class Language;
28 class PainterInfo;
29 class Paragraph;
30 class ParagraphList;
31 class ParagraphMetrics;
32 class Row;
33 class Text;
34 class TextMetrics;
35
36 namespace frontend { class Painter; }
37
38 /**
39  * A class used for painting an individual row of text.
40  * FIXME: get rid of that class.
41  */
42 class RowPainter {
43 public:
44         /// initialise and run painter
45         RowPainter(PainterInfo & pi, Text const & text,
46                 pit_type pit, Row const & row, int x, int y);
47
48         /// paint various parts
49         /// FIXME: transfer to TextMetrics
50         void paintAppendix() const;
51         void paintDepthBar() const;
52         void paintChangeBar() const;
53         void paintTooLargeMarks(bool const left, bool const right) const;
54         void paintFirst() const;
55         void paintLast();
56         void paintText();
57         void paintOnlyInsets();
58         void paintSelection() const;
59
60 private:
61         void paintSeparator(double width, Font const & font);
62         void paintForeignMark(double orig_x, Language const * lang, int desc = 0) const;
63         void paintStringAndSel(docstring const & str, Font const & font,
64                          Change const & change,
65                          pos_type start_pos, pos_type end_pos);
66         void paintMisspelledMark(double orig_x,
67                                  docstring const & str, Font const & font,
68                                  pos_type pos, bool changed) const;
69         void paintChange(double orig_x , Font const & font, Change const & change) const;
70         int paintAppendixStart(int y) const;
71         void paintInset(Inset const * inset, Font const & font,
72                     Change const & change, pos_type const pos);
73
74         /// return the label font for this row
75         FontInfo labelFont() const;
76
77         ///
78         void paintLabel() const;
79         ///
80         void paintTopLevelLabel() const;
81
82
83         /// contains painting related information.
84         PainterInfo & pi_;
85
86         /// Text for the row
87         Text const & text_;
88         TextMetrics const & text_metrics_;
89         ParagraphList const & pars_;
90
91         /// The row to paint
92         Row const & row_;
93
94         /// Row's paragraph
95         pit_type const pit_;
96         Paragraph const & par_;
97         ParagraphMetrics const & pm_;
98
99         /// row changed? (change tracking)
100         Change const change_;
101
102         // Looks ugly - is
103         double const xo_;
104         int const yo_;    // current baseline
105         double x_;
106         int width_;
107         int solid_line_thickness_;
108         int solid_line_offset_;
109         int dotted_line_thickness_;
110         int dotted_line_offset_;
111 };
112
113 } // namespace lyx
114
115 #endif // ROWPAINTER_H