]> git.lyx.org Git - lyx.git/blob - src/rowpainter.h
Draw right-to-left text string-wise using Qt
[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 "Bidi.h"
18 #include "Changes.h"
19
20 #include "support/types.h"
21
22 namespace lyx {
23
24 class BufferView;
25 class Font;
26 class FontInfo;
27 class Inset;
28 class Language;
29 class PainterInfo;
30 class Paragraph;
31 class ParagraphList;
32 class ParagraphMetrics;
33 class Row;
34 class Text;
35 class TextMetrics;
36
37 namespace frontend { class Painter; }
38
39 /**
40  * A class used for painting an individual row of text.
41  * FIXME: get rid of that class.
42  */
43 class RowPainter {
44 public:
45         /// initialise and run painter
46         RowPainter(PainterInfo & pi, Text const & text,
47                 pit_type pit, Row const & row, int x, int y);
48
49         /// paint various parts
50         /// FIXME: transfer to TextMetrics
51         void paintAppendix();
52         void paintDepthBar();
53         void paintChangeBar();
54         void paintFirst();
55         void paintLast();
56         void paintText();
57         void paintOnlyInsets();
58         void paintSelection();
59
60 private:
61         void paintSeparator(double orig_x, double width, FontInfo const & font);
62         void paintForeignMark(double orig_x, Language const * lang, int desc = 0);
63         void paintMisspelledMark(double orig_x, bool changed);
64         void paintChars(pos_type & vpos, Font const & font);
65         int paintAppendixStart(int y);
66         void paintFromPos(pos_type & vpos, bool changed);
67         void paintInset(Inset const * inset, pos_type const pos);
68         void paintInlineCompletion(Font const & font);
69
70         /// return left margin
71         int leftMargin() const;
72
73         /// return the label font for this row
74         FontInfo labelFont() const;
75
76         ///
77         void paintLabel();
78         ///
79         void paintTopLevelLabel();
80
81
82         /// contains painting related information.
83         PainterInfo & pi_;
84
85         /// Text for the row
86         Text const & text_;
87         TextMetrics & text_metrics_;
88         ParagraphList const & pars_;
89
90         /// The row to paint
91         Row const & row_;
92
93         /// Row's paragraph
94         pit_type const pit_;
95         Paragraph const & par_;
96         ParagraphMetrics const & pm_;
97
98         /// bidi cache
99         Bidi bidi_;
100
101         /// row changed? (change tracking)
102         Change const change_;
103
104         // Looks ugly - is
105         double const xo_;
106         int const yo_;    // current baseline
107         double x_;
108         int width_;
109         float solid_line_thickness_;
110         int solid_line_offset_;
111         float dotted_line_thickness_;
112         int dotted_line_offset_;
113 };
114
115 } // namespace lyx
116
117 #endif // ROWPAINTER_H