⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 html_table.cpp

📁 手机浏览器源码程序,功能强大
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/**
 * This file is part of the DOM implementation for KDE.
 *
 * (C) 1999 Lars Knoll (knoll@kde.org)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 */
// --------------------------------------------------------------------------

#include "dom/html_misc.h"
#include "dom/html_table.h"
#include "dom/dom_exception.h"

#include "html/html_miscimpl.h"
#include "html/html_tableimpl.h"
#include "misc/htmlhashes.h"

using namespace DOM;

HTMLTableCaptionElement::HTMLTableCaptionElement() : HTMLElement()
{
}

HTMLTableCaptionElement::HTMLTableCaptionElement(const HTMLTableCaptionElement &other) : HTMLElement(other)
{
}

HTMLTableCaptionElement::HTMLTableCaptionElement(HTMLTableCaptionElementImpl *impl) : HTMLElement(impl)
{
}

HTMLTableCaptionElement &HTMLTableCaptionElement::operator = (const Node &other)
{
    assignOther( other, ID_CAPTION );
    return *this;
}

HTMLTableCaptionElement &HTMLTableCaptionElement::operator = (const HTMLTableCaptionElement &other)
{
    HTMLElement::operator = (other);
    return *this;
}

HTMLTableCaptionElement::~HTMLTableCaptionElement()
{
}

DOMString HTMLTableCaptionElement::align() const
{
    if(!impl) return DOMString();
    return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
}

void HTMLTableCaptionElement::setAlign( const DOMString &value )
{
    if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
}

// --------------------------------------------------------------------------

HTMLTableCellElement::HTMLTableCellElement() : HTMLElement()
{
}

HTMLTableCellElement::HTMLTableCellElement(const HTMLTableCellElement &other) : HTMLElement(other)
{
}

HTMLTableCellElement::HTMLTableCellElement(HTMLTableCellElementImpl *impl) : HTMLElement(impl)
{
}

HTMLTableCellElement &HTMLTableCellElement::operator = (const Node &other)
{
    if( other.elementId() != ID_TD &&
	other.elementId() != ID_TH )
    {
	if ( impl ) impl->deref();
	impl = 0;
    } else {
    Node::operator = (other);
    }
    return *this;
}

HTMLTableCellElement &HTMLTableCellElement::operator = (const HTMLTableCellElement &other)
{
    HTMLElement::operator = (other);
    return *this;
}

HTMLTableCellElement::~HTMLTableCellElement()
{
}

long HTMLTableCellElement::cellIndex() const
{
    if(!impl) return 0;
    return ((HTMLTableCellElementImpl *)impl)->cellIndex();
}

void HTMLTableCellElement::setCellIndex( long /*_cellIndex*/ )
{
#if KHTML_NO_EXCEPTIONS    
    { _exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR; return; }
#else
    throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);
#endif    
}

DOMString HTMLTableCellElement::abbr() const
{
    if(!impl) return DOMString();
    return ((ElementImpl *)impl)->getAttribute(ATTR_ABBR);
}

void HTMLTableCellElement::setAbbr( const DOMString &value )
{
    if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ABBR, value);
}

DOMString HTMLTableCellElement::align() const
{
    if(!impl) return DOMString();
    return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
}

void HTMLTableCellElement::setAlign( const DOMString &value )
{
    if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
}

DOMString HTMLTableCellElement::axis() const
{
    if(!impl) return DOMString();
    return ((ElementImpl *)impl)->getAttribute(ATTR_AXIS);
}

void HTMLTableCellElement::setAxis( const DOMString &value )
{
    if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_AXIS, value);
}

DOMString HTMLTableCellElement::bgColor() const
{
    if(!impl) return DOMString();
    return ((ElementImpl *)impl)->getAttribute(ATTR_BGCOLOR);
}

void HTMLTableCellElement::setBgColor( const DOMString &value )
{
    if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_BGCOLOR, value);
}

