]> git.lyx.org Git - lyx.git/blob - src/rowpainter.h
add missing 'else'
[lyx.git] / src / rowpainter.h
1 /**
2  * \file rowpainter.h
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author various
7  * \author John Levon
8  *
9  * Full author contact details are available in file CREDITS
10  */
11
12 #ifndef ROWPAINTER_H
13 #define ROWPAINTER_H
14
15 #include <config.h>
16
17 #include "LString.h"
18 #include "support/types.h"
19
20 class LyXText;
21 class BufferView;
22 class Row;
23 class Paragraph;
24 class Painter;
25 class LyXFont;
26 class VSpace;
27
28 /**
29  * A class used for painting an individual row of text.
30  */
31 class RowPainter {
32 public:
33         /// initialise painter
34         RowPainter(BufferView const & bv, LyXText const & text, Row const & row);
35
36         /// paint the row. Returns true if CHANGED_IN_DRAW (e.g. image was loaded)
37         bool paint(int y_offset, int x_offset, int y, bool cleared = false);
38
39 private:
40         // paint various parts
41         bool paintBackground();
42         void paintSelection();
43         void paintAppendix();
44         void paintDepthBar();
45         void paintChangeBar();
46         void paintFirst();
47         void paintLast();
48         void paintNewline(lyx::pos_type const pos);
49         void paintForeignMark(float const orig_x, LyXFont const & orig_font);
50         void paintHebrewComposeChar(lyx::pos_type & vpos);
51         void paintArabicComposeChar(lyx::pos_type & vpos);
52         void paintChars(lyx::pos_type & vpos, bool hebrew, bool arabic);
53         int paintPageBreak(string const & label, int y);
54         int paintLengthMarker(string const & prefix, VSpace const & vsp, int start);
55         /// returns true when CHANGED_IN_DRAW
56         bool paintText();
57         /// returns true when CHANGED_IN_DRAW
58         bool paintFromPos(lyx::pos_type & vpos);
59         /// returns true when CHANGED_IN_DRAW
60         bool paintInset(lyx::pos_type const pos);
61
62         /// return left margin
63         int leftMargin() const;
64
65         /// return the font at the given pos
66         LyXFont const getFont(lyx::pos_type pos) const;
67
68         /// return the label font for this row
69         LyXFont const getLabelFont() const;
70
71         char const transformChar(char c, lyx::pos_type pos) const;
72
73         /// return pixel width for the given pos
74         int singleWidth(lyx::pos_type pos) const;
75         int singleWidth(lyx::pos_type pos, char c) const;
76
77         /// bufferview to paint on
78         BufferView const & bv_;
79
80         /// Painter to use
81         Painter & pain_;
82
83         /// LyXText for the row
84         LyXText const & text_;
85
86         /// The row to paint
87         Row const & row_;
88
89         /// Row's paragraph
90         Paragraph const & par_;
91
92         // Looks ugly - is
93         int xo_;
94         int yo_;
95         float x_;
96         int y_;
97         bool cleared_;
98         int width_;
99         float separator_;
100         float hfill_;
101         float label_hfill_;
102 };
103
104 /// return the pixel height of a space marker before/after a par
105 int getLengthMarkerHeight(BufferView const & bv, VSpace const & vsp);
106
107 #endif // ROWPAINTER_H