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

Side by Side Diff: core/fpdftext/include/cpdf_textpage.h

Issue 1938163002: More define cleanup. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 7 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/fpdftext/fpdf_text_int.cpp ('k') | fpdfsdk/fpdftext.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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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_FPDFTEXT_INCLUDE_CPDF_TEXTPAGE_H_ 7 #ifndef CORE_FPDFTEXT_INCLUDE_CPDF_TEXTPAGE_H_
8 #define CORE_FPDFTEXT_INCLUDE_CPDF_TEXTPAGE_H_ 8 #define CORE_FPDFTEXT_INCLUDE_CPDF_TEXTPAGE_H_
9 9
10 #include <deque> 10 #include <deque>
11 #include <vector> 11 #include <vector>
12 12
13 #include "core/fpdfapi/fpdf_page/cpdf_pageobjectlist.h" 13 #include "core/fpdfapi/fpdf_page/cpdf_pageobjectlist.h"
14 #include "core/fxcrt/include/fx_basic.h" 14 #include "core/fxcrt/include/fx_basic.h"
15 #include "core/fxcrt/include/fx_coordinates.h" 15 #include "core/fxcrt/include/fx_coordinates.h"
16 #include "core/fxcrt/include/fx_string.h" 16 #include "core/fxcrt/include/fx_string.h"
17 17
18 class CFX_BidiChar; 18 class CFX_BidiChar;
19 class CPDF_Font; 19 class CPDF_Font;
20 class CPDF_FormObject; 20 class CPDF_FormObject;
21 class CPDF_Page; 21 class CPDF_Page;
22 class CPDF_TextObject; 22 class CPDF_TextObject;
23 23
24 enum class FPDFText_MarkedContent { Pass = 0, Done, Delay };
25
26 enum class FPDFText_Direction { Left = -1, Right = 1 };
27
24 struct FPDF_CHAR_INFO { 28 struct FPDF_CHAR_INFO {
25 FX_WCHAR m_Unicode; 29 FX_WCHAR m_Unicode;
26 FX_WCHAR m_Charcode; 30 FX_WCHAR m_Charcode;
27 int32_t m_Flag; 31 int32_t m_Flag;
28 FX_FLOAT m_FontSize; 32 FX_FLOAT m_FontSize;
29 FX_FLOAT m_OriginX; 33 FX_FLOAT m_OriginX;
30 FX_FLOAT m_OriginY; 34 FX_FLOAT m_OriginY;
31 CFX_FloatRect m_CharBox; 35 CFX_FloatRect m_CharBox;
32 CPDF_TextObject* m_pTextObj; 36 CPDF_TextObject* m_pTextObj;
33 CFX_Matrix m_Matrix; 37 CFX_Matrix m_Matrix;
(...skipping 16 matching lines...) Expand all
50 int m_Index; 54 int m_Index;
51 }; 55 };
52 56
53 struct PDFTEXT_Obj { 57 struct PDFTEXT_Obj {
54 CPDF_TextObject* m_pTextObj; 58 CPDF_TextObject* m_pTextObj;
55 CFX_Matrix m_formMatrix; 59 CFX_Matrix m_formMatrix;
56 }; 60 };
57 61
58 class CPDF_TextPage { 62 class CPDF_TextPage {
59 public: 63 public:
60 CPDF_TextPage(const CPDF_Page* pPage, int flags); 64 static FX_BOOL IsRectIntersect(const CFX_FloatRect& rect1,
65 const CFX_FloatRect& rect2);
66
67 CPDF_TextPage(const CPDF_Page* pPage, FPDFText_Direction flags);
61 ~CPDF_TextPage() {} 68 ~CPDF_TextPage() {}
62 69
63 // IPDF_TextPage: 70 // IPDF_TextPage:
64 void ParseTextPage(); 71 void ParseTextPage();
65 bool IsParsed() const { return m_bIsParsed; } 72 bool IsParsed() const { return m_bIsParsed; }
66 int CharIndexFromTextIndex(int TextIndex) const; 73 int CharIndexFromTextIndex(int TextIndex) const;
67 int TextIndexFromCharIndex(int CharIndex) const; 74 int TextIndexFromCharIndex(int CharIndex) const;
68 int CountChars() const; 75 int CountChars() const;
69 void GetCharInfo(int index, FPDF_CHAR_INFO* info) const; 76 void GetCharInfo(int index, FPDF_CHAR_INFO* info) const;
70 std::vector<CFX_FloatRect> GetRectArray(int start, int nCount) const; 77 std::vector<CFX_FloatRect> GetRectArray(int start, int nCount) const;
(...skipping 13 matching lines...) Expand all
84 FX_FLOAT& left, 91 FX_FLOAT& left,
85 FX_FLOAT& top, 92 FX_FLOAT& top,
86 FX_FLOAT& right, 93 FX_FLOAT& right,
87 FX_FLOAT& bottom) const; 94 FX_FLOAT& bottom) const;
88 int CountBoundedSegments(FX_FLOAT left, 95 int CountBoundedSegments(FX_FLOAT left,
89 FX_FLOAT top, 96 FX_FLOAT top,
90 FX_FLOAT right, 97 FX_FLOAT right,
91 FX_FLOAT bottom, 98 FX_FLOAT bottom,
92 FX_BOOL bContains = FALSE); 99 FX_BOOL bContains = FALSE);
93 100
94 int GetWordBreak(int index, int direction) const;
95
96 static FX_BOOL IsRectIntersect(const CFX_FloatRect& rect1,
97 const CFX_FloatRect& rect2);
98 static FX_BOOL IsLetter(FX_WCHAR unicode);
99
100 private: 101 private:
101 FX_BOOL IsHyphen(FX_WCHAR curChar); 102 FX_BOOL IsHyphen(FX_WCHAR curChar);
102 bool IsControlChar(const PAGECHAR_INFO& charInfo); 103 bool IsControlChar(const PAGECHAR_INFO& charInfo);
103 FX_BOOL GetBaselineRotate(int start, int end, int& Rotate);
104 void ProcessObject(); 104 void ProcessObject();
105 void ProcessFormObject(CPDF_FormObject* pFormObj, 105 void ProcessFormObject(CPDF_FormObject* pFormObj,
106 const CFX_Matrix& formMatrix); 106 const CFX_Matrix& formMatrix);
107 void ProcessTextObject(PDFTEXT_Obj pObj); 107 void ProcessTextObject(PDFTEXT_Obj pObj);
108 void ProcessTextObject(CPDF_TextObject* pTextObj, 108 void ProcessTextObject(CPDF_TextObject* pTextObj,
109 const CFX_Matrix& formMatrix, 109 const CFX_Matrix& formMatrix,
110 const CPDF_PageObjectList* pObjList, 110 const CPDF_PageObjectList* pObjList,
111 CPDF_PageObjectList::const_iterator ObjPos); 111 CPDF_PageObjectList::const_iterator ObjPos);
112 int ProcessInsertObject(const CPDF_TextObject* pObj, 112 int ProcessInsertObject(const CPDF_TextObject* pObj,
113 const CFX_Matrix& formMatrix); 113 const CFX_Matrix& formMatrix);
114 FX_BOOL GenerateCharInfo(FX_WCHAR unicode, PAGECHAR_INFO& info); 114 FX_BOOL GenerateCharInfo(FX_WCHAR unicode, PAGECHAR_INFO& info);
115 FX_BOOL IsSameAsPreTextObject(CPDF_TextObject* pTextObj, 115 FX_BOOL IsSameAsPreTextObject(CPDF_TextObject* pTextObj,
116 const CPDF_PageObjectList* pObjList, 116 const CPDF_PageObjectList* pObjList,
117 CPDF_PageObjectList::const_iterator ObjPos); 117 CPDF_PageObjectList::const_iterator ObjPos);
118 FX_BOOL IsSameTextObject(CPDF_TextObject* pTextObj1, 118 FX_BOOL IsSameTextObject(CPDF_TextObject* pTextObj1,
119 CPDF_TextObject* pTextObj2); 119 CPDF_TextObject* pTextObj2);
120 int GetCharWidth(uint32_t charCode, CPDF_Font* pFont) const; 120 int GetCharWidth(uint32_t charCode, CPDF_Font* pFont) const;
121 void CloseTempLine(); 121 void CloseTempLine();
122 void OnPiece(CFX_BidiChar* pBidi, CFX_WideString& str); 122 FPDFText_MarkedContent PreMarkedContent(PDFTEXT_Obj pObj);
123 int32_t PreMarkedContent(PDFTEXT_Obj pObj);
124 void ProcessMarkedContent(PDFTEXT_Obj pObj); 123 void ProcessMarkedContent(PDFTEXT_Obj pObj);
125 void CheckMarkedContentObject(int32_t& start, int32_t& nCount) const; 124 void CheckMarkedContentObject(int32_t& start, int32_t& nCount) const;
126 void FindPreviousTextObject(void); 125 void FindPreviousTextObject(void);
127 void AddCharInfoByLRDirection(FX_WCHAR wChar, PAGECHAR_INFO info); 126 void AddCharInfoByLRDirection(FX_WCHAR wChar, PAGECHAR_INFO info);
128 void AddCharInfoByRLDirection(FX_WCHAR wChar, PAGECHAR_INFO info); 127 void AddCharInfoByRLDirection(FX_WCHAR wChar, PAGECHAR_INFO info);
129 int32_t GetTextObjectWritingMode(const CPDF_TextObject* pTextObj); 128 int32_t GetTextObjectWritingMode(const CPDF_TextObject* pTextObj);
130 int32_t FindTextlineFlowDirection(); 129 int32_t FindTextlineFlowDirection();
131 130
132 void SwapTempTextBuf(int32_t iCharListStartAppend, int32_t iBufStartAppend); 131 void SwapTempTextBuf(int32_t iCharListStartAppend, int32_t iBufStartAppend);
133 FX_BOOL IsRightToLeft(const CPDF_TextObject* pTextObj, 132 FX_BOOL IsRightToLeft(const CPDF_TextObject* pTextObj,
134 const CPDF_Font* pFont, 133 const CPDF_Font* pFont,
135 int nItems) const; 134 int nItems) const;
136 135
137 const CPDF_Page* const m_pPage; 136 const CPDF_Page* const m_pPage;
138 std::vector<uint16_t> m_CharIndex; 137 std::vector<uint16_t> m_CharIndex;
139 std::deque<PAGECHAR_INFO> m_CharList; 138 std::deque<PAGECHAR_INFO> m_CharList;
140 std::deque<PAGECHAR_INFO> m_TempCharList; 139 std::deque<PAGECHAR_INFO> m_TempCharList;
141 CFX_WideTextBuf m_TextBuf; 140 CFX_WideTextBuf m_TextBuf;
142 CFX_WideTextBuf m_TempTextBuf; 141 CFX_WideTextBuf m_TempTextBuf;
143 const int m_parserflag; 142 const FPDFText_Direction m_parserflag;
144 CPDF_TextObject* m_pPreTextObj; 143 CPDF_TextObject* m_pPreTextObj;
145 CFX_Matrix m_perMatrix; 144 CFX_Matrix m_perMatrix;
146 bool m_bIsParsed; 145 bool m_bIsParsed;
147 CFX_Matrix m_DisplayMatrix; 146 CFX_Matrix m_DisplayMatrix;
148 CFX_ArrayTemplate<FPDF_SEGMENT> m_Segments; 147 CFX_ArrayTemplate<FPDF_SEGMENT> m_Segments;
149 std::vector<CFX_FloatRect> m_SelRects; 148 std::vector<CFX_FloatRect> m_SelRects;
150 CFX_ArrayTemplate<PDFTEXT_Obj> m_LineObj; 149 CFX_ArrayTemplate<PDFTEXT_Obj> m_LineObj;
151 int32_t m_TextlineDir; 150 int32_t m_TextlineDir;
152 CFX_FloatRect m_CurlineRect; 151 CFX_FloatRect m_CurlineRect;
153 }; 152 };
154 153
155 #endif // CORE_FPDFTEXT_INCLUDE_CPDF_TEXTPAGE_H_ 154 #endif // CORE_FPDFTEXT_INCLUDE_CPDF_TEXTPAGE_H_
OLDNEW
« no previous file with comments | « core/fpdftext/fpdf_text_int.cpp ('k') | fpdfsdk/fpdftext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698