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
);
91 /// Whether the text at this point is right-to-left (for InsetNewline)
95 class TextMetricsInfo
{};
100 ViewMetricsInfo(lyx::pit_type p1
, lyx::pit_type p2
, int y1
, int y2
,
101 bool singlepar
) : p1(p1
), p2(p2
), y1(y1
), y2(y2
),
102 singlepar(singlepar
) {}
111 // Generic base for temporarily changing things.
112 // The original state gets restored when the Changer is destructed.
114 template <class Struct
, class Temp
= Struct
>
118 Changer(Struct
& orig
) : orig_(orig
) {}
128 // temporarily change some aspect of a font
129 class FontChanger
: public Changer
<LyXFont
> {
132 FontChanger(LyXFont
& orig
, char const * font
);
138 // temporarily change a full font
139 class FontSetChanger
: public Changer
<MetricsBase
> {
142 FontSetChanger(MetricsBase
& mb
, char const * font
);
148 // temporarily change the style
149 class StyleChanger
: public Changer
<MetricsBase
> {
152 StyleChanger(MetricsBase
& mb
, Styles style
);
158 // temporarily change the style to script style
159 class ScriptChanger
: public StyleChanger
{
162 ScriptChanger(MetricsBase
& mb
);
166 // temporarily change the style suitable for use in fractions
167 class FracChanger
: public StyleChanger
{
170 FracChanger(MetricsBase
& mb
);
174 // temporarily change the style suitable for use in tabulars and arrays
175 class ArrayChanger
: public StyleChanger
{
178 ArrayChanger(MetricsBase
& mb
);
183 // temporarily change the shape of a font
184 class ShapeChanger
: public Changer
<LyXFont
, LyXFont::FONT_SHAPE
> {
187 ShapeChanger(LyXFont
& font
, LyXFont::FONT_SHAPE shape
);
193 // temporarily change the available text width
194 class WidthChanger
: public Changer
<MetricsBase
>
198 WidthChanger(MetricsBase
& mb
, int width
);
204 // temporarily change the used color
205 class ColorChanger
: public Changer
<LyXFont
, std::string
> {
208 ColorChanger(LyXFont
& font
, std::string
const & color
);