Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: core/src/fpdftext/text_int.h

Issue 1618273004: Remove CFX_SegmentedArray use from master (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Nits. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fpdftext/fpdf_text_int.cpp ('k') | core/src/fxcrt/fx_basic_array.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 19 matching lines...) Expand all
124 void AddCharInfoByRLDirection(CFX_WideString& str, int i); 124 void AddCharInfoByRLDirection(CFX_WideString& str, int i);
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 void SwapTempTextBuf(int32_t iCharListStartAppend, int32_t iBufStartAppend); 127 void SwapTempTextBuf(int32_t iCharListStartAppend, int32_t iBufStartAppend);
128 FX_BOOL IsRightToLeft(const CPDF_TextObject* pTextObj, 128 FX_BOOL IsRightToLeft(const CPDF_TextObject* pTextObj,
129 const CPDF_Font* pFont, 129 const CPDF_Font* pFont,
130 int nItems) const; 130 int nItems) const;
131 131
132 CFX_WordArray m_CharIndex; 132 CFX_WordArray m_CharIndex;
133 const CPDF_PageObjectList* const m_pPage; 133 const CPDF_PageObjectList* const m_pPage;
134 PAGECHAR_InfoArray m_charList; 134 std::deque<PAGECHAR_INFO> m_CharList;
135 std::deque<PAGECHAR_INFO> m_TempCharList;
135 CFX_WideTextBuf m_TextBuf; 136 CFX_WideTextBuf m_TextBuf;
136 PAGECHAR_InfoArray m_TempCharList;
137 CFX_WideTextBuf m_TempTextBuf; 137 CFX_WideTextBuf m_TempTextBuf;
138 const int m_parserflag; 138 const int m_parserflag;
139 CPDF_TextObject* m_pPreTextObj; 139 CPDF_TextObject* m_pPreTextObj;
140 CFX_Matrix m_perMatrix; 140 CFX_Matrix m_perMatrix;
141 bool m_bIsParsed; 141 bool m_bIsParsed;
142 CFX_Matrix m_DisplayMatrix; 142 CFX_Matrix m_DisplayMatrix;
143 SEGMENT_Array m_Segment; 143 CFX_ArrayTemplate<FPDF_SEGMENT> m_Segments;
144 CFX_RectArray m_SelRects; 144 CFX_RectArray m_SelRects;
145 LINEOBJ m_LineObj; 145 CFX_ArrayTemplate<PDFTEXT_Obj> m_LineObj;
146 int32_t m_TextlineDir; 146 int32_t m_TextlineDir;
147 CFX_FloatRect m_CurlineRect; 147 CFX_FloatRect m_CurlineRect;
148 }; 148 };
149 149
150 class CPDF_TextPageFind : public IPDF_TextPageFind { 150 class CPDF_TextPageFind : public IPDF_TextPageFind {
151 public: 151 public:
152 explicit CPDF_TextPageFind(const IPDF_TextPage* pTextPage); 152 explicit CPDF_TextPageFind(const IPDF_TextPage* pTextPage);
153 ~CPDF_TextPageFind() override {} 153 ~CPDF_TextPageFind() override {}
154 154
155 // IPDF_TextPageFind 155 // IPDF_TextPageFind
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst); 237 FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst);
238 void NormalizeString(CFX_WideString& str); 238 void NormalizeString(CFX_WideString& str);
239 void NormalizeCompositeChar(FX_WCHAR wChar, CFX_WideString& sDest); 239 void NormalizeCompositeChar(FX_WCHAR wChar, CFX_WideString& sDest);
240 void GetTextStream_Unicode(CFX_WideTextBuf& buffer, 240 void GetTextStream_Unicode(CFX_WideTextBuf& buffer,
241 CPDF_PageObjectList* pPage, 241 CPDF_PageObjectList* pPage,
242 FX_BOOL bUseLF, 242 FX_BOOL bUseLF,
243 CFX_PtrArray* pObjArray); 243 CFX_PtrArray* pObjArray);
244 244
245 #endif // CORE_SRC_FPDFTEXT_TEXT_INT_H_ 245 #endif // CORE_SRC_FPDFTEXT_TEXT_INT_H_
OLDNEW
« no previous file with comments | « core/src/fpdftext/fpdf_text_int.cpp ('k') | core/src/fxcrt/fx_basic_array.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698