glyphelement.h
1/* This file is part of the KDE project
2 Copyright (C) 2006 Alfredo Beaumont Sainz <alfredo.beaumont@gmail.com>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef GLYPHELEMENT_H
21#define GLYPHELEMENT_H
22
23#include "textelement.h"
24
25KFORMULA_NAMESPACE_BEGIN
26
27class GlyphElement : public TextElement {
28 typedef TextElement inherited;
29public:
30 GlyphElement( BasicElement* parent = 0 );
31
36 virtual void calcSizes( const ContextStyle& cstyle,
38 ContextStyle::IndexStyle istyle,
39 StyleAttributes& style );
40
46 virtual void draw( TQPainter& painter, const LuPixelRect& r,
47 const ContextStyle& context,
49 ContextStyle::IndexStyle istyle,
50 StyleAttributes& style,
51 const LuPixelPoint& parentOrigin );
52
53protected:
54 virtual bool readAttributesFromMathMLDom( const TQDomElement &element );
55
56private:
57 virtual TQString getElementName() const { return "mglyph"; }
58 virtual void writeMathMLAttributes( TQDomElement& element ) const ;
59
60 TQChar m_char; // Char to be shown
61 TQString m_fontFamily; // Font family to use
62 TQString m_alt; // Alternative text if font family not found
63 bool m_hasFont; // Whether required font is available
64};
65
66KFORMULA_NAMESPACE_END
67
68#endif // GLYPHELEMENT_H
Basis of every formula element.
virtual bool readAttributesFromMathMLDom(const TQDomElement &element)
Reads our attributes from the MathML element.
Contains all the style information for the formela.
TextStyle
Textstyles like in TeX.
An element that represents one char.
Definition textelement.h:37
virtual void draw(TQPainter &painter, const LuPixelRect &r, const ContextStyle &context, ContextStyle::TextStyle tstyle, ContextStyle::IndexStyle istyle, StyleAttributes &style, const LuPixelPoint &parentOrigin)
Draws the whole element including its children.
virtual void calcSizes(const ContextStyle &cstyle, ContextStyle::TextStyle tstyle, ContextStyle::IndexStyle istyle, StyleAttributes &style)
Calculates our width and height and our children's parentPosition.