]> git.lyx.org Git - features.git/blob - src/rowpainter.h
* RowPainter:
[features.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 "support/types.h"
18
19 namespace lyx {
20
21 class Bidi;
22 class BufferView;
23 class Font;
24 class Inset;
25 class PainterInfo;
26 class Paragraph;
27 class ParagraphList;
28 class ParagraphMetrics;
29 class Row;
30 class Text;
31 class TextMetrics;
32 class ViewMetricsInfo;
33
34 namespace frontend { class Painter; }
35
36 /**
37  * A class used for painting an individual row of text.
38  * FIXME: get rid of that class.
39  */
40 class RowPainter {
41 public:
42         /// initialise and run painter
43         RowPainter(PainterInfo & pi, Text const & text,
44                 pit_type pit, Row const & row, Bidi & bidi, int x, int y);
45
46         /// paint various parts
47         /// FIXME: transfer to TextMetrics
48         void paintAppendix();
49         void paintDepthBar();
50         void paintChangeBar();
51         void paintFirst();
52         void paintLast();
53         void paintText();
54         void paintOnlyInsets();
55
56 private:
57         void paintForeignMark(double orig_x, Font const & font, int desc = 0);
58         void paintHebrewComposeChar(pos_type & vpos, Font const & font);
59         void paintArabicComposeChar(pos_type & vpos, Font const & font);
60         void paintChars(pos_type & vpos, Font const & font,
61                         bool hebrew, bool arabic);
62         int paintAppendixStart(int y);
63         void paintFromPos(pos_type & vpos);
64         void paintInset(Inset const * inset, pos_type const pos);
65         void paintHfill(pos_type const pos, pos_type const body_pos);
66
67         /// return left margin
68         int leftMargin() const;
69
70         /// return the label font for this row
71         Font const getLabelFont() const;
72
73         /// bufferview to paint on
74         BufferView & bv_;
75
76         /// Painter to use
77         frontend::Painter & pain_;
78
79         /// Text for the row
80         Text const & text_;
81         TextMetrics & text_metrics_;
82         ParagraphList const & pars_;
83
84         /// The row to paint
85         Row const & row_;
86
87         /// Row's paragraph
88         pit_type const pit_;
89         Paragraph const & par_;
90         ParagraphMetrics const & pm_;
91
92         /// bidi cache, comes from outside the rowpainter because
93         /// rowpainters are normally created in a for loop and there only
94         /// one of them is active at a time.
95         Bidi & bidi_;
96
97         /// is row erased? (change tracking)
98         bool erased_;
99
100         // Looks ugly - is
101         double const xo_;
102         int const yo_;    // current baseline
103         double x_;
104         int width_;
105 };
106
107 } // namespace lyx
108
109 #endif // ROWPAINTER_H