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"
29 /// Standard Sizes (mode styles)
43 // This is the part common to MetricsInfo and PainterInfo
50 MetricsBase(BufferView * bv, LyXFont const & font, int textwidth);
56 /// current math style (display/text/script/..)
58 /// name of current font - mathed specific
60 /// This is the width available in pixels
66 // This contains a MetricsBase and information that's only relevant during
67 // the first phase of the two-phase draw
74 MetricsInfo(BufferView * bv, LyXFont const & font, int textwidth);
82 // This contains a MetricsBase and information that's only relevant during
83 // the second phase of the two-phase draw
88 PainterInfo(BufferView * bv, lyx::frontend::Painter & pain);
90 void draw(int x, int y, char c);
92 void draw(int x, int y, std::string const & str);
97 lyx::frontend::Painter & pain;
98 /// Whether the text at this point is right-to-left (for InsetNewline)
100 /// Whether the parent is deleted (change tracking)
104 class TextMetricsInfo {};
106 class ViewMetricsInfo
109 ViewMetricsInfo(lyx::pit_type p1, lyx::pit_type p2, int y1, int y2,
110 bool singlepar, lyx::pit_type size) : p1(p1), p2(p2),
111 y1(y1), y2(y2), singlepar(singlepar), size(size) {}
121 // Generic base for temporarily changing things.
122 // The original state gets restored when the Changer is destructed.
124 template <class Struct, class Temp = Struct>
128 Changer(Struct & orig) : orig_(orig) {}
138 // temporarily change some aspect of a font
139 class FontChanger : public Changer<LyXFont> {
142 FontChanger(LyXFont & orig, char const * font);
148 // temporarily change a full font
149 class FontSetChanger : public Changer<MetricsBase> {
152 FontSetChanger(MetricsBase & mb, char const * font);
158 // temporarily change the style
159 class StyleChanger : public Changer<MetricsBase> {
162 StyleChanger(MetricsBase & mb, Styles style);
168 // temporarily change the style to script style
169 class ScriptChanger : public StyleChanger {
172 ScriptChanger(MetricsBase & mb);
176 // temporarily change the style suitable for use in fractions
177 class FracChanger : public StyleChanger {
180 FracChanger(MetricsBase & mb);
184 // temporarily change the style suitable for use in tabulars and arrays
185 class ArrayChanger : public StyleChanger {
188 ArrayChanger(MetricsBase & mb);
193 // temporarily change the shape of a font
194 class ShapeChanger : public Changer<LyXFont, LyXFont::FONT_SHAPE> {
197 ShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape);
203 // temporarily change the available text width
204 class WidthChanger : public Changer<MetricsBase>
208 WidthChanger(MetricsBase & mb, int width);
214 // temporarily change the used color
215 class ColorChanger : public Changer<LyXFont, std::string> {
218 ColorChanger(LyXFont & font, std::string const & color);