• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdehtml
 

tdehtml

  • tdehtml
  • dom
css_stylesheet.cpp
1
24#include "dom/dom_exception.h"
25#include "dom/css_rule.h"
26#include "dom/dom_doc.h"
27
28#include "xml/dom_docimpl.h"
29
30#include "html/html_headimpl.h"
31
32#include "css/css_stylesheetimpl.h"
33#include "misc/htmlhashes.h"
34
35#include <stdio.h>
36
37using namespace DOM;
38
39StyleSheet::StyleSheet()
40{
41 impl = 0;
42}
43
44StyleSheet::StyleSheet(const StyleSheet &other)
45{
46 impl = other.impl;
47 if(impl) impl->ref();
48}
49
50StyleSheet::StyleSheet(StyleSheetImpl *i)
51{
52 impl = i;
53 if(impl) impl->ref();
54}
55
56StyleSheet &StyleSheet::operator = (const StyleSheet &other)
57{
58 if ( impl != other.impl ) {
59 if(impl) impl->deref();
60 impl = other.impl;
61 if(impl) impl->ref();
62 }
63 return *this;
64}
65
66StyleSheet::~StyleSheet()
67{
68 if(impl) impl->deref();
69}
70
71DOMString StyleSheet::type() const
72{
73 if(!impl) return DOMString();
74 return ((StyleSheetImpl *)impl)->type();
75}
76
77bool StyleSheet::disabled() const
78{
79 if(!impl) return 0;
80 return ((StyleSheetImpl *)impl)->disabled();
81}
82
83void StyleSheet::setDisabled( bool _disabled )
84{
85 if(impl)
86 ((StyleSheetImpl *)impl)->setDisabled( _disabled );
87}
88
89DOM::Node StyleSheet::ownerNode() const
90{
91 if(!impl) return Node();
92 return ((StyleSheetImpl *)impl)->ownerNode();
93}
94
95StyleSheet StyleSheet::parentStyleSheet() const
96{
97 if(!impl) return 0;
98 return ((StyleSheetImpl *)impl)->parentStyleSheet();
99}
100
101DOMString StyleSheet::href() const
102{
103 if(!impl) return DOMString();
104 return ((StyleSheetImpl *)impl)->href();
105}
106
107DOMString StyleSheet::title() const
108{
109 if(!impl) return DOMString();
110 return ((StyleSheetImpl *)impl)->title();
111}
112
113MediaList StyleSheet::media() const
114{
115 if(!impl) return 0;
116 return ((StyleSheetImpl *)impl)->media();
117}
118
119bool StyleSheet::isCSSStyleSheet() const
120{
121 if(!impl) return false;
122 return ((StyleSheetImpl *)impl)->isCSSStyleSheet();
123}
124
125CSSStyleSheet::CSSStyleSheet() : StyleSheet()
126{
127}
128
129CSSStyleSheet::CSSStyleSheet(const CSSStyleSheet &other) : StyleSheet(other)
130{
131}
132
133CSSStyleSheet::CSSStyleSheet(const StyleSheet &other)
134{
135 if (!other.isCSSStyleSheet())
136 impl = 0;
137 else
138 operator=(other);
139}
140
141CSSStyleSheet::CSSStyleSheet(CSSStyleSheetImpl *impl) : StyleSheet(impl)
142{
143}
144
145CSSStyleSheet &CSSStyleSheet::operator = (const CSSStyleSheet &other)
146{
147 StyleSheet::operator = (other);
148 return *this;
149}
150
151CSSStyleSheet &CSSStyleSheet::operator = (const StyleSheet &other)
152{
153 if(!other.handle()->isCSSStyleSheet())
154 {
155 if(impl) impl->deref();
156 impl = 0;
157 } else {
158 StyleSheet::operator = (other);
159 }
160 return *this;
161}
162
163CSSStyleSheet::~CSSStyleSheet()
164{
165}
166
167CSSRule CSSStyleSheet::ownerRule() const
168{
169 if(!impl) return 0;
170 return ((CSSStyleSheetImpl *)impl)->ownerRule();
171}
172
173CSSRuleList CSSStyleSheet::cssRules() const
174{
175 if(!impl) return (CSSRuleListImpl*)0;
176 return ((CSSStyleSheetImpl *)impl)->cssRules();
177}
178
179unsigned long CSSStyleSheet::insertRule( const DOMString &rule, unsigned long index )
180{
181 int exceptioncode = 0;
182 if(!impl) return 0;
183 unsigned long retval = ((CSSStyleSheetImpl *)impl)->insertRule( rule, index, exceptioncode );
184 if ( exceptioncode >= CSSException::_EXCEPTION_OFFSET )
185 throw CSSException( exceptioncode - CSSException::_EXCEPTION_OFFSET );
186 if ( exceptioncode )
187 throw DOMException( exceptioncode );
188 return retval;
189}
190
191void CSSStyleSheet::deleteRule( unsigned long index )
192{
193 int exceptioncode = 0;
194 if(impl)
195 ((CSSStyleSheetImpl *)impl)->deleteRule( index, exceptioncode );
196 if ( exceptioncode >= CSSException::_EXCEPTION_OFFSET )
197 throw CSSException( exceptioncode - CSSException::_EXCEPTION_OFFSET );
198 if ( exceptioncode )
199 throw DOMException( exceptioncode );
200}
201
202
203
204StyleSheetList::StyleSheetList()
205{
206 impl = 0;
207}
208
209StyleSheetList::StyleSheetList(const StyleSheetList &other)
210{
211 impl = other.impl;
212 if(impl) impl->ref();
213}
214
215StyleSheetList::StyleSheetList(StyleSheetListImpl *i)
216{
217 impl = i;
218 if(impl) impl->ref();
219}
220
221StyleSheetList &StyleSheetList::operator = (const StyleSheetList &other)
222{
223 if ( impl != other.impl ) {
224 if(impl) impl->deref();
225 impl = other.impl;
226 if(impl) impl->ref();
227 }
228 return *this;
229}
230
231StyleSheetList::~StyleSheetList()
232{
233 if(impl) impl->deref();
234}
235
236unsigned long StyleSheetList::length() const
237{
238 if(!impl) return 0;
239 return ((StyleSheetListImpl *)impl)->length();
240}
241
242StyleSheet StyleSheetList::item( unsigned long index )
243{
244 if(!impl) return StyleSheet();
245 return ((StyleSheetListImpl *)impl)->item( index );
246}
247
248StyleSheetListImpl *StyleSheetList::handle() const
249{
250 return impl;
251}
252
253bool StyleSheetList::isNull() const
254{
255 return (impl == 0);
256}
257
258// ----------------------------------------------------------
259
260MediaList::MediaList()
261{
262 impl = 0;
263}
264
265MediaList::MediaList(const MediaList &other)
266{
267 impl = other.impl;
268 if(impl) impl->ref();
269}
270
271MediaList::MediaList(MediaListImpl *i)
272{
273 impl = i;
274 if(impl) impl->ref();
275}
276
277MediaList &MediaList::operator = (const MediaList &other)
278{
279 if ( impl != other.impl ) {
280 if(impl) impl->deref();
281 impl = other.impl;
282 if(impl) impl->ref();
283 }
284 return *this;
285}
286
287MediaList::~MediaList()
288{
289 if(impl) impl->deref();
290}
291
292DOM::DOMString MediaList::mediaText() const
293{
294 if(!impl) return DOMString();
295 return static_cast<MediaListImpl *>(impl)->mediaText();
296}
297
298void MediaList::setMediaText(const DOM::DOMString &value )
299{
300 if(impl)
301 static_cast<MediaListImpl *>(impl)->setMediaText( value );
302}
303
304unsigned long MediaList::length() const
305{
306 if(!impl) return 0;
307 return ((MediaListImpl *)impl)->length();
308}
309
310DOM::DOMString MediaList::item(unsigned long index) const
311{
312 if(!impl) return DOMString();
313 return ((MediaListImpl *)impl)->item( index );
314}
315
316void MediaList::deleteMedium(const DOM::DOMString &oldMedium)
317{
318 if(impl)
319 ((MediaListImpl *)impl)->deleteMedium( oldMedium );
320}
321
322void MediaList::appendMedium(const DOM::DOMString &newMedium)
323{
324 if(impl)
325 ((MediaListImpl *)impl)->appendMedium( newMedium );
326}
327
328MediaListImpl *MediaList::handle() const
329{
330 return impl;
331}
332
333bool MediaList::isNull() const
334{
335 return (impl == 0);
336}
337
338// ----------------------------------------------------------
339
340LinkStyle::LinkStyle()
341{
342 node = 0;
343}
344
345LinkStyle::LinkStyle(const LinkStyle &other)
346{
347 node = other.node;
348 if(node) node->ref();
349}
350
351LinkStyle & LinkStyle::operator = (const LinkStyle &other)
352{
353 if ( node != other.node ) {
354 if(node) node->deref();
355 node = other.node;
356 if(node) node->ref();
357 }
358 return *this;
359}
360
361LinkStyle & LinkStyle::operator = (const Node &other)
362{
363 if(node) node->deref();
364 node = 0;
365 // ### add processing instructions
366 NodeImpl *n = other.handle();
367
368 // ### check link is really linking a style sheet
369 if( n && n->isElementNode() &&
370 (n->id() == ID_STYLE || n->id() == ID_LINK) ) {
371 node = n;
372 if(node) node->ref();
373 }
374 return *this;
375}
376
377LinkStyle::~LinkStyle()
378{
379 if(node) node->deref();
380}
381
382StyleSheet LinkStyle::sheet()
383{
384 int id = node ? node->id() : 0;
385 // ### add PI
386 return
387 ( id == ID_STYLE) ?
388 static_cast<HTMLStyleElementImpl *>(node)->sheet()
389 : ( (id == ID_LINK) ?
390 static_cast<HTMLLinkElementImpl *>(node)->sheet()
391 : StyleSheet() );
392}
393
394bool LinkStyle::isNull() const
395{
396 return (node == 0);
397}
398
399
400// ----------------------------------------------------------
401
402DocumentStyle::DocumentStyle()
403{
404 doc = 0;
405}
406
407DocumentStyle::DocumentStyle(const DocumentStyle &other)
408{
409 doc = other.doc;
410 if(doc) doc->ref();
411}
412
413DocumentStyle & DocumentStyle::operator = (const DocumentStyle &other)
414{
415 if ( doc != other.doc ) {
416 if(doc) doc->deref();
417 doc = other.doc;
418 if(doc) doc->ref();
419 }
420 return *this;
421}
422
423DocumentStyle & DocumentStyle::operator = (const Document &other)
424{
425 DocumentImpl *odoc = static_cast<DocumentImpl *>(other.handle());
426 if ( doc != odoc ) {
427 if(doc) doc->deref();
428 doc = odoc;
429 if(doc) doc->ref();
430 }
431 return *this;
432}
433
434DocumentStyle::~DocumentStyle()
435{
436 if(doc) doc->deref();
437}
438
439StyleSheetList DocumentStyle::styleSheets()
440{
441 return doc->styleSheets();
442}
443
444DOMString DocumentStyle::preferredStylesheetSet() const
445{
446 return doc->preferredStylesheetSet();
447}
448
449void DocumentStyle::setSelectedStylesheetSet(const DOMString& aStr)
450{
451 return doc->setSelectedStylesheetSet(aStr);
452}
453
454DOMString DocumentStyle::selectedStylesheetSet() const
455{
456 return doc->selectedStylesheetSet();
457}
DOM::CSSException
This exception is raised when a specific CSS operation is impossible to perform.
Definition: css_stylesheet.h:174
DOM::CSSRuleList
The CSSRuleList interface provides the abstraction of an ordered collection of CSS rules.
Definition: css_rule.h:485
DOM::CSSRule
The CSSRule interface is the abstract base interface for any type of CSS statement .
Definition: css_rule.h:53
DOM::CSSStyleSheet
The CSSStyleSheet interface is a concrete interface used to represent a CSS style sheet i....
Definition: css_stylesheet.h:208
DOM::CSSStyleSheet::ownerRule
CSSRule ownerRule() const
If this style sheet comes from an @import rule, the ownerRule attribute will contain the CSSImportRul...
Definition: css_stylesheet.cpp:167
DOM::CSSStyleSheet::deleteRule
void deleteRule(unsigned long index)
Used to delete a rule from the style sheet.
Definition: css_stylesheet.cpp:191
DOM::CSSStyleSheet::cssRules
CSSRuleList cssRules() const
The list of all CSS rules contained within the style sheet.
Definition: css_stylesheet.cpp:173
DOM::CSSStyleSheet::insertRule
unsigned long insertRule(const DOM::DOMString &rule, unsigned long index)
Used to insert a new rule into the style sheet.
Definition: css_stylesheet.cpp:179
DOM::DOMException
DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impos...
Definition: dom_exception.h:58
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
DOM::Document
The Document interface represents the entire HTML or XML document.
Definition: dom_doc.h:246
DOM::MediaList
The MediaList interface provides the abstraction of an ordered collection of media,...
Definition: css_stylesheet.h:364
DOM::MediaList::setMediaText
void setMediaText(const DOM::DOMString &value)
see mediaText
Definition: css_stylesheet.cpp:298
DOM::MediaList::mediaText
DOM::DOMString mediaText() const
The parsable textual representation of the media list.
Definition: css_stylesheet.cpp:292
DOM::MediaList::length
unsigned long length() const
The number of media in the list.
Definition: css_stylesheet.cpp:304
DOM::MediaList::appendMedium
void appendMedium(const DOM::DOMString &newMedium)
Adds the medium newMedium to the end of the list.
Definition: css_stylesheet.cpp:322
DOM::MediaList::item
DOM::DOMString item(unsigned long index) const
Returns the indexth in the list.
Definition: css_stylesheet.cpp:310
DOM::MediaList::deleteMedium
void deleteMedium(const DOM::DOMString &oldMedium)
Deletes the medium indicated by oldMedium from the list.
Definition: css_stylesheet.cpp:316
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:275
DOM::StyleSheetList
The StyleSheetList interface provides the abstraction of an ordered collection of style sheets.
Definition: css_stylesheet.h:310
DOM::StyleSheetList::length
unsigned long length() const
The number of StyleSheet in the list.
Definition: css_stylesheet.cpp:236
DOM::StyleSheetList::item
StyleSheet item(unsigned long index)
Used to retrieve a style sheet by ordinal index.
Definition: css_stylesheet.cpp:242
DOM::StyleSheet
The StyleSheet interface is the abstract base interface for any type of style sheet.
Definition: css_stylesheet.h:59
DOM::StyleSheet::href
DOM::DOMString href() const
If the style sheet is a linked style sheet, the value of its attribute is its location.
Definition: css_stylesheet.cpp:101
DOM::StyleSheet::media
MediaList media() const
The intended destination media for style information.
Definition: css_stylesheet.cpp:113
DOM::StyleSheet::parentStyleSheet
StyleSheet parentStyleSheet() const
For style sheet languages that support the concept of style sheet inclusion, this attribute represent...
Definition: css_stylesheet.cpp:95
DOM::StyleSheet::disabled
bool disabled() const
false if the style sheet is applied to the document.
Definition: css_stylesheet.cpp:77
DOM::StyleSheet::setDisabled
void setDisabled(bool)
see disabled
Definition: css_stylesheet.cpp:83
DOM::StyleSheet::title
DOM::DOMString title() const
The advisory title.
Definition: css_stylesheet.cpp:107
DOM::StyleSheet::type
DOM::DOMString type() const
This specifies the style sheet language for this style sheet.
Definition: css_stylesheet.cpp:71
DOM::StyleSheet::ownerNode
DOM::Node ownerNode() const
The node that associates this style sheet with the document.
Definition: css_stylesheet.cpp:89
DOM
The Document Object Model (DOM) is divided into two parts, the COREDOM core DOM, specifying some core...
Definition: design.h:57

tdehtml

Skip menu "tdehtml"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdehtml

Skip menu "tdehtml"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdehtml by doxygen 1.9.4
This website is maintained by Timothy Pearson.