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