KHtml

khtml_part.h
1 /* This file is part of the KDE project
2  *
3  * Copyright (C) 1998, 1999 Torben Weis <[email protected]>
4  * 1999-2001 Lars Knoll <[email protected]>
5  * 1999-2001 Antti Koivisto <[email protected]>
6  * 2000-2001 Simon Hausmann <[email protected]>
7  * 2000-2001 Dirk Mueller <[email protected]>
8  * 2000 Stefan Schimanski <[email protected]>
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Library General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Library General Public License for more details.
19  *
20  * You should have received a copy of the GNU Library General Public License
21  * along with this library; see the file COPYING.LIB. If not, write to
22  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23  * Boston, MA 02110-1301, USA.
24  */
25 #ifndef __khtml_part_h__
26 #define __khtml_part_h__
27 
28 #include "dom/dom_doc.h"
29 #include "dom/dom2_range.h"
30 
31 #include <kparts/readonlypart.h>
32 #include <kparts/browserextension.h>
33 #include <kparts/browserhostextension.h>
34 #include <kfind.h>
35 #include <kfinddialog.h>
36 #include <klocalizedstring.h>
37 #include <kencodingdetector.h>
38 #include <kencodingprober.h>
39 #include <QRegExp>
40 #include <QUrl>
41 
42 class KHTMLPartPrivate;
44 class KJSProxy;
45 class KHTMLView;
46 class KHTMLViewBar;
47 class KHTMLFindBar;
48 class KHTMLSettings;
49 class KJavaAppletContext;
50 class KJSErrorDlg;
51 
52 namespace DOM
53 {
54 class HTMLDocument;
55 class HTMLDocumentImpl;
56 class DocumentImpl;
57 class Document;
58 class XMLDocumentImpl;
59 class HTMLTitleElementImpl;
60 class HTMLFrameElementImpl;
61 class HTMLIFrameElementImpl;
62 class HTMLObjectElementImpl;
63 class HTMLFormElementImpl;
64 class HTMLAnchorElementImpl;
65 class HTMLMetaElementImpl;
66 class NodeImpl;
67 class ElementImpl;
68 class Node;
69 class HTMLEventListener;
70 class EventListener;
71 class HTMLPartContainerElementImpl;
72 class HTMLObjectBaseElementImpl;
73 class Position;
74 class Selection;
75 class Range;
76 class Editor;
77 }
78 
79 namespace WebCore
80 {
81 class SVGDocumentExtensions;
82 }
83 
84 namespace KJS
85 {
86 class Interpreter;
87 class HTMLElement;
88 }
89 
90 namespace khtml
91 {
92 class DocLoader;
93 class RenderPart;
94 class ChildFrame;
95 class MousePressEvent;
96 class MouseDoubleClickEvent;
97 class MouseMoveEvent;
98 class MouseReleaseEvent;
99 class DrawContentsEvent;
100 class CachedObject;
101 class RenderWidget;
102 class RenderBlock;
103 class CSSStyleSelector;
104 class HTMLTokenizer;
105 class XMLTokenizer;
106 struct EditorContext;
107 class EditCommandImpl;
108 class KHTMLPartAccessor;
109 }
110 
111 namespace KJS
112 {
113 class Window;
114 class WindowFunc;
115 class ExternalFunc;
116 class JSEventListener;
117 class JSLazyEventListener;
118 class JSNodeFilter;
119 class DOMDocument;
120 class SourceFile;
121 class ScheduledAction;
122 class DOMSelection;
123 class DOMSelectionProtoFunc;
124 class KHTMLPartScriptable;
125 }
126 
127 namespace KParts
128 {
129 class PartManager;
130 class ScriptableExtension;
131 }
132 
133 namespace KWallet
134 {
135 class Wallet;
136 }
137 
208 class KHTML_EXPORT KHTMLPart : public KParts::ReadOnlyPart
209 {
210  Q_OBJECT
211  friend class KHTMLView;
212  friend class DOM::HTMLTitleElementImpl;
213  friend class DOM::HTMLFrameElementImpl;
214  friend class DOM::HTMLIFrameElementImpl;
215  friend class DOM::HTMLObjectBaseElementImpl;
216  friend class DOM::HTMLObjectElementImpl;
217  friend class DOM::HTMLAnchorElementImpl;
218  friend class DOM::HTMLMetaElementImpl;
219  friend class DOM::NodeImpl;
220  friend class DOM::ElementImpl;
221  friend class KHTMLRun;
222  friend class DOM::HTMLFormElementImpl;
223  friend class KJS::Window;
224  friend class KJS::ScheduledAction;
225  friend class KJS::JSNodeFilter;
226  friend class KJS::WindowFunc;
227  friend class KJS::ExternalFunc;
228  friend class KJS::JSEventListener;
229  friend class KJS::JSLazyEventListener;
230  friend class KJS::DOMDocument;
231  friend class KJS::HTMLElement;
232  friend class KJS::SourceFile;
233  friend class KJS::DOMSelection;
234  friend class KJS::DOMSelectionProtoFunc;
235  friend class KJS::KHTMLPartScriptable;
236  friend class KJSProxy;
237  friend class KHTMLPartBrowserExtension;
238  friend class DOM::DocumentImpl;
239  friend class DOM::HTMLDocumentImpl;
240  friend class DOM::Selection;
241  friend class DOM::Editor;
242  friend class KHTMLPartBrowserHostExtension;
243  friend class khtml::HTMLTokenizer;
244  friend class khtml::XMLTokenizer;
245  friend class khtml::RenderWidget;
246  friend class khtml::RenderBlock;
247  friend class khtml::CSSStyleSelector;
248  friend class khtml::EditCommandImpl;
249  friend class khtml::KHTMLPartAccessor;
250  friend class KHTMLPartIface;
251  friend class KHTMLPartFunction;
252  friend class KHTMLPopupGUIClient;
253  friend class KHTMLFind;
254  friend class StorePass;
255  friend class WebCore::SVGDocumentExtensions;
256 
257  Q_PROPERTY(bool javaScriptEnabled READ jScriptEnabled WRITE setJScriptEnabled)
258  Q_PROPERTY(bool javaEnabled READ javaEnabled WRITE setJavaEnabled)
259  Q_PROPERTY(bool dndEnabled READ dndEnabled WRITE setDNDEnabled)
260  Q_PROPERTY(bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled)
261  Q_PROPERTY(DNSPrefetch dnsPrefetch READ dnsPrefetch WRITE setDNSPrefetch)
262 
263  /*
264  *
265  * Don't add setOnlyLocalReferences here. It shouldn't be accessible via DBus.
266  *
267  **/
268  Q_PROPERTY(bool modified READ isModified)
269  Q_PROPERTY(QString encoding READ encoding WRITE setEncoding)
270  Q_PROPERTY(QString lastModified READ lastModified)
271  Q_PROPERTY(bool metaRefreshEnabled READ metaRefreshEnabled WRITE setMetaRefreshEnabled)
272 
273 public:
274  enum GUIProfile { DefaultGUI, BrowserViewGUI /* ... */ };
275 
283  enum DNSPrefetch {
284  DNSPrefetchDisabled = 0,
285  DNSPrefetchEnabled,
286  DNSPrefetchOnlyWWWAndSLD
287  };
288 
301  KHTMLPart(QWidget *parentWidget = nullptr,
302  QObject *parent = nullptr, GUIProfile prof = DefaultGUI);
321  KHTMLPart(KHTMLView *view, QObject *parent = nullptr, GUIProfile prof = DefaultGUI);
322 
326  virtual ~KHTMLPart();
327 
333  bool openUrl(const QUrl &url) override;
334 
338  bool closeUrl() override;
339 
346  virtual void showError(KJob *job);
347 
351  DOM::HTMLDocument htmlDocument() const;
352 
356  DOM::Document document() const;
357 
361  QString documentSource() const;
362 
366  DOM::Node activeNode() const;
367 
371  KParts::BrowserExtension *browserExtension() const;
372  KParts::BrowserHostExtension *browserHostExtension() const;
373 
377  KHTMLView *view() const;
378 
385  void setJScriptEnabled(bool enable);
386 
391  bool jScriptEnabled() const;
392 
410  KJS::Interpreter *jScriptInterpreter();
411 
423  void setStatusMessagesEnabled(bool enable);
424 
428  bool statusMessagesEnabled() const;
429 
433  void setMetaRefreshEnabled(bool enable);
434 
438  bool metaRefreshEnabled() const;
439 
444  QVariant executeScript(const DOM::Node &n, const QString &script);
445 
450  void setDNDEnabled(bool b);
451 
455  bool dndEnabled() const;
456 
463  void setJavaEnabled(bool enable);
464 
468  bool javaEnabled() const;
469 
473  void setPluginsEnabled(bool enable);
474 
478  bool pluginsEnabled() const;
479 
486  void setAutoloadImages(bool enable);
493  bool autoloadImages() const;
494 
511  void setOnlyLocalReferences(bool enable);
512 
522  void setForcePermitLocalImages(bool enable);
523 
536  void setDNSPrefetch(DNSPrefetch pmode);
537 
546  DNSPrefetch dnsPrefetch() const;
547 
552  bool onlyLocalReferences() const;
553 
560  bool forcePermitLocalImages() const;
561 
564  bool isCaretMode() const;
565 
569  bool isEditable() const;
570 
583  void setCaretPosition(DOM::Node node, long offset, bool extendSelection = false);
584 
591  CaretBlink
592  };
593 
597  CaretDisplayPolicy caretDisplayPolicyNonFocused() const;
598 
608  void setCaretDisplayPolicyNonFocused(CaretDisplayPolicy policy);
609 
610 #ifndef KDE_NO_COMPAT
611  QUrl baseURL() const;
612 #endif
613 
617  QUrl backgroundURL() const;
618 
622  void scheduleRedirection(int delay, const QString &url, bool lockHistory = true);
623 
646  virtual void begin(const QUrl &url = QUrl(), int xOffset = 0, int yOffset = 0);
647 
668  virtual void write(const char *str, int len = -1);
669 
681  // FIXME KDE5: always honour doctype, remove setAlwaysHonourDoctype()
682  virtual void write(const QString &str);
683 
687  virtual void end();
688 
689  /*
690  * Prints the current HTML page laid out for the printer.
691  *
692  * (not implemented at the moment)
693  */
694  // void print(QPainter *, int pageHeight, int pageWidth);
695 
699  void paint(QPainter *, const QRect &, int = 0, bool * = nullptr);
700 
707  bool setEncoding(const QString &name, bool override = false);
708 
714  QString encoding() const;
715 
725  void setUserStyleSheet(const QUrl &url);
726 
736  void setUserStyleSheet(const QString &styleSheet);
737 
738 public:
739 
745  void setStandardFont(const QString &name);
746 
753  void setFixedFont(const QString &name);
754 
762  bool gotoAnchor(const QString &name);
763 
769  bool nextAnchor();
770 
774  bool prevAnchor();
775 
779  void setURLCursor(const QCursor &c);
780 
784  QCursor urlCursor() const;
785 
789  enum FindOptions {
790  FindLinksOnly = 1 * KFind::MinimumUserOption,
791  FindNoPopups = 2 * KFind::MinimumUserOption
792  //FindIncremental = 4 * KFind::MinimumUserOption
793  };
794 
799  void findText();
800 
808  void findText(const QString &str, long options, QWidget *parent = nullptr,
809  KFindDialog *findDialog = nullptr);
810 
814  void findTextBegin();
815 
821  bool findTextNext(bool reverse = false);
822 
832  void setZoomFactor(int percent);
833 
837  int zoomFactor() const;
838 
848  void setFontScaleFactor(int percent);
849 
853  int fontScaleFactor() const;
854 
858  virtual QString selectedText() const;
859 
866  QString selectedTextAsHTML() const;
867 
871  DOM::Range selection() const;
872 
883  void selection(DOM::Node &startNode, long &startOffset,
884  DOM::Node &endNode, long &endOffset) const;
885 
889  void setSelection(const DOM::Range &);
890 
899  bool hasSelection() const;
900 
905  DOM::Editor *editor() const;
906 
910  void selectAll();
911 
917  void show();
918 
924  void hide();
925 
930  KParts::PartManager *partManager();
931 
939  virtual void saveState(QDataStream &stream);
949  virtual void restoreState(QDataStream &stream);
950 
957  DOM::Node nodeUnderMouse() const;
958 
966  DOM::Node nonSharedNodeUnderMouse() const;
967 
971  const KHTMLSettings *settings() const;
972 
979  // ### KDE5 make const
980  KHTMLPart *parentPart();
981 
987  QStringList frameNames() const;
988 
989  QList<KParts::ReadOnlyPart *> frames() const;
990 
994  KHTMLPart *findFrame(const QString &f);
995 
1003  KHTMLPart *findFrameParent(KParts::ReadOnlyPart *callingPart, const QString &f, khtml::ChildFrame **childFrame = nullptr);
1004 
1010  KParts::ReadOnlyPart *currentFrame() const;
1011 
1018  bool frameExists(const QString &frameName);
1019 
1023  KJSProxy *framejScript(KParts::ReadOnlyPart *framePart);
1024 
1028  KParts::ReadOnlyPart *findFramePart(const QString &f);
1034  void setJSStatusBarText(const QString &text);
1035 
1041  void setJSDefaultStatusBarText(const QString &text);
1042 
1048  QString jsStatusBarText() const;
1049 
1055  QString jsDefaultStatusBarText() const;
1056 
1060  QString referrer() const;
1061 
1065  QString pageReferrer() const;
1066 
1070  QString lastModified() const;
1071 
1075  void preloadStyleSheet(const QString &url, const QString &stylesheet);
1076 
1080  void preloadScript(const QString &url, const QString &script);
1081 
1087  bool isPointInsideSelection(int x, int y);
1088 
1092  bool restored() const;
1093 
1103  // ### KDE5 remove - fix write( const QString &str ) instead
1104  void setAlwaysHonourDoctype(bool b = true);
1105 
1106  // ### KDE5 remove me
1107  enum FormNotification { NoNotification = 0, Before, Only, Unused = 255 };
1113  void setFormNotification(FormNotification fn);
1114 
1120  FormNotification formNotification() const;
1121 
1128  QUrl toplevelURL();
1129 
1135  bool isModified() const;
1136 
1140  void setSuppressedPopupIndicator(bool enable, KHTMLPart *originPart = nullptr);
1141 
1145  bool inProgress() const;
1146 
1147 Q_SIGNALS:
1151  void onURL(const QString &url);
1152 
1158  void popupMenu(const QString &url, const QPoint &point);
1159 
1163  void selectionChanged();
1164 
1172  void nodeActivated(const DOM::Node &);
1173 
1176  void docCreated();
1177 
1188  void caretPositionChanged(const DOM::Node &node, long offset);
1189 
1194  // TODO: remove/deprecate?
1195  void formSubmitNotification(const char *action, const QString &url,
1196  const QByteArray &formData, const QString &target,
1197  const QString &contentType, const QString &boundary);
1198 
1202  void configurationChanged();
1203 
1204 protected:
1205 
1210  QUrl completeURL(const QString &url);
1211 
1218  void htmlError(int errorCode, const QString &text, const QUrl &reqUrl);
1219 
1220  void customEvent(QEvent *event) override;
1221 
1225  virtual void khtmlMousePressEvent(khtml::MousePressEvent *event);
1229  virtual void khtmlMouseDoubleClickEvent(khtml::MouseDoubleClickEvent *);
1233  virtual void khtmlMouseMoveEvent(khtml::MouseMoveEvent *event);
1237  virtual void khtmlMouseReleaseEvent(khtml::MouseReleaseEvent *event);
1241  virtual void khtmlDrawContentsEvent(khtml::DrawContentsEvent *);
1242 
1246  void guiActivateEvent(KParts::GUIActivateEvent *event) override;
1247 
1251  bool openFile() override;
1252 
1253  virtual bool urlSelected(const QString &url, int button, int state,
1254  const QString &_target,
1256  const KParts::BrowserArguments &browserArgs = KParts::BrowserArguments());
1257 
1266  virtual KParts::ReadOnlyPart *createPart(QWidget *parentWidget,
1267  QObject *parent,
1268  const QString &mimetype, QString &serviceName,
1269  QStringList &serviceTypes, const QStringList &params);
1270 
1271  // This is for RenderPartObject. We want to ask the 'download plugin?'
1272  // question only once per mimetype
1273  bool pluginPageQuestionAsked(const QString &mimetype) const;
1274  void setPluginPageQuestionAsked(const QString &mimetype);
1275 
1276  enum PageSecurity { NotCrypted, Encrypted, Mixed };
1277  void setPageSecurity(PageSecurity sec);
1278 
1282  bool doOpenStream(const QString &mimeType) override;
1283 
1287  bool doWriteStream(const QByteArray &data) override;
1288 
1292  bool doCloseStream() override;
1293 
1297  void timerEvent(QTimerEvent *) override;
1298 
1305  bool mayPrefetchHostname(const QString &name);
1306 
1310  void updateZoomFactor();
1311 
1312 public Q_SLOTS:
1313 
1323  void setActiveNode(const DOM::Node &node);
1324 
1328  void stopAnimations();
1329 
1337  QVariant executeScript(const QString &script);
1338 
1348  void setCaretMode(bool enable);
1349 
1360  void setEditable(bool enable);
1361 
1377  void setCaretVisible(bool show);
1378 
1379  // ### FIXME:
1380  // Remove this and make the one below protected+virtual slot.
1381  // Warning: this is effectively "internal". Be careful.
1382  void submitFormProxy(const char *action, const QString &url,
1383  const QByteArray &formData,
1384  const QString &target,
1385  const QString &contentType = QString(),
1386  const QString &boundary = QString());
1387 
1388 protected Q_SLOTS:
1389 
1395  virtual void slotFinished(KJob *);
1396 
1397 protected:
1403  virtual void startingJob(KIO::Job *) {}
1404 
1405 private Q_SLOTS:
1406 
1410  void reparseConfiguration();
1411 
1415  void slotData(KIO::Job *, const QByteArray &data);
1419  void slotInfoMessage(KJob *, const QString &msg);
1423  void slotRestoreData(const QByteArray &data);
1427  void slotFinishedParsing();
1431  void slotRedirect();
1435  void slotRedirection(KIO::Job *, const QUrl &);
1439  void slotDebugScript();
1443  void slotDebugDOMTree();
1447  void slotDebugRenderTree();
1448 
1449  void slotDebugFrameTree();
1450 
1454  void slotStopAnimations();
1458  virtual void slotViewDocumentSource();
1462  virtual void slotViewFrameSource();
1466  void slotViewPageInfo();
1470  virtual void slotSaveBackground();
1474  virtual void slotSaveDocument();
1478  virtual void slotSaveFrame();
1482  virtual void slotSecurity();
1486  virtual void slotSetEncoding(const QString &);
1487 
1491  virtual void slotUseStylesheet();
1492 
1493  virtual void slotFind();
1494  virtual void slotFindDone(); // ### remove me
1495  virtual void slotFindDialogDestroyed(); // ### remove me
1496  void slotFindNext();
1497  void slotFindPrev();
1498  void slotFindAheadText();
1499  void slotFindAheadLink();
1500 
1501  void slotIncZoom();
1502  void slotDecZoom();
1503  void slotIncZoomFast();
1504  void slotDecZoomFast();
1505 
1506  void slotIncFontSize();
1507  void slotDecFontSize();
1508  void slotIncFontSizeFast();
1509  void slotDecFontSizeFast();
1510 
1511  void slotLoadImages();
1512  void slotWalletClosed();
1513  void launchWalletManager();
1514  void walletMenu();
1515  void delNonPasswordStorableSite();
1516  void removeStoredPasswordForm(QAction *action);
1517  void addWalletFormKey(const QString &walletFormKey);
1518 
1522  void submitFormAgain();
1523 
1527  void updateActions();
1531  void slotPartRemoved(KParts::Part *part);
1535  void slotActiveFrameChanged(KParts::Part *part);
1539  void slotChildStarted(KIO::Job *job);
1543  void slotChildCompleted();
1547  void slotChildCompleted(bool);
1551  void slotParentCompleted();
1555  void slotChildURLRequest(const QUrl &url, const KParts::OpenUrlArguments &, const KParts::BrowserArguments &args);
1559  void slotChildDocCreated();
1563  void slotRequestFocus(KParts::ReadOnlyPart *);
1564  void slotLoaderRequestStarted(khtml::DocLoader *, khtml::CachedObject *obj);
1565  void slotLoaderRequestDone(khtml::DocLoader *, khtml::CachedObject *obj);
1566  void checkCompleted();
1567 
1571  void slotAutoScroll();
1572 
1573  void slotPrintFrame();
1574 
1575  void slotSelectAll();
1576 
1580  void slotProgressUpdate();
1581 
1582  /*
1583  * @internal
1584  */
1585  void slotJobPercent(KJob *, unsigned long);
1586 
1587  /*
1588  * @internal
1589  */
1590  void slotJobDone(KJob *);
1591 
1592  /*
1593  * @internal
1594  */
1595  void slotUserSheetStatDone(KJob *);
1596 
1597  /*
1598  * @internal
1599  */
1600  void slotJobSpeed(KJob *, unsigned long);
1601 
1605  void slotClearSelection();
1606 
1610  void slotZoomView(int);
1611 
1615  void slotAutomaticDetectionLanguage(KEncodingProber::ProberType scri);
1616 
1620  void slotToggleCaretMode();
1621 
1625  void suppressedPopupMenu();
1626 
1630  void togglePopupPassivePopup();
1631 
1635  void showSuppressedPopups();
1636 
1640  void launchJSConfigDialog();
1641 
1645  void launchJSErrorDialog();
1646 
1650  void removeJSErrorExtension();
1651 
1655  void disableJSErrorExtension();
1656 
1660  void jsErrorDialogContextMenu();
1661 
1667  void restoreScrollPosition();
1668 
1669  void walletOpened(KWallet::Wallet *);
1670 
1671 private:
1672 
1673  KJSErrorDlg *jsErrorExtension();
1674 
1675  enum StatusBarPriority { BarDefaultText, BarHoverText, BarOverrideText };
1676  void setStatusBarText(const QString &text, StatusBarPriority p);
1677 
1678  bool restoreURL(const QUrl &url);
1679  void clearCaretRectIfNeeded();
1680  void setFocusNodeIfNeeded(const DOM::Selection &);
1681  void selectionLayoutChanged();
1682  void notifySelectionChanged(bool closeTyping = true);
1683  void resetFromScript();
1684  void emitSelectionChanged();
1685  void onFirstData();
1686  // Returns whether callingHtmlPart may access this part
1687  bool checkFrameAccess(KHTMLPart *callingHtmlPart);
1688  bool openUrlInFrame(const QUrl &url, const KParts::OpenUrlArguments &arguments, const KParts::BrowserArguments &browserArguments);
1689  void startAutoScroll();
1690  void stopAutoScroll();
1691  void overURL(const QString &url, const QString &target, bool shiftPressed = false);
1692  void resetHoverText(); // Undo overURL and reset HoverText
1693 
1694  KParts::ScriptableExtension *scriptableExtension(const DOM::NodeImpl *);
1695 
1696  KWallet::Wallet *wallet();
1697 
1698  void openWallet(DOM::HTMLFormElementImpl *);
1699  void saveToWallet(const QString &key, const QMap<QString, QString> &data);
1700  void dequeueWallet(DOM::HTMLFormElementImpl *);
1701  void saveLoginInformation(const QString &host, const QString &key, const QMap<QString, QString> &walletMap);
1702 
1703  void enableFindAheadActions(bool);
1704 
1708  KHTMLViewBar *pTopViewBar() const;
1709 
1713  KHTMLViewBar *pBottomViewBar() const;
1714 
1718  bool pFindTextNextInThisFrame(bool reverse);
1719 
1723  // ### FIXME:
1724  // It is desirable to be able to filter form submissions as well.
1725  // For instance, forms can have a target and an inheriting class
1726  // might want to filter based on the target. Make this protected
1727  // and virtual, or provide a better solution.
1728  // See the web_module for the sidebar for an example where this is
1729  // necessary.
1730  void submitForm(const char *action, const QString &url, const QByteArray &formData,
1731  const QString &target, const QString &contentType = QString(),
1732  const QString &boundary = QString());
1733 
1734  void popupMenu(const QString &url);
1735 
1736  void init(KHTMLView *view, GUIProfile prof);
1737 
1738  void clear();
1739 
1740  QVariant crossFrameExecuteScript(const QString &target, const QString &script);
1741 
1749  QString requestFrameName();
1750 
1751  // Requests loading of a frame or iframe element
1752  void loadFrameElement(DOM::HTMLPartContainerElementImpl *frame, const QString &url, const QString &frameName,
1753  const QStringList &args = QStringList(), bool isIFrame = false);
1754 
1755  // Requests loading of an object or embed element. Returns true if
1756  // loading succeeded.
1757  bool loadObjectElement(DOM::HTMLPartContainerElementImpl *frame, const QString &url, const QString &serviceType,
1758  const QStringList &args = QStringList());
1759 
1760  // Tries an open a URL in given ChildFrame with all known navigation information
1761  // like mimetype and the like in the KParts arguments.
1762  //
1763  // Returns true if it's done -- which excludes the case when it's still resolving
1764  // the mimetype.
1765  // ### refine comment wrt to error case
1766  bool requestObject(khtml::ChildFrame *child, const QUrl &url,
1768  const KParts::BrowserArguments &browserArgs = KParts::BrowserArguments());
1769 
1770  // This method does the loading inside a ChildFrame once we know what mimetype to
1771  // load it as
1772  bool processObjectRequest(khtml::ChildFrame *child, const QUrl &url, const QString &mimetype);
1773 
1774  // helper for reporting ChildFrame load failure
1775  void childLoadFailure(khtml::ChildFrame *child);
1776 
1777  // Updates the ChildFrame to use the particular part, hooking up the various
1778  // signals, connections, etc.
1779  void connectToChildPart(khtml::ChildFrame *child, KParts::ReadOnlyPart *part,
1780  const QString &mimetype);
1781 
1782  // Low-level navigation of the part itself --- this doesn't ask the user
1783  // to save things or such, and assumes that all the ChildFrame info is already
1784  // filed in with things like the mimetype and so on
1785  //
1786  // Returns if successful or not
1787  bool navigateChild(khtml::ChildFrame *child, const QUrl &url);
1788 
1789  // Helper for executing javascript: or about: protocols
1790  bool navigateLocalProtocol(khtml::ChildFrame *child, KParts::ReadOnlyPart *part,
1791  const QUrl &url);
1792 
1793  DOM::EventListener *createHTMLEventListener(QString code, QString name, DOM::NodeImpl *node, bool svg = false);
1794 
1795  DOM::HTMLDocumentImpl *docImpl() const;
1796  DOM::DocumentImpl *xmlDocImpl() const;
1797  khtml::ChildFrame *frame(const QObject *obj);
1798 
1799  khtml::ChildFrame *recursiveFrameRequest(KHTMLPart *callingHtmlPart, const QUrl &url,
1800  const KParts::OpenUrlArguments &args, const KParts::BrowserArguments &browserArgs,
1801  bool callParent = true);
1802 
1803  bool checkLinkSecurity(const QUrl &linkURL, const KLocalizedString &message = KLocalizedString(), const QString &button = QString());
1804  QVariant executeScript(const QString &filename, int baseLine, const DOM::Node &n, const QString &script);
1805 
1806  KJSProxy *jScript();
1807 
1808  KHTMLPart *opener();
1809  long cacheId() const;
1810  void setOpener(KHTMLPart *_opener);
1811  bool openedByJS();
1812  void setOpenedByJS(bool _openedByJS);
1813 
1814  void checkEmitLoadEvent();
1815  void emitLoadEvent();
1816 
1817  bool initFindNode(bool selection, bool reverse, bool fromCursor);
1818 
1828  void extendSelectionTo(int x, int y, const DOM::Node &innerNode);
1832  bool isExtendingSelection() const;
1833  KEncodingDetector *createDecoder();
1834  QString defaultEncoding() const;
1835 
1837  QString defaultExtension() const;
1838 
1842  void zoomIn(const int stepping[], int count);
1846  void zoomOut(const int stepping[], int count);
1847 
1848  void incFontSize(const int stepping[], int count);
1849 
1850  void decFontSize(const int stepping[], int count);
1851 
1852  void emitCaretPositionChanged(const DOM::Position &pos);
1853 
1854  void setDebugScript(bool enable);
1855 
1856  void runAdFilter();
1857 
1858  khtml::EditorContext *editorContext() const;
1859 
1864  void initCaret();
1865 
1869  const DOM::Selection &caret() const;
1870 
1874  const DOM::Selection &dragCaret() const;
1875 
1879  void setCaret(const DOM::Selection &, bool closeTyping = true);
1880 
1884  void setDragCaret(const DOM::Selection &);
1885 
1889  void clearSelection();
1890 
1894  void invalidateSelection();
1895 
1899  void setSelectionVisible(bool flag = true);
1900 
1904  void paintCaret(QPainter *p, const QRect &rect) const;
1905 
1909  void paintDragCaret(QPainter *p, const QRect &rect) const;
1910 
1918  QString simplifiedSelectedText() const;
1919 
1920  bool handleMouseMoveEventDrag(khtml::MouseMoveEvent *event);
1921  bool handleMouseMoveEventOver(khtml::MouseMoveEvent *event);
1922  void handleMouseMoveEventSelection(khtml::MouseMoveEvent *event);
1923 
1924  void handleMousePressEventSingleClick(khtml::MousePressEvent *event);
1925  void handleMousePressEventDoubleClick(khtml::MouseDoubleClickEvent *event);
1926  void handleMousePressEventTripleClick(khtml::MouseDoubleClickEvent *event);
1927 
1928  KHTMLPartPrivate *d;
1929  friend class KHTMLPartPrivate;
1930 
1931 public: // So we don't end up having to add 50 more friends
1932 
1934  KHTMLPartPrivate *impl()
1935  {
1936  return d;
1937  }
1938 };
1939 
1940 #endif
Settings for the HTML view.
D-BUS interface for KHTML.
Definition: khtml_iface.h:31
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:278
This class resembles the editing API when the associated khtml document is editable (in design mode)...
Definition: editor.h:63
An HTMLDocument is the root of the HTML hierarchy and holds the entire content.
Definition: html_document.h:74
Provides encoding detection capabilities.
This file is part of the HTML rendering engine for KDE.
Proxy class serving as interface when being dlopen&#39;ed.
Definition: kjs_proxy.h:61
This class is khtml&#39;s main class.
Definition: khtml_part.h:208
caret is not displayed
Definition: khtml_part.h:590
Renders and displays HTML in a QScrollArea.
Definition: khtmlview.h:97
virtual void startingJob(KIO::Job *)
Hook for adding code before a job is started.
Definition: khtml_part.h:1403
The Document interface represents the entire HTML or XML document.
Definition: dom_doc.h:246
An action (either function or string) to be executed after a specified time interval, either once or repeatedly.
Definition: kjs_window.h:292
FindOptions
Extra Find options that can be used when calling the extended findText().
Definition: khtml_part.h:789
the StyleSelector implementation for CSS.
This class is merely a namespace for static accessor methods to private methods of KHTMLPart...
caret is displayed
Definition: khtml_part.h:589
QCA_EXPORT void init()
Introduced in DOM Level 2.
Definition: dom2_events.h:69
This library provides a full-featured HTML parser and widget.
This is the BrowserExtension for a KHTMLPart document.
Definition: khtml_ext.h:45
MinimumUserOption
KHTMLPartPrivate * impl()
Definition: khtml_part.h:1934
CaretDisplayPolicy
Enumeration for displaying the caret.
Definition: khtml_part.h:588
DNSPrefetch
DNS Prefetching Mode enumeration.
Definition: khtml_part.h:283
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 1 2020 22:35:35 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.