dom2_views.cpp00001
00023 #include "dom/dom2_views.h"
00024 #include "dom/dom_exception.h"
00025 #include "dom/dom_doc.h"
00026 #include "xml/dom_elementimpl.h"
00027 #include "xml/dom2_viewsimpl.h"
00028
00029 using namespace DOM;
00030
00031
00032 AbstractView::AbstractView()
00033 {
00034 impl = 0;
00035 }
00036
00037
00038 AbstractView::AbstractView(const AbstractView &other)
00039 {
00040 impl = other.impl;
00041 if (impl) impl->ref();
00042 }
00043
00044
00045 AbstractView::AbstractView(AbstractViewImpl *i)
00046 {
00047 impl = i;
00048 if (impl) impl->ref();
00049 }
00050
00051 AbstractView::~AbstractView()
00052 {
00053 if (impl)
00054 impl->deref();
00055 }
00056
00057 AbstractView &AbstractView::operator = (const AbstractView &other)
00058 {
00059 if ( impl != other.impl ) {
00060 if(impl) impl->deref();
00061 impl = other.impl;
00062 if(impl) impl->ref();
00063 }
00064 return *this;
00065 }
00066
00067 Document AbstractView::document() const
00068 {
00069 if (!impl)
00070 throw DOMException(DOMException::INVALID_STATE_ERR);
00071
00072 return impl->document();
00073 }
00074
00075 CSSStyleDeclaration AbstractView::getComputedStyle(const Element &elt, const DOMString &pseudoElt)
00076 {
00077 if (!impl)
00078 throw DOMException(DOMException::INVALID_STATE_ERR);
00079
00080 return impl->getComputedStyle(static_cast<ElementImpl*>(elt.handle()),pseudoElt.implementation());
00081 }
00082
00083
00084 AbstractViewImpl *AbstractView::handle() const
00085 {
00086 return impl;
00087 }
00088
00089 bool AbstractView::isNull() const
00090 {
00091 return (impl == 0);
00092 }
00093
00094
00095
|