| 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 <deque> |
| 11 |
| 10 #include "core/include/fpdftext/fpdf_text.h" | 12 #include "core/include/fpdftext/fpdf_text.h" |
| 11 #include "core/include/fxcrt/fx_basic.h" | 13 #include "core/include/fxcrt/fx_basic.h" |
| 12 | 14 |
| 13 class CFX_BidiChar; | 15 class CFX_BidiChar; |
| 14 class CPDF_DocProgressiveSearch; | 16 class CPDF_DocProgressiveSearch; |
| 15 class CPDF_FormObject; | 17 class CPDF_FormObject; |
| 16 class CPDF_LinkExtract; | 18 class CPDF_LinkExtract; |
| 17 class CPDF_TextPageFind; | 19 class CPDF_TextPageFind; |
| 18 | 20 |
| 19 #define FPDFTEXT_CHAR_ERROR -1 | 21 #define FPDFTEXT_CHAR_ERROR -1 |
| 20 #define FPDFTEXT_CHAR_NORMAL 0 | 22 #define FPDFTEXT_CHAR_NORMAL 0 |
| 21 #define FPDFTEXT_CHAR_GENERATED 1 | 23 #define FPDFTEXT_CHAR_GENERATED 1 |
| 22 #define FPDFTEXT_CHAR_UNUNICODE 2 | 24 #define FPDFTEXT_CHAR_UNUNICODE 2 |
| 23 #define FPDFTEXT_CHAR_HYPHEN 3 | 25 #define FPDFTEXT_CHAR_HYPHEN 3 |
| 24 #define FPDFTEXT_CHAR_PIECE 4 | 26 #define FPDFTEXT_CHAR_PIECE 4 |
| 25 #define FPDFTEXT_MC_PASS 0 | 27 #define FPDFTEXT_MC_PASS 0 |
| 26 #define FPDFTEXT_MC_DONE 1 | 28 #define FPDFTEXT_MC_DONE 1 |
| 27 #define FPDFTEXT_MC_DELAY 2 | 29 #define FPDFTEXT_MC_DELAY 2 |
| 28 | 30 |
| 29 typedef struct _PAGECHAR_INFO { | 31 struct PAGECHAR_INFO { |
| 30 int m_CharCode; | 32 int m_CharCode; |
| 31 FX_WCHAR m_Unicode; | 33 FX_WCHAR m_Unicode; |
| 32 FX_FLOAT m_OriginX; | 34 FX_FLOAT m_OriginX; |
| 33 FX_FLOAT m_OriginY; | 35 FX_FLOAT m_OriginY; |
| 34 int32_t m_Flag; | 36 int32_t m_Flag; |
| 35 CFX_FloatRect m_CharBox; | 37 CFX_FloatRect m_CharBox; |
| 36 CPDF_TextObject* m_pTextObj; | 38 CPDF_TextObject* m_pTextObj; |
| 37 CFX_Matrix m_Matrix; | 39 CFX_Matrix m_Matrix; |
| 38 int m_Index; | 40 int m_Index; |
| 39 } PAGECHAR_INFO; | 41 }; |
| 40 typedef CFX_SegmentedArray<PAGECHAR_INFO> PAGECHAR_InfoArray; | 42 |
| 41 typedef struct { | 43 struct FPDF_SEGMENT { |
| 42 int m_Start; | 44 int m_Start; |
| 43 int m_nCount; | 45 int m_nCount; |
| 44 } FPDF_SEGMENT; | 46 }; |
| 45 typedef CFX_ArrayTemplate<FPDF_SEGMENT> SEGMENT_Array; | 47 |
| 46 typedef struct { | 48 struct PDFTEXT_Obj { |
| 47 CPDF_TextObject* m_pTextObj; | 49 CPDF_TextObject* m_pTextObj; |
| 48 CFX_Matrix m_formMatrix; | 50 CFX_Matrix m_formMatrix; |
| 49 } PDFTEXT_Obj; | 51 }; |
| 50 typedef CFX_ArrayTemplate<PDFTEXT_Obj> LINEOBJ; | |
| 51 | 52 |
| 52 class CPDF_TextPage : public IPDF_TextPage { | 53 class CPDF_TextPage : public IPDF_TextPage { |
| 53 public: | 54 public: |
| 54 CPDF_TextPage(const CPDF_Page* pPage, int flags); | 55 CPDF_TextPage(const CPDF_Page* pPage, int flags); |
| 55 ~CPDF_TextPage() override {} | 56 ~CPDF_TextPage() override {} |
| 56 | 57 |
| 57 // IPDF_TextPage: | 58 // IPDF_TextPage: |
| 58 FX_BOOL ParseTextPage() override; | 59 FX_BOOL ParseTextPage() override; |
| 59 bool IsParsed() const override { return m_bIsParsed; } | 60 bool IsParsed() const override { return m_bIsParsed; } |
| 60 int CharIndexFromTextIndex(int TextIndex) const override; | 61 int CharIndexFromTextIndex(int TextIndex) const override; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 84 FX_BOOL GetBaselineRotate(int rectIndex, int& Rotate) override; | 85 FX_BOOL GetBaselineRotate(int rectIndex, int& Rotate) override; |
| 85 FX_BOOL GetBaselineRotate(const CFX_FloatRect& rect, int& Rotate) override; | 86 FX_BOOL GetBaselineRotate(const CFX_FloatRect& rect, int& Rotate) override; |
| 86 int CountBoundedSegments(FX_FLOAT left, | 87 int CountBoundedSegments(FX_FLOAT left, |
| 87 FX_FLOAT top, | 88 FX_FLOAT top, |
| 88 FX_FLOAT right, | 89 FX_FLOAT right, |
| 89 FX_FLOAT bottom, | 90 FX_FLOAT bottom, |
| 90 FX_BOOL bContains = FALSE) override; | 91 FX_BOOL bContains = FALSE) override; |
| 91 void GetBoundedSegment(int index, int& start, int& count) const override; | 92 void GetBoundedSegment(int index, int& start, int& count) const override; |
| 92 int GetWordBreak(int index, int direction) const override; | 93 int GetWordBreak(int index, int direction) const override; |
| 93 | 94 |
| 94 const PAGECHAR_InfoArray* GetCharList() const { return &m_charList; } | |
| 95 static FX_BOOL IsRectIntersect(const CFX_FloatRect& rect1, | 95 static FX_BOOL IsRectIntersect(const CFX_FloatRect& rect1, |
| 96 const CFX_FloatRect& rect2); | 96 const CFX_FloatRect& rect2); |
| 97 static FX_BOOL IsLetter(FX_WCHAR unicode); | 97 static FX_BOOL IsLetter(FX_WCHAR unicode); |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 FX_BOOL IsHyphen(FX_WCHAR curChar); | 100 FX_BOOL IsHyphen(FX_WCHAR curChar); |
| 101 bool IsControlChar(const PAGECHAR_INFO& charInfo); | 101 bool IsControlChar(const PAGECHAR_INFO& charInfo); |
| 102 FX_BOOL GetBaselineRotate(int start, int end, int& Rotate); | 102 FX_BOOL GetBaselineRotate(int start, int end, int& Rotate); |
| 103 void ProcessObject(); | 103 void ProcessObject(); |
| 104 void ProcessFormObject(CPDF_FormObject* pFormObj, | 104 void ProcessFormObject(CPDF_FormObject* pFormObj, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 125 int32_t GetTextObjectWritingMode(const CPDF_TextObject* pTextObj); | 125 int32_t GetTextObjectWritingMode(const CPDF_TextObject* pTextObj); |
| 126 int32_t FindTextlineFlowDirection(); | 126 int32_t FindTextlineFlowDirection(); |
| 127 | 127 |
| 128 void SwapTempTextBuf(int32_t iCharListStartAppend, int32_t iBufStartAppend); | 128 void SwapTempTextBuf(int32_t iCharListStartAppend, int32_t iBufStartAppend); |
| 129 FX_BOOL IsRightToLeft(const CPDF_TextObject* pTextObj, | 129 FX_BOOL IsRightToLeft(const CPDF_TextObject* pTextObj, |
| 130 const CPDF_Font* pFont, | 130 const CPDF_Font* pFont, |
| 131 int nItems) const; | 131 int nItems) const; |
| 132 | 132 |
| 133 CFX_WordArray m_CharIndex; | 133 CFX_WordArray m_CharIndex; |
| 134 const CPDF_PageObjectList* const m_pPage; | 134 const CPDF_PageObjectList* const m_pPage; |
| 135 PAGECHAR_InfoArray m_charList; | 135 std::deque<PAGECHAR_INFO> m_CharList; |
| 136 std::deque<PAGECHAR_INFO> m_TempCharList; |
| 136 CFX_WideTextBuf m_TextBuf; | 137 CFX_WideTextBuf m_TextBuf; |
| 137 PAGECHAR_InfoArray m_TempCharList; | |
| 138 CFX_WideTextBuf m_TempTextBuf; | 138 CFX_WideTextBuf m_TempTextBuf; |
| 139 const int m_parserflag; | 139 const int m_parserflag; |
| 140 CPDF_TextObject* m_pPreTextObj; | 140 CPDF_TextObject* m_pPreTextObj; |
| 141 CFX_Matrix m_perMatrix; | 141 CFX_Matrix m_perMatrix; |
| 142 bool m_bIsParsed; | 142 bool m_bIsParsed; |
| 143 CFX_Matrix m_DisplayMatrix; | 143 CFX_Matrix m_DisplayMatrix; |
| 144 SEGMENT_Array m_Segment; | 144 CFX_ArrayTemplate<FPDF_SEGMENT> m_Segments; |
| 145 CFX_RectArray m_SelRects; | 145 CFX_RectArray m_SelRects; |
| 146 LINEOBJ m_LineObj; | 146 CFX_ArrayTemplate<PDFTEXT_Obj> m_LineObj; |
| 147 int32_t m_TextlineDir; | 147 int32_t m_TextlineDir; |
| 148 CFX_FloatRect m_CurlineRect; | 148 CFX_FloatRect m_CurlineRect; |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 class CPDF_TextPageFind : public IPDF_TextPageFind { | 151 class CPDF_TextPageFind : public IPDF_TextPageFind { |
| 152 public: | 152 public: |
| 153 explicit CPDF_TextPageFind(const IPDF_TextPage* pTextPage); | 153 explicit CPDF_TextPageFind(const IPDF_TextPage* pTextPage); |
| 154 ~CPDF_TextPageFind() override {} | 154 ~CPDF_TextPageFind() override {} |
| 155 | 155 |
| 156 // IPDF_TextPageFind | 156 // IPDF_TextPageFind |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 237 |
| 238 FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst); | 238 FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst); |
| 239 void NormalizeString(CFX_WideString& str); | 239 void NormalizeString(CFX_WideString& str); |
| 240 void NormalizeCompositeChar(FX_WCHAR wChar, CFX_WideString& sDest); | 240 void NormalizeCompositeChar(FX_WCHAR wChar, CFX_WideString& sDest); |
| 241 void GetTextStream_Unicode(CFX_WideTextBuf& buffer, | 241 void GetTextStream_Unicode(CFX_WideTextBuf& buffer, |
| 242 CPDF_PageObjectList* pPage, | 242 CPDF_PageObjectList* pPage, |
| 243 FX_BOOL bUseLF, | 243 FX_BOOL bUseLF, |
| 244 CFX_PtrArray* pObjArray); | 244 CFX_PtrArray* pObjArray); |
| 245 | 245 |
| 246 #endif // CORE_SRC_FPDFTEXT_TEXT_INT_H_ | 246 #endif // CORE_SRC_FPDFTEXT_TEXT_INT_H_ |
| OLD | NEW |