khtml Library API Documentation

html_tableimpl.h

00001 /*
00002  * This file is part of the DOM implementation for KDE.
00003  *
00004  * Copyright (C) 1997 Martin Jones (mjones@kde.org)
00005  *           (C) 1997 Torben Weis (weis@kde.org)
00006  *           (C) 1998 Waldo Bastian (bastian@kde.org)
00007  *           (C) 1999 Lars Knoll (knoll@kde.org)
00008  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
00009  *
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Library General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2 of the License, or (at your option) any later version.
00014  *
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Library General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU Library General Public License
00021  * along with this library; see the file COPYING.LIB.  If not, write to
00022  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00023  * Boston, MA 02111-1307, USA.
00024  *
00025  * $Id: html_tableimpl.h,v 1.65.2.1 2003/05/18 12:34:39 mueller Exp $
00026  */
00027 #ifndef HTML_TABLEIMPL_H
00028 #define HTML_TABLEIMPL_H
00029 
00030 #include "html/html_elementimpl.h"
00031 
00032 namespace DOM {
00033 
00034 class DOMString;
00035 class HTMLTableElementImpl;
00036 class HTMLTableSectionElementImpl;
00037 class HTMLTableSectionElement;
00038 class HTMLTableRowElementImpl;
00039 class HTMLTableRowElement;
00040 class HTMLTableCellElementImpl;
00041 class HTMLTableCellElement;
00042 class HTMLTableColElementImpl;
00043 class HTMLTableColElement;
00044 class HTMLTableCaptionElementImpl;
00045 class HTMLTableCaptionElement;
00046 class HTMLElement;
00047 class HTMLCollection;
00048 
00049 class HTMLTableElementImpl : public HTMLElementImpl
00050 {
00051 public:
00052     enum Rules {
00053         None    = 0x00,
00054         RGroups = 0x01,
00055         CGroups = 0x02,
00056         Groups  = 0x03,
00057         Rows    = 0x05,
00058         Cols    = 0x0a,
00059         All     = 0x0f
00060     };
00061     enum Frame {
00062         Void   = 0x00,
00063         Above  = 0x01,
00064         Below  = 0x02,
00065         Lhs    = 0x04,
00066         Rhs    = 0x08,
00067         Hsides = 0x03,
00068         Vsides = 0x0c,
00069         Box    = 0x0f
00070     };
00071 
00072     HTMLTableElementImpl(DocumentPtr *doc);
00073     ~HTMLTableElementImpl();
00074 
00075     virtual Id id() const;
00076 
00077     HTMLTableCaptionElementImpl *caption() const { return tCaption; }
00078     NodeImpl *setCaption( HTMLTableCaptionElementImpl * );
00079 
00080     HTMLTableSectionElementImpl *tHead() const { return head; }
00081     NodeImpl *setTHead( HTMLTableSectionElementImpl * );
00082 
00083     HTMLTableSectionElementImpl *tFoot() const { return foot; }
00084     NodeImpl *setTFoot( HTMLTableSectionElementImpl * );
00085 
00086     NodeImpl *setTBody( HTMLTableSectionElementImpl * );
00087 
00088     HTMLElementImpl *createTHead (  );
00089     void deleteTHead (  );
00090     HTMLElementImpl *createTFoot (  );
00091     void deleteTFoot (  );
00092     HTMLElementImpl *createCaption (  );
00093     void deleteCaption (  );
00094     HTMLElementImpl *insertRow ( long index, int &exceptioncode );
00095     void deleteRow ( long index, int &exceptioncode );
00096 
00097     // overrides
00098     virtual NodeImpl *addChild(NodeImpl *child);
00099     virtual void parseAttribute(AttributeImpl *attr);
00100     virtual void attach();
00101 
00102 protected:
00103     HTMLTableSectionElementImpl *head;
00104     HTMLTableSectionElementImpl *foot;
00105     HTMLTableSectionElementImpl *firstBody;
00106     HTMLTableCaptionElementImpl *tCaption;
00107 
00108 #if 0
00109     Frame frame;
00110     Rules rules;
00111 #endif
00112 
00113     bool m_noBorder     : 1;
00114     bool m_solid        : 1;
00115     uint unused     : 14;
00116     ushort padding  : 16;
00117     friend class HTMLTableCellElementImpl;
00118 };
00119 
00120 // -------------------------------------------------------------------------
00121 
00122 class HTMLTablePartElementImpl : public HTMLElementImpl
00123 
00124 {
00125 public:
00126     HTMLTablePartElementImpl(DocumentPtr *doc)
00127         : HTMLElementImpl(doc), m_solid(false)
00128         { }
00129 
00130     virtual void parseAttribute(AttributeImpl *attr);
00131 
00132 protected:
00133     bool m_solid : 1;
00134 };
00135 
00136 // -------------------------------------------------------------------------
00137 
00138 class HTMLTableSectionElementImpl : public HTMLTablePartElementImpl
00139 {
00140 public:
00141     HTMLTableSectionElementImpl(DocumentPtr *doc, ushort tagid, bool implicit);
00142 
00143     ~HTMLTableSectionElementImpl();
00144 
00145     virtual Id id() const;
00146 
00147     HTMLElementImpl *insertRow ( long index, int& exceptioncode );
00148     void deleteRow ( long index, int& exceptioncode );
00149 
00150     int numRows() const;
00151 
00152 protected:
00153     ushort _id;
00154 };
00155 
00156 // -------------------------------------------------------------------------
00157 
00158 class HTMLTableRowElementImpl : public HTMLTablePartElementImpl
00159 {
00160 public:
00161     HTMLTableRowElementImpl(DocumentPtr *doc);
00162 
00163     ~HTMLTableRowElementImpl();
00164 
00165     virtual Id id() const;
00166 
00167     long rowIndex() const;
00168     long sectionRowIndex() const;
00169 
00170     HTMLElementImpl *insertCell ( long index, int &exceptioncode );
00171     void deleteCell ( long index, int &exceptioncode );
00172 
00173 protected:
00174     int ncols;
00175 };
00176 
00177 // -------------------------------------------------------------------------
00178 
00179 class HTMLTableCellElementImpl : public HTMLTablePartElementImpl
00180 {
00181 public:
00182     HTMLTableCellElementImpl(DocumentPtr *doc, int tagId);
00183     ~HTMLTableCellElementImpl();
00184 
00185     // ### FIX these two...
00186     long cellIndex() const { return 0; }
00187 
00188     int col() const { return _col; }
00189     void setCol(int col) { _col = col; }
00190     int row() const { return _row; }
00191     void setRow(int r) { _row = r; }
00192 
00193     int colSpan() const { return cSpan; }
00194     int rowSpan() const { return rSpan; }
00195     bool noWrap() const { return m_nowrap; }
00196 
00197     virtual Id id() const { return _id; }
00198     virtual void parseAttribute(AttributeImpl *attr);
00199     virtual void attach();
00200 
00201 protected:
00202     int _row;
00203     int _col;
00204     int rSpan;
00205     int cSpan;
00206     int _id;
00207     int rowHeight;
00208 
00209     bool m_nowrap : 1;
00210 };
00211 
00212 // -------------------------------------------------------------------------
00213 
00214 class HTMLTableColElementImpl : public HTMLTablePartElementImpl
00215 {
00216 public:
00217     HTMLTableColElementImpl(DocumentPtr *doc, ushort i);
00218 
00219     ~HTMLTableColElementImpl();
00220 
00221     virtual Id id() const;
00222 
00223     void setTable(HTMLTableElementImpl *t) { table = t; }
00224 
00225     // overrides
00226     virtual void parseAttribute(AttributeImpl *attr);
00227 
00228     int span() const { return _span; }
00229 
00230 protected:
00231     // could be ID_COL or ID_COLGROUP ... The DOM is not quite clear on
00232     // this, but since both elements work quite similar, we use one
00233     // DOMElement for them...
00234     ushort _id;
00235     int _span;
00236     HTMLTableElementImpl *table;
00237 };
00238 
00239 // -------------------------------------------------------------------------
00240 
00241 class HTMLTableCaptionElementImpl : public HTMLTablePartElementImpl
00242 {
00243 public:
00244     HTMLTableCaptionElementImpl(DocumentPtr *doc);
00245 
00246     ~HTMLTableCaptionElementImpl();
00247 
00248     virtual Id id() const;
00249 
00250     virtual void parseAttribute(AttributeImpl *attr);
00251 };
00252 
00253 } //namespace
00254 
00255 #endif
00256 
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:16:35 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001