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
110 : p1(0), p2(0), y1(0), y2(0),
111 singlepar(false), size(0) {}
112 ViewMetricsInfo(lyx::pit_type p1, lyx::pit_type p2, int y1, int y2,
113 bool singlepar, lyx::pit_type size)
114 : p1(p1), p2(p2), y1(y1), y2(y2),
115 singlepar(singlepar), size(size) {}
125 // Generic base for temporarily changing things.
126 // The original state gets restored when the Changer is destructed.
128 template <class Struct, class Temp = Struct>
132 Changer(Struct & orig) : orig_(orig) {}
142 // temporarily change some aspect of a font
143 class FontChanger : public Changer<LyXFont> {
146 FontChanger(LyXFont & orig, char const * font);
152 // temporarily change a full font
153 class FontSetChanger : public Changer<MetricsBase> {
156 FontSetChanger(MetricsBase & mb, char const * font);
162 // temporarily change the style
163 class StyleChanger : public Changer<MetricsBase> {
166 StyleChanger(MetricsBase & mb, Styles style);
172 // temporarily change the style to script style
173 class ScriptChanger : public StyleChanger {
176 ScriptChanger(MetricsBase & mb);
180 // temporarily change the style suitable for use in fractions
181 class FracChanger : public StyleChanger {
184 FracChanger(MetricsBase & mb);
188 // temporarily change the style suitable for use in tabulars and arrays
189 class ArrayChanger : public StyleChanger {
192 ArrayChanger(MetricsBase & mb);
197 // temporarily change the shape of a font
198 class ShapeChanger : public Changer<LyXFont, LyXFont::FONT_SHAPE> {
201 ShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape);
207 // temporarily change the available text width
208 class WidthChanger : public Changer<MetricsBase>
212 WidthChanger(MetricsBase & mb, int width);
218 // temporarily change the used color
219 class ColorChanger : public Changer<LyXFont, std::string> {
222 ColorChanger(LyXFont & font, std::string const & color);