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_IPDF_TEXTPAGE_H_ | |
8 #define CORE_FPDFTEXT_INCLUDE_IPDF_TEXTPAGE_H_ | |
9 | |
10 #include "core/fxcrt/include/fx_coordinates.h" | |
11 #include "core/fxcrt/include/fx_system.h" | |
12 | |
13 class CPDF_TextObject; | |
14 class CPDF_Page; | |
15 | |
16 struct FPDF_CHAR_INFO { | |
17 FX_WCHAR m_Unicode; | |
18 FX_WCHAR m_Charcode; | |
19 int32_t m_Flag; | |
20 FX_FLOAT m_FontSize; | |
21 FX_FLOAT m_OriginX; | |
22 FX_FLOAT m_OriginY; | |
23 CFX_FloatRect m_CharBox; | |
24 CPDF_TextObject* m_pTextObj; | |
25 CFX_Matrix m_Matrix; | |
26 }; | |
27 | |
28 class IPDF_TextPage { | |
29 public: | |
30 static IPDF_TextPage* CreateTextPage(const CPDF_Page* pPage, int flags = 0); | |
31 virtual ~IPDF_TextPage() {} | |
32 | |
33 virtual void ParseTextPage() = 0; | |
34 virtual bool IsParsed() const = 0; | |
35 virtual int CharIndexFromTextIndex(int TextIndex) const = 0; | |
36 virtual int TextIndexFromCharIndex(int CharIndex) const = 0; | |
37 virtual int CountChars() const = 0; | |
38 virtual void GetCharInfo(int index, FPDF_CHAR_INFO* info) const = 0; | |
39 virtual void GetRectArray(int start, | |
40 int nCount, | |
41 CFX_RectArray& rectArray) const = 0; | |
42 virtual int GetIndexAtPos(CFX_FloatPoint point, | |
43 FX_FLOAT xTolerance, | |
44 FX_FLOAT yTolerance) const = 0; | |
45 virtual int GetIndexAtPos(FX_FLOAT x, | |
46 FX_FLOAT y, | |
47 FX_FLOAT xTolerance, | |
48 FX_FLOAT yTolerance) const = 0; | |
49 virtual CFX_WideString GetTextByRect(const CFX_FloatRect& rect) const = 0; | |
50 virtual void GetRectsArrayByRect(const CFX_FloatRect& rect, | |
51 CFX_RectArray& resRectArray) const = 0; | |
52 virtual int CountRects(int start, int nCount) = 0; | |
53 virtual void GetRect(int rectIndex, | |
54 FX_FLOAT& left, | |
55 FX_FLOAT& top, | |
56 FX_FLOAT& right, | |
57 FX_FLOAT& bottom) const = 0; | |
58 virtual FX_BOOL GetBaselineRotate(int rectIndex, int& Rotate) = 0; | |
59 virtual FX_BOOL GetBaselineRotate(const CFX_FloatRect& rect, int& Rotate) = 0; | |
60 virtual int CountBoundedSegments(FX_FLOAT left, | |
61 FX_FLOAT top, | |
62 FX_FLOAT right, | |
63 FX_FLOAT bottom, | |
64 FX_BOOL bContains = FALSE) = 0; | |
65 virtual void GetBoundedSegment(int index, int& start, int& count) const = 0; | |
66 virtual int GetWordBreak(int index, int direction) const = 0; | |
67 virtual CFX_WideString GetPageText(int start = 0, int nCount = -1) const = 0; | |
68 }; | |
69 | |
70 #endif // CORE_FPDFTEXT_INCLUDE_IPDF_TEXTPAGE_H_ | |
OLD | NEW |