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/types.h"
24 /// Standard Sizes (mode styles)
38 // This is the part common to MetricsInfo and PainterInfo
45 MetricsBase(BufferView * bv, LyXFont const & font, int textwidth);
51 /// current math style (display/text/script/..)
53 /// name of current font - mathed specific
55 /// This is the width available in pixels
61 // This contains a MetricsBase and information that's only relevant during
62 // the first phase of the two-phase draw
69 MetricsInfo(BufferView * bv, LyXFont const & font, int textwidth);
77 // This contains a MetricsBase and information that's only relevant during
78 // the second phase of the two-phase draw
83 PainterInfo(BufferView * bv, Painter & pain);
85 void draw(int x, int y, char c);
91 /// Whether the text at this point is right-to-left (for InsetNewline)
95 class TextMetricsInfo {};
100 ViewMetricsInfo(lyx::pit_type p1, lyx::pit_type p2,
101 int y1, int y2) : p1(p1), p2(p2), y1(y1), y2(y2) {}
109 // Generic base for temporarily changing things.
110 // The original state gets restored when the Changer is destructed.
112 template <class Struct, class Temp = Struct>
116 Changer(Struct & orig) : orig_(orig) {}
126 // temporarily change some aspect of a font
127 class FontChanger : public Changer<LyXFont> {
130 FontChanger(LyXFont & orig, char const * font);
136 // temporarily change a full font
137 class FontSetChanger : public Changer<MetricsBase> {
140 FontSetChanger(MetricsBase & mb, char const * font);
146 // temporarily change the style
147 class StyleChanger : public Changer<MetricsBase> {
150 StyleChanger(MetricsBase & mb, Styles style);
156 // temporarily change the style to script style
157 class ScriptChanger : public StyleChanger {
160 ScriptChanger(MetricsBase & mb);
164 // temporarily change the style suitable for use in fractions
165 class FracChanger : public StyleChanger {
168 FracChanger(MetricsBase & mb);
172 // temporarily change the style suitable for use in tabulars and arrays
173 class ArrayChanger : public StyleChanger {
176 ArrayChanger(MetricsBase & mb);
181 // temporarily change the shape of a font
182 class ShapeChanger : public Changer<LyXFont, LyXFont::FONT_SHAPE> {
185 ShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape);
191 // temporarily change the available text width
192 class WidthChanger : public Changer<MetricsBase>
196 WidthChanger(MetricsBase & mb, int width);
202 // temporarily change the used color
203 class ColorChanger : public Changer<LyXFont, std::string> {
206 ColorChanger(LyXFont & font, std::string const & color);