summaryrefslogtreecommitdiffstats
path: root/src/kile/kilehelp.h
blob: 7d7b6abb970fa8faeae3ad442db80fff62f50b11 (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
109
110
/***************************************************************************
    date                 : Feb 12 2007
    version              : 0.30
    copyright            : (C) 2004-2007 by Holger Danielsson
    email                : holger.danielsson@versanet.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef KILEHELP_H
#define KILEHELP_H

#include <tqobject.h>
#include <tqmap.h>
#include <tqstring.h>

#include <tdeconfig.h>
#include <tdemenubar.h>
#include <kate/view.h>
#include "kileedit.h"

#include "userhelp.h"
#include "texdocdialog.h"
#include "usermenudialog.h"
#include "kiletool.h"
#include "kiletoolmanager.h"

/**
  *@author Holger Danielsson
  */

namespace KileDocument { class EditorExtension; }

namespace KileHelp
{

	enum Type 
	{
		HelpKileRefs,
		HelpTexRefs,
		HelpLatexIndex,
		HelpLatexCommand,
		HelpLatexSubject,
		HelpLatexEnvironment
	};

	enum TexVersion
	{
		TETEX2,
		TETEX3,
		TEXLIVE2005
	};

	class Help : public TQObject
	{
		Q_OBJECT
  

	public:
		Help(KileDocument::EditorExtension *edit);
		~Help();
		
		void setUserhelp(KileTool::Manager *manager, KMenuBar *menubar); 
		void update();

		// calls for help
		void helpKeyword(Kate::View *view);
		void noHelpAvailableFor(const TQString &word);
		void userHelpDialog() { m_userhelp->userHelpDialog(); }
		void enableUserhelpEntries(bool state);
	public slots:
		void helpTexGuide();
		void helpLatexIndex() { helpLatex(KileHelp::HelpLatexIndex); }
		void helpLatexCommand() { helpLatex(KileHelp::HelpLatexCommand); }
		void helpLatexSubject() { helpLatex(KileHelp::HelpLatexSubject); }
		void helpLatexEnvironment() { helpLatex(KileHelp::HelpLatexEnvironment); }
		void helpKeyword();
		void helpDocBrowser(); 
		
	private:
		KileTool::Manager *m_manager;
		KileDocument::EditorExtension *m_edit;
		UserHelp *m_userhelp;
		
		TexVersion m_texVersion;
		TQString m_texReference;
		TQString m_texdocPath;

		TQMap<TQString,TQString> m_dictHelpKile;
		TQMap<TQString,TQString> m_dictHelpTex;

		void initTexDocumentation();
		void readHelpList(const TQString &filename,TQMap<TQString,TQString> &map);
		void showHelpFile(const TQString &parameter);

		void helpLatex(KileHelp::Type type);
		void helpTexRefsKeyword(Kate::View *view);
		void helpKileRefsKeyword(Kate::View *view);
		TQString getKeyword(Kate::View *view);
	};
}

#endif