File: help.h

package info (click to toggle)
texstudio 2.11.2%2Bdebian-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 41,292 kB
  • ctags: 12,405
  • sloc: cpp: 93,072; xml: 10,217; ansic: 4,153; sh: 145; makefile: 56
file content (83 lines) | stat: -rw-r--r-- 1,826 bytes parent folder | download | duplicates (2)
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
#ifndef HELP_H
#define HELP_H

#include "mostQtHeaders.h"

class Help : public QObject
{
	Q_OBJECT

public:
	static Help *instance();

	static bool isMiktexTexdoc();
	static bool isTexdocExpectedToFinish();
	static QString texdocCommand();
	static QString packageDocFile(const QString &package, bool silent = false);

signals:
	void texdocAvailableReply(const QString &package, bool available, QString errorMessage);

public slots:
	void execTexdocDialog(const QStringList &packages, const QString &defaultPackage);
	void viewTexdoc(QString package);
	void texdocAvailableRequest(const QString &package);

private slots:
	void texdocProcessFinished();
	void texdocAvailableRequestFinished(int exitCode);

private:
	Help();
	Help(const Help &);
	Help &operator=(const Help &);
	static QStringList getAdditionalCmdSearchPathList();

	static Help *m_Instance;
	static int texDocSystem;
	static QString m_texdocCommand;
};


class LatexReference : public QObject
{
	Q_OBJECT

public:
	explicit LatexReference(QObject *parent = 0);

	void setFile(QString filename);
	bool contains(const QString &command);
	QString getTextForTooltip(const QString &command);
	QString getSectionText(const QString &command);
	QString getPartialText(const QString &command);

protected:
	void makeIndex();

private:
	struct Anchor {
		Anchor()
		{
			name = QString();
			start_pos = -1;
			end_pos = -1;
		}
		Anchor(const QString &n)
		{
			name = n;
			start_pos = -1;
			end_pos = -1;
		}
		QString name;
		int start_pos;
		int end_pos;
	};

	QString m_filename;
	QString m_htmltext;
	QHash<QString, Anchor> m_anchors; // maps commands to their anchor
	QHash<QString, Anchor> m_sectionAnchors; // maps commands to the anchor of their section
};

#endif // HELP_H