00001 #ifndef __view_h__
00002 #define __view_h__
00003
00004 #include <khtml_part.h>
00005
00006 #include "glossary.h"
00007 #include "navigator.h"
00008
00009 class KActionCollection;
00010
00011 namespace DOM {
00012 class Node;
00013 }
00014
00015 namespace KHC {
00016
00017 class Formatter;
00018
00019 class View : public KHTMLPart
00020 {
00021 Q_OBJECT
00022 public:
00023 View( TQWidget *parentWidget, const char *widgetName,
00024 TQObject *parent, const char *name, KHTMLPart::GUIProfile prof,
00025 KActionCollection *col );
00026
00027 ~View();
00028
00029 virtual bool openURL( const KURL &url );
00030
00031 virtual void saveState( TQDataStream &stream );
00032 virtual void restoreState( TQDataStream &stream );
00033
00034 enum State { Docu, About, Search };
00035
00036 int state() const { return mState; }
00037 TQString title() const { return mTitle; }
00038
00039 static TQString langLookup( const TQString &fname );
00040
00041 void beginSearchResult();
00042 void writeSearchResult( const TQString & );
00043 void endSearchResult();
00044
00045 void beginInternal( const KURL & );
00046 KURL internalUrl() const;
00047
00048 int zoomStepping() const { return m_zoomStepping; }
00049
00050 Formatter *formatter() const { return mFormatter; }
00051
00052 void copySelectedText();
00053
00054 public slots:
00055 void lastSearch();
00056 void slotIncFontSizes();
00057 void slotDecFontSizes();
00058 void slotReload( const KURL &url = KURL() );
00059 void slotCopyLink();
00060 bool nextPage(bool checkOnly = false);
00061 bool prevPage(bool checkOnly = false);
00062
00063 signals:
00064 void searchResultCacheAvailable();
00065
00066 protected:
00067 bool eventFilter( TQObject *o, TQEvent *e );
00068
00069 private slots:
00070 void setTitle( const TQString &title );
00071 void showMenu( const TQString& url, const TQPoint& pos);
00072
00073 private:
00074 void showAboutPage();
00075 KURL urlFromLinkNode( const DOM::Node &n ) const;
00076
00077 int mState;
00078 TQString mTitle;
00079
00080 TQString mSearchResult;
00081 KURL mInternalUrl;
00082
00083 int m_zoomStepping;
00084
00085 Formatter *mFormatter;
00086 KActionCollection *mActionCollection;
00087 TQString mCopyURL;
00088 };
00089
00090 }
00091
00092 #endif
00093
00094