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 = 31;
00016 static const char* const KHTMLPartIface_ftable[30][3] = {
00017 { "bool", "closeURL()", "closeURL()" },
00018 { "void", "setJScriptEnabled(bool)", "setJScriptEnabled(bool enable)" },
00019 { "bool", "jScriptEnabled()", "jScriptEnabled()" },
00020 { "void", "setMetaRefreshEnabled(bool)", "setMetaRefreshEnabled(bool enable)" },
00021 { "bool", "metaRefreshEnabled()", "metaRefreshEnabled()" },
00022 { "void", "setDNDEnabled(bool)", "setDNDEnabled(bool b)" },
00023 { "bool", "dndEnabled()", "dndEnabled()" },
00024 { "void", "setJavaEnabled(bool)", "setJavaEnabled(bool enable)" },
00025 { "bool", "javaEnabled()", "javaEnabled()" },
00026 { "void", "setPluginsEnabled(bool)", "setPluginsEnabled(bool enable)" },
00027 { "bool", "pluginsEnabled()", "pluginsEnabled()" },
00028 { "void", "setAutoloadImages(bool)", "setAutoloadImages(bool enable)" },
00029 { "bool", "autoloadImages()", "autoloadImages()" },
00030 { "void", "setOnlyLocalReferences(bool)", "setOnlyLocalReferences(bool enable)" },
00031 { "bool", "onlyLocalReferences()", "onlyLocalReferences()" },
00032 { "bool", "setEncoding(QString)", "setEncoding(QString name)" },
00033 { "QString", "encoding()", "encoding()" },
00034 { "void", "setUserStyleSheet(QString)", "setUserStyleSheet(QString styleSheet)" },
00035 { "void", "setFixedFont(QString)", "setFixedFont(QString name)" },
00036 { "bool", "gotoAnchor(QString)", "gotoAnchor(QString name)" },
00037 { "QString", "selectedText()", "selectedText()" },
00038 { "void", "selectAll()", "selectAll()" },
00039 { "QString", "lastModified()", "lastModified()" },
00040 { "void", "debugRenderTree()", "debugRenderTree()" },
00041 { "void", "viewDocumentSource()", "viewDocumentSource()" },
00042 { "void", "viewFrameSource()", "viewFrameSource()" },
00043 { "void", "saveBackground(QString)", "saveBackground(QString url)" },
00044 { "void", "saveDocument(QString)", "saveDocument(QString url)" },
00045 { "QString", "evalJS(QString)", "evalJS(QString script)" },
00046 { 0, 0, 0 }
00047 };
00048
00049 bool KHTMLPartIface::process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData)
00050 {
00051 static QAsciiDict<int>* fdict = 0;
00052 if ( !fdict ) {
00053 fdict = new QAsciiDict<int>( KHTMLPartIface_fhash, TRUE, FALSE );
00054 for ( int i = 0; KHTMLPartIface_ftable[i][1]; i++ )
00055 fdict->insert( KHTMLPartIface_ftable[i][1], new int( i ) );
00056 }
00057 int* fp = fdict->find( fun );
00058 switch ( fp?*fp:-1) {
00059 case 0: {
00060 replyType = KHTMLPartIface_ftable[0][0];
00061 QDataStream _replyStream( replyData, IO_WriteOnly );
00062 _replyStream << closeURL( );
00063 } break;
00064 case 1: {
00065 bool arg0;
00066 QDataStream arg( data, IO_ReadOnly );
00067 arg >> arg0;
00068 replyType = KHTMLPartIface_ftable[1][0];
00069 setJScriptEnabled(arg0 );
00070 } break;
00071 case 2: {
00072 replyType = KHTMLPartIface_ftable[2][0];
00073 QDataStream _replyStream( replyData, IO_WriteOnly );
00074 _replyStream << jScriptEnabled( );
00075 } break;
00076 case 3: {
00077 bool arg0;
00078 QDataStream arg( data, IO_ReadOnly );
00079 arg >> arg0;
00080 replyType = KHTMLPartIface_ftable[3][0];
00081 setMetaRefreshEnabled(arg0 );
00082 } break;
00083 case 4: {
00084 replyType = KHTMLPartIface_ftable[4][0];
00085 QDataStream _replyStream( replyData, IO_WriteOnly );
00086 _replyStream << metaRefreshEnabled( );
00087 } break;
00088 case 5: {
00089 bool arg0;
00090 QDataStream arg( data, IO_ReadOnly );
00091 arg >> arg0;
00092 replyType = KHTMLPartIface_ftable[5][0];
00093 setDNDEnabled(arg0 );
00094 } break;
00095 case 6: {
00096 replyType = KHTMLPartIface_ftable[6][0];
00097 QDataStream _replyStream( replyData, IO_WriteOnly );
00098 _replyStream << dndEnabled( );
00099 } break;
00100 case 7: {
00101 bool arg0;
00102 QDataStream arg( data, IO_ReadOnly );
00103 arg >> arg0;
00104 replyType = KHTMLPartIface_ftable[7][0];
00105 setJavaEnabled(arg0 );
00106 } break;
00107 case 8: {
00108 replyType = KHTMLPartIface_ftable[8][0];
00109 QDataStream _replyStream( replyData, IO_WriteOnly );
00110 _replyStream << javaEnabled( );
00111 } break;
00112 case 9: {
00113 bool arg0;
00114 QDataStream arg( data, IO_ReadOnly );
00115 arg >> arg0;
00116 replyType = KHTMLPartIface_ftable[9][0];
00117 setPluginsEnabled(arg0 );
00118 } break;
00119 case 10: {
00120 replyType = KHTMLPartIface_ftable[10][0];
00121 QDataStream _replyStream( replyData, IO_WriteOnly );
00122 _replyStream << pluginsEnabled( );
00123 } break;
00124 case 11: {
00125 bool arg0;
00126 QDataStream arg( data, IO_ReadOnly );
00127 arg >> arg0;
00128 replyType = KHTMLPartIface_ftable[11][0];
00129 setAutoloadImages(arg0 );
00130 } break;
00131 case 12: {
00132 replyType = KHTMLPartIface_ftable[12][0];
00133 QDataStream _replyStream( replyData, IO_WriteOnly );
00134 _replyStream << autoloadImages( );
00135 } break;
00136 case 13: {
00137 bool arg0;
00138 QDataStream arg( data, IO_ReadOnly );
00139 arg >> arg0;
00140 replyType = KHTMLPartIface_ftable[13][0];
00141 setOnlyLocalReferences(arg0 );
00142 } break;
00143 case 14: {
00144 replyType = KHTMLPartIface_ftable[14][0];
00145 QDataStream _replyStream( replyData, IO_WriteOnly );
00146 _replyStream << onlyLocalReferences( );
00147 } break;
00148 case 15: {
00149 QString arg0;
00150 QDataStream arg( data, IO_ReadOnly );
00151 arg >> arg0;
00152 replyType = KHTMLPartIface_ftable[15][0];
00153 QDataStream _replyStream( replyData, IO_WriteOnly );
00154 _replyStream << setEncoding(arg0 );
00155 } break;
00156 case 16: {
00157 replyType = KHTMLPartIface_ftable[16][0];
00158 QDataStream _replyStream( replyData, IO_WriteOnly );
00159 _replyStream << encoding( );
00160 } break;
00161 case 17: {
00162 QString arg0;
00163 QDataStream arg( data, IO_ReadOnly );
00164 arg >> arg0;
00165 replyType = KHTMLPartIface_ftable[17][0];
00166 setUserStyleSheet(arg0 );
00167 } break;
00168 case 18: {
00169 QString arg0;
00170 QDataStream arg( data, IO_ReadOnly );
00171 arg >> arg0;
00172 replyType = KHTMLPartIface_ftable[18][0];
00173 setFixedFont(arg0 );
00174 } break;
00175 case 19: {
00176 QString arg0;
00177 QDataStream arg( data, IO_ReadOnly );
00178 arg >> arg0;
00179 replyType = KHTMLPartIface_ftable[19][0];
00180 QDataStream _replyStream( replyData, IO_WriteOnly );
00181 _replyStream << gotoAnchor(arg0 );
00182 } break;
00183 case 20: {
00184 replyType = KHTMLPartIface_ftable[20][0];
00185 QDataStream _replyStream( replyData, IO_WriteOnly );
00186 _replyStream << selectedText( );
00187 } break;
00188 case 21: {
00189 replyType = KHTMLPartIface_ftable[21][0];
00190 selectAll( );
00191 } break;
00192 case 22: {
00193 replyType = KHTMLPartIface_ftable[22][0];
00194 QDataStream _replyStream( replyData, IO_WriteOnly );
00195 _replyStream << lastModified( );
00196 } break;
00197 case 23: {
00198 replyType = KHTMLPartIface_ftable[23][0];
00199 debugRenderTree( );
00200 } break;
00201 case 24: {
00202 replyType = KHTMLPartIface_ftable[24][0];
00203 viewDocumentSource( );
00204 } break;
00205 case 25: {
00206 replyType = KHTMLPartIface_ftable[25][0];
00207 viewFrameSource( );
00208 } break;
00209 case 26: {
00210 QString arg0;
00211 QDataStream arg( data, IO_ReadOnly );
00212 arg >> arg0;
00213 replyType = KHTMLPartIface_ftable[26][0];
00214 saveBackground(arg0 );
00215 } break;
00216 case 27: {
00217 QString arg0;
00218 QDataStream arg( data, IO_ReadOnly );
00219 arg >> arg0;
00220 replyType = KHTMLPartIface_ftable[27][0];
00221 saveDocument(arg0 );
00222 } break;
00223 case 28: {
00224 QString arg0;
00225 QDataStream arg( data, IO_ReadOnly );
00226 arg >> arg0;
00227 replyType = KHTMLPartIface_ftable[28][0];
00228 QDataStream _replyStream( replyData, IO_WriteOnly );
00229 _replyStream << evalJS(arg0 );
00230 } break;
00231 default:
00232 return DCOPObject::process( fun, data, replyType, replyData );
00233 }
00234 return TRUE;
00235 }
00236
00237 QCStringList KHTMLPartIface::interfaces()
00238 {
00239 QCStringList ifaces = DCOPObject::interfaces();
00240 ifaces += "KHTMLPartIface";
00241 return ifaces;
00242 }
00243
00244 QCStringList KHTMLPartIface::functions()
00245 {
00246 QCStringList funcs = DCOPObject::functions();
00247 for ( int i = 0; KHTMLPartIface_ftable[i][2]; i++ ) {
00248 QCString func = KHTMLPartIface_ftable[i][0];
00249 func += ' ';
00250 func += KHTMLPartIface_ftable[i][2];
00251 funcs << func;
00252 }
00253 return funcs;
00254 }
00255
00256