kword

KWTableTemplate.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2002 Nash Hoogwater <nrhoogwater@wanadoo.nl>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; using
00007    version 2 of the License.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef kwtabletemplate_h
00021 #define kwtabletemplate_h
00022 
00023 #include "KWTableStyle.h"
00024 
00025 #include <qdom.h>
00026 #include <qptrlist.h>
00027 #include <qbrush.h>
00028 
00029 class KWTableTemplate;
00030 class KWDocument;
00031 
00032 /******************************************************************/
00033 /* Class: KWTableTemplateCollection                               */
00034 /******************************************************************/
00035 
00036 class KWTableTemplateCollection
00037 {
00038 public:
00039     KWTableTemplateCollection();
00040     ~KWTableTemplateCollection();
00041     const QPtrList<KWTableTemplate> & tableTemplateList() const { return m_templateList; }
00042     void clear();
00043 
00044     KWTableTemplate* findTableTemplate( const QString & name );
00048     KWTableTemplate* tableTemplateAt( int i ) { return m_templateList.at(i); }
00049 
00050     KWTableTemplate* addTableTemplate( KWTableTemplate *tt );
00051 
00052     void removeTableTemplate ( KWTableTemplate *tt );
00053 
00054 private:
00055     QPtrList<KWTableTemplate> m_templateList;
00056     QPtrList<KWTableTemplate> m_deletedTemplates;
00057     KWTableTemplate *m_lastTemplate;
00058 };
00059 
00060 /******************************************************************/
00061 /* Class: KWTableTemplate                                            */
00062 /******************************************************************/
00063 
00064 class KWTableTemplate
00065 {
00066 public:
00067     KWTableTemplate( const QString & name, KWTableStyle * _firstRow=0L, KWTableStyle * _firstCol=0L,
00068                      KWTableStyle *_lastRow=0L, KWTableStyle *_lastCol=0L, KWTableStyle *_bodyCell=0L,
00069                      KWTableStyle *_topLeftCorner=0L, KWTableStyle *_topRightCorner=0L,
00070                      KWTableStyle *_bottomLeftCorner=0L, KWTableStyle *_bottomRightCorner=0L );
00071 
00072     KWTableTemplate( const KWTableTemplate & rhs ) { *this = rhs; }
00073 
00074     KWTableTemplate( QDomElement & parentElem, KWDocument *_doc, int docVersion=2 );
00075 
00076     ~KWTableTemplate() {}
00077 
00078     void operator=( const KWTableTemplate & );
00079 
00081     QString name() const { return m_name; }
00082     void setName( const QString & name ) { m_name = name; }
00084     QString displayName() const;
00085 
00086     // ATTRIBUTES
00087     KWTableStyle firstRow() const { return *m_firstRow; }
00088     KWTableStyle* pFirstRow() const { return m_firstRow; }
00089     void setFirstRow( KWTableStyle *_tableStyle ) { m_firstRow = _tableStyle; }
00090 
00091     KWTableStyle lastRow() const { return *m_lastRow; }
00092     KWTableStyle* pLastRow() const { return m_lastRow; }
00093     void setLastRow( KWTableStyle *_tableStyle ) { m_lastRow = _tableStyle; }
00094 
00095     KWTableStyle firstCol() const { return *m_firstCol; }
00096     KWTableStyle* pFirstCol() const { return m_firstCol; }
00097     void setFirstCol( KWTableStyle *_tableStyle ) { m_firstCol = _tableStyle; }
00098 
00099     KWTableStyle lastCol() const { return *m_lastCol; }
00100     KWTableStyle* pLastCol() const { return m_lastCol; }
00101     void setLastCol( KWTableStyle *_tableStyle ) { m_lastCol = _tableStyle; }
00102 
00103     KWTableStyle bodyCell() const { return *m_bodyCell; }
00104     KWTableStyle* pBodyCell() const { return m_bodyCell; }
00105     void setBodyCell( KWTableStyle *_tableStyle ) { m_bodyCell = _tableStyle; }
00106 
00107     KWTableStyle topLeftCorner() const { return *m_topLeftCorner; }
00108     KWTableStyle* pTopLeftCorner() const { return m_topLeftCorner; }
00109     void setTopLeftCorner( KWTableStyle *_tableStyle ) { m_topLeftCorner = _tableStyle; }
00110 
00111     KWTableStyle topRightCorner() const { return *m_topRightCorner; }
00112     KWTableStyle* pTopRightCorner() const { return m_topRightCorner; }
00113     void setTopRightCorner( KWTableStyle *_tableStyle ) { m_topRightCorner = _tableStyle; }
00114 
00115     KWTableStyle bottomRightCorner() const { return *m_bottomRightCorner; }
00116     KWTableStyle* pBottomRightCorner() const { return m_bottomRightCorner; }
00117     void setBottomRightCorner( KWTableStyle *_tableStyle ) { m_bottomRightCorner = _tableStyle; }
00118 
00119     KWTableStyle bottomLeftCorner() const { return *m_bottomLeftCorner; }
00120     KWTableStyle* pBottomLeftCorner() const { return m_bottomLeftCorner; }
00121     void setBottomLeftCorner( KWTableStyle *_tableStyle ) { m_bottomLeftCorner = _tableStyle; }
00122 
00123     // SAVING METHODS
00124     void save( QDomElement parentElem, KoTextZoomHandler* zh );
00125     void saveTableTemplate( QDomElement & parentElem );
00126 
00127     // STATIC METHODS
00128     static KWTableTemplate *loadTemplate( QDomElement & parentElem, KWDocument *_doc, int docVersion=2 );
00129 
00130 private:
00131     QString m_name;
00132     KWTableStyle *m_firstRow;
00133     KWTableStyle *m_lastRow;
00134     KWTableStyle *m_firstCol;
00135     KWTableStyle *m_lastCol;
00136     KWTableStyle *m_bodyCell;
00137 
00138     KWTableStyle *m_topLeftCorner;
00139     KWTableStyle *m_topRightCorner;
00140     KWTableStyle *m_bottomRightCorner;
00141     KWTableStyle *m_bottomLeftCorner;
00142 
00143 };
00144 
00145 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys