KHTML
html_misc.cpp
Go to the documentation of this file.00001 00022 // -------------------------------------------------------------------------- 00023 00024 #include "dom/html_misc.h" 00025 #include "html/html_miscimpl.h" 00026 #include "misc/htmlhashes.h" 00027 00028 using namespace DOM; 00029 00030 HTMLBaseFontElement::HTMLBaseFontElement() : HTMLElement() 00031 { 00032 } 00033 00034 HTMLBaseFontElement::HTMLBaseFontElement(const HTMLBaseFontElement &other) : HTMLElement(other) 00035 { 00036 } 00037 00038 HTMLBaseFontElement::HTMLBaseFontElement(HTMLBaseFontElementImpl *impl) : HTMLElement(impl) 00039 { 00040 } 00041 00042 HTMLBaseFontElement &HTMLBaseFontElement::operator = (const Node &other) 00043 { 00044 assignOther( other, ID_BASEFONT ); 00045 return *this; 00046 } 00047 00048 HTMLBaseFontElement &HTMLBaseFontElement::operator = (const HTMLBaseFontElement &other) 00049 { 00050 HTMLElement::operator = (other); 00051 return *this; 00052 } 00053 00054 HTMLBaseFontElement::~HTMLBaseFontElement() 00055 { 00056 } 00057 00058 DOMString HTMLBaseFontElement::color() const 00059 { 00060 if(!impl) return DOMString(); 00061 return ((ElementImpl *)impl)->getAttribute(ATTR_COLOR); 00062 } 00063 00064 void HTMLBaseFontElement::setColor( const DOMString &value ) 00065 { 00066 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_COLOR, value); 00067 } 00068 00069 DOMString HTMLBaseFontElement::face() const 00070 { 00071 if(!impl) return DOMString(); 00072 return ((ElementImpl *)impl)->getAttribute(ATTR_FACE); 00073 } 00074 00075 void HTMLBaseFontElement::setFace( const DOMString &value ) 00076 { 00077 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_FACE, value); 00078 } 00079 00080 DOMString HTMLBaseFontElement::size() const 00081 { 00082 if(!impl) return DOMString(); 00083 return ((ElementImpl *)impl)->getAttribute(ATTR_SIZE); 00084 } 00085 00086 void HTMLBaseFontElement::setSize( const DOMString &value ) 00087 { 00088 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_SIZE, value); 00089 } 00090 00091 long HTMLBaseFontElement::getSize() const 00092 { 00093 if(!impl) return 0; 00094 return ((ElementImpl *)impl)->getAttribute(ATTR_SIZE).toInt(); 00095 } 00096 00097 void HTMLBaseFontElement::setSize( long _value ) 00098 { 00099 if ( impl ) 00100 { 00101 DOMString value( QString::number( _value ) ); 00102 ((ElementImpl *)impl)->setAttribute(ATTR_SIZE, value); 00103 } 00104 } 00105 00106 00107 // -------------------------------------------------------------------------- 00108 00109 HTMLCollection::HTMLCollection() 00110 : impl(0) 00111 { 00112 } 00113 00114 HTMLCollection::HTMLCollection(HTMLCollectionImpl* _impl): impl(_impl) 00115 { 00116 if (impl) impl->ref(); 00117 } 00118 00119 HTMLCollection::HTMLCollection(const HTMLCollection &other) 00120 { 00121 impl = other.impl; 00122 if(impl) impl->ref(); 00123 } 00124 00125 HTMLCollection::HTMLCollection(NodeImpl *base, int type) 00126 { 00127 impl = new HTMLCollectionImpl(base, type); 00128 impl->ref(); 00129 } 00130 00131 HTMLCollection &HTMLCollection::operator = (const HTMLCollection &other) 00132 { 00133 if(impl != other.impl) { 00134 if(impl) impl->deref(); 00135 impl = other.impl; 00136 if(impl) impl->ref(); 00137 } 00138 return *this; 00139 } 00140 00141 HTMLCollection::~HTMLCollection() 00142 { 00143 if(impl) impl->deref(); 00144 } 00145 00146 unsigned long HTMLCollection::length() const 00147 { 00148 if(!impl) return 0; 00149 return ((HTMLCollectionImpl *)impl)->length(); 00150 } 00151 00152 Node HTMLCollection::item( unsigned long index ) const 00153 { 00154 if(!impl) return 0; 00155 return ((HTMLCollectionImpl *)impl)->item( index ); 00156 } 00157 00158 Node HTMLCollection::namedItem( const DOMString &name ) const 00159 { 00160 if(!impl) return 0; 00161 return ((HTMLCollectionImpl *)impl)->namedItem( name ); 00162 } 00163 00164 Node HTMLCollection::base() const 00165 { 00166 if ( !impl ) 00167 return 0; 00168 00169 return static_cast<HTMLCollectionImpl*>( impl )->m_refNode; 00170 } 00171 00172 Node HTMLCollection::firstItem() const 00173 { 00174 if ( !impl ) 00175 return 0; 00176 return static_cast<HTMLCollectionImpl*>( impl )->firstItem(); 00177 } 00178 00179 Node HTMLCollection::nextItem() const 00180 { 00181 if ( !impl ) 00182 return 0; 00183 return static_cast<HTMLCollectionImpl*>( impl )->nextItem(); 00184 } 00185 00186 Node HTMLCollection::nextNamedItem( const DOMString &name ) const 00187 { 00188 if ( !impl ) 00189 return 0; 00190 return static_cast<HTMLCollectionImpl*>( impl )->nextNamedItem( name ); 00191 } 00192 00193 HTMLCollectionImpl *HTMLCollection::handle() const 00194 { 00195 return impl; 00196 } 00197 00198 bool HTMLCollection::isNull() const 00199 { 00200 return (impl == 0); 00201 } 00202 00203 00204 // ----------------------------------------------------------------------------- 00205 00206 HTMLFormCollection::HTMLFormCollection(NodeImpl *base) 00207 : HTMLCollection() 00208 { 00209 impl = new HTMLFormCollectionImpl(base); 00210 impl->ref(); 00211 } 00212