OLD | NEW |
| (Empty) |
1 // Copyright 2016 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #ifndef CORE_FPDFTEXT_INCLUDE_CPDF_TEXTPAGEFIND_H_ | |
8 #define CORE_FPDFTEXT_INCLUDE_CPDF_TEXTPAGEFIND_H_ | |
9 | |
10 #include <vector> | |
11 | |
12 #include "core/fxcrt/include/fx_coordinates.h" | |
13 #include "core/fxcrt/include/fx_string.h" | |
14 #include "core/fxcrt/include/fx_system.h" | |
15 | |
16 class CPDF_TextPage; | |
17 | |
18 class CPDF_TextPageFind { | |
19 public: | |
20 explicit CPDF_TextPageFind(const CPDF_TextPage* pTextPage); | |
21 ~CPDF_TextPageFind(); | |
22 | |
23 FX_BOOL FindFirst(const CFX_WideString& findwhat, | |
24 int flags, | |
25 int startPos = 0); | |
26 FX_BOOL FindNext(); | |
27 FX_BOOL FindPrev(); | |
28 int GetCurOrder() const; | |
29 int GetMatchedCount() const; | |
30 | |
31 protected: | |
32 void ExtractFindWhat(const CFX_WideString& findwhat); | |
33 FX_BOOL IsMatchWholeWord(const CFX_WideString& csPageText, | |
34 int startPos, | |
35 int endPos); | |
36 FX_BOOL ExtractSubString(CFX_WideString& rString, | |
37 const FX_WCHAR* lpszFullString, | |
38 int iSubString, | |
39 FX_WCHAR chSep); | |
40 CFX_WideString MakeReverse(const CFX_WideString& str); | |
41 int GetCharIndex(int index) const; | |
42 | |
43 private: | |
44 std::vector<uint16_t> m_CharIndex; | |
45 const CPDF_TextPage* m_pTextPage; | |
46 CFX_WideString m_strText; | |
47 CFX_WideString m_findWhat; | |
48 int m_flags; | |
49 std::vector<CFX_WideString> m_csFindWhatArray; | |
50 int m_findNextStart; | |
51 int m_findPreStart; | |
52 FX_BOOL m_bMatchCase; | |
53 FX_BOOL m_bMatchWholeWord; | |
54 int m_resStart; | |
55 int m_resEnd; | |
56 std::vector<CFX_FloatRect> m_resArray; | |
57 FX_BOOL m_IsFind; | |
58 }; | |
59 | |
60 #endif // CORE_FPDFTEXT_INCLUDE_CPDF_TEXTPAGEFIND_H_ | |
OLD | NEW |