summaryrefslogtreecommitdiffstats
path: root/src/kchmviewwindow_qtextbrowser.h
blob: c2a24f250c5e5dbdc409172b5c78d8af60a949a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/***************************************************************************
 *   Copyright (C) 2004-2007 by Georgy Yunaev, [email protected]       *
 *   Please do not use email address above for bug reports; see            *
 *   the README file                                                       *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
 ***************************************************************************/

#ifndef KCHMVIEWWINDOW_TQTEXTBROWSER_H
#define KCHMVIEWWINDOW_TQTEXTBROWSER_H

#include "tde-tqt.h"

#include "kchmviewwindow.h"
#include "kchmsourcefactory.h"

/**
@author Georgy Yunaev
*/
class KCHMViewWindow_QTextBrowser : public TQTextBrowser, public KCHMViewWindow
{
TQ_OBJECT
  
public:
	KCHMViewWindow_QTextBrowser( TQTabWidget * parent );
	~KCHMViewWindow_QTextBrowser();

	//! Open a page from current chm archive
	virtual bool	openPage (const TQString& url);
	
	//! Invalidate current view, doing all the cleanups etc.
	virtual void	invalidate();

	//! Return current ZoomFactor.
	virtual int		getZoomFactor() const { return m_zoomfactor; }
	
	//! Sets ZoomFactor. The value returned by getZoomFactor(), given to this function, should give the same result.
	virtual void	setZoomFactor (int zoom);
	
	//! Relatively changes ZoomFactor. Most common values are -1 and 1.
	virtual void	addZoomFactor (int value);

	//! Popups the print dialog, and prints the current page on the printer.
	virtual bool	printCurrentPage();

	//! Initiates the find-in-page search, if succeed, cursor moved to the first entry
	virtual void	searchWord( const TQString & word, bool forward = true, bool casesensitive = false );

	//! Select the content of the whole page
	virtual void	clipSelectAll();

	//! Copies the selected content to the clipboard
	virtual void	clipCopy();

	/*!
	 * Return current scrollbar position in view window. Saved on program exit. 
	 * There is no restriction on returned value, except that giving this value to 
	 * setScrollbarPosition() should move the scrollbar in the same position.
	 */
	virtual int		getScrollbarPosition();
	
	//! Sets the scrollbar position.
	virtual void	setScrollbarPosition(int pos);

	virtual TQObject *	getTQObject() { return TQT_TQOBJECT(this); }
	virtual TQWidget *	getTQWidget() { return TQT_TQWIDGET(this); }

	static	TQString decodeUrl( const TQString &url );
		
signals:
	/*!
	 * Emitted when the user clicked on the link, before the page changed.
 	 * If signalLinkClicked() sets follow_link to false, the current page should NOT change.
	 * Otherwise it should be changed to the new link value.
	 */
	void	signalLinkClicked ( const TQString & newlink, bool& follow_link );

private slots:
	virtual void	slotLinkClicked (const TQString & newlink);
	
private:
	TQPopupMenu * 	createPopupMenu ( const TQPoint & pos );
	void	setSource ( const TQString & name );
			
	int						m_zoomfactor;
	bool					m_allowSourceChange;
	int						m_searchLastIndex;
	int						m_searchLastParagraph;
	TQString					m_searchText;
	
	KCHMSourceFactory	*	m_sourcefactory;
};


#endif /* KCHMVIEWWINDOW_TQTEXTBROWSER_H */