css_value.h
/*
* This file is part of the DOM implementation for KDE.
*
* (C) 1999 Lars Knoll (knoll@kde.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* This file includes excerpts from the Document Object Model (DOM)
* Level 2 Specification (Style)
* http://www.w3.org/TR/DOM-Level-2-Style/
* Copyright © 2000 W3C® (MIT, INRIA, Keio), All Rights Reserved.
*
*/
#ifndef _CSS_css_value_h_
#define _CSS_css_value_h_
#include <dom/dom_string.h>
#include <qcolor.h>
#include <kdemacros.h>
namespace DOM {
class CSSStyleDeclarationImpl;
class CSSRule;
class CSSValue;
class KHTML_EXPORT CSSStyleDeclaration
{
public:
CSSStyleDeclaration();
CSSStyleDeclaration(const CSSStyleDeclaration &other);
CSSStyleDeclaration(CSSStyleDeclarationImpl *impl);
public:
CSSStyleDeclaration & operator = (const CSSStyleDeclaration &other);
~CSSStyleDeclaration();
DOM::DOMString cssText() const;
void setCssText( const DOM::DOMString & );
unsigned long length() const;
CSSRule parentRule() const;
DOM::DOMString getPropertyValue ( const DOM::DOMString &propertyName ) const;
DOM::DOMString getPropertyValue ( const DOM::DOMString &propertyName );
CSSValue getPropertyCSSValue ( const DOM::DOMString &propertyName ) const;
CSSValue getPropertyCSSValue ( const DOM::DOMString &propertyName );
DOM::DOMString removeProperty ( const DOM::DOMString &propertyName );
DOM::DOMString getPropertyPriority ( const DOM::DOMString &propertyName ) const;
DOM::DOMString getPropertyPriority ( const DOM::DOMString &propertyName );
void setProperty ( const DOM::DOMString &propertyName, const DOM::DOMString &value, const DOM::DOMString &priority );
DOM::DOMString item ( unsigned long index ) const;
DOM::DOMString item ( unsigned long index );
CSSStyleDeclarationImpl *handle() const;
bool isNull() const;
protected:
CSSStyleDeclarationImpl *impl;
};
class CSSValueImpl;
class KHTML_EXPORT CSSValue
{
public:
CSSValue();
CSSValue(const CSSValue &other);
CSSValue(CSSValueImpl *impl);
public:
CSSValue & operator = (const CSSValue &other);
~CSSValue();
enum UnitTypes {
CSS_INHERIT = 0,
CSS_PRIMITIVE_VALUE = 1,
CSS_VALUE_LIST = 2,
CSS_CUSTOM = 3,
CSS_INITIAL = 4
};
DOM::DOMString cssText() const;
void setCssText( const DOM::DOMString & );
unsigned short cssValueType() const;
bool isCSSValueList() const;
bool isCSSPrimitiveValue() const;
CSSValueImpl *handle() const;
bool isNull() const;
protected:
CSSValueImpl *impl;
};
class CSSValueListImpl;
class CSSValue;
class KHTML_EXPORT CSSValueList : public CSSValue
{
public:
CSSValueList();
CSSValueList(const CSSValueList &other);
CSSValueList(const CSSValue &other);
CSSValueList(CSSValueListImpl *impl);
public:
CSSValueList & operator = (const CSSValueList &other);
CSSValueList & operator = (const CSSValue &other);
~CSSValueList();
unsigned long length() const;
CSSValue item ( unsigned long index );
protected:
CSSValueListImpl *vimpl;
};
class CSSPrimitiveValueImpl;
class Counter;
class RGBColor;
class Rect;
class KHTML_EXPORT CSSPrimitiveValue : public CSSValue
{
public:
CSSPrimitiveValue();
CSSPrimitiveValue(const CSSPrimitiveValue &other);
CSSPrimitiveValue(const CSSValue &other);
CSSPrimitiveValue(CSSPrimitiveValueImpl *impl);
public:
CSSPrimitiveValue & operator = (const CSSPrimitiveValue &other);
CSSPrimitiveValue & operator = (const CSSValue &other);
~CSSPrimitiveValue();
enum UnitTypes {
CSS_UNKNOWN = 0,
CSS_NUMBER = 1,
CSS_PERCENTAGE = 2,
CSS_EMS = 3,
CSS_EXS = 4,
CSS_PX = 5,
CSS_CM = 6,
CSS_MM = 7,
CSS_IN = 8,
CSS_PT = 9,
CSS_PC = 10,
CSS_DEG = 11,
CSS_RAD = 12,
CSS_GRAD = 13,
CSS_MS = 14,
CSS_S = 15,
CSS_HZ = 16,
CSS_KHZ = 17,
CSS_DIMENSION = 18,
CSS_STRING = 19,
CSS_URI = 20,
CSS_IDENT = 21,
CSS_ATTR = 22,
CSS_COUNTER = 23,
CSS_RECT = 24,
CSS_RGBCOLOR = 25,
CSS_PAIR = 100, // We envision this being exposed as a means of getting computed style values for pairs
CSS_HTML_RELATIVE = 255
};
unsigned short primitiveType() const;
void setFloatValue ( unsigned short unitType, float floatValue );
// ### KDE 4: make this const!
float getFloatValue ( unsigned short unitType );
void setStringValue ( unsigned short stringType, const DOM::DOMString &stringValue );
// ### KDE4: make this const!
DOM::DOMString getStringValue ( );
// ### KDE4: make this const!
Counter getCounterValue ( );
// ### KDE4: make this const!
Rect getRectValue ( );
// ### KDE4: make this const!
RGBColor getRGBColorValue ( );
};
class KHTML_EXPORT RGBColor
{
public:
RGBColor();
RGBColor(const QColor& c) { m_color = c.rgb(); }
RGBColor(QRgb color);
RGBColor(const RGBColor &other);
RGBColor & operator = (const RGBColor &other);
~RGBColor();
CSSPrimitiveValue red() const;
CSSPrimitiveValue green() const;
CSSPrimitiveValue blue() const;
QRgb color() const { return m_color; }
protected:
QRgb m_color;
};
class RectImpl;
class KHTML_EXPORT Rect
{
friend class CSSPrimitiveValue;
public:
Rect();
Rect(const Rect &other);
Rect & operator = (const Rect &other);
~Rect();
CSSPrimitiveValue top() const;
CSSPrimitiveValue right() const;
CSSPrimitiveValue bottom() const;
CSSPrimitiveValue left() const;
RectImpl *handle() const;
bool isNull() const;
protected:
RectImpl *impl;
Rect(RectImpl *i);
};
class CounterImpl;
class KHTML_EXPORT Counter
{
friend class CSSPrimitiveValue;
public:
Counter();
Counter(const Counter &other);
public:
Counter & operator = (const Counter &other);
~Counter();
DOM::DOMString identifier() const;
DOM::DOMString listStyle() const;
DOM::DOMString separator() const;
CounterImpl *handle() const;
bool isNull() const;
protected:
CounterImpl *impl;
Counter(CounterImpl *i);
};
} // namespace
#endif
DOM::CSSValue::UnitTypes
UnitTypes
An integer indicating which type of unit applies to the value.
Definition: css_value.h:261
DOM::CSSStyleDeclaration
The CSSStyleDeclaration interface represents a single CSS declaration block .
Definition: css_value.h:60
DOM::CSSValueList
The CSSValueList interface provides the absraction of an ordered collection of CSS values...
Definition: css_value.h:316
DOM::CSSPrimitiveValue
The CSSPrimitiveValue interface represents a single CSS value .
Definition: css_value.h:373
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:43
DOM::RGBColor::RGBColor
RGBColor(const QColor &c)
Definition: css_value.h:598
DOM::Rect
The Rect interface is used to represent any rect value.
Definition: css_value.h:642
DOM::CSSRule
The CSSRule interface is the abstract base interface for any type of CSS statement ...
Definition: css_rule.h:52
DOM::RGBColor
The RGBColor interface is used to represent any RGB color value.
Definition: css_value.h:591
DOM::CSSValue
The CSSValue interface represents a simple or a complexe value.
Definition: css_value.h:243
DOM::Counter
The Counter interface is used to represent any counter or counters function value.
Definition: css_value.h:699

KDE Home | KDE Accessibility Home | Description of Access Keys