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);
87 void draw(int x, int y, std::string const & str);
93 /// Whether the text at this point is right-to-left (for InsetNewline)
97 class TextMetricsInfo {};
102 ViewMetricsInfo(lyx::pit_type p1, lyx::pit_type p2, int y1, int y2,
103 bool singlepar) : p1(p1), p2(p2), y1(y1), y2(y2),
104 singlepar(singlepar) {}
113 // Generic base for temporarily changing things.
114 // The original state gets restored when the Changer is destructed.
116 template <class Struct, class Temp = Struct>
120 Changer(Struct & orig) : orig_(orig) {}
130 // temporarily change some aspect of a font
131 class FontChanger : public Changer<LyXFont> {
134 FontChanger(LyXFont & orig, char const * font);
140 // temporarily change a full font
141 class FontSetChanger : public Changer<MetricsBase> {
144 FontSetChanger(MetricsBase & mb, char const * font);
150 // temporarily change the style
151 class StyleChanger : public Changer<MetricsBase> {
154 StyleChanger(MetricsBase & mb, Styles style);
160 // temporarily change the style to script style
161 class ScriptChanger : public StyleChanger {
164 ScriptChanger(MetricsBase & mb);
168 // temporarily change the style suitable for use in fractions
169 class FracChanger : public StyleChanger {
172 FracChanger(MetricsBase & mb);
176 // temporarily change the style suitable for use in tabulars and arrays
177 class ArrayChanger : public StyleChanger {
180 ArrayChanger(MetricsBase & mb);
185 // temporarily change the shape of a font
186 class ShapeChanger : public Changer<LyXFont, LyXFont::FONT_SHAPE> {
189 ShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape);
195 // temporarily change the available text width
196 class WidthChanger : public Changer<MetricsBase>
200 WidthChanger(MetricsBase & mb, int width);
206 // temporarily change the used color
207 class ColorChanger : public Changer<LyXFont, std::string> {
210 ColorChanger(LyXFont & font, std::string const & color);