| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 } FPDF_SEGMENT; | 44 } FPDF_SEGMENT; |
| 45 typedef CFX_ArrayTemplate<FPDF_SEGMENT> SEGMENT_Array; | 45 typedef CFX_ArrayTemplate<FPDF_SEGMENT> SEGMENT_Array; |
| 46 typedef struct { | 46 typedef struct { |
| 47 CPDF_TextObject* m_pTextObj; | 47 CPDF_TextObject* m_pTextObj; |
| 48 CFX_AffineMatrix m_formMatrix; | 48 CFX_AffineMatrix m_formMatrix; |
| 49 } PDFTEXT_Obj; | 49 } PDFTEXT_Obj; |
| 50 typedef CFX_ArrayTemplate<PDFTEXT_Obj> LINEOBJ; | 50 typedef CFX_ArrayTemplate<PDFTEXT_Obj> LINEOBJ; |
| 51 | 51 |
| 52 class CPDF_TextPage : public IPDF_TextPage { | 52 class CPDF_TextPage : public IPDF_TextPage { |
| 53 public: | 53 public: |
| 54 CPDF_TextPage(const CPDF_Page* pPage, int flags = 0); | 54 CPDF_TextPage(const CPDF_Page* pPage, int flags); |
| 55 CPDF_TextPage(const CPDF_PageObjects* pPage, int flags = 0); | |
| 56 CPDF_TextPage(const CPDF_Page* pPage, CPDFText_ParseOptions ParserOptions); | |
| 57 ~CPDF_TextPage() override {} | 55 ~CPDF_TextPage() override {} |
| 58 | 56 |
| 59 // IPDF_TextPage | 57 // IPDF_TextPage |
| 60 FX_BOOL ParseTextPage() override; | 58 FX_BOOL ParseTextPage() override; |
| 61 void NormalizeObjects(FX_BOOL bNormalize) override; | 59 void NormalizeObjects(FX_BOOL bNormalize) override; |
| 62 FX_BOOL IsParsered() const override { return m_IsParsered; } | 60 bool IsParsed() const override { return m_bIsParsed; } |
| 63 int CharIndexFromTextIndex(int TextIndex) const override; | 61 int CharIndexFromTextIndex(int TextIndex) const override; |
| 64 int TextIndexFromCharIndex(int CharIndex) const override; | 62 int TextIndexFromCharIndex(int CharIndex) const override; |
| 65 int CountChars() const override; | 63 int CountChars() const override; |
| 66 void GetCharInfo(int index, FPDF_CHAR_INFO& info) const override; | 64 void GetCharInfo(int index, FPDF_CHAR_INFO& info) const override; |
| 67 void GetRectArray(int start, | 65 void GetRectArray(int start, |
| 68 int nCount, | 66 int nCount, |
| 69 CFX_RectArray& rectArray) const override; | 67 CFX_RectArray& rectArray) const override; |
| 70 int GetIndexAtPos(CPDF_Point point, | 68 int GetIndexAtPos(CPDF_Point point, |
| 71 FX_FLOAT xTolerance, | 69 FX_FLOAT xTolerance, |
| 72 FX_FLOAT yTolerance) const override; | 70 FX_FLOAT yTolerance) const override; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 void FindPreviousTextObject(void); | 123 void FindPreviousTextObject(void); |
| 126 void AddCharInfoByLRDirection(CFX_WideString& str, int i); | 124 void AddCharInfoByLRDirection(CFX_WideString& str, int i); |
| 127 void AddCharInfoByRLDirection(CFX_WideString& str, int i); | 125 void AddCharInfoByRLDirection(CFX_WideString& str, int i); |
| 128 int32_t GetTextObjectWritingMode(const CPDF_TextObject* pTextObj); | 126 int32_t GetTextObjectWritingMode(const CPDF_TextObject* pTextObj); |
| 129 int32_t FindTextlineFlowDirection(); | 127 int32_t FindTextlineFlowDirection(); |
| 130 void SwapTempTextBuf(int32_t iCharListStartAppend, int32_t iBufStartAppend); | 128 void SwapTempTextBuf(int32_t iCharListStartAppend, int32_t iBufStartAppend); |
| 131 FX_BOOL IsRightToLeft(const CPDF_TextObject* pTextObj, | 129 FX_BOOL IsRightToLeft(const CPDF_TextObject* pTextObj, |
| 132 const CPDF_Font* pFont, | 130 const CPDF_Font* pFont, |
| 133 int nItems) const; | 131 int nItems) const; |
| 134 | 132 |
| 135 protected: | |
| 136 CPDFText_ParseOptions m_ParseOptions; | 133 CPDFText_ParseOptions m_ParseOptions; |
| 137 CFX_WordArray m_CharIndex; | 134 CFX_WordArray m_CharIndex; |
| 138 const CPDF_PageObjects* m_pPage; | 135 const CPDF_PageObjects* const m_pPage; |
| 139 PAGECHAR_InfoArray m_charList; | 136 PAGECHAR_InfoArray m_charList; |
| 140 CFX_WideTextBuf m_TextBuf; | 137 CFX_WideTextBuf m_TextBuf; |
| 141 PAGECHAR_InfoArray m_TempCharList; | 138 PAGECHAR_InfoArray m_TempCharList; |
| 142 CFX_WideTextBuf m_TempTextBuf; | 139 CFX_WideTextBuf m_TempTextBuf; |
| 143 int m_parserflag; | 140 const int m_parserflag; |
| 144 CPDF_TextObject* m_pPreTextObj; | 141 CPDF_TextObject* m_pPreTextObj; |
| 145 CFX_AffineMatrix m_perMatrix; | 142 CFX_AffineMatrix m_perMatrix; |
| 146 FX_BOOL m_IsParsered; | 143 bool m_bIsParsed; |
| 147 CFX_AffineMatrix m_DisplayMatrix; | 144 CFX_AffineMatrix m_DisplayMatrix; |
| 148 | |
| 149 SEGMENT_Array m_Segment; | 145 SEGMENT_Array m_Segment; |
| 150 CFX_RectArray m_SelRects; | 146 CFX_RectArray m_SelRects; |
| 151 LINEOBJ m_LineObj; | 147 LINEOBJ m_LineObj; |
| 152 int32_t m_TextlineDir; | 148 int32_t m_TextlineDir; |
| 153 CFX_FloatRect m_CurlineRect; | 149 CFX_FloatRect m_CurlineRect; |
| 154 }; | 150 }; |
| 155 | 151 |
| 156 class CPDF_TextPageFind : public IPDF_TextPageFind { | 152 class CPDF_TextPageFind : public IPDF_TextPageFind { |
| 157 public: | 153 public: |
| 158 CPDF_TextPageFind(const IPDF_TextPage* pTextPage); | 154 explicit CPDF_TextPageFind(const IPDF_TextPage* pTextPage); |
| 159 ~CPDF_TextPageFind() override {} | 155 ~CPDF_TextPageFind() override {} |
| 160 | 156 |
| 161 // IPDF_TextPageFind | 157 // IPDF_TextPageFind |
| 162 FX_BOOL FindFirst(const CFX_WideString& findwhat, | 158 FX_BOOL FindFirst(const CFX_WideString& findwhat, |
| 163 int flags, | 159 int flags, |
| 164 int startPos = 0) override; | 160 int startPos = 0) override; |
| 165 FX_BOOL FindNext() override; | 161 FX_BOOL FindNext() override; |
| 166 FX_BOOL FindPrev() override; | 162 FX_BOOL FindPrev() override; |
| 167 void GetRectArray(CFX_RectArray& rects) const override; | 163 void GetRectArray(CFX_RectArray& rects) const override; |
| 168 int GetCurOrder() const override; | 164 int GetCurOrder() const override; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 193 CFX_WideStringArray m_csFindWhatArray; | 189 CFX_WideStringArray m_csFindWhatArray; |
| 194 int m_findNextStart; | 190 int m_findNextStart; |
| 195 int m_findPreStart; | 191 int m_findPreStart; |
| 196 FX_BOOL m_bMatchCase; | 192 FX_BOOL m_bMatchCase; |
| 197 FX_BOOL m_bMatchWholeWord; | 193 FX_BOOL m_bMatchWholeWord; |
| 198 int m_resStart; | 194 int m_resStart; |
| 199 int m_resEnd; | 195 int m_resEnd; |
| 200 CFX_RectArray m_resArray; | 196 CFX_RectArray m_resArray; |
| 201 FX_BOOL m_IsFind; | 197 FX_BOOL m_IsFind; |
| 202 }; | 198 }; |
| 199 |
| 203 class CPDF_LinkExt { | 200 class CPDF_LinkExt { |
| 204 public: | 201 public: |
| 205 CPDF_LinkExt() {} | 202 CPDF_LinkExt() {} |
| 206 int m_Start; | 203 int m_Start; |
| 207 int m_Count; | 204 int m_Count; |
| 208 CFX_WideString m_strUrl; | 205 CFX_WideString m_strUrl; |
| 209 virtual ~CPDF_LinkExt() {} | 206 virtual ~CPDF_LinkExt() {} |
| 210 }; | 207 }; |
| 211 | 208 |
| 212 typedef CFX_ArrayTemplate<CPDF_LinkExt*> LINK_InfoArray; | 209 typedef CFX_ArrayTemplate<CPDF_LinkExt*> LINK_InfoArray; |
| 213 | 210 |
| 214 class CPDF_LinkExtract : public IPDF_LinkExtract { | 211 class CPDF_LinkExtract : public IPDF_LinkExtract { |
| 215 public: | 212 public: |
| 216 CPDF_LinkExtract(); | 213 CPDF_LinkExtract(); |
| 217 ~CPDF_LinkExtract() override; | 214 ~CPDF_LinkExtract() override; |
| 218 | 215 |
| 219 // IPDF_LinkExtract | 216 // IPDF_LinkExtract |
| 220 FX_BOOL ExtractLinks(const IPDF_TextPage* pTextPage) override; | 217 FX_BOOL ExtractLinks(const IPDF_TextPage* pTextPage) override; |
| 221 int CountLinks() const override; | 218 int CountLinks() const override; |
| 222 CFX_WideString GetURL(int index) const override; | 219 CFX_WideString GetURL(int index) const override; |
| 223 void GetBoundedSegment(int index, int& start, int& count) const override; | 220 void GetBoundedSegment(int index, int& start, int& count) const override; |
| 224 void GetRects(int index, CFX_RectArray& rects) const override; | 221 void GetRects(int index, CFX_RectArray& rects) const override; |
| 225 | 222 |
| 226 FX_BOOL IsExtract() const { return m_IsParserd; } | 223 FX_BOOL IsExtract() const { return m_bIsParsed; } |
| 227 | 224 |
| 228 protected: | 225 protected: |
| 229 void parserLink(); | 226 void ParseLink(); |
| 230 void DeleteLinkList(); | 227 void DeleteLinkList(); |
| 231 FX_BOOL CheckWebLink(CFX_WideString& strBeCheck); | 228 FX_BOOL CheckWebLink(CFX_WideString& strBeCheck); |
| 232 FX_BOOL CheckMailLink(CFX_WideString& str); | 229 FX_BOOL CheckMailLink(CFX_WideString& str); |
| 233 FX_BOOL AppendToLinkList(int start, int count, const CFX_WideString& strUrl); | 230 FX_BOOL AppendToLinkList(int start, int count, const CFX_WideString& strUrl); |
| 234 | 231 |
| 235 private: | 232 private: |
| 236 LINK_InfoArray m_LinkList; | 233 LINK_InfoArray m_LinkList; |
| 237 const CPDF_TextPage* m_pTextPage; | 234 const CPDF_TextPage* m_pTextPage; |
| 238 CFX_WideString m_strPageText; | 235 CFX_WideString m_strPageText; |
| 239 FX_BOOL m_IsParserd; | 236 bool m_bIsParsed; |
| 240 }; | 237 }; |
| 241 | 238 |
| 242 FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst); | 239 FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst); |
| 243 void NormalizeString(CFX_WideString& str); | 240 void NormalizeString(CFX_WideString& str); |
| 244 void NormalizeCompositeChar(FX_WCHAR wChar, CFX_WideString& sDest); | 241 void NormalizeCompositeChar(FX_WCHAR wChar, CFX_WideString& sDest); |
| 245 void GetTextStream_Unicode(CFX_WideTextBuf& buffer, | 242 void GetTextStream_Unicode(CFX_WideTextBuf& buffer, |
| 246 CPDF_PageObjects* pPage, | 243 CPDF_PageObjects* pPage, |
| 247 FX_BOOL bUseLF, | 244 FX_BOOL bUseLF, |
| 248 CFX_PtrArray* pObjArray); | 245 CFX_PtrArray* pObjArray); |
| 249 | 246 |
| 250 #endif // CORE_SRC_FPDFTEXT_TEXT_INT_H_ | 247 #endif // CORE_SRC_FPDFTEXT_TEXT_INT_H_ |
| OLD | NEW |