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