1
2#ifndef KHC_VIEW_H
3#define KHC_VIEW_H
4
5#include <khtml_part.h>
6
7#include "glossary.h"
8#include "navigator.h"
9
10#include <QEvent>
11
12class KActionCollection;
13
14namespace DOM {
15 class Node;
16 class HTMLLinkElement;
17}
18
19namespace KHC {
20
21class Formatter;
22
23class View : public KHTMLPart
24{
25 Q_OBJECT
26 public:
27 View( QWidget *parentWidget, QObject *parent, KHTMLPart::GUIProfile prof,
28 KActionCollection *col );
29
30 ~View();
31
32 virtual bool openUrl( const KUrl &url );
33
34 virtual void saveState( QDataStream &stream );
35 virtual void restoreState( QDataStream &stream );
36
37 enum State { Docu, About, Search };
38
39 int state() const { return mState; }
40 QString title() const { return mTitle; }
41
42 static QString langLookup( const QString &fname );
43
44 void beginSearchResult();
45 void writeSearchResult( const QString & );
46 void endSearchResult();
47
48 void beginInternal( const KUrl & );
49 KUrl internalUrl() const;
50
51 int fontScaleStepping() const { return m_fontScaleStepping; }
52
53 Formatter *formatter() const { return mFormatter; }
54
55 void copySelectedText();
56
57 public Q_SLOTS:
58 void lastSearch();
59 void slotIncFontSizes();
60 void slotDecFontSizes();
61 void slotReload( const KUrl &url = KUrl() );
62 void slotCopyLink();
63 bool nextPage(bool checkOnly = false);
64 bool prevPage(bool checkOnly = false);
65
66 Q_SIGNALS:
67 void searchResultCacheAvailable();
68
69 protected:
70 bool eventFilter( QObject *o, QEvent *e );
71
72 private Q_SLOTS:
73 void setTitle( const QString &title );
74 void showMenu( const QString& url, const QPoint& pos);
75
76 private:
77 KUrl urlFromLinkNode( const DOM::HTMLLinkElement &link ) const;
78
79 int mState;
80 QString mTitle;
81
82 QString mSearchResult;
83 KUrl mInternalUrl;
84
85 int m_fontScaleStepping;
86
87 Formatter *mFormatter;
88 KActionCollection *mActionCollection;
89 QString mCopyURL;
90};
91
92}
93
94#endif //KHC_VIEW_H
95
96// vim:ts=2:sw=2:et
97