khtml Library API Documentation

css_renderstyledeclarationimpl.cpp

00001 
00021 #include "css_renderstyledeclarationimpl.h"
00022 
00023 #include "rendering/render_style.h"
00024 #include "rendering/render_object.h"
00025 
00026 #include "cssproperties.h"
00027 
00028 using namespace DOM;
00029 using namespace khtml;
00030 
00031 
00032 RenderStyleDeclarationImpl::RenderStyleDeclarationImpl( DOM::NodeImpl *node )
00033     : CSSStyleDeclarationImpl( 0 )
00034 {
00035     m_node = node;
00036     m_renderer = m_node->renderer();
00037 }
00038 
00039 RenderStyleDeclarationImpl::~RenderStyleDeclarationImpl()
00040 {
00041 }
00042 
00043 DOM::DOMString RenderStyleDeclarationImpl::cssText() const
00044 {
00045     return DOMString();
00046 }
00047 
00048 void RenderStyleDeclarationImpl::setCssText( DOM::DOMString )
00049 {
00050     // ### report that this sucka is read only
00051 }
00052 
00053 CSSValueImpl *RenderStyleDeclarationImpl::getPropertyCSSValue( int propertyID ) const
00054 {
00055     CSSPrimitiveValueImpl *val = 0;
00056 
00057     switch( propertyID )
00058     {
00059     case CSS_PROP_BACKGROUND_COLOR:
00060         val = new CSSPrimitiveValueImpl( m_renderer->style()->backgroundColor().rgb() );
00061         break;
00062     case CSS_PROP_BACKGROUND_IMAGE:
00063         break;
00064     case CSS_PROP_BACKGROUND_REPEAT:
00065         break;
00066     case CSS_PROP_BACKGROUND_ATTACHMENT:
00067         break;
00068     case CSS_PROP_BACKGROUND_POSITION:
00069         break;
00070     case CSS_PROP_BACKGROUND_POSITION_X:
00071         break;
00072     case CSS_PROP_BACKGROUND_POSITION_Y:
00073         break;
00074     case CSS_PROP_BORDER_COLLAPSE:
00075         break;
00076     case CSS_PROP_BORDER_SPACING:
00077         break;
00078     case CSS_PROP__KHTML_BORDER_HORIZONTAL_SPACING:
00079         break;
00080     case CSS_PROP__KHTML_BORDER_VERTICAL_SPACING:
00081         break;
00082     case CSS_PROP_BORDER_TOP_COLOR:
00083         break;
00084     case CSS_PROP_BORDER_RIGHT_COLOR:
00085         break;
00086     case CSS_PROP_BORDER_BOTTOM_COLOR:
00087         break;
00088     case CSS_PROP_BORDER_LEFT_COLOR:
00089         break;
00090     case CSS_PROP_BORDER_TOP_STYLE:
00091         break;
00092     case CSS_PROP_BORDER_RIGHT_STYLE:
00093         break;
00094     case CSS_PROP_BORDER_BOTTOM_STYLE:
00095         break;
00096     case CSS_PROP_BORDER_LEFT_STYLE:
00097         break;
00098     case CSS_PROP_BORDER_TOP_WIDTH:
00099         break;
00100     case CSS_PROP_BORDER_RIGHT_WIDTH:
00101         break;
00102     case CSS_PROP_BORDER_BOTTOM_WIDTH:
00103         break;
00104     case CSS_PROP_BORDER_LEFT_WIDTH:
00105         break;
00106     case CSS_PROP_BOTTOM:
00107         break;
00108     case CSS_PROP_CAPTION_SIDE:
00109         break;
00110     case CSS_PROP_CLEAR:
00111         break;
00112     case CSS_PROP_CLIP:
00113         break;
00114     case CSS_PROP_COLOR:
00115         break;
00116     case CSS_PROP_CONTENT:
00117         break;
00118     case CSS_PROP_COUNTER_INCREMENT:
00119         break;
00120     case CSS_PROP_COUNTER_RESET:
00121         break;
00122     case CSS_PROP_CURSOR:
00123         break;
00124     case CSS_PROP_DIRECTION:
00125         break;
00126     case CSS_PROP_DISPLAY:
00127         break;
00128     case CSS_PROP_EMPTY_CELLS:
00129         break;
00130     case CSS_PROP_FLOAT:
00131         break;
00132     case CSS_PROP_FONT_FAMILY:
00133         break;
00134     case CSS_PROP_FONT_SIZE:
00135         break;
00136     case CSS_PROP_FONT_STYLE:
00137         break;
00138     case CSS_PROP_FONT_VARIANT:
00139         break;
00140     case CSS_PROP_FONT_WEIGHT:
00141         break;
00142     case CSS_PROP_HEIGHT:
00143         val = new CSSPrimitiveValueImpl( m_renderer->height(),
00144                                          CSSPrimitiveValue::CSS_PX );
00145         break;
00146     case CSS_PROP_LEFT:
00147         break;
00148     case CSS_PROP_LETTER_SPACING:
00149         break;
00150     case CSS_PROP_LINE_HEIGHT:
00151         break;
00152     case CSS_PROP_LIST_STYLE_IMAGE:
00153         break;
00154     case CSS_PROP_LIST_STYLE_POSITION:
00155         break;
00156     case CSS_PROP_LIST_STYLE_TYPE:
00157         break;
00158     case CSS_PROP_MARGIN_TOP:
00159         break;
00160     case CSS_PROP_MARGIN_RIGHT:
00161         break;
00162     case CSS_PROP_MARGIN_BOTTOM:
00163         break;
00164     case CSS_PROP_MARGIN_LEFT:
00165         break;
00166     case CSS_PROP_MAX_HEIGHT:
00167         val = new CSSPrimitiveValueImpl( m_renderer->availableHeight(),
00168                                          CSSPrimitiveValue::CSS_PX );
00169         break;
00170     case CSS_PROP_MAX_WIDTH:
00171         val = new CSSPrimitiveValueImpl( m_renderer->maxWidth(),
00172                                          CSSPrimitiveValue::CSS_PX );
00173         break;
00174     case CSS_PROP_MIN_HEIGHT:
00175         val = new CSSPrimitiveValueImpl( m_renderer->contentHeight(),
00176                                          CSSPrimitiveValue::CSS_PX );
00177         break;
00178     case CSS_PROP_MIN_WIDTH:
00179         val = new CSSPrimitiveValueImpl( m_renderer->minWidth(),
00180                                          CSSPrimitiveValue::CSS_PX );
00181         break;
00182     case CSS_PROP_ORPHANS:
00183         break;
00184     case CSS_PROP_OUTLINE_COLOR:
00185         break;
00186     case CSS_PROP_OUTLINE_STYLE:
00187         break;
00188     case CSS_PROP_OUTLINE_WIDTH:
00189         break;
00190     case CSS_PROP_OVERFLOW:
00191         break;
00192     case CSS_PROP_PADDING_TOP:
00193         val = new CSSPrimitiveValueImpl( m_renderer->paddingTop(),
00194                                          CSSPrimitiveValue::CSS_PX );
00195         break;
00196     case CSS_PROP_PADDING_RIGHT:
00197         val = new CSSPrimitiveValueImpl( m_renderer->paddingRight(),
00198                                          CSSPrimitiveValue::CSS_PX );
00199         break;
00200     case CSS_PROP_PADDING_BOTTOM:
00201         val = new CSSPrimitiveValueImpl( m_renderer->paddingBottom(),
00202                                          CSSPrimitiveValue::CSS_PX );
00203         break;
00204     case CSS_PROP_PADDING_LEFT:
00205         val = new CSSPrimitiveValueImpl( m_renderer->paddingLeft(),
00206                                          CSSPrimitiveValue::CSS_PX );
00207         break;
00208     case CSS_PROP_PAGE_BREAK_AFTER:
00209         break;
00210     case CSS_PROP_PAGE_BREAK_BEFORE:
00211         break;
00212     case CSS_PROP_PAGE_BREAK_INSIDE:
00213         break;
00214     case CSS_PROP_POSITION:
00215         break;
00216     case CSS_PROP_QUOTES:
00217         break;
00218     case CSS_PROP_RIGHT:
00219         break;
00220     case CSS_PROP_SIZE:
00221         break;
00222     case CSS_PROP_TABLE_LAYOUT:
00223         break;
00224     case CSS_PROP_TEXT_ALIGN:
00225         break;
00226     case CSS_PROP_TEXT_DECORATION:
00227         break;
00228     case CSS_PROP_TEXT_INDENT:
00229         break;
00230     case CSS_PROP_TEXT_TRANSFORM:
00231         break;
00232     case CSS_PROP_TOP:
00233         break;
00234     case CSS_PROP_UNICODE_BIDI:
00235         break;
00236     case CSS_PROP_VERTICAL_ALIGN:
00237         break;
00238     case CSS_PROP_VISIBILITY:
00239         break;
00240     case CSS_PROP_WHITE_SPACE:
00241         break;
00242     case CSS_PROP_WIDOWS:
00243         break;
00244     case CSS_PROP_WIDTH:
00245         val = new CSSPrimitiveValueImpl( m_renderer->width(),
00246                                          CSSPrimitiveValue::CSS_PX );
00247         break;
00248     case CSS_PROP_WORD_SPACING:
00249         break;
00250     case CSS_PROP_Z_INDEX:
00251         break;
00252     case CSS_PROP_BACKGROUND:
00253         break;
00254     case CSS_PROP_BORDER:
00255         break;
00256     case CSS_PROP_BORDER_COLOR:
00257         break;
00258     case CSS_PROP_BORDER_STYLE:
00259         break;
00260     case CSS_PROP_BORDER_TOP:
00261         val = new CSSPrimitiveValueImpl( m_renderer->borderTop(),
00262                                          CSSPrimitiveValue::CSS_PX );
00263         break;
00264     case CSS_PROP_BORDER_RIGHT:
00265         val = new CSSPrimitiveValueImpl( m_renderer->borderRight(),
00266                                          CSSPrimitiveValue::CSS_PX );
00267         break;
00268     case CSS_PROP_BORDER_BOTTOM:
00269         val = new CSSPrimitiveValueImpl( m_renderer->borderBottom(),
00270                                          CSSPrimitiveValue::CSS_PX );
00271         break;
00272     case CSS_PROP_BORDER_LEFT:
00273         val = new CSSPrimitiveValueImpl( m_renderer->borderLeft(),
00274                                          CSSPrimitiveValue::CSS_PX );
00275         break;
00276     case CSS_PROP_BORDER_WIDTH:
00277         break;
00278     case CSS_PROP_FONT:
00279         break;
00280     case CSS_PROP_LIST_STYLE:
00281         break;
00282     case CSS_PROP_MARGIN:
00283         break;
00284     case CSS_PROP_OUTLINE:
00285         break;
00286     case CSS_PROP_PADDING:
00287         break;
00288     case CSS_PROP_SCROLLBAR_BASE_COLOR:
00289         break;
00290     case CSS_PROP_SCROLLBAR_FACE_COLOR:
00291         break;
00292     case CSS_PROP_SCROLLBAR_SHADOW_COLOR:
00293         break;
00294     case CSS_PROP_SCROLLBAR_HIGHLIGHT_COLOR:
00295         break;
00296     case CSS_PROP_SCROLLBAR_3DLIGHT_COLOR:
00297         break;
00298     case CSS_PROP_SCROLLBAR_DARKSHADOW_COLOR:
00299         break;
00300     case CSS_PROP_SCROLLBAR_TRACK_COLOR:
00301         break;
00302     case CSS_PROP_SCROLLBAR_ARROW_COLOR:
00303         break;
00304     case CSS_PROP__KHTML_FLOW_MODE:
00305         break;
00306     case CSS_PROP__KHTML_USER_INPUT:
00307         break;
00308     case CSS_PROP__KHTML_TEXT_DECORATION_COLOR:
00309         break;
00310     default:
00311         Q_ASSERT( 0 );
00312         break;
00313     }
00314     return val;
00315 }
00316 
00317 DOMString RenderStyleDeclarationImpl::getPropertyValue( int propertyID ) const
00318 {
00319     CSSProperty var = property( propertyID );
00320     DOMString str = var.cssText();
00321     return str;
00322 }
00323 
00324 bool RenderStyleDeclarationImpl::getPropertyPriority( int ) const
00325 {
00326     return false;
00327 }
00328 
00329 DOM::DOMString RenderStyleDeclarationImpl::removeProperty( int, bool )
00330 {
00331     // ### emit error since we're read-only
00332     return DOMString();
00333 }
00334 
00335 bool RenderStyleDeclarationImpl::setProperty ( int, const DOM::DOMString&, bool,
00336                                                bool )
00337 {
00338     // ### emit error since we're read-only
00339     return false;
00340 }
00341 
00342 void RenderStyleDeclarationImpl::setProperty ( int, int, bool,
00343                                                bool )
00344 {
00345     // ### emit error since we're read-only
00346 }
00347 
00348 void RenderStyleDeclarationImpl::setLengthProperty( int, const DOM::DOMString&, bool,
00349                                                     bool, bool )
00350 {
00351     // ### emit error since we're read-only
00352 }
00353 
00354 void RenderStyleDeclarationImpl::setProperty( const DOMString& )
00355 {
00356     // ### emit error since we're read-only
00357 }
00358 
00359 DOM::DOMString RenderStyleDeclarationImpl::item( unsigned long ) const
00360 {
00361     // ###
00362     return DOMString();
00363 }
00364 
00365 
00366 CSSProperty RenderStyleDeclarationImpl::property( int id ) const
00367 {
00368     CSSProperty prop;
00369     prop.m_id = id;
00370     prop.m_bImportant = false;
00371     prop.nonCSSHint = false;
00372 
00373     prop.setValue( getPropertyCSSValue( id ) );
00374     return prop;
00375 }
KDE Logo
This file is part of the documentation for khtml Library Version 3.2.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Mar 4 22:45:38 2004 by doxygen 1.3.6-20040222 written by Dimitri van Heesch, © 1997-2003