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