| 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_CPDF_TEXTPAGEFIND_H_ | 7 #ifndef CORE_FPDFTEXT_CPDF_TEXTPAGEFIND_H_ |
| 8 #define CORE_FPDFTEXT_CPDF_TEXTPAGEFIND_H_ | 8 #define CORE_FPDFTEXT_CPDF_TEXTPAGEFIND_H_ |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "core/fxcrt/fx_coordinates.h" | 12 #include "core/fxcrt/fx_coordinates.h" |
| 13 #include "core/fxcrt/fx_string.h" | 13 #include "core/fxcrt/fx_string.h" |
| 14 #include "core/fxcrt/fx_system.h" | 14 #include "core/fxcrt/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 bool FindFirst(const CFX_WideString& findwhat, int flags, int startPos = 0); |
| 24 int flags, | 24 bool FindNext(); |
| 25 int startPos = 0); | 25 bool FindPrev(); |
| 26 FX_BOOL FindNext(); | |
| 27 FX_BOOL FindPrev(); | |
| 28 int GetCurOrder() const; | 26 int GetCurOrder() const; |
| 29 int GetMatchedCount() const; | 27 int GetMatchedCount() const; |
| 30 | 28 |
| 31 protected: | 29 protected: |
| 32 void ExtractFindWhat(const CFX_WideString& findwhat); | 30 void ExtractFindWhat(const CFX_WideString& findwhat); |
| 33 FX_BOOL IsMatchWholeWord(const CFX_WideString& csPageText, | 31 bool IsMatchWholeWord(const CFX_WideString& csPageText, |
| 34 int startPos, | 32 int startPos, |
| 35 int endPos); | 33 int endPos); |
| 36 FX_BOOL ExtractSubString(CFX_WideString& rString, | 34 bool ExtractSubString(CFX_WideString& rString, |
| 37 const FX_WCHAR* lpszFullString, | 35 const FX_WCHAR* lpszFullString, |
| 38 int iSubString, | 36 int iSubString, |
| 39 FX_WCHAR chSep); | 37 FX_WCHAR chSep); |
| 40 CFX_WideString MakeReverse(const CFX_WideString& str); | 38 CFX_WideString MakeReverse(const CFX_WideString& str); |
| 41 int GetCharIndex(int index) const; | 39 int GetCharIndex(int index) const; |
| 42 | 40 |
| 43 private: | 41 private: |
| 44 std::vector<uint16_t> m_CharIndex; | 42 std::vector<uint16_t> m_CharIndex; |
| 45 const CPDF_TextPage* m_pTextPage; | 43 const CPDF_TextPage* m_pTextPage; |
| 46 CFX_WideString m_strText; | 44 CFX_WideString m_strText; |
| 47 CFX_WideString m_findWhat; | 45 CFX_WideString m_findWhat; |
| 48 int m_flags; | 46 int m_flags; |
| 49 std::vector<CFX_WideString> m_csFindWhatArray; | 47 std::vector<CFX_WideString> m_csFindWhatArray; |
| 50 int m_findNextStart; | 48 int m_findNextStart; |
| 51 int m_findPreStart; | 49 int m_findPreStart; |
| 52 FX_BOOL m_bMatchCase; | 50 bool m_bMatchCase; |
| 53 FX_BOOL m_bMatchWholeWord; | 51 bool m_bMatchWholeWord; |
| 54 int m_resStart; | 52 int m_resStart; |
| 55 int m_resEnd; | 53 int m_resEnd; |
| 56 std::vector<CFX_FloatRect> m_resArray; | 54 std::vector<CFX_FloatRect> m_resArray; |
| 57 FX_BOOL m_IsFind; | 55 bool m_IsFind; |
| 58 }; | 56 }; |
| 59 | 57 |
| 60 #endif // CORE_FPDFTEXT_CPDF_TEXTPAGEFIND_H_ | 58 #endif // CORE_FPDFTEXT_CPDF_TEXTPAGEFIND_H_ |
| OLD | NEW |