summaryrefslogtreecommitdiff
path: root/core/fpdftext/include/cpdf_textpagefind.h
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-04-19 10:39:24 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-19 10:39:24 -0700
commita28ae388f3859c52630deb6ef3d0ea468e5177e3 (patch)
tree1ab55ded754a5d1fc6ab5702e9d2244e5830ed68 /core/fpdftext/include/cpdf_textpagefind.h
parent11178284eccf22306338cf0d252b8dbb946feb16 (diff)
downloadpdfium-a28ae388f3859c52630deb6ef3d0ea468e5177e3.tar.xz
Remove IPDF_TextPage, IPDF_TextPageFind and IPDF_LinkExtract interfaces.
Each was only used by one subclass. Removed and used the concrete classes. BUG=pdfium:468 Review URL: https://codereview.chromium.org/1897993002
Diffstat (limited to 'core/fpdftext/include/cpdf_textpagefind.h')
-rw-r--r--core/fpdftext/include/cpdf_textpagefind.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/core/fpdftext/include/cpdf_textpagefind.h b/core/fpdftext/include/cpdf_textpagefind.h
new file mode 100644
index 0000000000..ec739e4896
--- /dev/null
+++ b/core/fpdftext/include/cpdf_textpagefind.h
@@ -0,0 +1,65 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FPDFTEXT_INCLUDE_CPDF_TEXTPAGEFIND_H_
+#define CORE_FPDFTEXT_INCLUDE_CPDF_TEXTPAGEFIND_H_
+
+#include <vector>
+
+#include "core/fxcrt/include/fx_coordinates.h"
+#include "core/fxcrt/include/fx_string.h"
+#include "core/fxcrt/include/fx_system.h"
+
+class CPDF_TextPage;
+
+class CPDF_TextPageFind {
+ public:
+ explicit CPDF_TextPageFind(const CPDF_TextPage* pTextPage);
+ ~CPDF_TextPageFind() {}
+
+ FX_BOOL FindFirst(const CFX_WideString& findwhat,
+ int flags,
+ int startPos = 0);
+ FX_BOOL FindNext();
+ FX_BOOL FindPrev();
+ void GetRectArray(CFX_RectArray& rects) const;
+ int GetCurOrder() const;
+ int GetMatchedCount() const;
+
+ protected:
+ void ExtractFindWhat(const CFX_WideString& findwhat);
+ FX_BOOL IsMatchWholeWord(const CFX_WideString& csPageText,
+ int startPos,
+ int endPos);
+ FX_BOOL ExtractSubString(CFX_WideString& rString,
+ const FX_WCHAR* lpszFullString,
+ int iSubString,
+ FX_WCHAR chSep);
+ CFX_WideString MakeReverse(const CFX_WideString& str);
+ int ReverseFind(const CFX_WideString& csPageText,
+ const CFX_WideString& csWord,
+ int nStartPos,
+ int& WordLength);
+ int GetCharIndex(int index) const;
+
+ private:
+ std::vector<uint16_t> m_CharIndex;
+ const CPDF_TextPage* m_pTextPage;
+ CFX_WideString m_strText;
+ CFX_WideString m_findWhat;
+ int m_flags;
+ std::vector<CFX_WideString> m_csFindWhatArray;
+ int m_findNextStart;
+ int m_findPreStart;
+ FX_BOOL m_bMatchCase;
+ FX_BOOL m_bMatchWholeWord;
+ int m_resStart;
+ int m_resEnd;
+ CFX_RectArray m_resArray;
+ FX_BOOL m_IsFind;
+};
+
+#endif // CORE_FPDFTEXT_INCLUDE_CPDF_TEXTPAGEFIND_H_