4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
16 #include "support/docstring.h"
22 namespace frontend { class Painter; }
25 /// Standard Sizes (mode styles)
39 // This is the part common to MetricsInfo and PainterInfo
46 MetricsBase(BufferView * bv, LyXFont const & font, int textwidth);
52 /// current math style (display/text/script/..)
54 /// name of current font - mathed specific
56 /// This is the width available in pixels
62 // This contains a MetricsBase and information that's only relevant during
63 // the first phase of the two-phase draw
70 MetricsInfo(BufferView * bv, LyXFont const & font, int textwidth);
78 // This contains a MetricsBase and information that's only relevant during
79 // the second phase of the two-phase draw
84 PainterInfo(BufferView * bv, frontend::Painter & pain);
86 void draw(int x, int y, char_type c);
88 void draw(int x, int y, docstring const & str);
93 frontend::Painter & pain;
94 /// Whether the text at this point is right-to-left (for InsetNewline)
96 /// Whether the parent is deleted (change tracking)
100 class TextMetricsInfo {};
102 class ViewMetricsInfo
106 : p1(0), p2(0), y1(0), y2(0), singlepar(false), size(0)
108 ViewMetricsInfo(pit_type p1, pit_type p2, int y1, int y2,
109 bool singlepar, pit_type size)
110 : p1(p1), p2(p2), y1(y1), y2(y2), singlepar(singlepar), size(size)
122 // Generic base for temporarily changing things.
123 // The original state gets restored when the Changer is destructed.
125 template <class Struct, class Temp = Struct>
129 Changer(Struct & orig) : orig_(orig) {}
139 // temporarily change some aspect of a font
140 class FontChanger : public Changer<LyXFont> {
143 FontChanger(LyXFont & orig, char const * font);
149 // temporarily change a full font
150 class FontSetChanger : public Changer<MetricsBase> {
153 FontSetChanger(MetricsBase & mb, char const * font);
159 // temporarily change the style
160 class StyleChanger : public Changer<MetricsBase> {
163 StyleChanger(MetricsBase & mb, Styles style);
169 // temporarily change the style to script style
170 class ScriptChanger : public StyleChanger {
173 ScriptChanger(MetricsBase & mb);
177 // temporarily change the style suitable for use in fractions
178 class FracChanger : public StyleChanger {
181 FracChanger(MetricsBase & mb);
185 // temporarily change the style suitable for use in tabulars and arrays
186 class ArrayChanger : public StyleChanger {
189 ArrayChanger(MetricsBase & mb);
194 // temporarily change the shape of a font
195 class ShapeChanger : public Changer<LyXFont, LyXFont::FONT_SHAPE> {
198 ShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape);
204 // temporarily change the available text width
205 class WidthChanger : public Changer<MetricsBase>
209 WidthChanger(MetricsBase & mb, int width);
215 // temporarily change the used color
216 class ColorChanger : public Changer<LyXFont, std::string> {
219 ColorChanger(LyXFont & font, std::string const & color);