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, lyx::pit_type size) : p1(p1), p2(p2),
106 y1(y1), y2(y2), singlepar(singlepar), size(size) {}
116 // Generic base for temporarily changing things.
117 // The original state gets restored when the Changer is destructed.
119 template <class Struct, class Temp = Struct>
123 Changer(Struct & orig) : orig_(orig) {}
133 // temporarily change some aspect of a font
134 class FontChanger : public Changer<LyXFont> {
137 FontChanger(LyXFont & orig, char const * font);
143 // temporarily change a full font
144 class FontSetChanger : public Changer<MetricsBase> {
147 FontSetChanger(MetricsBase & mb, char const * font);
153 // temporarily change the style
154 class StyleChanger : public Changer<MetricsBase> {
157 StyleChanger(MetricsBase & mb, Styles style);
163 // temporarily change the style to script style
164 class ScriptChanger : public StyleChanger {
167 ScriptChanger(MetricsBase & mb);
171 // temporarily change the style suitable for use in fractions
172 class FracChanger : public StyleChanger {
175 FracChanger(MetricsBase & mb);
179 // temporarily change the style suitable for use in tabulars and arrays
180 class ArrayChanger : public StyleChanger {
183 ArrayChanger(MetricsBase & mb);
188 // temporarily change the shape of a font
189 class ShapeChanger : public Changer<LyXFont, LyXFont::FONT_SHAPE> {
192 ShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape);
198 // temporarily change the available text width
199 class WidthChanger : public Changer<MetricsBase>
203 WidthChanger(MetricsBase & mb, int width);
209 // temporarily change the used color
210 class ColorChanger : public Changer<LyXFont, std::string> {
213 ColorChanger(LyXFont & font, std::string const & color);