lib

KoStyleStack.h
1/* This file is part of the KDE project
2 Copyright (c) 2003 Lukas Tinkl <lukas@kde.org>
3 Copyright (c) 2003 David Faure <faure@kde.org>
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., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KOSTYLESTACK_H
22#define KOSTYLESTACK_H
23
24
25#include <tqvaluelist.h>
26#include <tqdom.h>
27#include <tqvaluestack.h>
28
29#include <tdemacros.h>
30
31#include "koffice_export.h"
32
59class KOFFICECORE_EXPORT KoStyleStack
60{
61public:
69 KoStyleStack( const char* styleNSURI, const char* foNSURI );
70 virtual ~KoStyleStack();
71
75 void clear();
76
81 void save();
82
86 void restore();
87
91 void pop();
92
96 void push( const TQDomElement& style );
97
103 bool hasAttribute( const TQString& name, const TQString& detail = TQString() ) const TDE_DEPRECATED;
104
109 TQString attribute( const TQString& name, const TQString& detail = TQString() ) const TDE_DEPRECATED;
110
116 bool hasAttributeNS( const char* nsURI, const char* localName, const char* detail = 0 ) const;
117
122 TQString attributeNS( const char* nsURI, const char* localName, const char* detail = 0 ) const;
123
127 bool hasChildNode( const TQString & name ) const TDE_DEPRECATED;
128
133 TQDomElement childNode( const TQString & name ) const TDE_DEPRECATED;
134
138 bool hasChildNodeNS( const char* nsURI, const char* localName ) const;
139
145 TQDomElement childNodeNS( const char* nsURI, const char* localName ) const;
146
150 double fontSize() const;
151
158 TQString userStyleName( const TQString& family ) const;
159
164 TQString userStyleDisplayName( const TQString& family ) const;
165
173 void setTypeProperties( const char* typeProperties );
174
175private:
176 bool isUserStyle( const TQDomElement& e, const TQString& family ) const;
177
178private:
180 TQValueStack<int> m_marks;
181
186 TQValueList<TQDomElement> m_stack;
187
188 TQCString m_propertiesTagName;
189
190 const char* m_styleNSURI;
191 const char* m_foNSURI;
192
193 class KoStyleStackPrivate;
194 KoStyleStackPrivate *d;
195
196 // forbidden
197 void operator=( const KoStyleStack& );
198 KoStyleStack( const KoStyleStack& );
199};
200
201#endif /* KOSTYLESTACK_H */
KoStyleStack()
Create a OASIS style stack.
bool hasAttributeNS(const char *nsURI, const char *localName, const char *detail=0) const
Check if any of the styles on the stack has an attribute called 'name'-'detail' where detail is e....
TQDomElement childNode(const TQString &name) const TDE_DEPRECATED
Search for a child node called 'name', starting on top of the stack, and return it.
void save()
Save the current state of the stack.
void clear()
Clears the complete stack.
TQDomElement childNodeNS(const char *nsURI, const char *localName) const
Search for a child element which has a child element called 'localName' in the namespace 'nsURI' star...
void setTypeProperties(const char *typeProperties)
Set the type of properties that will be looked for.
bool hasChildNode(const TQString &name) const TDE_DEPRECATED
Check if any of the styles on the stack has a child node called 'name'.
double fontSize() const
Special case for the current font size, due to special handling of fo:font-size="115%".
void push(const TQDomElement &style)
Pushes the new style onto the stack.
bool hasAttribute(const TQString &name, const TQString &detail=TQString()) const TDE_DEPRECATED
Check if any of the styles on the stack has an attribute called 'name'-'detail' where detail is e....
TQString attribute(const TQString &name, const TQString &detail=TQString()) const TDE_DEPRECATED
Search for the attribute called 'name', starting on top of the stack, and return it.
TQString attributeNS(const char *nsURI, const char *localName, const char *detail=0) const
Search for the attribute called 'name', starting on top of the stack, and return it.
bool hasChildNodeNS(const char *nsURI, const char *localName) const
Check if any of the styles on the stack has a child element called 'localName' in the namespace 'nsUR...
void pop()
Removes the style on top of the stack.
void restore()
Restore the stack to the state it was at the corresponding save() call.
TQString userStyleDisplayName(const TQString &family) const
Return the display name of the style specified by the user, i.e.
TQString userStyleName(const TQString &family) const
Return the name of the style specified by the user, i.e.