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