OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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_SRC_FPDFTEXT_TEXT_INT_H_ | 7 #ifndef CORE_SRC_FPDFTEXT_TEXT_INT_H_ |
8 #define CORE_SRC_FPDFTEXT_TEXT_INT_H_ | 8 #define CORE_SRC_FPDFTEXT_TEXT_INT_H_ |
9 | 9 |
10 #include "../../include/fpdftext/fpdf_text.h" | 10 #include "../../include/fpdftext/fpdf_text.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 class CPDF_TextPage : public IPDF_TextPage { | 53 class CPDF_TextPage : public IPDF_TextPage { |
54 public: | 54 public: |
55 CPDF_TextPage(const CPDF_Page* pPage, int flags = 0); | 55 CPDF_TextPage(const CPDF_Page* pPage, int flags = 0); |
56 CPDF_TextPage(const CPDF_PageObjects* pPage, int flags = 0); | 56 CPDF_TextPage(const CPDF_PageObjects* pPage, int flags = 0); |
57 CPDF_TextPage(const CPDF_Page* pPage, CPDFText_ParseOptions ParserOptions); | 57 CPDF_TextPage(const CPDF_Page* pPage, CPDFText_ParseOptions ParserOptions); |
58 ~CPDF_TextPage() override {} | 58 ~CPDF_TextPage() override {} |
59 | 59 |
60 // IPDF_TextPage | 60 // IPDF_TextPage |
61 FX_BOOL ParseTextPage() override; | 61 FX_BOOL ParseTextPage() override; |
62 void NormalizeObjects(FX_BOOL bNormalize) override; | 62 void NormalizeObjects(FX_BOOL bNormalize) override; |
63 bool IsParsed() const override { return m_IsParsered; } | 63 bool IsParsed() const override { return m_bIsParsed; } |
64 int CharIndexFromTextIndex(int TextIndex) const override; | 64 int CharIndexFromTextIndex(int TextIndex) const override; |
65 int TextIndexFromCharIndex(int CharIndex) const override; | 65 int TextIndexFromCharIndex(int CharIndex) const override; |
66 int CountChars() const override; | 66 int CountChars() const override; |
67 void GetCharInfo(int index, FPDF_CHAR_INFO& info) const override; | 67 void GetCharInfo(int index, FPDF_CHAR_INFO& info) const override; |
68 void GetRectArray(int start, | 68 void GetRectArray(int start, |
69 int nCount, | 69 int nCount, |
70 CFX_RectArray& rectArray) const override; | 70 CFX_RectArray& rectArray) const override; |
71 int GetIndexAtPos(CPDF_Point point, | 71 int GetIndexAtPos(CPDF_Point point, |
72 FX_FLOAT xTolerance, | 72 FX_FLOAT xTolerance, |
73 FX_FLOAT yTolerance) const override; | 73 FX_FLOAT yTolerance) const override; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 void OnPiece(IFX_BidiChar* pBidi, CFX_WideString& str); | 122 void OnPiece(IFX_BidiChar* pBidi, CFX_WideString& str); |
123 int32_t PreMarkedContent(PDFTEXT_Obj pObj); | 123 int32_t PreMarkedContent(PDFTEXT_Obj pObj); |
124 void ProcessMarkedContent(PDFTEXT_Obj pObj); | 124 void ProcessMarkedContent(PDFTEXT_Obj pObj); |
125 void CheckMarkedContentObject(int32_t& start, int32_t& nCount) const; | 125 void CheckMarkedContentObject(int32_t& start, int32_t& nCount) const; |
126 void FindPreviousTextObject(void); | 126 void FindPreviousTextObject(void); |
127 void AddCharInfoByLRDirection(CFX_WideString& str, int i); | 127 void AddCharInfoByLRDirection(CFX_WideString& str, int i); |
128 void AddCharInfoByRLDirection(CFX_WideString& str, int i); | 128 void AddCharInfoByRLDirection(CFX_WideString& str, int i); |
129 int32_t GetTextObjectWritingMode(const CPDF_TextObject* pTextObj); | 129 int32_t GetTextObjectWritingMode(const CPDF_TextObject* pTextObj); |
130 int32_t FindTextlineFlowDirection(); | 130 int32_t FindTextlineFlowDirection(); |
131 | 131 |
132 protected: | |
133 CPDFText_ParseOptions m_ParseOptions; | 132 CPDFText_ParseOptions m_ParseOptions; |
134 CFX_WordArray m_CharIndex; | 133 CFX_WordArray m_CharIndex; |
135 const CPDF_PageObjects* m_pPage; | 134 const CPDF_PageObjects* const m_pPage; |
136 PAGECHAR_InfoArray m_charList; | 135 PAGECHAR_InfoArray m_charList; |
137 CFX_WideTextBuf m_TextBuf; | 136 CFX_WideTextBuf m_TextBuf; |
138 PAGECHAR_InfoArray m_TempCharList; | 137 PAGECHAR_InfoArray m_TempCharList; |
139 CFX_WideTextBuf m_TempTextBuf; | 138 CFX_WideTextBuf m_TempTextBuf; |
140 int m_parserflag; | 139 const int m_parserflag; |
141 CPDF_TextObject* m_pPreTextObj; | 140 CPDF_TextObject* m_pPreTextObj; |
142 CFX_AffineMatrix m_perMatrix; | 141 CFX_AffineMatrix m_perMatrix; |
143 FX_BOOL m_IsParsered; | 142 bool m_bIsParsed; |
144 CFX_AffineMatrix m_DisplayMatrix; | 143 CFX_AffineMatrix m_DisplayMatrix; |
145 | |
146 SEGMENT_Array m_Segment; | 144 SEGMENT_Array m_Segment; |
147 CFX_RectArray m_SelRects; | 145 CFX_RectArray m_SelRects; |
148 LINEOBJ m_LineObj; | 146 LINEOBJ m_LineObj; |
149 int32_t m_TextlineDir; | 147 int32_t m_TextlineDir; |
150 CFX_FloatRect m_CurlineRect; | 148 CFX_FloatRect m_CurlineRect; |
151 }; | 149 }; |
152 | 150 |
153 class CPDF_TextPageFind : public IPDF_TextPageFind { | 151 class CPDF_TextPageFind : public IPDF_TextPageFind { |
154 public: | 152 public: |
155 CPDF_TextPageFind(const IPDF_TextPage* pTextPage); | 153 explicit CPDF_TextPageFind(const IPDF_TextPage* pTextPage); |
156 ~CPDF_TextPageFind() override {} | 154 ~CPDF_TextPageFind() override {} |
157 | 155 |
158 // IPDF_TextPageFind | 156 // IPDF_TextPageFind |
159 FX_BOOL FindFirst(const CFX_WideString& findwhat, | 157 FX_BOOL FindFirst(const CFX_WideString& findwhat, |
160 int flags, | 158 int flags, |
161 int startPos = 0) override; | 159 int startPos = 0) override; |
162 FX_BOOL FindNext() override; | 160 FX_BOOL FindNext() override; |
163 FX_BOOL FindPrev() override; | 161 FX_BOOL FindPrev() override; |
164 void GetRectArray(CFX_RectArray& rects) const override; | 162 void GetRectArray(CFX_RectArray& rects) const override; |
165 int GetCurOrder() const override; | 163 int GetCurOrder() const override; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 CPDF_LinkExtract(); | 211 CPDF_LinkExtract(); |
214 ~CPDF_LinkExtract() override; | 212 ~CPDF_LinkExtract() override; |
215 | 213 |
216 // IPDF_LinkExtract | 214 // IPDF_LinkExtract |
217 FX_BOOL ExtractLinks(const IPDF_TextPage* pTextPage) override; | 215 FX_BOOL ExtractLinks(const IPDF_TextPage* pTextPage) override; |
218 int CountLinks() const override; | 216 int CountLinks() const override; |
219 CFX_WideString GetURL(int index) const override; | 217 CFX_WideString GetURL(int index) const override; |
220 void GetBoundedSegment(int index, int& start, int& count) const override; | 218 void GetBoundedSegment(int index, int& start, int& count) const override; |
221 void GetRects(int index, CFX_RectArray& rects) const override; | 219 void GetRects(int index, CFX_RectArray& rects) const override; |
222 | 220 |
223 FX_BOOL IsExtract() const { return m_IsParserd; } | 221 FX_BOOL IsExtract() const { return m_bIsParsed; } |
224 | 222 |
225 protected: | 223 protected: |
226 void parserLink(); | 224 void ParseLink(); |
227 void DeleteLinkList(); | 225 void DeleteLinkList(); |
228 FX_BOOL CheckWebLink(CFX_WideString& strBeCheck); | 226 FX_BOOL CheckWebLink(CFX_WideString& strBeCheck); |
229 FX_BOOL CheckMailLink(CFX_WideString& str); | 227 FX_BOOL CheckMailLink(CFX_WideString& str); |
230 void AppendToLinkList(int start, int count, const CFX_WideString& strUrl); | 228 void AppendToLinkList(int start, int count, const CFX_WideString& strUrl); |
231 | 229 |
232 private: | 230 private: |
233 LINK_InfoArray m_LinkList; | 231 LINK_InfoArray m_LinkList; |
234 const CPDF_TextPage* m_pTextPage; | 232 const CPDF_TextPage* m_pTextPage; |
235 CFX_WideString m_strPageText; | 233 CFX_WideString m_strPageText; |
236 FX_BOOL m_IsParserd; | 234 bool m_bIsParsed; |
237 }; | 235 }; |
238 | 236 |
239 FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst); | 237 FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst); |
240 void NormalizeString(CFX_WideString& str); | 238 void NormalizeString(CFX_WideString& str); |
241 void NormalizeCompositeChar(FX_WCHAR wChar, CFX_WideString& sDest); | 239 void NormalizeCompositeChar(FX_WCHAR wChar, CFX_WideString& sDest); |
242 void GetTextStream_Unicode(CFX_WideTextBuf& buffer, | 240 void GetTextStream_Unicode(CFX_WideTextBuf& buffer, |
243 CPDF_PageObjects* pPage, | 241 CPDF_PageObjects* pPage, |
244 FX_BOOL bUseLF, | 242 FX_BOOL bUseLF, |
245 CFX_PtrArray* pObjArray); | 243 CFX_PtrArray* pObjArray); |
246 | 244 |
247 #endif // CORE_SRC_FPDFTEXT_TEXT_INT_H_ | 245 #endif // CORE_SRC_FPDFTEXT_TEXT_INT_H_ |
OLD | NEW |