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)
95 /// Whether the parent is deleted (change tracking)
99 class TextMetricsInfo {};
101 class ViewMetricsInfo
104 ViewMetricsInfo(lyx::pit_type p1, lyx::pit_type p2, int y1, int y2,
105 bool singlepar) : p1(p1), p2(p2), y1(y1), y2(y2),
106 singlepar(singlepar) {}
115 // Generic base for temporarily changing things.
116 // The original state gets restored when the Changer is destructed.
118 template <class Struct, class Temp = Struct>
122 Changer(Struct & orig) : orig_(orig) {}
132 // temporarily change some aspect of a font
133 class FontChanger : public Changer<LyXFont> {
136 FontChanger(LyXFont & orig, char const * font);
142 // temporarily change a full font
143 class FontSetChanger : public Changer<MetricsBase> {
146 FontSetChanger(MetricsBase & mb, char const * font);
152 // temporarily change the style
153 class StyleChanger : public Changer<MetricsBase> {
156 StyleChanger(MetricsBase & mb, Styles style);
162 // temporarily change the style to script style
163 class ScriptChanger : public StyleChanger {
166 ScriptChanger(MetricsBase & mb);
170 // temporarily change the style suitable for use in fractions
171 class FracChanger : public StyleChanger {
174 FracChanger(MetricsBase & mb);
178 // temporarily change the style suitable for use in tabulars and arrays
179 class ArrayChanger : public StyleChanger {
182 ArrayChanger(MetricsBase & mb);
187 // temporarily change the shape of a font
188 class ShapeChanger : public Changer<LyXFont, LyXFont::FONT_SHAPE> {
191 ShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape);
197 // temporarily change the available text width
198 class WidthChanger : public Changer<MetricsBase>
202 WidthChanger(MetricsBase & mb, int width);
208 // temporarily change the used color
209 class ColorChanger : public Changer<LyXFont, std::string> {
212 ColorChanger(LyXFont & font, std::string const & color);