DOMString HTMLTableCellElement::ch() const
{
    if(!impl) return DOMString();
    return ((ElementImpl *)impl)->getAttribute(ATTR_CHAR);
}

void HTMLTableCellElement::setCh( const DOMString &value )
{
    if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CHAR, value);
}

DOMString HTMLTableCellElement::chOff() const
{
    if(!impl) return DOMString();
    return ((ElementImpl *)impl)->getAttribute(ATTR_CHAROFF);
}

void HTMLTableCellElement::setChOff( const DOMString &value )
{
    if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CHAROFF, value);
}

long HTMLTableCellElement::colSpan() const
{
    if(!impl) return 0;
    return ((ElementImpl *)impl)->getAttribute(ATTR_COLSPAN).toInt();
}

void HTMLTableCellElement::setColSpan( long _colSpan )
{
    if(impl) {
	DOMString value(QString::number(_colSpan));
        ((ElementImpl *)impl)->setAttribute(ATTR_COLSPAN,value);
    }
}

DOMString HTMLTableCellElement::headers() const
{
    if(!impl) return DOMString();
    return ((ElementImpl *)impl)->getAttribute(ATTR_HEADERS);
}

void HTMLTableCellElement::setHeaders( const DOMString &value )
{
    if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HEADERS, value);
}

DOMString HTMLTableCellElement::height() const
{
    if(!impl) return DOMString();
    return ((ElementImpl *)impl)->getAttribute(ATTR_HEIGHT);
}

void HTMLTableCellElement::setHeight( const DOMString &value )
{
    if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HEIGHT, value);
}

bool HTMLTableCellElement::noWrap() const
{
    if(!impl) return false;
    return !((ElementImpl *)impl)->getAttribute(ATTR_NOWRAP).isNull();
}

void HTMLTableCellElement::setNoWrap( bool _noWrap )
{
    if(impl)
	((ElementImpl *)impl)->setAttribute(ATTR_NOWRAP, _noWrap ? "" : 0);
}

long HTMLTableCellElement::rowSpan() const
{
    if(!impl) return 0;
    return ((ElementImpl *)impl)->getAttribute(ATTR_ROWSPAN).toInt();
}

void HTMLTableCellElement::setRowSpan( long _rowSpan )
{
    if(impl) {
	DOMString value(QString::number(_rowSpan));
        ((ElementImpl *)impl)->setAttribute(ATTR_ROWSPAN,value);
    }
}

DOMString HTMLTableCellElement::scope() const
{
    if(!impl) return DOMString();
    return ((ElementImpl *)impl)->getAttribute(ATTR_SCOPE);
}

void HTMLTableCellElement::setScope( const DOMString &value )
{
    if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_SCOPE, value);
}

DOMString HTMLTableCellElement::vAlign() const
{
    if(!impl) return DOMString();
    return ((ElementImpl *)impl)->getAttribute(ATTR_VALIGN);
}

void HTMLTableCellElement::setVAlign( const DOMString &value )
{
    if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_VALIGN, value);
}

DOMString HTMLTableCellElement::width() const
{
    if(!impl) return DOMString();
    return ((ElementImpl *)impl)->getAttribute(ATTR_WIDTH);
}

void HTMLTableCellElement::setWidth( const DOMString &value )
{
    if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_WIDTH, value);
}

// --------------------------------------------------------------------------

HTMLTableColElement::HTMLTableColElement() : HTMLElement()
{
}

HTMLTableColElement::HTMLTableColElement(const HTMLTableColElement &other) : HTMLElement(other)
{
}

HTMLTableColElement::HTMLTableColElement(HTMLTableColElementImpl *impl) : HTMLElement(impl)
{
}

HTMLTableColElement &HTMLTableColElement::operator = (const Node &other)
{
    if( other.elementId() != ID_COL &&
	other.elementId() != ID_COLGROUP )
    {
	if ( impl ) impl->deref();
	impl = 0;
    } else {
    Node::operator = (other);
    }
    return *this;
}

