kword

KWTableStyle.h
1/* This file is part of the KDE project
2 Copyright (C) 2002 Nash Hoogwater <nrhoogwater@wanadoo.nl>
3 Copyright (C) 2005 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; using
8 version 2 of the License.
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 kwtablestyle_h
22#define kwtablestyle_h
23
24#include "KWFrameStyle.h"
25#include <KoParagStyle.h>
26
27#include <tqdom.h>
28#include <tqptrlist.h>
29#include <tqbrush.h>
30
32class KoStyleCollection;
33class KWTableStyle;
34class KWDocument;
35class KWFrame;
36
47class KWTableStyle : public KoUserStyle
48{
49public:
51 KWTableStyle( const TQString & name, KoParagStyle * _style, KWFrameStyle * _frameStyle );
52
53 KWTableStyle( TQDomElement & parentElem, KWDocument *_doc, int docVersion=2 );
54
56 KWTableStyle( const KWTableStyle & rhs ) : KoUserStyle( TQString() ) { *this = rhs; }
57
58 ~KWTableStyle() {}
59
60 void operator=( const KWTableStyle & );
61
62 // ATTRIBUTES
63 KoParagStyle* paragraphStyle() const { return m_paragStyle; }
64 void setParagraphStyle( KoParagStyle *paragStyle ) { m_paragStyle = paragStyle; }
65
66 KWFrameStyle* frameStyle() const { return m_frameStyle; }
67 void setFrameStyle( KWFrameStyle *frameStyle ) { m_frameStyle = frameStyle; }
68
70 void saveTableStyle( TQDomElement & parentElem );
72 void saveOasis( KoGenStyles& mainStyles, KoSavingContext& savingContext ) const;
73
75 static KWTableStyle *loadStyle( TQDomElement & parentElem, KWDocument *_doc, int docVersion=2 );
77 void loadOasis( TQDomElement & styleElem, KoOasisContext& context, const KoStyleCollection& paragraphStyles, const KWFrameStyleCollection& frameStyles );
78
79private:
80 KoParagStyle *m_paragStyle;
81 KWFrameStyle *m_frameStyle;
82};
83
87class KWTableStyleCollection : public KoUserStyleCollection
88{
89public:
91
92 static TQString defaultStyleName() { return TQString::fromLatin1( "Plain" ); }
93
98 KWTableStyle* findStyle( const TQString & name ) const {
99 return static_cast<KWTableStyle*>( KoUserStyleCollection::findStyle( name, defaultStyleName() ) );
100 }
101
102
108 KWTableStyle* findStyleByDisplayName( const TQString & name ) const {
109 return static_cast<KWTableStyle*>( KoUserStyleCollection::findStyleByDisplayName( name ) );
110 }
111
117 return static_cast<KWTableStyle*>( KoUserStyleCollection::addStyle( sty ) );
118 }
119
123 KWTableStyle* tableStyleAt( int i ) const {
124 return static_cast<KWTableStyle*>( m_styleList[i] );
125 }
126
127 void saveOasis( KoGenStyles& mainStyles, KoSavingContext& savingContext ) const;
128 int loadOasisStyles( KoOasisContext& context, const KoStyleCollection& paragraphStyles, const KWFrameStyleCollection& frameStyles );
129};
130
131#endif
Collection of frame styles.
The user-visible style for frames (borders and background)
This class represents a single frame.
Definition KWFrame.h:68
Collection of user-defined table styles.
KWTableStyle * findStyle(const TQString &name) const
Find style based on the untranslated name name.
KWTableStyle * addStyle(KWTableStyle *sty)
See KoUserStyleCollection::addStyle.
KWTableStyle * findStyleByDisplayName(const TQString &name) const
Find style based on the display name name.
KWTableStyle * tableStyleAt(int i) const
Return style number i.
Table style (can created/modified/deleted by the user) A table style is simply a paragraph style and ...
KWTableStyle(const KWTableStyle &rhs)
Copy another framestyle.
static KWTableStyle * loadStyle(TQDomElement &parentElem, KWDocument *_doc, int docVersion=2)
load (old xml format)
void loadOasis(TQDomElement &styleElem, KoOasisContext &context, const KoStyleCollection &paragraphStyles, const KWFrameStyleCollection &frameStyles)
load (new oasis xml format)
void saveOasis(KoGenStyles &mainStyles, KoSavingContext &savingContext) const
save (new oasis xml format)
void saveTableStyle(TQDomElement &parentElem)
save (old xml format)