KHTML
css_rule.cpp
Go to the documentation of this file.00001
00023 #include "css/css_ruleimpl.h"
00024
00025 using namespace DOM;
00026
00027 CSSRule::CSSRule()
00028 {
00029 impl = 0;
00030 }
00031
00032 CSSRule::CSSRule(const CSSRule &other)
00033 {
00034 impl = other.impl;
00035 if(impl) impl->ref();
00036 }
00037
00038 CSSRule::CSSRule(CSSRuleImpl *i)
00039 {
00040 impl = i;
00041 if(impl) impl->ref();
00042 }
00043
00044 CSSRule &CSSRule::operator = (const CSSRule &other)
00045 {
00046 if ( impl != other.impl ) {
00047 if(impl) impl->deref();
00048 impl = other.impl;
00049 if(impl) impl->ref();
00050 }
00051 return *this;
00052 }
00053
00054 CSSRule::~CSSRule()
00055 {
00056 if(impl) impl->deref();
00057 }
00058
00059 unsigned short CSSRule::type() const
00060 {
00061 if(!impl) return 0;
00062 return ((CSSRuleImpl *)impl)->type();
00063 }
00064
00065 DOMString CSSRule::cssText() const
00066 {
00067 if(!impl) return DOMString();
00068 return impl->cssText();
00069 }
00070
00071 void CSSRule::setCssText( const DOMString &value )
00072 {
00073 if(!impl) return;
00074 impl->setCssText(value);
00075 }
00076
00077 CSSStyleSheet CSSRule::parentStyleSheet() const
00078 {
00079 if(!impl) return CSSStyleSheet();
00080 return ((CSSRuleImpl *)impl)->parentStyleSheet();
00081 }
00082
00083 CSSRule CSSRule::parentRule() const
00084 {
00085 if(!impl) return 0;
00086 return ((CSSRuleImpl *)impl)->parentRule();
00087 }
00088
00089 CSSRuleImpl *CSSRule::handle() const
00090 {
00091 return impl;
00092 }
00093
00094 bool CSSRule::isNull() const
00095 {
00096 return (impl == 0);
00097 }
00098
00099 void CSSRule::assignOther( const CSSRule &other, RuleType thisType )
00100 {
00101 if (other.type() != thisType ) {
00102 if ( impl ) impl->deref();
00103 impl = 0;
00104 } else
00105 CSSRule::operator = ( other );
00106 }
00107
00108
00109
00110
00111 CSSCharsetRule::CSSCharsetRule()
00112 : CSSRule()
00113 {
00114 }
00115
00116 CSSCharsetRule::CSSCharsetRule(const CSSCharsetRule &other) : CSSRule(other)
00117 {
00118 }
00119
00120 CSSCharsetRule::CSSCharsetRule(const CSSRule &other)
00121 {
00122 impl = 0;
00123 operator=(other);
00124 }
00125
00126 CSSCharsetRule::CSSCharsetRule(CSSCharsetRuleImpl *impl) : CSSRule(impl)
00127 {
00128 }
00129
00130 CSSCharsetRule &CSSCharsetRule::operator = (const CSSCharsetRule &other)
00131 {
00132 CSSRule::operator = (other);
00133 return *this;
00134 }
00135
00136 CSSCharsetRule &CSSCharsetRule::operator = (const CSSRule &other)
00137 {
00138 assignOther( other, CSSRule::CHARSET_RULE);
00139 return *this;
00140 }
00141
00142 CSSCharsetRule::~CSSCharsetRule()
00143 {
00144 }
00145
00146 DOMString CSSCharsetRule::encoding() const
00147 {
00148 if(!impl) return DOMString();
00149 return ((CSSCharsetRuleImpl*)impl)->encoding();
00150 }
00151
00152 void CSSCharsetRule::setEncoding( const DOMString &value )
00153 {
00154 ((CSSCharsetRuleImpl*)impl)->setEncoding(value);
00155 }
00156
00157
00158
00159
00160
00161 CSSFontFaceRule::CSSFontFaceRule() : CSSRule()
00162 {
00163 }
00164
00165 CSSFontFaceRule::CSSFontFaceRule(const CSSFontFaceRule &other) : CSSRule(other)
00166 {
00167 }
00168
00169 CSSFontFaceRule::CSSFontFaceRule(const CSSRule &other)
00170 {
00171 impl = 0;
00172 operator=(other);
00173 }
00174
00175 CSSFontFaceRule::CSSFontFaceRule(CSSFontFaceRuleImpl *impl) : CSSRule(impl)
00176 {
00177 }
00178
00179 CSSFontFaceRule &CSSFontFaceRule::operator = (const CSSFontFaceRule &other)
00180 {
00181 CSSRule::operator = (other);
00182 return *this;
00183 }
00184
00185 CSSFontFaceRule &CSSFontFaceRule::operator = (const CSSRule &other)
00186 {
00187 assignOther( other, CSSRule::FONT_FACE_RULE );
00188 return *this;
00189 }
00190
00191 CSSFontFaceRule::~CSSFontFaceRule()
00192 {
00193 }
00194
00195 CSSStyleDeclaration CSSFontFaceRule::style() const
00196 {
00197 if(!impl) return CSSStyleDeclaration();
00198 return ((CSSFontFaceRuleImpl *)impl)->style();
00199 }
00200
00201
00202
00203
00204
00205 CSSImportRule::CSSImportRule() : CSSRule()
00206 {
00207 }
00208
00209 CSSImportRule::CSSImportRule(const CSSImportRule &other) : CSSRule(other)
00210 {
00211 }
00212
00213 CSSImportRule::CSSImportRule(const CSSRule &other)
00214 {
00215 impl = 0;
00216 operator=(other);
00217 }
00218
00219 CSSImportRule::CSSImportRule(CSSImportRuleImpl *impl) : CSSRule(impl)
00220 {
00221 }
00222
00223 CSSImportRule &CSSImportRule::operator = (const CSSImportRule &other)
00224 {
00225 CSSRule::operator = (other);
00226 return *this;
00227 }
00228
00229 CSSImportRule &CSSImportRule::operator = (const CSSRule &other)
00230 {
00231 assignOther( other, CSSRule::IMPORT_RULE );
00232 return *this;
00233 }
00234
00235 CSSImportRule::~CSSImportRule()
00236 {
00237 }
00238
00239 DOMString CSSImportRule::href() const
00240 {
00241 if(!impl) return DOMString();
00242 return ((CSSImportRuleImpl *)impl)->href();
00243 }
00244
00245 MediaList CSSImportRule::media() const
00246 {
00247 if(!impl) return MediaList();
00248 return ((CSSImportRuleImpl *)impl)->media();
00249 }
00250
00251 CSSStyleSheet CSSImportRule::styleSheet() const
00252 {
00253 if(!impl) return CSSStyleSheet();
00254 return ((CSSImportRuleImpl *)impl)->styleSheet();
00255 }
00256
00257
00258
00259
00260
00261 CSSMediaRule::CSSMediaRule() : CSSRule()
00262 {
00263 }
00264
00265 CSSMediaRule::CSSMediaRule(const CSSMediaRule &other) : CSSRule(other)
00266 {
00267 }
00268
00269 CSSMediaRule::CSSMediaRule(const CSSRule &other)
00270 {
00271 impl = 0;
00272 operator=(other);
00273 }
00274
00275 CSSMediaRule::CSSMediaRule(CSSMediaRuleImpl *impl) : CSSRule(impl)
00276 {
00277 }
00278
00279 CSSMediaRule &CSSMediaRule::operator = (const CSSMediaRule &other)
00280 {
00281 CSSRule::operator = (other);
00282 return *this;
00283 }
00284
00285 CSSMediaRule &CSSMediaRule::operator = (const CSSRule &other)
00286 {
00287 assignOther( other, CSSRule::MEDIA_RULE );
00288 return *this;
00289 }
00290
00291 CSSMediaRule::~CSSMediaRule()
00292 {
00293 }
00294
00295 MediaList CSSMediaRule::media() const
00296 {
00297 if(!impl) return MediaList();
00298 return ((CSSMediaRuleImpl *)impl)->media();
00299 }
00300
00301 CSSRuleList CSSMediaRule::cssRules() const
00302 {
00303 if(!impl) return CSSRuleList();
00304 return ((CSSMediaRuleImpl *)impl)->cssRules();
00305 }
00306
00307 unsigned long CSSMediaRule::insertRule( const DOMString &rule, unsigned long index )
00308 {
00309 if(!impl) return 0;
00310 return ((CSSMediaRuleImpl *)impl)->insertRule( rule, index );
00311 }
00312
00313 void CSSMediaRule::deleteRule( unsigned long index )
00314 {
00315 if(impl)
00316 ((CSSMediaRuleImpl *)impl)->deleteRule( index );
00317 }
00318
00319
00320
00321
00322
00323 CSSPageRule::CSSPageRule() : CSSRule()
00324 {
00325 }
00326
00327 CSSPageRule::CSSPageRule(const CSSPageRule &other) : CSSRule(other)
00328 {
00329 }
00330
00331 CSSPageRule::CSSPageRule(const CSSRule &other)
00332 {
00333 impl = 0;
00334 operator=(other);
00335 }
00336
00337 CSSPageRule::CSSPageRule(CSSPageRuleImpl *impl) : CSSRule(impl)
00338 {
00339 }
00340
00341 CSSPageRule &CSSPageRule::operator = (const CSSPageRule &other)
00342 {
00343 CSSRule::operator = (other);
00344 return *this;
00345 }
00346
00347 CSSPageRule &CSSPageRule::operator = (const CSSRule &other)
00348 {
00349 assignOther( other, CSSRule::PAGE_RULE );
00350 return *this;
00351 }
00352
00353 CSSPageRule::~CSSPageRule()
00354 {
00355 }
00356
00357 DOMString CSSPageRule::selectorText() const
00358 {
00359 if(!impl) return DOMString();
00360 return ((CSSPageRuleImpl*)impl)->selectorText();
00361 }
00362
00363 void CSSPageRule::setSelectorText( const DOMString &value )
00364 {
00365 ((CSSPageRuleImpl*)impl)->setSelectorText(value);
00366 }
00367
00368 CSSStyleDeclaration CSSPageRule::style() const
00369 {
00370 if(!impl) return CSSStyleDeclaration();
00371 return ((CSSPageRuleImpl *)impl)->style();
00372 }
00373
00374
00375
00376
00377 CSSStyleRule::CSSStyleRule() : CSSRule()
00378 {
00379 }
00380
00381 CSSStyleRule::CSSStyleRule(const CSSStyleRule &other)
00382 : CSSRule(other)
00383 {
00384 }
00385
00386 CSSStyleRule::CSSStyleRule(const CSSRule &other)
00387 {
00388 impl = 0;
00389 operator=(other);
00390 }
00391
00392
00393 CSSStyleRule::CSSStyleRule(CSSStyleRuleImpl *impl)
00394 : CSSRule(impl)
00395 {
00396 }
00397
00398 CSSStyleRule &CSSStyleRule::operator = (const CSSStyleRule &other)
00399 {
00400 CSSRule::operator = (other);
00401 return *this;
00402 }
00403
00404 CSSStyleRule &CSSStyleRule::operator = (const CSSRule &other)
00405 {
00406 assignOther( other, CSSRule::STYLE_RULE );
00407 return *this;
00408 }
00409
00410 CSSStyleRule::~CSSStyleRule()
00411 {
00412 }
00413
00414 DOMString CSSStyleRule::selectorText() const
00415 {
00416 if(!impl) return DOMString();
00417 return ((CSSStyleRuleImpl*)impl)->selectorText();
00418 }
00419
00420 void CSSStyleRule::setSelectorText( const DOMString &value )
00421 {
00422 ((CSSStyleRuleImpl*)impl)->setSelectorText(value);
00423 }
00424
00425 CSSStyleDeclaration CSSStyleRule::style() const
00426 {
00427 if(!impl) return CSSStyleDeclaration();
00428 return ((CSSStyleRuleImpl *)impl)->style();
00429 }
00430
00431
00432
00433
00434
00435 CSSUnknownRule::CSSUnknownRule() : CSSRule()
00436 {
00437 }
00438
00439 CSSUnknownRule::CSSUnknownRule(const CSSUnknownRule &other)
00440 : CSSRule(other)
00441 {
00442 }
00443
00444 CSSUnknownRule::CSSUnknownRule(const CSSRule &other)
00445 {
00446 impl = 0;
00447 operator=(other);
00448 }
00449
00450 CSSUnknownRule::CSSUnknownRule(CSSUnknownRuleImpl *impl)
00451 : CSSRule(impl)
00452 {
00453 }
00454
00455 CSSUnknownRule &CSSUnknownRule::operator = (const CSSUnknownRule &other)
00456 {
00457 CSSRule::operator = (other);
00458 return *this;
00459 }
00460
00461 CSSUnknownRule &CSSUnknownRule::operator = (const CSSRule &other)
00462 {
00463 assignOther( other, CSSRule::UNKNOWN_RULE );
00464 return *this;
00465 }
00466
00467 CSSUnknownRule::~CSSUnknownRule()
00468 {
00469 }
00470
00471
00472
00473
00474 CSSRuleList::CSSRuleList()
00475 {
00476 impl = 0;
00477 }
00478
00479 CSSRuleList::CSSRuleList(const CSSRuleList &other)
00480 {
00481 impl = other.impl;
00482 if(impl) impl->ref();
00483 }
00484
00485 CSSRuleList::CSSRuleList(CSSRuleListImpl *i)
00486 {
00487 impl = i;
00488 if(impl) impl->ref();
00489 }
00490
00491 CSSRuleList::CSSRuleList(StyleListImpl *lst)
00492 {
00493 impl = new CSSRuleListImpl;
00494 impl->ref();
00495 if (lst)
00496 {
00497 for( unsigned long i = 0; i < lst->length() ; ++i )
00498 {
00499 StyleBaseImpl* style = lst->item( i );
00500 if ( style->isRule() )
00501 impl->insertRule( static_cast<CSSRuleImpl *>(style), impl->length() );
00502 }
00503 }
00504 }
00505
00506 CSSRuleList &CSSRuleList::operator = (const CSSRuleList &other)
00507 {
00508 if ( impl != other.impl ) {
00509 if(impl) impl->deref();
00510 impl = other.impl;
00511 if(impl) impl->ref();
00512 }
00513 return *this;
00514 }
00515
00516 CSSRuleList::~CSSRuleList()
00517 {
00518 if(impl) impl->deref();
00519 }
00520
00521 unsigned long CSSRuleList::length() const
00522 {
00523 if(!impl) return 0;
00524 return ((CSSRuleListImpl *)impl)->length();
00525 return 0;
00526 }
00527
00528 CSSRule CSSRuleList::item( unsigned long index )
00529 {
00530 if(!impl) return CSSRule();
00531 return ((CSSRuleListImpl *)impl)->item( index );
00532 }
00533
00534 CSSRuleListImpl *CSSRuleList::handle() const
00535 {
00536 return impl;
00537 }
00538
00539 bool CSSRuleList::isNull() const
00540 {
00541 return (impl == 0);
00542 }
00543
00544
00545
00546