1 /*
2  For general Scribus (>=1.3.2) copyright and licensing information please refer
3  to the COPYING file provided with the program. Following this notice may exist
4  a copyright and/or license notice that predates the release of Scribus 1.3.2
5  for which a new license (GPL+exception) is in place.
6  */
7 
8 #ifndef SCWORDITERATOR_H
9 #define SCWORDITERATOR_H
10 
11 #include <QString>
12 #include <unicode/uversion.h>
13 
14 #include "scribusapi.h"
15 #include "storytext.h"
16 
17 U_NAMESPACE_BEGIN
18 class BreakIterator;
19 class UnicodeString;
20 U_NAMESPACE_END
21 
22 class SCRIBUS_API ScWordIterator
23 {
24 public:
25 	ScWordIterator(StoryText& story);
26 	~ScWordIterator();
27 
28 	int firstWord();
29 	int nextWord(int pos);
30 	int prevWord(int pos);
31 	int endOfWord(int pos);
32 
33 	QString word(int pos);
34 
35 private:
36 	icu::UnicodeString* m_unicodeString { nullptr };
37 	icu::BreakIterator* m_wordIterator { nullptr };
38 	StoryText& m_story;
39 
40 	icu::BreakIterator* getWordIterator();
41 };
42 
43 #endif
44