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
44 MetricsBase(BufferView * bv, LyXFont const & font, int textwidth);
50 /// current math style (display/text/script/..)
52 /// name of current font - mathed specific
54 /// This is the width available in pixels
60 // This contains a MetricsBase and information that's only relevant during
61 // the first phase of the two-phase draw
67 MetricsInfo(BufferView * bv, LyXFont const & font, int textwidth);
75 // This contains a MetricsBase and information that's only relevant during
76 // the second phase of the two-phase draw
80 PainterInfo(BufferView * bv, Painter & pain);
82 void draw(int x, int y, char c);
88 /// Whether the text at this point is right-to-left (for InsetNewline)
92 struct TextMetricsInfo {};
95 struct ViewMetricsInfo
97 ViewMetricsInfo(lyx::pit_type p1, lyx::pit_type p2,
98 int y1, int y2) : p1(p1), p2(p2), y1(y1), y2(y2) {}
106 // Generic base for temporarily changing things.
107 // The original state gets restored when the Changer is destructed.
109 template <class Struct, class Temp = Struct>
112 Changer(Struct & orig) : orig_(orig) {}
122 // temporarily change some aspect of a font
123 struct FontChanger : public Changer<LyXFont> {
125 FontChanger(LyXFont & orig, char const * font);
131 // temporarily change a full font
132 struct FontSetChanger : public Changer<MetricsBase> {
134 FontSetChanger(MetricsBase & mb, char const * font);
140 // temporarily change the style
141 struct StyleChanger : public Changer<MetricsBase> {
143 StyleChanger(MetricsBase & mb, Styles style);
149 // temporarily change the style to script style
150 struct ScriptChanger : public StyleChanger {
152 ScriptChanger(MetricsBase & mb);
156 // temporarily change the style suitable for use in fractions
157 struct FracChanger : public StyleChanger {
159 FracChanger(MetricsBase & mb);
163 // temporarily change the style suitable for use in tabulars and arrays
164 struct ArrayChanger : public StyleChanger {
166 ArrayChanger(MetricsBase & mb);
171 // temporarily change the shape of a font
172 struct ShapeChanger : public Changer<LyXFont, LyXFont::FONT_SHAPE> {
174 ShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape);
180 // temporarily change the available text width
181 struct WidthChanger : public Changer<MetricsBase>
184 WidthChanger(MetricsBase & mb, int width);
190 // temporarily change the used color
191 struct ColorChanger : public Changer<LyXFont, std::string> {
193 ColorChanger(LyXFont & font, std::string const & color);