kword

KWTableStyle.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2002 Nash Hoogwater <nrhoogwater@wanadoo.nl>
00003    Copyright (C) 2005 David Faure <faure@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; using
00008    version 2 of the License.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef kwtablestyle_h
00022 #define kwtablestyle_h
00023 
00024 #include "KWFrameStyle.h"
00025 #include <KoParagStyle.h>
00026 
00027 #include <qdom.h>
00028 #include <qptrlist.h>
00029 #include <qbrush.h>
00030 
00031 class KWFrameStyleCollection;
00032 class KoStyleCollection;
00033 class KWTableStyle;
00034 class KWDocument;
00035 class KWFrame;
00036 
00047 class KWTableStyle : public KoUserStyle
00048 {
00049 public:
00051     KWTableStyle( const QString & name, KoParagStyle * _style, KWFrameStyle * _frameStyle );
00052 
00053     KWTableStyle( QDomElement & parentElem, KWDocument *_doc, int docVersion=2 );
00054 
00056     KWTableStyle( const KWTableStyle & rhs ) : KoUserStyle( QString::null ) { *this = rhs; }
00057 
00058     ~KWTableStyle() {}
00059 
00060     void operator=( const KWTableStyle & );
00061 
00062     // ATTRIBUTES
00063     KoParagStyle* paragraphStyle() const { return m_paragStyle; }
00064     void setParagraphStyle( KoParagStyle *paragStyle ) { m_paragStyle = paragStyle; }
00065 
00066     KWFrameStyle* frameStyle() const { return m_frameStyle; }
00067     void setFrameStyle( KWFrameStyle *frameStyle ) { m_frameStyle = frameStyle; }
00068 
00070     void saveTableStyle( QDomElement & parentElem );
00072     void saveOasis( KoGenStyles& mainStyles, KoSavingContext& savingContext ) const;
00073 
00075     static KWTableStyle *loadStyle( QDomElement & parentElem, KWDocument *_doc, int docVersion=2 );
00077     void loadOasis( QDomElement & styleElem, KoOasisContext& context, const KoStyleCollection& paragraphStyles, const KWFrameStyleCollection& frameStyles );
00078 
00079 private:
00080     KoParagStyle *m_paragStyle;
00081     KWFrameStyle *m_frameStyle;
00082 };
00083 
00087 class KWTableStyleCollection : public KoUserStyleCollection
00088 {
00089 public:
00090     KWTableStyleCollection();
00091 
00092     static QString defaultStyleName() { return QString::fromLatin1( "Plain" ); }
00093 
00098     KWTableStyle* findStyle( const QString & name ) const {
00099         return static_cast<KWTableStyle*>( KoUserStyleCollection::findStyle( name, defaultStyleName() ) );
00100     }
00101 
00102 
00108     KWTableStyle* findStyleByDisplayName( const QString & name ) const {
00109         return static_cast<KWTableStyle*>( KoUserStyleCollection::findStyleByDisplayName( name ) );
00110     }
00111 
00116     KWTableStyle* addStyle( KWTableStyle* sty ) {
00117         return static_cast<KWTableStyle*>( KoUserStyleCollection::addStyle( sty ) );
00118     }
00119 
00123     KWTableStyle* tableStyleAt( int i ) const {
00124         return static_cast<KWTableStyle*>( m_styleList[i] );
00125     }
00126 
00127     void saveOasis( KoGenStyles& mainStyles, KoSavingContext& savingContext ) const;
00128     int loadOasisStyles( KoOasisContext& context, const KoStyleCollection& paragraphStyles, const KWFrameStyleCollection& frameStyles );
00129 };
00130 
00131 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys