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 void GetRectArray(CFX_RectArray& rects) const; |
| 29 int GetCurOrder() const; |
| 30 int GetMatchedCount() const; |
| 31 |
| 32 protected: |
| 33 void ExtractFindWhat(const CFX_WideString& findwhat); |
| 34 FX_BOOL IsMatchWholeWord(const CFX_WideString& csPageText, |
| 35 int startPos, |
| 36 int endPos); |
| 37 FX_BOOL ExtractSubString(CFX_WideString& rString, |
| 38 const FX_WCHAR* lpszFullString, |
| 39 int iSubString, |
| 40 FX_WCHAR chSep); |
| 41 CFX_WideString MakeReverse(const CFX_WideString& str); |
| 42 int ReverseFind(const CFX_WideString& csPageText, |
| 43 const CFX_WideString& csWord, |
| 44 int nStartPos, |
| 45 int& WordLength); |
| 46 int GetCharIndex(int index) const; |
| 47 |
| 48 private: |
| 49 std::vector<uint16_t> m_CharIndex; |
| 50 const CPDF_TextPage* m_pTextPage; |
| 51 CFX_WideString m_strText; |
| 52 CFX_WideString m_findWhat; |
| 53 int m_flags; |
| 54 std::vector<CFX_WideString> m_csFindWhatArray; |
| 55 int m_findNextStart; |
| 56 int m_findPreStart; |
| 57 FX_BOOL m_bMatchCase; |
| 58 FX_BOOL m_bMatchWholeWord; |
| 59 int m_resStart; |
| 60 int m_resEnd; |
| 61 CFX_RectArray m_resArray; |
| 62 FX_BOOL m_IsFind; |
| 63 }; |
| 64 |
| 65 #endif // CORE_FPDFTEXT_INCLUDE_CPDF_TEXTPAGEFIND_H_ |
OLD | NEW |