00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "./khtml_iface.h"
00010
00011 #include <kdatastream.h>
00012 #include <qasciidict.h>
00013
00014
00015 static const int KHTMLPartIface_fhash = 37;
00016 static const char* const KHTMLPartIface_ftable[37][3] = {
00017 { "KURL", "url()", "url()" },
00018 { "bool", "closeURL()", "closeURL()" },
00019 { "void", "setJScriptEnabled(bool)", "setJScriptEnabled(bool enable)" },
00020 { "bool", "jScriptEnabled()", "jScriptEnabled()" },
00021 { "void", "setMetaRefreshEnabled(bool)", "setMetaRefreshEnabled(bool enable)" },
00022 { "bool", "metaRefreshEnabled()", "metaRefreshEnabled()" },
00023 { "void", "setDNDEnabled(bool)", "setDNDEnabled(bool b)" },
00024 { "bool", "dndEnabled()", "dndEnabled()" },
00025 { "void", "setJavaEnabled(bool)", "setJavaEnabled(bool enable)" },
00026 { "bool", "javaEnabled()", "javaEnabled()" },
00027 { "void", "setPluginsEnabled(bool)", "setPluginsEnabled(bool enable)" },
00028 { "bool", "pluginsEnabled()", "pluginsEnabled()" },
00029 { "void", "setAutoloadImages(bool)", "setAutoloadImages(bool enable)" },
00030 { "bool", "autoloadImages()", "autoloadImages()" },
00031 { "void", "setOnlyLocalReferences(bool)", "setOnlyLocalReferences(bool enable)" },
00032 { "bool", "onlyLocalReferences()", "onlyLocalReferences()" },
00033 { "bool", "setEncoding(QString)", "setEncoding(QString name)" },
00034 { "QString", "encoding()", "encoding()" },
00035 { "void", "setUserStyleSheet(QString)", "setUserStyleSheet(QString styleSheet)" },
00036 { "void", "setFixedFont(QString)", "setFixedFont(QString name)" },
00037 { "bool", "gotoAnchor(QString)", "gotoAnchor(QString name)" },
00038 { "bool", "nextAnchor()", "nextAnchor()" },
00039 { "bool", "prevAnchor()", "prevAnchor()" },
00040 { "void", "activateNode()", "activateNode()" },
00041 { "QString", "selectedText()", "selectedText()" },
00042 { "void", "selectAll()", "selectAll()" },
00043 { "QString", "lastModified()", "lastModified()" },
00044 { "ASYNC", "print(bool)", "print(bool quick)" },
00045 { "void", "debugRenderTree()", "debugRenderTree()" },
00046 { "void", "debugDOMTree()", "debugDOMTree()" },
00047 { "void", "viewDocumentSource()", "viewDocumentSource()" },
00048 { "void", "viewFrameSource()", "viewFrameSource()" },
00049 { "void", "saveBackground(QString)", "saveBackground(QString url)" },
00050 { "void", "saveDocument(QString)", "saveDocument(QString url)" },
00051 { "QString", "evalJS(QString)", "evalJS(QString script)" },
00052 { "void", "stopAnimations()", "stopAnimations()" },
00053 { 0, 0, 0 }
00054 };
00055 static const int KHTMLPartIface_ftable_hiddens[36] = {
00056 0,
00057 0,
00058 0,
00059 0,
00060 0,
00061 0,
00062 0,
00063 0,
00064 0,
00065 0,
00066 0,
00067 0,
00068 0,
00069 0,
00070 0,
00071 0,
00072 0,
00073 0,
00074 0,
00075 0,
00076 0,
00077 0,
00078 0,
00079 0,
00080 0,
00081 0,
00082 0,
00083 0,
00084 0,
00085 0,
00086 0,
00087 0,
00088 0,
00089 0,
00090 0,
00091 0,
00092 };
00093
00094 bool KHTMLPartIface::process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData)
00095 {
00096 static QAsciiDict<int>* fdict = 0;
00097 if ( !fdict ) {
00098 fdict = new QAsciiDict<int>( KHTMLPartIface_fhash, true, false );
00099 for ( int i = 0; KHTMLPartIface_ftable[i][1]; i++ )
00100 fdict->insert( KHTMLPartIface_ftable[i][1], new int( i ) );
00101 }
00102 int* fp = fdict->find( fun );
00103 switch ( fp?*fp:-1) {
00104 case 0: {
00105 replyType = KHTMLPartIface_ftable[0][0];
00106 QDataStream _replyStream( replyData, IO_WriteOnly );
00107 _replyStream << url( );
00108 } break;
00109 case 1: {
00110 replyType = KHTMLPartIface_ftable[1][0];
00111 QDataStream _replyStream( replyData, IO_WriteOnly );
00112 _replyStream << closeURL( );
00113 } break;
00114 case 2: {
00115 bool arg0;
00116 QDataStream arg( data, IO_ReadOnly );
00117 if (arg.atEnd()) return false;
00118 arg >> arg0;
00119 replyType = KHTMLPartIface_ftable[2][0];
00120 setJScriptEnabled(arg0 );
00121 } break;
00122 case 3: {
00123 replyType = KHTMLPartIface_ftable[3][0];
00124 QDataStream _replyStream( replyData, IO_WriteOnly );
00125 _replyStream << jScriptEnabled( );
00126 } break;
00127 case 4: {
00128 bool arg0;
00129 QDataStream arg( data, IO_ReadOnly );
00130 if (arg.atEnd()) return false;
00131 arg >> arg0;
00132 replyType = KHTMLPartIface_ftable[4][0];
00133 setMetaRefreshEnabled(arg0 );
00134 } break;
00135 case 5: {
00136 replyType = KHTMLPartIface_ftable[5][0];
00137 QDataStream _replyStream( replyData, IO_WriteOnly );
00138 _replyStream << metaRefreshEnabled( );
00139 } break;
00140 case 6: {
00141 bool arg0;
00142 QDataStream arg( data, IO_ReadOnly );
00143 if (arg.atEnd()) return false;
00144 arg >> arg0;
00145 replyType = KHTMLPartIface_ftable[6][0];
00146 setDNDEnabled(arg0 );
00147 } break;
00148 case 7: {
00149 replyType = KHTMLPartIface_ftable[7][0];
00150 QDataStream _replyStream( replyData, IO_WriteOnly );
00151 _replyStream << dndEnabled( );
00152 } break;
00153 case 8: {
00154 bool arg0;
00155 QDataStream arg( data, IO_ReadOnly );
00156 if (arg.atEnd()) return false;
00157 arg >> arg0;
00158 replyType = KHTMLPartIface_ftable[8][0];
00159 setJavaEnabled(arg0 );
00160 } break;
00161 case 9: {
00162 replyType = KHTMLPartIface_ftable[9][0];
00163 QDataStream _replyStream( replyData, IO_WriteOnly );
00164 _replyStream << javaEnabled( );
00165 } break;
00166 case 10: {
00167 bool arg0;
00168 QDataStream arg( data, IO_ReadOnly );
00169 if (arg.atEnd()) return false;
00170 arg >> arg0;
00171 replyType = KHTMLPartIface_ftable[10][0];
00172 setPluginsEnabled(arg0 );
00173 } break;
00174 case 11: {
00175 replyType = KHTMLPartIface_ftable[11][0];
00176 QDataStream _replyStream( replyData, IO_WriteOnly );
00177 _replyStream << pluginsEnabled( );
00178 } break;
00179 case 12: {
00180 bool arg0;
00181 QDataStream arg( data, IO_ReadOnly );
00182 if (arg.atEnd()) return false;
00183 arg >> arg0;
00184 replyType = KHTMLPartIface_ftable[12][0];
00185 setAutoloadImages(arg0 );
00186 } break;
00187 case 13: {
00188 replyType = KHTMLPartIface_ftable[13][0];
00189 QDataStream _replyStream( replyData, IO_WriteOnly );
00190 _replyStream << autoloadImages( );
00191 } break;
00192 case 14: {
00193 bool arg0;
00194 QDataStream arg( data, IO_ReadOnly );
00195 if (arg.atEnd()) return false;
00196 arg >> arg0;
00197 replyType = KHTMLPartIface_ftable[14][0];
00198 setOnlyLocalReferences(arg0 );
00199 } break;
00200 case 15: {
00201 replyType = KHTMLPartIface_ftable[15][0];
00202 QDataStream _replyStream( replyData, IO_WriteOnly );
00203 _replyStream << onlyLocalReferences( );
00204 } break;
00205 case 16: {
00206 QString arg0;
00207 QDataStream arg( data, IO_ReadOnly );
00208 if (arg.atEnd()) return false;
00209 arg >> arg0;
00210 replyType = KHTMLPartIface_ftable[16][0];
00211 QDataStream _replyStream( replyData, IO_WriteOnly );
00212 _replyStream << setEncoding(arg0 );
00213 } break;
00214 case 17: {
00215 replyType = KHTMLPartIface_ftable[17][0];
00216 QDataStream _replyStream( replyData, IO_WriteOnly );
00217 _replyStream << encoding( );
00218 } break;
00219 case 18: {
00220 QString arg0;
00221 QDataStream arg( data, IO_ReadOnly );
00222 if (arg.atEnd()) return false;
00223 arg >> arg0;
00224 replyType = KHTMLPartIface_ftable[18][0];
00225 setUserStyleSheet(arg0 );
00226 } break;
00227 case 19: {
00228 QString arg0;
00229 QDataStream arg( data, IO_ReadOnly );
00230 if (arg.atEnd()) return false;
00231 arg >> arg0;
00232 replyType = KHTMLPartIface_ftable[19][0];
00233 setFixedFont(arg0 );
00234 } break;
00235 case 20: {
00236 QString arg0;
00237 QDataStream arg( data, IO_ReadOnly );
00238 if (arg.atEnd()) return false;
00239 arg >> arg0;
00240 replyType = KHTMLPartIface_ftable[20][0];
00241 QDataStream _replyStream( replyData, IO_WriteOnly );
00242 _replyStream << gotoAnchor(arg0 );
00243 } break;
00244 case 21: {
00245 replyType = KHTMLPartIface_ftable[21][0];
00246 QDataStream _replyStream( replyData, IO_WriteOnly );
00247 _replyStream << nextAnchor( );
00248 } break;
00249 case 22: {
00250 replyType = KHTMLPartIface_ftable[22][0];
00251 QDataStream _replyStream( replyData, IO_WriteOnly );
00252 _replyStream << prevAnchor( );
00253 } break;
00254 case 23: {
00255 replyType = KHTMLPartIface_ftable[23][0];
00256 activateNode( );
00257 } break;
00258 case 24: {
00259 replyType = KHTMLPartIface_ftable[24][0];
00260 QDataStream _replyStream( replyData, IO_WriteOnly );
00261 _replyStream << selectedText( );
00262 } break;
00263 case 25: {
00264 replyType = KHTMLPartIface_ftable[25][0];
00265 selectAll( );
00266 } break;
00267 case 26: {
00268 replyType = KHTMLPartIface_ftable[26][0];
00269 QDataStream _replyStream( replyData, IO_WriteOnly );
00270 _replyStream << lastModified( );
00271 } break;
00272 case 27: {
00273 bool arg0;
00274 QDataStream arg( data, IO_ReadOnly );
00275 if (arg.atEnd()) return false;
00276 arg >> arg0;
00277 replyType = KHTMLPartIface_ftable[27][0];
00278 print(arg0 );
00279 } break;
00280 case 28: {
00281 replyType = KHTMLPartIface_ftable[28][0];
00282 debugRenderTree( );
00283 } break;
00284 case 29: {
00285 replyType = KHTMLPartIface_ftable[29][0];
00286 debugDOMTree( );
00287 } break;
00288 case 30: {
00289 replyType = KHTMLPartIface_ftable[30][0];
00290 viewDocumentSource( );
00291 } break;
00292 case 31: {
00293 replyType = KHTMLPartIface_ftable[31][0];
00294 viewFrameSource( );
00295 } break;
00296 case 32: {
00297 QString arg0;
00298 QDataStream arg( data, IO_ReadOnly );
00299 if (arg.atEnd()) return false;
00300 arg >> arg0;
00301 replyType = KHTMLPartIface_ftable[32][0];
00302 saveBackground(arg0 );
00303 } break;
00304 case 33: {
00305 QString arg0;
00306 QDataStream arg( data, IO_ReadOnly );
00307 if (arg.atEnd()) return false;
00308 arg >> arg0;
00309 replyType = KHTMLPartIface_ftable[33][0];
00310 saveDocument(arg0 );
00311 } break;
00312 case 34: {
00313 QString arg0;
00314 QDataStream arg( data, IO_ReadOnly );
00315 if (arg.atEnd()) return false;
00316 arg >> arg0;
00317 replyType = KHTMLPartIface_ftable[34][0];
00318 QDataStream _replyStream( replyData, IO_WriteOnly );
00319 _replyStream << evalJS(arg0 );
00320 } break;
00321 case 35: {
00322 replyType = KHTMLPartIface_ftable[35][0];
00323 stopAnimations( );
00324 } break;
00325 default:
00326 return DCOPObject::process( fun, data, replyType, replyData );
00327 }
00328 return true;
00329 }
00330
00331 QCStringList KHTMLPartIface::interfaces()
00332 {
00333 QCStringList ifaces = DCOPObject::interfaces();
00334 ifaces += "KHTMLPartIface";
00335 return ifaces;
00336 }
00337
00338 QCStringList KHTMLPartIface::functions()
00339 {
00340 QCStringList funcs = DCOPObject::functions();
00341 for ( int i = 0; KHTMLPartIface_ftable[i][2]; i++ ) {
00342 if (KHTMLPartIface_ftable_hiddens[i])
00343 continue;
00344 QCString func = KHTMLPartIface_ftable[i][0];
00345 func += ' ';
00346 func += KHTMLPartIface_ftable[i][2];
00347 funcs << func;
00348 }
00349 return funcs;
00350 }
00351
00352