1 // -*- c-basic-offset: 2 -*-
2 /* This file is part of the KDE project
4 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
5 * 1999-2001 Lars Knoll <knoll@kde.org>
6 * 1999-2001 Antti Koivisto <koivisto@kde.org>
7 * 2000-2001 Simon Hausmann <hausmann@kde.org>
8 * 2000-2001 Dirk Mueller <mueller@kde.org>
9 * 2000 Stefan Schimanski <1Stein@gmx.de>
10 * Copyright (C) 2004 Apple Computer, Inc.
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public License
23 * along with this library; see the file COPYING.LIB. If not, write to
24 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 * Boston, MA 02111-1307, USA.
27 #ifndef __khtml_part_h__
28 #define __khtml_part_h__
30 #include "editing/text_granularity.h"
31 #include "editing/edit_actions.h"
33 #include <kparts/part.h>
34 #include <kparts/browserextension.h>
36 class KHTMLPartPrivate;
37 class KHTMLPartBrowserExtension;
41 class KJavaAppletContext;
45 class CSSComputedStyleDeclarationImpl;
46 class CSSMutableStyleDeclarationImpl;
47 class CSSStyleDeclarationImpl;
53 class HTMLAnchorElementImpl;
55 class HTMLDocumentImpl;
56 class HTMLElementImpl;
57 class HTMLEventListener;
58 class HTMLFormElementImpl;
59 class HTMLFrameElementImpl;
60 class HTMLIFrameElementImpl;
61 class HTMLMetaElementImpl;
62 class HTMLObjectElementImpl;
63 class HTMLTitleElementImpl;
73 class CSSStyleSelector;
75 class DrawContentsEvent;
79 class MouseDoubleClickEvent;
82 class MousePressEvent;
83 class MouseReleaseEvent;
85 class RenderPartObject;
93 class JSEventListener;
106 * This class is khtml's main class. It features an almost complete
107 * web browser, and html renderer.
109 * The easiest way to use this class (if you just want to display an HTML
110 * page at some URL) is the following:
113 * KURL url = "http://www.kde.org";
114 * KHTMLPart *w = new KHTMLPart();
116 * w->view()->resize(500, 400);
120 * By default Java and JavaScript support are disabled. You can enable them by
121 * using the @ref setJavaEnabled() and @ref setJScriptEnabled() methods.
123 * Some apps want to write their HTML code directly into the widget instead of
124 * it opening an url. You can also do that in the following way:
127 * QString myHTMLCode = ...;
128 * KHTMLPart *w = new KHTMLPart();
130 * w->write(myHTMLCode);
135 * You can do as many calls to write as you want. But there are two
136 * @ref write() methods, one accepting a @ref QString one accepting a
137 * @p char @p * argument. You should use one or the other
138 * (but not both) since the method using
139 * the @p char @p * argument does an additional decoding step to convert the
140 * written data to Unicode.
142 * @short HTML Browser Widget
143 * @author Lars Knoll (knoll@kde.org)
145 class KHTMLPart : public KParts::ReadOnlyPart
148 friend class KHTMLView;
149 friend class DOM::HTMLTitleElementImpl;
150 friend class DOM::HTMLFrameElementImpl;
151 friend class DOM::HTMLIFrameElementImpl;
152 friend class DOM::HTMLObjectElementImpl;
153 friend class DOM::HTMLAnchorElementImpl;
154 friend class DOM::HTMLMetaElementImpl;
155 friend class DOM::NodeImpl;
156 friend class KHTMLRun;
157 friend class DOM::HTMLFormElementImpl;
158 friend class khtml::RenderPartObject;
159 friend class KJS::Selection;
160 friend class KJS::SelectionFunc;
161 friend class KJS::Window;
162 friend class KJS::WindowFunc;
163 friend class KJS::JSEventListener;
164 friend class KJS::DOMDocument;
165 friend class KJSProxy;
166 friend class KHTMLPartBrowserExtension;
167 friend class DOM::DocumentImpl;
168 friend class DOM::HTMLDocumentImpl;
169 friend class KHTMLPartBrowserHostExtension;
170 friend class khtml::HTMLTokenizer;
171 friend class khtml::XMLTokenizer;
172 friend class khtml::RenderWidget;
173 friend class khtml::CSSStyleSelector;
174 friend class KHTMLPartIface;
176 Q_PROPERTY( bool javaScriptEnabled READ jScriptEnabled WRITE setJScriptEnabled )
177 Q_PROPERTY( bool javaEnabled READ javaEnabled WRITE setJavaEnabled )
178 Q_PROPERTY( bool autoloadImages READ autoloadImages WRITE setAutoloadImages )
179 Q_PROPERTY( bool dndEnabled READ dndEnabled WRITE setDNDEnabled )
180 Q_PROPERTY( bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled )
181 Q_PROPERTY( bool onlyLocalReferences READ onlyLocalReferences WRITE setOnlyLocalReferences )
182 Q_PROPERTY( QCString dcopObjectId READ dcopObjectId )
185 enum GUIProfile { DefaultGUI, BrowserViewGUI /* ... */ };
186 enum { NoXPosForVerticalArrowNavigation = INT_MIN };
189 * Constructs a new KHTMLPart.
191 * KHTML basically consists of two objects: The KHTMLPart itself,
192 * holding the document data (DOM document), and the @ref KHTMLView,
193 * derived from @ref QScrollView, in which the document content is
194 * rendered in. You can specify two different parent objects for a
195 * KHTMLPart, one parent for the KHTMLPart document and on parent
196 * for the @ref KHTMLView. If the second @p parent argument is 0L, then
197 * @p parentWidget is used as parent for both objects, the part and
200 KHTMLPart( QWidget *parentWidget = 0, const char *widgetname = 0,
201 QObject *parent = 0, const char *name = 0, GUIProfile prof = DefaultGUI );
203 KHTMLPart( KHTMLView *view, QObject *parent = 0, const char *name = 0, GUIProfile prof = DefaultGUI );
208 virtual ~KHTMLPart();
211 * Opens the specified URL @p url.
213 * Reimplemented from @ref KParts::ReadOnlyPart::openURL .
215 virtual bool openURL( const KURL &url );
218 * Stops loading the document and kill all data requests (for images, etc.)
220 virtual bool closeURL();
224 * is called when a certain error situation (i.e. connection timed out) occured.
225 * default implementation either shows a KIO error dialog or loads a more verbose
226 * error description a as page, depending on the users configuration.
227 * @p job is the job that signaled the error situation
229 virtual void showError(KIO::Job* job);
233 * Returns a reference to the DOM HTML document (for non-HTML documents, returns null)
235 DOM::HTMLDocument htmlDocument() const;
238 * Returns a reference to the DOM document.
240 DOM::Document document() const;
243 * Returns the node that has the keyboard focus.
245 DOM::Node activeNode() const;
248 * Returns a pointer to the @ref KParts::BrowserExtension.
250 KParts::BrowserExtension *browserExtension() const;
253 * Returns a pointer to the HTML document's view.
255 KHTMLView *view() const;
258 * Enable/disable Javascript support. Note that this will
259 * in either case permanently override the default usersetting.
260 * If you want to have the default UserSettings, don't call this
263 void setJScriptEnabled( bool enable );
266 * Returns @p true if Javascript support is enabled or @p false
269 bool jScriptEnabled() const;
272 * Enable/disable the automatic forwarding by <meta http-equiv="refresh" ....>
274 void setMetaRefreshEnabled( bool enable );
277 * Returns @p true if automtaic forwarding is enabled.
279 bool metaRefreshEnabled() const;
282 * Execute the specified snippet of JavaScript code.
284 * Returns @p true if JavaScript was enabled, no error occured
285 * and the code returned true itself or @p false otherwise.
286 * @deprecated, use the one below.
288 QVariant executeScript( const QString &script, bool forceUserGesture = false );
290 * Same as above except the Node parameter specifying the 'this' value.
292 QVariant executeScript( const DOM::Node &n, const QString &script, bool forceUserGesture = false );
295 * Enables or disables Drag'n'Drop support. A drag operation is started if
296 * the users drags a link.
298 void setDNDEnabled( bool b );
300 * Returns whether Dragn'n'Drop support is enabled or not.
302 bool dndEnabled() const;
305 * Implementation of CSS property -khtml-user-drag == auto
307 virtual bool shouldDragAutoNode(DOM::NodeImpl*, int x, int y) const;
310 * Enables/disables Java applet support. Note that calling this function
311 * will permanently override the User settings about Java applet support.
312 * Not calling this function is the only way to let the default settings
315 void setJavaEnabled( bool enable );
318 * Return if Java applet support is enabled/disabled.
320 bool javaEnabled() const;
323 * Returns the java context of the applets. If no applet exists, 0 is returned.
325 KJavaAppletContext *javaContext();
328 * Returns the java context of the applets. If no context exists yet, a new one is
331 KJavaAppletContext *createJavaContext();
334 * Enables or disables plugins via, default is enabled
336 void setPluginsEnabled( bool enable );
339 * Returns trie if plugins are enabled/disabled.
341 bool pluginsEnabled() const;
344 * Specifies whether images contained in the document should be loaded
345 * automatically or not.
347 * @note Request will be ignored if called before @ref begin().
349 void setAutoloadImages( bool enable );
351 * Returns whether images contained in the document are loaded automatically
353 * @note that the returned information is unrelieable as long as no begin()
356 bool autoloadImages() const;
361 * Specify whether only local references ( stylesheets, images, scripts, subdocuments )
362 * should be loaded. ( default false - everything is loaded, if the more specific
365 void setOnlyLocalReferences(bool enable);
368 * Returns whether references should be loaded ( default false )
370 bool onlyLocalReferences() const;
372 #ifndef KDE_NO_COMPAT
373 void enableJScript(bool e) { setJScriptEnabled(e); }
374 void enableJava(bool e) { setJavaEnabled(e); }
375 void enablePlugins(bool e) { setPluginsEnabled(e); }
376 void autoloadImages(bool e) { setAutoloadImages(e); }
377 void enableMetaRefresh(bool e) { setMetaRefreshEnabled(e); }
378 bool setCharset( const QString &, bool ) { return true; }
380 KURL baseURL() const;
381 QString baseTarget() const;
385 * Returns the URL for the background Image (used by save background)
387 KURL backgroundURL() const;
390 * Schedules a redirection after @p delay seconds.
392 void scheduleRedirection(double delay, const QString &url, bool lockHistory = true);
395 * Schedules a location change.
396 * This is used for JavaScript-triggered location changes.
398 void scheduleLocationChange(const QString &url, bool lockHistory = true, bool userGesture = false);
399 bool isScheduledLocationChangePending() const;
402 * Schedules a history navigation operation (go forward, go back, etc.).
403 * This is used for JavaScript-triggered location changes.
405 void scheduleHistoryNavigation( int steps );
408 * Clears the widget and prepares it for new content.
410 * If you want @ref url() to return
411 * for example "file:/tmp/test.html", you can use the following code:
413 * view->begin( KURL("file:/tmp/test.html" ) );
416 * @param url is the url of the document to be displayed. Even if you
417 * are generating the HTML on the fly, it may be useful to specify
418 * a directory so that any pixmaps are found.
420 * @param xOffset is the initial horizontal scrollbar value. Usually
421 * you don't want to use this.
423 * @param yOffset is the initial vertical scrollbar value. Usually
424 * you don't want to use this.
426 * All child frames and the old document are removed if you call
429 virtual void begin( const KURL &url = KURL(), int xOffset = 0, int yOffset = 0 );
432 * Writes another part of the HTML code to the widget.
435 * this function many times in sequence. But remember: The fewer calls
436 * you make, the faster the widget will be.
438 * The HTML code is send through a decoder which decodes the stream to
441 * The @p len parameter is needed for streams encoded in utf-16,
442 * since these can have \0 chars in them. In case the encoding
443 * you're using isn't utf-16, you can safely leave out the length
446 * Attention: Don't mix calls to @ref write( const char *) with calls
447 * to @ref write( const QString & ).
449 * The result might not be what you want.
451 virtual void write( const char *str, int len = -1 );
454 * Writes another part of the HTML code to the widget.
457 * this function many times in sequence. But remember: The fewer calls
458 * you make, the faster the widget will be.
460 virtual void write( const QString &str );
463 * Call this after your last call to @ref write().
468 * Similar to end, but called to abort a load rather than cleanly end.
473 * Prints the current HTML page layed out for the printer.
475 * (not implemented at the moment)
477 // void print(QPainter *, int pageHeight, int pageWidth);
480 * Paints the HTML page to a QPainter. See @ref KHTMLView::paint for details
482 void paint(QPainter *, const QRect &, int = 0, bool * = 0);
485 * Sets the encoding the page uses.
487 * This can be different from the charset. The widget will try to reload the current page in the new
488 * encoding, if url() is not empty.
490 bool setEncoding( const QString &name, bool override = false );
493 * Returns the encoding the page currently uses.
495 * Note that the encoding might be different from the charset.
497 QString encoding() const;
500 * Sets a user defined style sheet to be used on top of the HTML 4
501 * default style sheet.
503 * This gives a wide range of possibilities to
504 * change the layout of the page.
506 void setUserStyleSheet(const KURL &url);
509 * Sets a user defined style sheet to be used on top of the HTML 4
510 * default style sheet.
512 * This gives a wide range of possibilities to
513 * change the layout of the page.
515 void setUserStyleSheet(const QString &styleSheet);
520 * Sets the standard font style.
522 * @param name The font name to use for standard text.
524 void setStandardFont( const QString &name );
527 * Sets the fixed font style.
529 * @param name The font name to use for fixed text, e.g.
530 * the <tt><pre></tt> tag.
532 void setFixedFont( const QString &name );
535 * Finds the anchor named @p name.
537 * If the anchor is found, the widget
538 * scrolls to the closest position. Returns @p if the anchor has
541 bool gotoAnchor( const QString &name );
544 * Sets the cursor to use when the cursor is on a link.
546 void setURLCursor( const QCursor &c );
549 * Returns the cursor which is used when the cursor is on a link.
551 QCursor urlCursor() const;
554 * Initiates a text search.
556 void findTextBegin(DOM::NodeImpl *startNode = 0, int startPos = -1);
559 * Finds the next occurrence of the string or expression.
560 * If isRegExp is true then str is converted to a QRegExp, and caseSensitive is ignored.
562 bool findTextNext( const QString &str, bool forward, bool caseSensitive, bool isRegExp );
565 * Sets the Zoom factor. The value is given in percent, larger values mean a
566 * generally larger font and larger page contents. It is not guaranteed that
567 * all parts of the page are scaled with the same factor though.
569 * The given value should be in the range of 20..300, values outside that
570 * range are not guaranteed to work. A value of 100 will disable all zooming
571 * and show the page with the sizes determined via the given lengths in the
574 void setZoomFactor(int percent);
577 * Returns the current zoom factor.
579 int zoomFactor() const;
582 * Returns the text the user has marked.
584 virtual QString selectedText() const;
587 * Returns the selected part of the HTML.
589 const khtml::Selection &selection() const;
592 * Returns the granularity of the selection (character, word, line, paragraph).
594 khtml::ETextGranularity selectionGranularity() const;
597 * Returns the drag caret of the HTML.
599 const khtml::Selection &dragCaret() const;
602 * Sets the current selection.
604 void setSelection(const khtml::Selection &, bool closeTyping = true, bool keepTypingStyle = false);
607 * Returns a mark, to be used as emacs uses it.
609 const khtml::Selection &mark() const;
614 void setMark(const khtml::Selection &);
617 * Sets the current drag cart.
619 void setDragCaret(const khtml::Selection &);
622 * Clears the current selection.
624 void clearSelection();
627 * Invalidates the current selection.
629 void invalidateSelection();
632 * Controls the visibility of the selection.
634 void setCaretVisible(bool flag=true);
639 void paintCaret(QPainter *p, const QRect &rect) const;
642 * Paints the drag caret.
644 void paintDragCaret(QPainter *p, const QRect &rect) const;
647 * Set info for vertical arrow navigation.
649 void setXPosForVerticalArrowNavigation(int x);
652 * Get info for vertical arrow navigation.
654 int xPosForVerticalArrowNavigation() const;
657 * Returns the text for a part of the document.
659 QString text(const DOM::Range &) const;
662 * Has the user selected anything?
664 * Call @ref selectedText() to
665 * retrieve the selected text.
667 * @return @p true if there is text selected.
669 bool hasSelection() const;
672 * Marks all text in the document as selected.
677 * Returns whether editing should end in the given range
679 virtual bool shouldBeginEditing(const DOM::Range &) const;
682 * Returns whether editing should end in the given range
684 virtual bool shouldEndEditing(const DOM::Range &) const;
687 * Returns the contentEditable "override" value for the part
689 virtual bool isContentEditable() const;
692 * Returns the most recent edit command applied.
694 khtml::EditCommandPtr lastEditCommand();
697 * Called when editing has been applied.
699 void appliedEditing(khtml::EditCommandPtr &);
702 * Called when editing has been unapplied.
704 void unappliedEditing(khtml::EditCommandPtr &);
707 * Called when editing has been reapplied.
709 void reappliedEditing(khtml::EditCommandPtr &);
712 * Returns the typing style for the document.
714 DOM::CSSMutableStyleDeclarationImpl *typingStyle() const;
717 * Sets the typing style for the document.
719 void setTypingStyle(DOM::CSSMutableStyleDeclarationImpl *);
722 * Clears the typing style for the document.
724 void clearTypingStyle();
727 * Convenience method to show the document's view.
729 * Equivalent to widget()->show() or view()->show() .
734 * Convenience method to hide the document's view.
736 * Equivalent to widget()->hide() or view()->hide().
741 * Returns a reference to the partmanager instance which
742 * manages html frame objects.
744 KParts::PartManager *partManager();
748 * Saves the KHTMLPart's complete state (including child frame
749 * objects) to the provided @ref QDataStream.
751 * This is called from the @ref saveState() method of the
752 * @ref browserExtension().
754 virtual void saveState( QDataStream &stream );
756 * Restores the KHTMLPart's previously saved state (including
757 * child frame objects) from the provided QDataStream.
761 * This is called from the @ref restoreState() method of the
762 * @ref browserExtension() .
764 virtual void restoreState( QDataStream &stream );
767 virtual void tokenizerProcessedData() {};
770 * Returns the @p Node currently under the mouse
772 DOM::Node nodeUnderMouse() const;
777 const KHTMLSettings *settings() const;
780 * Returns a pointer to the parent KHTMLPart if the part is a frame
781 * in an HTML frameset.
783 * Returns 0L otherwise.
785 KHTMLPart *parentPart() const;
788 * Returns a list of names of all frame (including iframe) objects of
789 * the current document. Note that this method is not working recursively
792 QStringList frameNames() const;
794 QPtrList<KParts::ReadOnlyPart> frames() const;
796 KHTMLPart *childFrameNamed(const QString &name) const;
799 * Finds a frame by name. Returns 0L if frame can't be found.
801 KHTMLPart *findFrame( const QString &f );
804 * Return the current frame (the one that has focus)
805 * Not necessarily a direct child of ours, framesets can be nested.
806 * Returns "this" if this part isn't a frameset.
808 KParts::ReadOnlyPart *currentFrame() const;
811 * Returns whether a frame with the specified name is exists or not.
812 * In contrary to the @ref findFrame method this one also returns true
813 * if the frame is defined but no displaying component has been
816 bool frameExists( const QString &frameName );
821 * Sets the StatusBarText assigned
824 void setJSStatusBarText( const QString &text );
828 * Sets the DefaultStatusBarText assigned
829 * via window.defaultStatus
831 void setJSDefaultStatusBarText( const QString &text );
835 * Returns the StatusBarText assigned
838 QString jsStatusBarText() const;
842 * Returns the DefaultStatusBarText assigned
843 * via window.defaultStatus
845 QString jsDefaultStatusBarText() const;
848 * Referrer used for links in this page.
850 QString referrer() const;
853 * Last-modified date (in raw string format), if received in the [HTTP] headers.
855 QString lastModified() const;
858 * Loads a style sheet into the stylesheet cache.
860 void preloadStyleSheet(const QString &url, const QString &stylesheet);
863 * Loads a script into the script cache.
865 void preloadScript(const QString &url, const QString &script);
867 bool isPointInsideSelection(int x, int y);
869 virtual bool tabsToLinks() const;
870 virtual bool tabsToAllControls() const;
875 bool restored() const;
877 void incrementFrameCount();
878 void decrementFrameCount();
879 int topLevelFrameCount();
881 // Editing operations.
882 // Not clear if these will be wanted in KHTMLPart by KDE,
883 // but for now these bridge so we don't have to pepper the
884 // KHTML code with WebCore-specific stuff.
885 enum TriState { falseTriState, trueTriState, mixedTriState };
886 void copyToPasteboard();
887 void cutToPasteboard();
888 void pasteFromPasteboard();
889 bool canPaste() const;
892 bool canRedo() const;
893 bool canUndo() const;
894 void computeAndSetTypingStyle(DOM::CSSStyleDeclarationImpl *, khtml::EditAction editingAction=khtml::EditActionUnspecified);
895 void applyStyle(DOM::CSSStyleDeclarationImpl *, khtml::EditAction editingAction=khtml::EditActionUnspecified);
896 TriState selectionHasStyle(DOM::CSSStyleDeclarationImpl *) const;
897 bool selectionStartHasStyle(DOM::CSSStyleDeclarationImpl *) const;
898 DOM::DOMString selectionStartStylePropertyValue(int stylePropertyID) const;
899 void applyEditingStyleToBodyElement() const;
900 void removeEditingStyleFromBodyElement() const;
901 void applyEditingStyleToElement(DOM::ElementImpl *) const;
902 void removeEditingStyleFromElement(DOM::ElementImpl *) const;
904 virtual bool isCharacterSmartReplaceExempt(const QChar &, bool);
906 // Used to keep the part alive when running a script that might destroy it.
911 * Emitted if the cursor is moved over an URL.
913 void onURL( const QString &url );
916 * Emitted when the user clicks the right mouse button on the document.
918 void popupMenu(const QString &url, const QPoint &point);
921 * This signal is emitted when the selection changes.
923 void selectionChanged();
926 * This signal is emitted when an element retrieves the
927 * keyboard focus. Note that the signal argument can be
928 * a null node if no element is active, meaning a node
929 * has explicitly been deactivated without a new one
932 void nodeActivated(const DOM::Node &);
937 * returns a KURL object for the given url. Use when
938 * you know what you're doing.
940 KURL completeURL( const QString &url );
945 * presents a detailed error message to the user.
946 * @p errorCode kio error code, eg KIO::ERR_SERVER_TIMEOUT.
947 * @p text kio additional information text.
948 * @p url the url that triggered the error.
950 void htmlError(int errorCode, const QString& text, const KURL& reqUrl);
952 virtual void customEvent( QCustomEvent *event );
955 * Eventhandler of the khtml::MousePressEvent.
957 virtual void khtmlMousePressEvent( khtml::MousePressEvent *event );
959 * Eventhandler for the khtml::MouseDoubleClickEvent.
961 virtual void khtmlMouseDoubleClickEvent( khtml::MouseDoubleClickEvent * );
964 * Eventhandler for the khtml::MouseDoubleMoveEvent.
966 virtual void khtmlMouseMoveEvent( khtml::MouseMoveEvent *event );
968 * Eventhandler for the khtml::MouseMoveEvent.
970 virtual void khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event );
972 * Eventhandler for the khtml::DrawContentsEvent.
974 virtual void khtmlDrawContentsEvent( khtml::DrawContentsEvent * );
976 void selectClosestWordFromMouseEvent(QMouseEvent *mouse, DOM::Node &innerNode, int x, int y);
980 * Internal reimplementation of KParts::Part::guiActivateEvent .
982 virtual void guiActivateEvent( KParts::GUIActivateEvent *event );
986 * Internal empty reimplementation of @ref KParts::ReadOnlyPart::openFile .
988 virtual bool openFile();
990 virtual void urlSelected( const QString &url, int button, int state,
991 const QString &_target, KParts::URLArgs args = KParts::URLArgs());
995 * This method is called when a new embedded object (include html frames) is to be created.
996 * Reimplement it if you want to add support for certain embeddable objects without registering
997 * them in the KDE wide registry system (KSyCoCa) . Another reason for re-implementing this
998 * method could be if you want to derive from KTHMLPart and also want all html frame objects
999 * to be a object of your derived type, in which case you should return a new instance for
1000 * the mimetype 'text/html' .
1002 virtual KParts::ReadOnlyPart *createPart( QWidget *parentWidget, const char *widgetName,
1003 QObject *parent, const char *name,
1004 const QString &mimetype, QString &serviceName,
1005 QStringList &serviceTypes, const QStringList ¶ms);
1011 * Sets the focussed node of the document to the specified node. If the node is a form control, the control will
1012 * receive focus in the same way that it would if the user had clicked on it or tabbed to it with the keyboard. For
1013 * most other types of elements, there is no visul indiction of whether or not they are focussed.
1015 * See @ref activeNode
1017 * @param node The node to focus
1019 void setActiveNode(const DOM::Node &node);
1022 * Stops all animated images on the current and child pages
1024 void stopAnimations();
1026 QCString dcopObjectId() const;
1033 void reparseConfiguration();
1038 void slotData( KIO::Job*, const QByteArray &data );
1042 void slotRestoreData( const QByteArray &data );
1046 void slotFinished( KIO::Job* );
1050 void slotFinishedParsing();
1054 void slotRedirect();
1058 void slotRedirection(KIO::Job*, const KURL&);
1062 void slotDebugDOMTree();
1066 void slotDebugRenderTree();
1071 virtual void slotViewDocumentSource();
1075 virtual void slotViewFrameSource();
1079 virtual void slotSaveBackground();
1083 virtual void slotSaveDocument();
1087 virtual void slotSaveFrame();
1091 virtual void slotSecurity();
1095 virtual void slotSetEncoding();
1100 virtual void slotUseStylesheet();
1102 virtual void slotFind();
1103 virtual void slotFindDone();
1104 virtual void slotFindDialogDestroyed();
1114 void slotLoadImages();
1119 void submitFormAgain();
1124 void updateActions();
1128 void slotPartRemoved( KParts::Part *part );
1132 void slotActiveFrameChanged( KParts::Part *part );
1136 void slotChildStarted( KIO::Job *job );
1140 void slotChildCompleted();
1144 void slotChildCompleted( bool );
1148 void slotParentCompleted();
1152 void slotChildURLRequest( const KURL &url, const KParts::URLArgs &args );
1154 void slotLoaderRequestStarted( khtml::DocLoader*, khtml::CachedObject* obj);
1155 void slotLoaderRequestDone( khtml::DocLoader*, khtml::CachedObject *obj );
1156 void checkCompleted(bool ignoreDoc = false);
1161 void slotShowDocument( const QString &url, const QString &target );
1166 void slotAutoScroll();
1168 void slotPrintFrame();
1170 void slotSelectAll();
1175 void slotProgressUpdate();
1180 void slotJobPercent(KIO::Job*, unsigned long);
1185 void slotJobSpeed(KIO::Job*, unsigned long);
1190 void slotClearSelection();
1192 void slotEndLifeSupport();
1200 bool restoreURL( const KURL &url );
1205 void clearCaretRectIfNeeded();
1210 void setFocusNodeIfNeeded();
1215 void selectionLayoutChanged();
1220 void emitSelectionChanged();
1225 void timerEvent(QTimerEvent *);
1230 bool openURLInFrame( const KURL &url, const KParts::URLArgs &urlArgs );
1232 void startAutoScroll();
1233 void stopAutoScroll();
1234 void overURL( const QString &url, const QString &target, bool shiftPressed = false );
1239 bool processObjectRequest( khtml::ChildFrame *child, const KURL &url, const QString &mimetype );
1244 void submitForm( const char *action, const QString &url, const khtml::FormData &formData,
1245 const QString &target, const QString& contentType = QString::null,
1246 const QString& boundary = QString::null );
1251 void popupMenu( const QString &url );
1254 void init( KHTMLView *view, GUIProfile prof );
1256 virtual void clear();
1258 bool scheduleScript( const DOM::Node &n, const QString& script);
1260 QVariant executeScheduledScript();
1262 bool requestFrame( khtml::RenderPart *frame, const QString &url, const QString &frameName,
1263 const QStringList ¶mNames = QStringList(), const QStringList ¶mValues = QStringList(), bool isIFrame = false );
1266 * @internal returns a name for a frame without a name.
1267 * This function returns a sequence of names.
1268 * All names in a sequence are different but the sequence is
1270 * The sequence is reset in clear().
1272 QString requestFrameName();
1274 bool requestObject( khtml::RenderPart *frame, const QString &url, const QString &serviceType,
1275 const QStringList ¶mNames = QStringList(), const QStringList ¶mValues = QStringList() );
1277 bool requestObject( khtml::ChildFrame *child, const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() );
1279 DOM::EventListener *createHTMLEventListener( QString code );
1282 DOM::DocumentImpl *xmlDocImpl() const;
1283 void replaceDocImpl(DOM::DocumentImpl* newDoc);
1286 khtml::ChildFrame *childFrame( const QObject *obj );
1288 khtml::ChildFrame *recursiveFrameRequest( const KURL &url, const KParts::URLArgs &args, bool callParent = true );
1290 void connectChild(const khtml::ChildFrame *) const;
1291 void disconnectChild(const khtml::ChildFrame *) const;
1293 bool checkLinkSecurity(const KURL &linkURL,const QString &message = QString::null, const QString &button = QString::null);
1294 QVariant executeScript(QString filename, int baseLine, const DOM::Node &n, const QString &script);
1296 void cancelRedirection(bool newLoadInProgress = false);
1298 KJSProxy *jScript();
1303 KHTMLPart *opener();
1307 long cacheId() const;
1308 void setOpener(KHTMLPart *_opener);
1310 void setOpenedByJS(bool _openedByJS);
1312 void checkEmitLoadEvent();
1313 void emitLoadEvent();
1315 void receivedFirstData();
1317 void replaceContentsWithScriptResult( const KURL &url );
1319 bool handleMouseMoveEventDrag(khtml::MouseMoveEvent *event);
1320 bool handleMouseMoveEventOver(khtml::MouseMoveEvent *event);
1321 void handleMouseMoveEventSelection(khtml::MouseMoveEvent *event);
1324 * @internal Extracts anchor and tries both encoded and decoded form.
1329 void handleMousePressEventSingleClick(khtml::MousePressEvent *event);
1330 void handleMousePressEventDoubleClick(khtml::MousePressEvent *event);
1331 void handleMousePressEventTripleClick(khtml::MousePressEvent *event);
1334 DOM::CSSComputedStyleDeclarationImpl *selectionComputedStyle(DOM::NodeImpl *&nodeToRemove) const;
1336 KHTMLPartPrivate *d;
1337 friend class KHTMLPartPrivate;
1338 friend class khtml::Selection;
1342 friend class KWQKHTMLPart;
1345 void completed(bool);
1346 bool didOpenURL(const KURL &);
1347 void setStatusBarText(const QString &);
1348 void started(KIO::Job *);
1349 void frameDetached();
1350 virtual void didFirstLayout() {}
1357 #include "KWQKHTMLPart.h"