HTMLTableColElement &HTMLTableColElement::operator = (const HTMLTableColElement &other)
{
    HTMLElement::operator = (other);
    return *this;
}

HTMLTableColElement::~HTMLTableColElement()
{
}

DOMString HTMLTableColElement::align() const
{
    if(!impl) return DOMString();
    return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
}

void HTMLTableColElement::setAlign( const DOMString &value )
{
    if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
}

DOMString HTMLTableColElement::ch() const
{
    if(!impl) return DOMString();
    return ((ElementImpl *)impl)->getAttribute(ATTR_CHAR);
}

void HTMLTableColElement::setCh( const DOMString &value )
{
    if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CHAR, value);
}

DOMString HTMLTableColElement::chOff() const
{
    if(!impl) return DOMString();
    return ((ElementImpl *)impl)->getAttribute(ATTR_CHAROFF);
}

void HTMLTableColElement::setChOff( const DOMString &value )
{
    if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CHAROFF, value);
}

long HTMLTableColElement::span() const
{
    if(!impl) return 0;
    return ((ElementImpl *)impl)->getAttribute(ATTR_SPAN).toInt();
}

void HTMLTableColElement::setSpan( long _span )
{
    if(impl) {
	DOMString value(QString::number(_span));
        ((ElementImpl *)impl)->setAttribute(ATTR_SPAN,value);
    }
}

DOMString HTMLTableColElement::vAlign() const
{
    if(!impl) return DOMString();
    return ((ElementImpl *)impl)->getAttribute(ATTR_VALIGN);
}

void HTMLTableColElement::setVAlign( const DOMString &value )
{
    if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_VALIGN, value);
}

DOMString HTMLTableColElement::width() const
{
    if(!impl) return DOMString();
    return ((ElementImpl *)impl)->getAttribute(ATTR_WIDTH);
}

void HTMLTableColElement::setWidth( const DOMString &value )
{
    if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_WIDTH, value);
}

// --------------------------------------------------------------------------

HTMLTableElement::HTMLTableElement() : HTMLElement()
{
}

HTMLTableElement::HTMLTableElement(const HTMLTableElement &other) : HTMLElement(other)
{
}

HTMLTableElement::HTMLTableElement(HTMLTableElementImpl *impl) : HTMLElement(impl)
{
}

HTMLTableElement &HTMLTableElement::operator = (const Node &other)
{
    assignOther( other, ID_TABLE );
    return *this;
}

HTMLTableElement &HTMLTableElement::operator = (const HTMLTableElement &other)
{
    HTMLElement::operator = (other);
    return *this;
}

HTMLTableElement::~HTMLTableElement()
{
}

HTMLTableCaptionElement HTMLTableElement::caption() const
{
    if(!impl) return 0;
    return ((HTMLTableElementImpl *)impl)->caption();
}

void HTMLTableElement::setCaption( const HTMLTableCaptionElement &_caption )
{
    if(impl)
        ((HTMLTableElementImpl *)impl)
	    ->setCaption( ((HTMLTableCaptionElementImpl *)_caption.impl) );
}

HTMLTableSectionElement HTMLTableElement::tHead() const
{
    if(!impl) return 0;
    return ((HTMLTableElementImpl *)impl)->tHead();
}

void HTMLTableElement::setTHead( const HTMLTableSectionElement &_tHead )
{

    if(impl)
        ((HTMLTableElementImpl *)impl)
	    ->setTHead( ((HTMLTableSectionElementImpl *)_tHead.impl) );
}

HTMLTableSectionElement HTMLTableElement::tFoot() const
{
    if(!impl) return 0;
    return ((HTMLTableElementImpl *)impl)->tFoot();
}

void HTMLTableElement::setTFoot( const HTMLTableSectionElement &_tFoot )

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -