23#include "dom/css_rule.h"
24#include "dom/dom_exception.h"
26#include "css/css_renderstyledeclarationimpl.h"
27#include "css/css_valueimpl.h"
31CSSStyleDeclaration::CSSStyleDeclaration()
36CSSStyleDeclaration::CSSStyleDeclaration(
const CSSStyleDeclaration &other)
42CSSStyleDeclaration::CSSStyleDeclaration(CSSStyleDeclarationImpl *i)
48CSSStyleDeclaration &CSSStyleDeclaration::operator = (
const CSSStyleDeclaration &other)
50 if ( impl != other.impl ) {
51 if(impl) impl->deref();
58CSSStyleDeclaration::~CSSStyleDeclaration()
60 if(impl) impl->deref();
66 return static_cast<CSSStyleDeclarationImpl *
>(impl)->
cssText();
72 impl->setCssText(value);
83 int id = getPropertyID(propertyName.string().ascii(), propertyName.length());
96 int id = getPropertyID(propertyName.string().ascii(), propertyName.length());
103 int id = getPropertyID(property.string().ascii(), property.length());
105 return static_cast<CSSStyleDeclarationImpl *
>(impl)->
removeProperty(
id );
115 int id = getPropertyID(propertyName.string().ascii(), propertyName.length());
117 if (impl->getPropertyPriority(
id))
125 int id = getPropertyID(propName.string().lower().ascii(), propName.length());
127 bool important =
false;
128 TQString str = priority.string();
129 if (str.find(
"important", 0,
false) != -1)
132 static_cast<CSSStyleDeclarationImpl *
>(impl)->
setProperty(
id, value, important );
138 return static_cast<CSSStyleDeclarationImpl *
>(impl)->
length();
149 return static_cast<CSSStyleDeclarationImpl *
>(impl)->
item( index );
154 return static_cast<CSSStyleDeclarationImpl *
>(impl)->
parentRule();
157CSSStyleDeclarationImpl *CSSStyleDeclaration::handle()
const
162bool CSSStyleDeclaration::isNull()
const
174CSSValue::CSSValue(
const CSSValue &other)
177 if(impl) impl->ref();
180CSSValue::CSSValue(CSSValueImpl *i)
183 if(impl) impl->ref();
186CSSValue &CSSValue::operator = (
const CSSValue &other)
188 if ( impl != other.impl ) {
189 if(impl) impl->deref();
191 if(impl) impl->ref();
198 if(impl) impl->deref();
204 return ((CSSValueImpl *)impl)->cssText();
210 ((CSSValueImpl *)impl)->cssText();
216 return ((CSSValueImpl *)impl)->cssValueType();
219bool CSSValue::isCSSValueList()
const
221 if(!impl)
return false;
222 return ((CSSValueImpl *)impl)->isValueList();
225bool CSSValue::isCSSPrimitiveValue()
const
227 if(!impl)
return false;
228 return ((CSSValueImpl *)impl)->isPrimitiveValue();
231CSSValueImpl *CSSValue::handle()
const
236bool CSSValue::isNull()
const
243CSSValueList::CSSValueList() : CSSValue()
247CSSValueList::CSSValueList(
const CSSValueList &other) : CSSValue(other)
251CSSValueList::CSSValueList(
const CSSValue &other)
257CSSValueList::CSSValueList(CSSValueListImpl *impl) : CSSValue(impl)
261CSSValueList &CSSValueList::operator = (
const CSSValueList &other)
263 if ( impl != other.impl ) {
264 if (impl) impl->deref();
265 impl = other.handle();
266 if (impl) impl->ref();
271CSSValueList &CSSValueList::operator = (
const CSSValue &other)
273 CSSValueImpl *ohandle = other.handle() ;
274 if ( impl != ohandle ) {
275 if (impl) impl->deref();
276 if (!other.isNull() && !other.isCSSValueList()) {
280 if (impl) impl->ref();
286CSSValueList::~CSSValueList()
293 return ((CSSValueListImpl *)impl)->length();
299 return ((CSSValueListImpl *)impl)->item( index );
304CSSPrimitiveValue::CSSPrimitiveValue() :
CSSValue()
308CSSPrimitiveValue::CSSPrimitiveValue(
const CSSPrimitiveValue &other) : CSSValue(other)
312CSSPrimitiveValue::CSSPrimitiveValue(
const CSSValue &other) : CSSValue(other)
318CSSPrimitiveValue::CSSPrimitiveValue(CSSPrimitiveValueImpl *impl) : CSSValue(impl)
322CSSPrimitiveValue &CSSPrimitiveValue::operator = (
const CSSPrimitiveValue &other)
324 if ( impl != other.impl ) {
325 if (impl) impl->deref();
326 impl = other.handle();
327 if (impl) impl->ref();
332CSSPrimitiveValue &CSSPrimitiveValue::operator = (
const CSSValue &other)
334 CSSValueImpl *ohandle = other.handle();
335 if ( impl != ohandle ) {
336 if (impl) impl->deref();
337 if (!other.isNull() && !other.isCSSPrimitiveValue()) {
341 if (impl) impl->ref();
347CSSPrimitiveValue::~CSSPrimitiveValue()
354 return ((CSSPrimitiveValueImpl *)impl)->primitiveType();
360 int exceptioncode = 0;
361 ((CSSPrimitiveValueImpl *)impl)->setFloatValue( unitType, floatValue, exceptioncode );
362 if ( exceptioncode >= CSSException::_EXCEPTION_OFFSET )
363 throw CSSException( exceptioncode - CSSException::_EXCEPTION_OFFSET );
374 return ((CSSPrimitiveValueImpl *)impl)->floatValue( unitType );
379 int exceptioncode = 0;
381 ((CSSPrimitiveValueImpl *)impl)->setStringValue( stringType, stringValue, exceptioncode );
382 if ( exceptioncode >= CSSException::_EXCEPTION_OFFSET )
383 throw CSSException( exceptioncode - CSSException::_EXCEPTION_OFFSET );
392 return ((CSSPrimitiveValueImpl *)impl)->getStringValue( );
398 return ((CSSPrimitiveValueImpl *)impl)->getCounterValue( );
403 if(!impl)
return Rect();
404 return ((CSSPrimitiveValueImpl *)impl)->getRectValue( );
421Counter::Counter(
const Counter &)
426Counter &Counter::operator = (
const Counter &other)
428 if ( impl != other.impl ) {
429 if (impl) impl->deref();
431 if (impl) impl->ref();
436Counter::Counter(CounterImpl *i)
439 if (impl) impl->ref();
444 if (impl) impl->deref();
450 return impl->identifier();
456 return tdehtml::stringForListStyleType((tdehtml::EListStyleType)impl->listStyle());
462 return impl->separator();
465CounterImpl *Counter::handle()
const
470bool Counter::isNull()
const
481RGBColor::RGBColor(
const RGBColor &other)
483 m_color = other.m_color;
486RGBColor::RGBColor(TQRgb color)
491RGBColor &RGBColor::operator = (
const RGBColor &other)
493 m_color = other.m_color;
503 return new CSSPrimitiveValueImpl(
float(tqAlpha(m_color) ? tqRed(m_color) : 0), CSSPrimitiveValue::CSS_DIMENSION);
508 return new CSSPrimitiveValueImpl(
float(tqAlpha(m_color) ? tqGreen(m_color) : 0), CSSPrimitiveValue::CSS_DIMENSION);
513 return new CSSPrimitiveValueImpl(
float(tqAlpha(m_color) ? tqBlue(m_color) : 0), CSSPrimitiveValue::CSS_DIMENSION);
524Rect::Rect(
const Rect &other)
527 if (impl) impl->ref();
530Rect::Rect(RectImpl *i)
533 if (impl) impl->ref();
536Rect &Rect::operator = (
const Rect &other)
538 if ( impl != other.impl ) {
539 if (impl) impl->deref();
541 if (impl) impl->ref();
548 if (impl) impl->deref();
560 return impl->right();
566 return impl->bottom();
575RectImpl *Rect::handle()
const
580bool Rect::isNull()
const
This exception is raised when a specific CSS operation is impossible to perform.
The CSSPrimitiveValue interface represents a single CSS value .
unsigned short primitiveType() const
The type of the value as defined by the constants specified above.
Counter getCounterValue()
This method is used to get the Counter value.
RGBColor getRGBColorValue()
This method is used to get the RGB color.
void setFloatValue(unsigned short unitType, float floatValue)
A method to set the float value with a specified unit.
float getFloatValue(unsigned short unitType)
This method is used to get a float value in a specified unit.
Rect getRectValue()
This method is used to get the Rect value.
void setStringValue(unsigned short stringType, const DOM::DOMString &stringValue)
A method to set the string value with a specified unit.
DOM::DOMString getStringValue()
This method is used to get the string value in a specified unit.
The CSSRule interface is the abstract base interface for any type of CSS statement .
The CSSStyleDeclaration interface represents a single CSS declaration block .
CSSRule parentRule() const
The CSS rule that contains this declaration block.
DOM::DOMString item(unsigned long index) const
Used to retrieve the properties that have been explicitly set in this declaration block.
DOM::DOMString getPropertyPriority(const DOM::DOMString &propertyName) const
Used to retrieve the priority of a CSS property (e.g.
CSSValue getPropertyCSSValue(const DOM::DOMString &propertyName) const
Used to retrieve the object representation of the value of a CSS property if it has been explicitly s...
DOM::DOMString getPropertyValue(const DOM::DOMString &propertyName) const
Used to retrieve the value of a CSS property if it has been explicitly set within this declaration bl...
void setCssText(const DOM::DOMString &)
see cssText
unsigned long length() const
The number of properties that have been explicitly set in this declaration block.
DOM::DOMString cssText() const
The parsable textual representation of the declaration block (including the surrounding curly braces)...
DOM::DOMString removeProperty(const DOM::DOMString &propertyName)
Used to remove a CSS property if it has been explicitly set within this declaration block.
void setProperty(const DOM::DOMString &propertyName, const DOM::DOMString &value, const DOM::DOMString &priority)
Used to set a property value and priority within this declaration block.
CSSValue item(unsigned long index)
Used to retrieve a CSS rule by ordinal index.
unsigned long length() const
The number of CSSValue s in the list.
The CSSValue interface represents a simple or a complexe value.
DOM::DOMString cssText() const
A string representation of the current value.
void setCssText(const DOM::DOMString &)
see cssText
unsigned short cssValueType() const
A code defining the type of the value as defined above.
The Counter interface is used to represent any counter or counters function value.
DOM::DOMString identifier() const
This attribute is used for the identifier of the counter.
DOM::DOMString listStyle() const
This attribute is used for the style of the list.
DOM::DOMString separator() const
This attribute is used for the separator of nested counters.
DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impos...
This class implements the basic string we use in the DOM.
The RGBColor interface is used to represent any RGB color value.
CSSPrimitiveValue blue() const
This attribute is used for the blue value of the RGB color.
CSSPrimitiveValue red() const
This attribute is used for the red value of the RGB color.
CSSPrimitiveValue green() const
This attribute is used for the green value of the RGB color.
The Rect interface is used to represent any rect value.
CSSPrimitiveValue bottom() const
This attribute is used for the bottom of the rect.
CSSPrimitiveValue left() const
This attribute is used for the left of the rect.
CSSPrimitiveValue right() const
This attribute is used for the right of the rect.
CSSPrimitiveValue top() const
This attribute is used for the top of the rect.
The Document Object Model (DOM) is divided into two parts, the COREDOM core DOM, specifying some core...