~ubuntu-branches/ubuntu/breezy/koffice/breezy-security

« back to all changes in this revision

Viewing changes to lib/kformula/spaceelement.h

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040509113300-vfrdadqsvjfuhn3b
Tags: 1:1.3.1-1
* New upstream bugfix release.
* Built against newer imagemagick (closes: #246623).
* Made koffice-libs/kformula recommend/depend on latex-xft-fonts, which
  provides mathematical fonts that the formula editor can use.  Also
  patched the kformula part to make these fonts the default.
* Changed kword menu hint from "WordProcessors" to "Word processors"
  (closes: #246209).
* Spellchecker configuration is now fixed (closes: #221256, #227568).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright (C) 2001 Andrea Rizzi <rizzi@kde.org>
 
3
                      Ulrich Kuettler <ulrich.kuettler@mailbox.tu-dresden.de>
 
4
 
 
5
   This library is free software; you can redistribute it and/or
 
6
   modify it under the terms of the GNU Library General Public
 
7
   License as published by the Free Software Foundation; either
 
8
   version 2 of the License, or (at your option) any later version.
 
9
 
 
10
   This library is distributed in the hope that it will be useful,
 
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
   Library General Public License for more details.
 
14
 
 
15
   You should have received a copy of the GNU Library General Public License
 
16
   along with this library; see the file COPYING.LIB.  If not, write to
 
17
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
18
   Boston, MA 02111-1307, USA.
 
19
*/
 
20
 
 
21
#ifndef SPACEELEMENT_H
 
22
#define SPACEELEMENT_H
 
23
 
 
24
#include <qfont.h>
 
25
#include <qstring.h>
 
26
 
 
27
#include "basicelement.h"
 
28
 
 
29
class SymbolTable;
 
30
 
 
31
 
 
32
KFORMULA_NAMESPACE_BEGIN
 
33
 
 
34
/**
 
35
 * A element that represents a space.
 
36
 */
 
37
class SpaceElement : public BasicElement {
 
38
    SpaceElement operator=( const SpaceElement& ) { return *this; }
 
39
public:
 
40
 
 
41
    SpaceElement( SpaceWidth space = THIN, bool tab=false, BasicElement* parent = 0 );
 
42
    SpaceElement( const SpaceElement& );
 
43
 
 
44
    virtual SpaceElement* clone() {
 
45
        return new SpaceElement( *this );
 
46
    }
 
47
 
 
48
    virtual bool accept( ElementVisitor* visitor );
 
49
 
 
50
    /**
 
51
     * @returns the type of this element. Used for
 
52
     * parsing a sequence.
 
53
     */
 
54
    //virtual TokenType getTokenType() const;
 
55
 
 
56
    /**
 
57
     * @returns the character that represents this element. Used for
 
58
     * parsing a sequence.
 
59
     */
 
60
    virtual QChar getCharacter() const { return ' '; }
 
61
 
 
62
    // drawing
 
63
    //
 
64
    // Drawing depends on a conspace which knows the required properties like
 
65
    // fonts, spaces and such.
 
66
    // It is essential to calculate elements size with the same conspace
 
67
    // before you draw.
 
68
 
 
69
    /**
 
70
     * Calculates our width and height and
 
71
     * our children's parentPosition.
 
72
     */
 
73
    virtual void calcSizes( const ContextStyle& context,
 
74
                            ContextStyle::TextStyle tstyle,
 
75
                            ContextStyle::IndexStyle istyle );
 
76
 
 
77
    /**
 
78
     * Draws the whole element including its children.
 
79
     * The `parentOrigin' is the point this element's parent starts.
 
80
     * We can use our parentPosition to get our own origin then.
 
81
     */
 
82
    virtual void draw( QPainter& painter, const LuPixelRect& r,
 
83
                       const ContextStyle& context,
 
84
                       ContextStyle::TextStyle tstyle,
 
85
                       ContextStyle::IndexStyle istyle,
 
86
                       const LuPixelPoint& parentOrigin );
 
87
 
 
88
    /**
 
89
     * Moves the cursor away from the given child. The cursor is
 
90
     * guaranteed to be inside this element.
 
91
     */
 
92
    //virtual void childWillVanish(FormulaCursor*, BasicElement*) {}
 
93
 
 
94
    /**
 
95
     * @returns the latex representation of the element and
 
96
     * of the element's children
 
97
     */
 
98
    virtual QString toLatex();
 
99
 
 
100
    virtual void writeMathML( QDomDocument doc, QDomNode parent );
 
101
 
 
102
protected:
 
103
 
 
104
    //Save/load support
 
105
 
 
106
    /**
 
107
     * @returns the tag name of this element type.
 
108
     */
 
109
    virtual QString getTagName() const { return "SPACE"; }
 
110
 
 
111
    /**
 
112
     * Appends our attributes to the dom element.
 
113
     */
 
114
    virtual void writeDom(QDomElement element);
 
115
 
 
116
    /**
 
117
     * Reads our attributes from the element.
 
118
     * Returns false if it failed.
 
119
     */
 
120
    virtual bool readAttributesFromDom(QDomElement element);
 
121
 
 
122
    /**
 
123
     * Reads our content from the node. Sets the node to the next node
 
124
     * that needs to be read.
 
125
     * Returns false if it failed.
 
126
     */
 
127
    virtual bool readContentFromDom(QDomNode& node);
 
128
 
 
129
private:
 
130
 
 
131
    SpaceWidth spaceWidth;
 
132
 
 
133
    /**
 
134
     * Whether this space behaves like a tab.
 
135
     */
 
136
    bool m_tab;
 
137
};
 
138
 
 
139
KFORMULA_NAMESPACE_END
 
140
 
 
141
#endif // SPACEELEMENT_H