File: searchquery.h

package info (click to toggle)
texstudio 2.12.14%2Bdebian-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 48,048 kB
  • sloc: cpp: 97,886; xml: 10,243; ansic: 8,127; sh: 158; makefile: 33
file content (82 lines) | stat: -rw-r--r-- 1,880 bytes parent folder | download | duplicates (3)
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
#ifndef SEARCHQUERY_H
#define SEARCHQUERY_H

#include "mostQtHeaders.h"
#include "searchresultmodel.h"
#include "qdocument.h"

class LatexDocument;


class SearchQuery : public QObject {
	Q_OBJECT

public:
	enum SearchFlag
	{
		NoFlags				= 0x0000,
		SearchParams		= 0x00FF,
		IsCaseSensitive		= 0x0001,
		IsWord				= 0x0002,
		IsRegExp			= 0x0004,
		
		SearchCapabilities	= 0xFF00,
		ScopeChangeAllowed	= 0x0100,
		ReplaceAllowed		= 0x0200,
		SearchAgainAllowed	= 0x0400,
	};
	Q_DECLARE_FLAGS(SearchFlags, SearchFlag)
	enum Scope {
		CurrentDocumentScope,
		ProjectScope,
		GlobalScope,
	};

	SearchQuery(QString expr, QString replaceText, SearchFlags f);
	SearchQuery(QString expr, QString replaceText, bool isCaseSensitive, bool isWord, bool isRegExp);

	bool flag(SearchFlag f) const;
	QString type() { return mType; }

	QString searchExpression() const { return mModel->searchExpression(); }
    void setExpression(QString expr);
	SearchResultModel * model() const { return mModel; }
	int getNextSearchResultColumn(QString text, int col) const;

	void setScope(Scope sc) { mScope = sc; }
	Scope scope() { return mScope; }
	
signals:
	void runCompleted();
	
public slots:
	virtual void run(LatexDocument *doc);
	void addDocSearchResult(QDocument *doc, QList<QDocumentLineHandle *> search);
	void setReplacementText(QString text);
	QString replacementText();
	virtual void replaceAll();
	
protected:
	void setFlag(SearchFlag f, bool b=true);
	QString mType;
	Scope mScope;
	SearchResultModel *mModel;
	SearchFlags searchFlags;
	
private:

};
Q_DECLARE_OPERATORS_FOR_FLAGS(SearchQuery::SearchFlags)


class LabelSearchQuery : public SearchQuery {
	Q_OBJECT

public:
	LabelSearchQuery(QString label);
	virtual void run(LatexDocument *doc);
	virtual void replaceAll();
};


#endif // SEARCHQUERY_H