25 #ifndef __tdehtml_part_h__
26 #define __tdehtml_part_h__
28 #include "dom/html_document.h"
29 #include "dom/dom2_range.h"
31 #include <tdeparts/part.h>
32 #include <tdeparts/browserextension.h>
33 #include <tdemacros.h>
34 #include <kfinddialog.h>
38 class TDEHTMLPartPrivate;
43 class KJavaAppletContext;
49 class HTMLDocumentImpl;
51 class HTMLTitleElementImpl;
52 class HTMLElementImpl;
53 class HTMLFrameElementImpl;
54 class HTMLIFrameElementImpl;
55 class HTMLObjectElementImpl;
56 class HTMLFormElementImpl;
57 class HTMLAnchorElementImpl;
58 class HTMLMetaElementImpl;
61 class HTMLEventListener;
74 class RenderPartObject;
77 class MousePressEvent;
78 class MouseDoubleClickEvent;
80 class MouseReleaseEvent;
81 class DrawContentsEvent;
84 class CSSStyleSelector;
94 class JSEventListener;
95 class JSLazyEventListener;
99 class ScheduledAction;
105 class LiveConnectExtension;
187 friend class DOM::HTMLTitleElementImpl;
188 friend class DOM::HTMLFrameElementImpl;
189 friend class DOM::HTMLIFrameElementImpl;
190 friend class DOM::HTMLObjectElementImpl;
191 friend class DOM::HTMLAnchorElementImpl;
192 friend class DOM::HTMLMetaElementImpl;
193 friend class DOM::NodeImpl;
194 friend class TDEHTMLRun;
195 friend class DOM::HTMLFormElementImpl;
196 friend class tdehtml::RenderPartObject;
197 friend class KJS::Window;
198 friend class KJS::ScheduledAction;
199 friend class KJS::JSNodeFilter;
200 friend class KJS::WindowFunc;
201 friend class KJS::ExternalFunc;
202 friend class KJS::JSEventListener;
203 friend class KJS::JSLazyEventListener;
204 friend class KJS::DOMDocument;
205 friend class KJS::SourceFile;
206 friend class KJSProxy;
208 friend class DOM::DocumentImpl;
209 friend class DOM::HTMLDocumentImpl;
210 friend class TDEHTMLPartBrowserHostExtension;
211 friend class tdehtml::HTMLTokenizer;
212 friend class tdehtml::XMLTokenizer;
213 friend class tdehtml::RenderWidget;
214 friend class tdehtml::CSSStyleSelector;
216 friend class TDEHTMLPartFunction;
217 friend class TDEHTMLPopupGUIClient;
219 TQ_PROPERTY(
bool javaScriptEnabled READ jScriptEnabled WRITE setJScriptEnabled )
220 TQ_PROPERTY(
bool javaEnabled READ javaEnabled WRITE setJavaEnabled )
221 TQ_PROPERTY(
bool autoloadImages READ autoloadImages WRITE setAutoloadImages )
222 TQ_PROPERTY(
bool dndEnabled READ dndEnabled WRITE setDNDEnabled )
223 TQ_PROPERTY(
bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled )
230 TQ_PROPERTY( TQCString dcopObjectId READ dcopObjectId )
231 TQ_PROPERTY(
bool modified READ isModified )
234 enum GUIProfile { DefaultGUI, BrowserViewGUI };
248 TDEHTMLPart( TQWidget *parentWidget = 0,
const char *widgetname = 0,
249 TQObject *parent = 0,
const char *name = 0, GUIProfile prof = DefaultGUI );
251 TDEHTMLPart(
TDEHTMLView *view, TQObject *parent = 0,
const char *name = 0, GUIProfile prof = DefaultGUI );
276 virtual void showError( TDEIO::Job* job );
292 TQString documentSource()
const;
317 void setJScriptEnabled(
bool enable );
323 bool jScriptEnabled()
const;
342 KJS::Interpreter *jScriptInterpreter();
355 void setStatusMessagesEnabled(
bool enable );
360 bool statusMessagesEnabled()
const;
365 void setMetaRefreshEnabled(
bool enable );
370 bool metaRefreshEnabled()
const;
376 TQVariant executeScript(
const DOM::Node &n,
const TQString &script );
382 void setDNDEnabled(
bool b );
387 bool dndEnabled()
const;
395 void setJavaEnabled(
bool enable );
400 bool javaEnabled()
const;
405 KJavaAppletContext *javaContext();
411 KJavaAppletContext *createJavaContext();
416 void setPluginsEnabled(
bool enable );
421 bool pluginsEnabled()
const;
429 void setAutoloadImages(
bool enable );
436 bool autoloadImages()
const;
454 void setOnlyLocalReferences(
bool enable );
460 bool onlyLocalReferences()
const;
465 bool isCaretMode()
const;
471 bool isEditable()
const;
486 void setCaretPosition(
DOM::Node node,
long offset,
bool extendSelection =
false);
496 CaretVisible, CaretInvisible, CaretBlink
503 CaretDisplayPolicy caretDisplayPolicyNonFocused()
const;
515 void setCaretDisplayPolicyNonFocused(CaretDisplayPolicy policy);
517 #ifndef KDE_NO_COMPAT
518 void enableJScript(
bool e ) { setJScriptEnabled(e); }
519 void enableJava(
bool e ) { setJavaEnabled(e); }
520 void enablePlugins(
bool e ) { setPluginsEnabled(e); }
521 void autoloadImages(
bool e ) { setAutoloadImages(e); }
522 void enableMetaRefresh(
bool e ) { setMetaRefreshEnabled(e); }
523 bool setCharset(
const TQString &,
bool ) {
return true; }
525 KURL baseURL()
const;
526 TQString baseTarget()
const;
532 KURL backgroundURL()
const;
537 void scheduleRedirection(
int delay,
const TQString &url,
bool lockHistory =
true );
561 virtual void begin(
const KURL &url =
KURL(),
int xOffset = 0,
int yOffset = 0 );
583 virtual void write(
const char *str,
int len = -1 );
592 virtual void write(
const TQString &str );
609 void paint( TQPainter *,
const TQRect &,
int = 0,
bool * = 0 );
617 bool setEncoding(
const TQString &name,
bool override =
false );
624 TQString encoding()
const;
635 void setUserStyleSheet(
const KURL &url );
646 void setUserStyleSheet(
const TQString &styleSheet );
655 void setStandardFont(
const TQString &name );
663 void setFixedFont(
const TQString &name );
672 bool gotoAnchor(
const TQString &name );
691 void setURLCursor(
const TQCursor &c );
696 TQCursor urlCursor()
const;
704 FindLinksOnly = 1 * KFindDialog::MinimumUserOption,
705 FindNoPopups = 2 * KFindDialog::MinimumUserOption
724 void findText(
const TQString &str,
long options, TQWidget *parent = 0,
725 KFindDialog *findDialog = 0 );
730 void findTextBegin();
737 bool findTextNext(
const TQString &str,
bool forward,
bool caseSensitive,
bool isRegExp );
753 bool findTextNext(
bool reverse );
765 void setZoomFactor(
int percent);
770 int zoomFactor()
const;
775 virtual TQString selectedText()
const;
785 TQString selectedTextAsHTML()
const;
790 DOM::Range selection()
const;
803 void selection(
DOM::Node &startNode,
long &startOffset,
804 DOM::Node &endNode,
long &endOffset)
const;
809 void setSelection(
const DOM::Range & );
819 bool hasSelection()
const;
853 virtual void saveState( TQDataStream &stream );
863 virtual void restoreState( TQDataStream &stream );
881 DOM::Node nonSharedNodeUnderMouse()
const;
901 TQStringList frameNames()
const;
903 TQPtrList<KParts::ReadOnlyPart> frames()
const;
933 bool frameExists(
const TQString &frameName );
949 void setJSStatusBarText(
const TQString &text );
956 void setJSDefaultStatusBarText(
const TQString &text );
963 TQString jsStatusBarText()
const;
970 TQString jsDefaultStatusBarText()
const;
975 TQString referrer()
const;
980 TQString pageReferrer()
const;
985 TQString lastModified()
const;
990 void preloadStyleSheet(
const TQString &url,
const TQString &stylesheet );
995 void preloadScript(
const TQString &url,
const TQString &script );
1000 bool restored()
const;
1003 enum FormNotification { NoNotification = 0, Before, Only, Unused=255 };
1010 void setFormNotification(FormNotification fn);
1018 FormNotification formNotification()
const;
1035 bool isModified()
const;
1042 void setSuppressedPopupIndicator(
bool enable );
1048 void setSuppressedPopupIndicator(
bool enable,
TDEHTMLPart *originPart );
1054 bool inProgress()
const;
1065 void popupMenu(
const TQString &url,
const TQPoint &point );
1106 const TQByteArray& formData,
const TQString& target,
1107 const TQString& contentType,
const TQString& boundary);
1116 KURL completeURL(
const TQString &url );
1124 void htmlError(
int errorCode,
const TQString& text,
const KURL& reqUrl );
1126 virtual void customEvent( TQCustomEvent *event );
1131 virtual void tdehtmlMousePressEvent( tdehtml::MousePressEvent *event );
1135 virtual void tdehtmlMouseDoubleClickEvent( tdehtml::MouseDoubleClickEvent * );
1139 virtual void tdehtmlMouseMoveEvent( tdehtml::MouseMoveEvent *event );
1143 virtual void tdehtmlMouseReleaseEvent( tdehtml::MouseReleaseEvent *event );
1147 virtual void tdehtmlDrawContentsEvent( tdehtml::DrawContentsEvent * );
1159 virtual void urlSelected(
const TQString &url,
int button,
int state,
1171 TQObject *parent,
const char *name,
1172 const TQString &mimetype, TQString &serviceName,
1173 TQStringList &serviceTypes,
const TQStringList ¶ms);
1177 bool pluginPageQuestionAsked(
const TQString& mimetype )
const;
1178 void setPluginPageQuestionAsked(
const TQString& mimetype );
1180 enum PageSecurity { NotCrypted, Encrypted, Mixed };
1181 void setPageSecurity( PageSecurity sec );
1186 virtual bool doOpenStream(
const TQString& mimeType );
1191 virtual bool doWriteStream(
const TQByteArray& data );
1196 virtual bool doCloseStream();
1209 void setActiveNode(
const DOM::Node &node );
1214 void stopAnimations();
1216 TQCString dcopObjectId()
const;
1225 TQVariant executeScript(
const TQString &script );
1237 void setCaretMode(
bool enable);
1250 void setEditable(
bool enable);
1268 void setCaretVisible(
bool show);
1274 void submitFormProxy(
const char *action,
const TQString &url,
1275 const TQByteArray &formData,
1276 const TQString &target,
1277 const TQString& contentType = TQString::null,
1278 const TQString& boundary = TQString::null );
1285 void reparseConfiguration();
1290 void slotData( TDEIO::Job*,
const TQByteArray &data );
1294 void slotInfoMessage( TDEIO::Job*,
const TQString& msg );
1298 void slotRestoreData(
const TQByteArray &data );
1302 void slotFinished( TDEIO::Job* );
1306 void slotFinishedParsing();
1310 void slotRedirect();
1314 void slotRedirection( TDEIO::Job*,
const KURL& );
1318 void slotDebugScript();
1322 void slotDebugDOMTree();
1326 void slotDebugRenderTree();
1330 void slotStopAnimations();
1334 virtual void slotViewDocumentSource();
1338 virtual void slotViewFrameSource();
1342 void slotViewPageInfo();
1346 virtual void slotSaveBackground();
1350 virtual void slotSaveDocument();
1354 virtual void slotSaveFrame();
1358 virtual void slotSecurity();
1362 virtual void slotSetEncoding();
1367 virtual void slotUseStylesheet();
1369 virtual void slotFind();
1370 virtual void slotFindDone();
1371 virtual void slotFindDialogDestroyed();
1372 void slotFindNext();
1373 void slotFindPrev();
1374 void slotFindAheadText();
1375 void slotFindAheadLink();
1379 void slotIncZoomFast();
1380 void slotDecZoomFast();
1382 void slotLoadImages();
1383 void slotWalletClosed();
1384 void launchWalletManager();
1390 void submitFormAgain();
1395 void updateActions();
1407 void slotChildStarted( TDEIO::Job *job );
1411 void slotChildCompleted();
1415 void slotChildCompleted(
bool );
1419 void slotParentCompleted();
1427 void slotChildDocCreated();
1432 void slotLoaderRequestStarted( tdehtml::DocLoader*, tdehtml::CachedObject* obj);
1433 void slotLoaderRequestDone( tdehtml::DocLoader*, tdehtml::CachedObject *obj );
1434 void checkCompleted();
1439 void slotAutoScroll();
1441 void slotPrintFrame();
1443 void slotSelectAll();
1448 void slotProgressUpdate();
1453 void slotJobPercent( TDEIO::Job*,
unsigned long );
1458 void slotJobDone( TDEIO::Job* );
1463 void slotUserSheetStatDone( TDEIO::Job* );
1468 void slotJobSpeed( TDEIO::Job*,
unsigned long );
1473 void slotClearSelection();
1478 void slotZoomView(
int );
1483 void slotHighlight(
const TQString &,
int index,
int length );
1488 void slotAutomaticDetectionLanguage(
int _id );
1493 void slotToggleCaretMode();
1498 void suppressedPopupMenu();
1503 void togglePopupPassivePopup();
1508 void showSuppressedPopups();
1513 void launchJSConfigDialog();
1518 void launchJSErrorDialog();
1523 void removeJSErrorExtension();
1528 void disableJSErrorExtension();
1533 void jsErrorDialogContextMenu();
1540 void restoreScrollPosition();
1542 void walletOpened(TDEWallet::Wallet*);
1546 KJSErrorDlg *jsErrorExtension();
1548 enum StatusBarPriority { BarDefaultText, BarHoverText, BarOverrideText };
1551 bool restoreURL(
const KURL &url );
1552 void resetFromScript();
1553 void emitSelectionChanged();
1555 bool checkFrameAccess(
TDEHTMLPart *callingHtmlPart);
1557 bool urlSelectedIntern(
const TQString &url,
int button,
int state,
1559 void startAutoScroll();
1560 void stopAutoScroll();
1561 void overURL(
const TQString &url,
const TQString &target,
bool shiftPressed =
false );
1562 void resetHoverText();
1564 bool processObjectRequest( tdehtml::ChildFrame *child,
const KURL &url,
const TQString &mimetype );
1566 TDEWallet::Wallet* wallet();
1568 void openWallet(DOM::HTMLFormElementImpl*);
1569 void saveToWallet(
const TQString& key,
const TQMap<TQString,TQString>& data);
1570 void dequeueWallet(DOM::HTMLFormElementImpl*);
1572 void enableFindAheadActions(
bool);
1584 void submitForm(
const char *action,
const TQString &url,
const TQByteArray &formData,
1585 const TQString &target,
const TQString& contentType = TQString::null,
1586 const TQString& boundary = TQString::null );
1588 void popupMenu(
const TQString &url );
1595 bool scheduleScript(
const DOM::Node &n,
const TQString& script);
1597 TQVariant crossFrameExecuteScript(
const TQString& target,
const TQString& script);
1598 TQVariant executeScheduledScript();
1600 bool requestFrame( tdehtml::RenderPart *frame,
const TQString &url,
const TQString &frameName,
1601 const TQStringList &args = TQStringList(),
bool isIFrame =
false );
1610 TQString requestFrameName();
1612 bool requestObject( tdehtml::RenderPart *frame,
const TQString &url,
const TQString &serviceType,
1613 const TQStringList &args = TQStringList() );
1617 DOM::EventListener *createHTMLEventListener( TQString code, TQString name, DOM::NodeImpl *node );
1619 DOM::HTMLDocumentImpl *docImpl()
const;
1620 DOM::DocumentImpl *xmlDocImpl()
const;
1621 tdehtml::ChildFrame *frame(
const TQObject *obj );
1623 tdehtml::ChildFrame *recursiveFrameRequest(
TDEHTMLPart *callingHtmlPart,
const KURL &url,
const KParts::URLArgs &args,
bool callParent =
true );
1625 bool checkLinkSecurity(
const KURL &linkURL,
const TQString &message = TQString::null,
const TQString &button = TQString::null );
1626 TQVariant executeScript(
const TQString& filename,
int baseLine,
const DOM::Node &n,
const TQString& script );
1628 KJSProxy *jScript();
1631 long cacheId()
const;
1634 void setOpenedByJS(
bool _openedByJS );
1636 void checkEmitLoadEvent();
1637 void emitLoadEvent();
1639 bool initFindNode(
bool selection,
bool reverse,
bool fromCursor );
1641 void extendSelection( DOM::NodeImpl* node,
long offset,
DOM::Node& selectionNode,
long& selectionOffset,
bool right,
bool paragraph );
1651 void extendSelectionTo(
int x,
int y,
int absX,
int absY,
const DOM::Node &innerNode);
1655 bool isExtendingSelection()
const;
1656 tdehtml::Decoder *createDecoder();
1657 TQString defaultEncoding()
const;
1660 TQString defaultExtension()
const;
1665 void zoomIn(
const int stepping[],
int count);
1669 void zoomOut(
const int stepping[],
int count);
1671 void emitCaretPositionChanged(
const DOM::Node &node,
long offset);
1673 void setDebugScript(
bool enable );
1677 TDEHTMLPartPrivate *d;
1678 friend class TDEHTMLPartPrivate;
The Document interface represents the entire HTML or XML document.
Introduced in DOM Level 2.
An HTMLDocument is the root of the HTML hierarchy and holds the entire content.
The Node interface is the primary datatype for the entire Document Object Model.
void setStatusBarText(const TQString &text)
virtual bool openURL(const KURL &url)
virtual void guiActivateEvent(GUIActivateEvent *event)
virtual bool openFile()=0
This is the BrowserExtension for a TDEHTMLPart document.
DCOP interface for TDEHTML.
This class is tdehtml's main class.
void popupMenu(const TQString &url, const TQPoint &point)
Emitted when the user clicks the right mouse button on the document.
CaretDisplayPolicy
Enumeration for displaying the caret.
FindOptions
Extra Find options that can be used when calling the extended findText().
void caretPositionChanged(const DOM::Node &node, long offset)
This signal is emitted whenever the caret position has been changed.
void onURL(const TQString &url)
Emitted if the cursor is moved over an URL.
void nodeActivated(const DOM::Node &)
This signal is emitted when an element retrieves the keyboard focus.
void formSubmitNotification(const char *action, const TQString &url, const TQByteArray &formData, const TQString &target, const TQString &contentType, const TQString &boundary)
If form notification is on, this will be emitted either for a form submit or before the form submit a...
void selectionChanged()
This signal is emitted when the selection changes.
Settings for the HTML view.
Renders and displays HTML in a TQScrollView.
The Document Object Model (DOM) is divided into two parts, the COREDOM core DOM, specifying some core...
TDEAction * clear(const TQObject *recvr, const char *slot, TDEActionCollection *parent, const char *name=0)
const TDEShortcut & end()
const TDEShortcut & zoomIn()
const TDEShortcut & zoomOut()