khtml Library API Documentation

khtmlpart_p.h

00001 #ifndef khtmlpart_p_h 00002 #define khtmlpart_p_h 00003 00004 /* This file is part of the KDE project 00005 * 00006 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 00007 * 1999-2001 Lars Knoll <knoll@kde.org> 00008 * 1999-2001 Antti Koivisto <koivisto@kde.org> 00009 * 2000-2001 Simon Hausmann <hausmann@kde.org> 00010 * 2000-2001 Dirk Mueller <mueller@kde.org> 00011 * 2000 Stefan Schimanski <1Stein@gmx.de> 00012 * 2001-2003 George Stiakos <staikos@kde.org> 00013 * 00014 * This library is free software; you can redistribute it and/or 00015 * modify it under the terms of the GNU Library General Public 00016 * License as published by the Free Software Foundation; either 00017 * version 2 of the License, or (at your option) any later version. 00018 * 00019 * This library is distributed in the hope that it will be useful, 00020 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00022 * Library General Public License for more details. 00023 * 00024 * You should have received a copy of the GNU Library General Public License 00025 * along with this library; see the file COPYING.LIB. If not, write to 00026 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00027 * Boston, MA 02111-1307, USA. 00028 */ 00029 #include <kcursor.h> 00030 #include <klibloader.h> 00031 #include <kxmlguifactory.h> 00032 #include <kaction.h> 00033 #include <kparts/partmanager.h> 00034 #include <kparts/statusbarextension.h> 00035 #include <kwallet.h> 00036 #include <qtimer.h> 00037 00038 #include "khtml_run.h" 00039 #include "khtml_factory.h" 00040 #include "khtml_events.h" 00041 #include "khtml_ext.h" 00042 #include "khtml_iface.h" 00043 #include "khtml_settings.h" 00044 #include "misc/decoder.h" 00045 #include "ecma/kjs_proxy.h" 00046 00047 class KFind; 00048 class KFindDialog; 00049 class KPopupMenu; 00050 class KSelectAction; 00051 class KURLLabel; 00052 class KJavaAppletContext; 00053 class KJSErrorDlg; 00054 00055 namespace KIO 00056 { 00057 class Job; 00058 class TransferJob; 00059 } 00060 namespace KParts 00061 { 00062 class StatusBarExtension; 00063 } 00064 00065 namespace khtml 00066 { 00067 struct ChildFrame 00068 { 00069 enum Type { Frame, IFrame, Object }; 00070 00071 ChildFrame() { 00072 m_bCompleted = false; m_bPreloaded = false; m_type = Frame; m_bNotify = false; 00073 m_bPendingRedirection = false; 00074 } 00075 00076 ~ChildFrame() { if (m_run) m_run->abort(); } 00077 00078 QGuardedPtr<khtml::RenderPart> m_frame; 00079 QGuardedPtr<KParts::ReadOnlyPart> m_part; 00080 QGuardedPtr<KParts::BrowserExtension> m_extension; 00081 QGuardedPtr<KParts::LiveConnectExtension> m_liveconnect; 00082 QString m_serviceName; 00083 QString m_serviceType; 00084 bool m_bCompleted; 00085 QString m_name; 00086 KParts::URLArgs m_args; 00087 QGuardedPtr<KHTMLRun> m_run; 00088 bool m_bPreloaded; 00089 KURL m_workingURL; 00090 Type m_type; 00091 QStringList m_params; 00092 bool m_bNotify; 00093 bool m_bPendingRedirection; 00094 }; 00095 00096 } 00097 00098 struct KHTMLFrameList : public QValueList<khtml::ChildFrame> 00099 { 00100 Iterator find( const QString &name ) KDE_NO_EXPORT; 00101 }; 00102 00103 typedef KHTMLFrameList::ConstIterator ConstFrameIt; 00104 typedef KHTMLFrameList::Iterator FrameIt; 00105 00106 static int khtml_part_dcop_counter = 0; 00107 00108 class KHTMLPartPrivate 00109 { 00110 public: 00111 KHTMLPartPrivate(QObject* parent) 00112 { 00113 m_doc = 0L; 00114 m_decoder = 0L; 00115 m_jscript = 0L; 00116 m_wallet = 0L; 00117 m_bWalletOpened = false; 00118 m_runningScripts = 0; 00119 m_kjs_lib = 0; 00120 m_job = 0L; 00121 m_bComplete = true; 00122 m_bLoadEventEmitted = true; 00123 m_cachePolicy = KIO::CC_Verify; 00124 m_manager = 0L; 00125 m_settings = new KHTMLSettings(*KHTMLFactory::defaultHTMLSettings()); 00126 m_bClearing = false; 00127 m_bCleared = false; 00128 m_zoomFactor = 100; 00129 m_bDnd = true; 00130 m_startOffset = m_endOffset = 0; 00131 m_startBeforeEnd = true; 00132 m_extendAtEnd = true; 00133 m_linkCursor = KCursor::handCursor(); 00134 m_loadedObjects = 0; 00135 m_totalObjectCount = 0; 00136 m_jobPercent = 0; 00137 m_haveEncoding = false; 00138 m_activeFrame = 0L; 00139 m_find = 0; 00140 m_findDialog = 0; 00141 m_ssl_in_use = false; 00142 m_jsedlg = 0; 00143 m_formNotification = KHTMLPart::NoNotification; 00144 00145 #ifndef Q_WS_QWS 00146 m_javaContext = 0; 00147 #endif 00148 m_cacheId = 0; 00149 m_frameNameId = 1; 00150 00151 m_restored = false; 00152 00153 m_focusNodeNumber = -1; 00154 m_focusNodeRestored = false; 00155 00156 m_bJScriptForce = false; 00157 m_bJScriptOverride = false; 00158 m_bJavaForce = false; 00159 m_bJavaOverride = false; 00160 m_bPluginsForce = false; 00161 m_bPluginsOverride = false; 00162 m_onlyLocalReferences = false; 00163 00164 m_caretMode = false; 00165 m_designMode = false; 00166 00167 m_metaRefreshEnabled = true; 00168 m_statusMessagesEnabled = true; 00169 00170 m_bFirstData = true; 00171 m_submitForm = 0; 00172 m_delayRedirect = 0; 00173 m_autoDetectLanguage = khtml::Decoder::SemiautomaticDetection; 00174 00175 // inherit settings from parent 00176 if(parent && parent->inherits("KHTMLPart")) 00177 { 00178 KHTMLPart* part = static_cast<KHTMLPart*>(parent); 00179 if(part->d) 00180 { 00181 m_bJScriptForce = part->d->m_bJScriptForce; 00182 m_bJScriptOverride = part->d->m_bJScriptOverride; 00183 m_bJavaForce = part->d->m_bJavaForce; 00184 m_bJavaOverride = part->d->m_bJavaOverride; 00185 m_bPluginsForce = part->d->m_bPluginsForce; 00186 m_bPluginsOverride = part->d->m_bPluginsOverride; 00187 // Same for SSL settings 00188 m_ssl_in_use = part->d->m_ssl_in_use; 00189 m_onlyLocalReferences = part->d->m_onlyLocalReferences; 00190 m_caretMode = part->d->m_caretMode; 00191 m_designMode = part->d->m_designMode; 00192 m_zoomFactor = part->d->m_zoomFactor; 00193 m_autoDetectLanguage = part->d->m_autoDetectLanguage; 00194 m_encoding = part->d->m_encoding; 00195 m_haveEncoding = part->d->m_haveEncoding; 00196 } 00197 } 00198 00199 m_focusNodeNumber = -1; 00200 m_focusNodeRestored = false; 00201 m_opener = 0; 00202 m_openedByJS = false; 00203 m_newJSInterpreterExists = false; 00204 m_dcopobject = 0; 00205 m_jobspeed = 0; 00206 m_dcop_counter = ++khtml_part_dcop_counter; 00207 m_statusBarWalletLabel = 0L; 00208 m_statusBarJSErrorLabel = 0L; 00209 m_userStyleSheetLastModified = 0; 00210 } 00211 ~KHTMLPartPrivate() 00212 { 00213 delete m_dcopobject; 00214 delete m_statusBarExtension; 00215 delete m_extension; 00216 delete m_settings; 00217 delete m_jscript; 00218 delete m_wallet; 00219 if ( m_kjs_lib) 00220 m_kjs_lib->unload(); 00221 #ifndef Q_WS_QWS 00222 //delete m_javaContext; 00223 #endif 00224 } 00225 00226 KHTMLFrameList m_frames; 00227 QValueList<khtml::ChildFrame> m_objects; 00228 00229 QGuardedPtr<KHTMLView> m_view; 00230 KHTMLPartBrowserExtension *m_extension; 00231 KParts::StatusBarExtension *m_statusBarExtension; 00232 KHTMLPartBrowserHostExtension *m_hostExtension; 00233 KURLLabel* m_statusBarIconLabel; 00234 KURLLabel* m_statusBarWalletLabel; 00235 KURLLabel* m_statusBarJSErrorLabel; 00236 DOM::DocumentImpl *m_doc; 00237 khtml::Decoder *m_decoder; 00238 QString m_encoding; 00239 QString m_sheetUsed; 00240 long m_cacheId; 00241 QString scheduledScript; 00242 DOM::Node scheduledScriptNode; 00243 00244 KJSProxy *m_jscript; 00245 KWallet::Wallet* m_wallet; 00246 KLibrary *m_kjs_lib; 00247 int m_runningScripts; 00248 bool m_bOpenMiddleClick :1; 00249 bool m_bBackRightClick :1; 00250 bool m_bJScriptEnabled :1; 00251 bool m_bJScriptDebugEnabled :1; 00252 bool m_bJavaEnabled :1; 00253 bool m_bPluginsEnabled :1; 00254 bool m_bJScriptForce :1; 00255 bool m_bJScriptOverride :1; 00256 bool m_bJavaForce :1; 00257 bool m_bJavaOverride :1; 00258 bool m_bPluginsForce :1; 00259 bool m_metaRefreshEnabled :1; 00260 bool m_bPluginsOverride :1; 00261 bool m_restored :1; 00262 bool m_statusMessagesEnabled :1; 00263 bool m_bWalletOpened :1; 00264 int m_frameNameId; 00265 int m_dcop_counter; 00266 DCOPObject *m_dcopobject; 00267 00268 #ifndef Q_WS_QWS 00269 KJavaAppletContext *m_javaContext; 00270 #endif 00271 00272 KHTMLSettings *m_settings; 00273 00274 KIO::TransferJob * m_job; 00275 00276 QString m_statusBarText[3]; 00277 unsigned long m_jobspeed; 00278 QString m_lastModified; 00279 QString m_httpHeaders; 00280 QString m_pageServices; 00281 00282 // QStrings for SSL metadata 00283 // Note: When adding new variables don't forget to update ::saveState()/::restoreState()! 00284 bool m_ssl_in_use; 00285 QString m_ssl_peer_certificate, 00286 m_ssl_peer_chain, 00287 m_ssl_peer_ip, 00288 m_ssl_cipher, 00289 m_ssl_cipher_desc, 00290 m_ssl_cipher_version, 00291 m_ssl_cipher_used_bits, 00292 m_ssl_cipher_bits, 00293 m_ssl_cert_state, 00294 m_ssl_parent_ip, 00295 m_ssl_parent_cert; 00296 00297 bool m_bComplete:1; 00298 bool m_bLoadEventEmitted:1; 00299 bool m_haveEncoding:1; 00300 bool m_onlyLocalReferences :1; 00301 bool m_redirectLockHistory:1; 00302 00303 KURL m_workingURL; 00304 00305 KIO::CacheControl m_cachePolicy; 00306 QTimer m_redirectionTimer; 00307 QTime m_parsetime; 00308 int m_delayRedirect; 00309 QString m_redirectURL; 00310 00311 KAction *m_paViewDocument; 00312 KAction *m_paViewFrame; 00313 KAction *m_paViewInfo; 00314 KAction *m_paSaveBackground; 00315 KAction *m_paSaveDocument; 00316 KAction *m_paSaveFrame; 00317 KAction *m_paSecurity; 00318 KActionMenu *m_paSetEncoding; 00319 KSelectAction *m_paUseStylesheet; 00320 KHTMLZoomFactorAction *m_paIncZoomFactor; 00321 KHTMLZoomFactorAction *m_paDecZoomFactor; 00322 KAction *m_paLoadImages; 00323 KAction *m_paFind; 00324 KAction *m_paFindNext; 00325 KAction *m_paPrintFrame; 00326 KAction *m_paSelectAll; 00327 KAction *m_paDebugScript; 00328 KAction *m_paDebugDOMTree; 00329 KAction *m_paDebugRenderTree; 00330 KAction *m_paStopAnimations; 00331 KToggleAction *m_paToggleCaretMode; 00332 00333 KParts::PartManager *m_manager; 00334 00335 QString m_popupMenuXML; 00336 KHTMLPart::GUIProfile m_guiProfile; 00337 00338 int m_zoomFactor; 00339 00340 QString m_strSelectedURL; 00341 QString m_strSelectedURLTarget; 00342 QString m_referrer; 00343 QString m_pageReferrer; 00344 00345 struct SubmitForm 00346 { 00347 const char *submitAction; 00348 QString submitUrl; 00349 QByteArray submitFormData; 00350 QString target; 00351 QString submitContentType; 00352 QString submitBoundary; 00353 }; 00354 00355 SubmitForm *m_submitForm; 00356 00357 bool m_bMousePressed; 00358 bool m_bRightMousePressed; 00359 DOM::Node m_mousePressNode; //node under the mouse when the mouse was pressed (set in the mouse handler) 00360 00361 // simply using the selection limits for the caret position does not suffice 00362 // as we need to know on which side to extend the selection 00363 // DOM::Node m_caretNode; // node containing the caret 00364 // long m_caretOffset; // offset within this node (0-based) 00365 00366 // the caret uses the selection variables for its position. If m_extendAtEnd 00367 // is true, m_selectionEnd and m_endOffset contain the mandatory caret 00368 // position, otherwise it's m_selectionStart and m_startOffset. 00369 DOM::Node m_selectionStart; 00370 long m_startOffset; 00371 DOM::Node m_selectionEnd; 00372 long m_endOffset; 00373 DOM::Node m_initialNode; // (Node, Offset) pair on which the 00374 long m_initialOffset; // selection has been initiated 00375 QString m_overURL; 00376 QString m_overURLTarget; 00377 00378 bool m_startBeforeEnd:1; 00379 bool m_extendAtEnd:1; // true if selection is to be extended at its end 00380 enum { ExtendByChar, ExtendByWord, ExtendByLine } m_extendMode:2; 00381 bool m_bDnd:1; 00382 bool m_bFirstData:1; 00383 bool m_bClearing:1; 00384 bool m_bCleared:1; 00385 bool m_bSecurityInQuestion:1; 00386 bool m_focusNodeRestored:1; 00387 00388 int m_focusNodeNumber; 00389 00390 QPoint m_dragStartPos; 00391 #ifdef KHTML_NO_SELECTION 00392 QPoint m_dragLastPos; 00393 #endif 00394 00395 bool m_designMode; 00396 bool m_caretMode; 00397 00398 QCursor m_linkCursor; 00399 QTimer m_scrollTimer; 00400 00401 unsigned long m_loadedObjects; 00402 unsigned long m_totalObjectCount; 00403 unsigned int m_jobPercent; 00404 00405 KHTMLPart::FormNotification m_formNotification; 00406 QTimer m_progressUpdateTimer; 00407 00408 QStringList m_pluginPageQuestionAsked; 00409 00411 struct StringPortion 00412 { 00413 // Just basic ref/deref on our node to make sure it doesn't get deleted 00414 StringPortion( int i, DOM::NodeImpl* n ) : index(i), node(n) { if (node) node->ref(); } 00415 StringPortion() : index(0), node(0) {} // for QValueList 00416 StringPortion( const StringPortion& other ) : node(0) { operator=(other); } 00417 StringPortion& operator=( const StringPortion& other ) { 00418 index=other.index; 00419 if (other.node) other.node->ref(); 00420 if (node) node->deref(); 00421 node=other.node; 00422 return *this; 00423 } 00424 ~StringPortion() { if (node) node->deref(); } 00425 00426 int index; 00427 DOM::NodeImpl *node; 00428 }; 00429 QValueList<StringPortion> m_stringPortions; 00430 00431 KFind *m_find; 00432 KFindDialog *m_findDialog; 00433 00434 struct findState 00435 { 00436 findState() 00437 { options = 0; } 00438 QStringList history; 00439 QString text; 00440 int options; 00441 }; 00442 00443 findState m_lastFindState; 00444 00445 KJSErrorDlg *m_jsedlg; 00446 00447 DOM::NodeImpl *m_findNode; // current node 00448 DOM::NodeImpl *m_findNodeEnd; // end node 00449 int m_findPos; // current pos in current node 00450 int m_findPosEnd; // pos in end node 00452 00453 //QGuardedPtr<KParts::Part> m_activeFrame; 00454 KParts::Part * m_activeFrame; 00455 QGuardedPtr<KHTMLPart> m_opener; 00456 bool m_openedByJS; 00457 bool m_newJSInterpreterExists; // set to 1 by setOpenedByJS, for window.open 00458 00459 khtml::Decoder::AutoDetectLanguage m_autoDetectLanguage; 00460 KPopupMenu *m_automaticDetection; 00461 KSelectAction *m_manualDetection; 00462 00463 void setFlagRecursively(bool KHTMLPartPrivate::*flag, bool value); 00465 DOM::Node &caretNode() { 00466 return m_extendAtEnd ? m_selectionEnd : m_selectionStart; 00467 } 00469 long &caretOffset() { 00470 return m_extendAtEnd ? m_endOffset : m_startOffset; 00471 } 00472 00473 time_t m_userStyleSheetLastModified; 00474 }; 00475 00476 #endif
KDE Logo
This file is part of the documentation for khtml Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:42:27 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003