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

Side by Side Diff: xfa/fgas/layout/fgas_rtfbreak.h

Issue 2072803002: Make code compile with clang_use_chrome_plugin (final) (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 4 years, 6 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 | « xfa/fgas/font/fgas_stdfontmgr.cpp ('k') | xfa/fgas/layout/fgas_rtfbreak.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 XFA_FGAS_LAYOUT_FGAS_RTFBREAK_H_ 7 #ifndef XFA_FGAS_LAYOUT_FGAS_RTFBREAK_H_
8 #define XFA_FGAS_LAYOUT_FGAS_RTFBREAK_H_ 8 #define XFA_FGAS_LAYOUT_FGAS_RTFBREAK_H_
9 9
10 #include "core/fxcrt/include/fx_basic.h" 10 #include "core/fxcrt/include/fx_basic.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #define FX_RTFLINEALIGNMENT_DistributedLeft \ 57 #define FX_RTFLINEALIGNMENT_DistributedLeft \
58 (FX_RTFLINEALIGNMENT_Left | FX_RTFLINEALIGNMENT_Distributed) 58 (FX_RTFLINEALIGNMENT_Left | FX_RTFLINEALIGNMENT_Distributed)
59 #define FX_RTFLINEALIGNMENT_DistributedCenter \ 59 #define FX_RTFLINEALIGNMENT_DistributedCenter \
60 (FX_RTFLINEALIGNMENT_Center | FX_RTFLINEALIGNMENT_Distributed) 60 (FX_RTFLINEALIGNMENT_Center | FX_RTFLINEALIGNMENT_Distributed)
61 #define FX_RTFLINEALIGNMENT_DistributedRight \ 61 #define FX_RTFLINEALIGNMENT_DistributedRight \
62 (FX_RTFLINEALIGNMENT_Right | FX_RTFLINEALIGNMENT_Distributed) 62 (FX_RTFLINEALIGNMENT_Right | FX_RTFLINEALIGNMENT_Distributed)
63 #define FX_RTFLINEALIGNMENT_LowerMask 0x03 63 #define FX_RTFLINEALIGNMENT_LowerMask 0x03
64 #define FX_RTFLINEALIGNMENT_HigherMask 0x0C 64 #define FX_RTFLINEALIGNMENT_HigherMask 0x0C
65 65
66 struct FX_RTFTEXTOBJ { 66 struct FX_RTFTEXTOBJ {
67 FX_RTFTEXTOBJ() { 67 FX_RTFTEXTOBJ();
68 pStr = NULL;
69 pWidths = NULL;
70 iLength = 0;
71 pFont = NULL;
72 fFontSize = 12.0f;
73 dwLayoutStyles = 0;
74 iCharRotation = 0;
75 iBidiLevel = 0;
76 pRect = NULL;
77 wLineBreakChar = L'\n';
78 iHorizontalScale = 100;
79 iVerticalScale = 100;
80 }
81 68
82 const FX_WCHAR* pStr; 69 const FX_WCHAR* pStr;
83 int32_t* pWidths; 70 int32_t* pWidths;
84 int32_t iLength; 71 int32_t iLength;
85 CFGAS_GEFont* pFont; 72 CFGAS_GEFont* pFont;
86 FX_FLOAT fFontSize; 73 FX_FLOAT fFontSize;
87 uint32_t dwLayoutStyles; 74 uint32_t dwLayoutStyles;
88 int32_t iCharRotation; 75 int32_t iCharRotation;
89 int32_t iBidiLevel; 76 int32_t iBidiLevel;
90 const CFX_RectF* pRect; 77 const CFX_RectF* pRect;
91 FX_WCHAR wLineBreakChar; 78 FX_WCHAR wLineBreakChar;
92 int32_t iHorizontalScale; 79 int32_t iHorizontalScale;
93 int32_t iVerticalScale; 80 int32_t iVerticalScale;
94 }; 81 };
95 82
96 class CFX_RTFPiece : public CFX_Target { 83 class CFX_RTFPiece : public CFX_Target {
97 public: 84 public:
98 CFX_RTFPiece() 85 CFX_RTFPiece();
99 : m_dwStatus(FX_RTFBREAK_PieceBreak), 86 ~CFX_RTFPiece() override;
100 m_iStartPos(0), 87
101 m_iWidth(-1),
102 m_iStartChar(0),
103 m_iChars(0),
104 m_iBidiLevel(0),
105 m_iBidiPos(0),
106 m_iFontSize(0),
107 m_iFontHeight(0),
108 m_iHorizontalScale(100),
109 m_iVerticalScale(100),
110 m_dwLayoutStyles(0),
111 m_dwIdentity(0),
112 m_pChars(NULL),
113 m_pUserData(NULL) {}
114 ~CFX_RTFPiece() { Reset(); }
115 void AppendChar(const CFX_RTFChar& tc) { 88 void AppendChar(const CFX_RTFChar& tc) {
116 ASSERT(m_pChars != NULL); 89 ASSERT(m_pChars != NULL);
117 m_pChars->Add(tc); 90 m_pChars->Add(tc);
118 if (m_iWidth < 0) { 91 if (m_iWidth < 0) {
119 m_iWidth = tc.m_iCharWidth; 92 m_iWidth = tc.m_iCharWidth;
120 } else { 93 } else {
121 m_iWidth += tc.m_iCharWidth; 94 m_iWidth += tc.m_iCharWidth;
122 } 95 }
123 m_iChars++; 96 m_iChars++;
124 } 97 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 m_iStartPos += m_iWidth; 137 m_iStartPos += m_iWidth;
165 } 138 }
166 m_iWidth = -1; 139 m_iWidth = -1;
167 m_iStartChar += m_iChars; 140 m_iStartChar += m_iChars;
168 m_iChars = 0; 141 m_iChars = 0;
169 m_iBidiLevel = 0; 142 m_iBidiLevel = 0;
170 m_iBidiPos = 0; 143 m_iBidiPos = 0;
171 m_iHorizontalScale = 100; 144 m_iHorizontalScale = 100;
172 m_iVerticalScale = 100; 145 m_iVerticalScale = 100;
173 } 146 }
147
174 uint32_t m_dwStatus; 148 uint32_t m_dwStatus;
175 int32_t m_iStartPos; 149 int32_t m_iStartPos;
176 int32_t m_iWidth; 150 int32_t m_iWidth;
177 int32_t m_iStartChar; 151 int32_t m_iStartChar;
178 int32_t m_iChars; 152 int32_t m_iChars;
179 int32_t m_iBidiLevel; 153 int32_t m_iBidiLevel;
180 int32_t m_iBidiPos; 154 int32_t m_iBidiPos;
181 int32_t m_iFontSize; 155 int32_t m_iFontSize;
182 int32_t m_iFontHeight; 156 int32_t m_iFontHeight;
183 int32_t m_iHorizontalScale; 157 int32_t m_iHorizontalScale;
184 int32_t m_iVerticalScale; 158 int32_t m_iVerticalScale;
185 uint32_t m_dwLayoutStyles; 159 uint32_t m_dwLayoutStyles;
186 uint32_t m_dwIdentity; 160 uint32_t m_dwIdentity;
187 CFX_RTFCharArray* m_pChars; 161 CFX_RTFCharArray* m_pChars;
188 IFX_Retainable* m_pUserData; 162 IFX_Retainable* m_pUserData;
189 }; 163 };
164
190 typedef CFX_BaseArrayTemplate<CFX_RTFPiece> CFX_RTFPieceArray; 165 typedef CFX_BaseArrayTemplate<CFX_RTFPiece> CFX_RTFPieceArray;
191 166
192 class CFX_RTFLine { 167 class CFX_RTFLine {
193 public: 168 public:
194 CFX_RTFLine() 169 CFX_RTFLine();
195 : m_LinePieces(16), 170 ~CFX_RTFLine();
196 m_iStart(0), 171
197 m_iWidth(0),
198 m_iArabicChars(0),
199 m_iMBCSChars(0) {}
200 ~CFX_RTFLine() { RemoveAll(); }
201 int32_t CountChars() const { return m_LineChars.GetSize(); } 172 int32_t CountChars() const { return m_LineChars.GetSize(); }
202 CFX_RTFChar& GetChar(int32_t index) { 173 CFX_RTFChar& GetChar(int32_t index) {
203 ASSERT(index > -1 && index < m_LineChars.GetSize()); 174 ASSERT(index > -1 && index < m_LineChars.GetSize());
204 return *m_LineChars.GetDataPtr(index); 175 return *m_LineChars.GetDataPtr(index);
205 } 176 }
206 CFX_RTFChar* GetCharPtr(int32_t index) { 177 CFX_RTFChar* GetCharPtr(int32_t index) {
207 ASSERT(index > -1 && index < m_LineChars.GetSize()); 178 ASSERT(index > -1 && index < m_LineChars.GetSize());
208 return m_LineChars.GetDataPtr(index); 179 return m_LineChars.GetDataPtr(index);
209 } 180 }
210 int32_t CountPieces() const { return m_LinePieces.GetSize(); } 181 int32_t CountPieces() const { return m_LinePieces.GetSize(); }
(...skipping 15 matching lines...) Expand all
226 if ((pUnknown = pChar->m_pUserData) != NULL) { 197 if ((pUnknown = pChar->m_pUserData) != NULL) {
227 pUnknown->Release(); 198 pUnknown->Release();
228 } 199 }
229 } 200 }
230 m_LineChars.RemoveAll(); 201 m_LineChars.RemoveAll();
231 m_LinePieces.RemoveAll(bLeaveMemory); 202 m_LinePieces.RemoveAll(bLeaveMemory);
232 m_iWidth = 0; 203 m_iWidth = 0;
233 m_iArabicChars = 0; 204 m_iArabicChars = 0;
234 m_iMBCSChars = 0; 205 m_iMBCSChars = 0;
235 } 206 }
207
236 CFX_RTFCharArray m_LineChars; 208 CFX_RTFCharArray m_LineChars;
237 CFX_RTFPieceArray m_LinePieces; 209 CFX_RTFPieceArray m_LinePieces;
238 int32_t m_iStart; 210 int32_t m_iStart;
239 int32_t m_iWidth; 211 int32_t m_iWidth;
240 int32_t m_iArabicChars; 212 int32_t m_iArabicChars;
241 int32_t m_iMBCSChars; 213 int32_t m_iMBCSChars;
242 }; 214 };
243 215
244 class CFX_RTFBreak { 216 class CFX_RTFBreak {
245 public: 217 public:
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 CFX_RectFArray& rtArray, 255 CFX_RectFArray& rtArray,
284 FX_BOOL bCharBBox = FALSE) const; 256 FX_BOOL bCharBBox = FALSE) const;
285 uint32_t AppendChar_CharCode(FX_WCHAR wch); 257 uint32_t AppendChar_CharCode(FX_WCHAR wch);
286 uint32_t AppendChar_Combination(CFX_RTFChar* pCurChar, int32_t iRotation); 258 uint32_t AppendChar_Combination(CFX_RTFChar* pCurChar, int32_t iRotation);
287 uint32_t AppendChar_Tab(CFX_RTFChar* pCurChar, int32_t iRotation); 259 uint32_t AppendChar_Tab(CFX_RTFChar* pCurChar, int32_t iRotation);
288 uint32_t AppendChar_Control(CFX_RTFChar* pCurChar, int32_t iRotation); 260 uint32_t AppendChar_Control(CFX_RTFChar* pCurChar, int32_t iRotation);
289 uint32_t AppendChar_Arabic(CFX_RTFChar* pCurChar, int32_t iRotation); 261 uint32_t AppendChar_Arabic(CFX_RTFChar* pCurChar, int32_t iRotation);
290 uint32_t AppendChar_Others(CFX_RTFChar* pCurChar, int32_t iRotation); 262 uint32_t AppendChar_Others(CFX_RTFChar* pCurChar, int32_t iRotation);
291 263
292 protected: 264 protected:
265 int32_t GetLineRotation(uint32_t dwStyles) const;
266 void SetBreakStatus();
267 CFX_RTFChar* GetLastChar(int32_t index) const;
268 CFX_RTFLine* GetRTFLine(FX_BOOL bReady) const;
269 CFX_RTFPieceArray* GetRTFPieces(FX_BOOL bReady) const;
270 FX_CHARTYPE GetUnifiedCharType(FX_CHARTYPE chartype) const;
271 int32_t GetLastPositionedTab() const;
272 FX_BOOL GetPositionedTab(int32_t& iTabPos) const;
273
274 int32_t GetBreakPos(CFX_RTFCharArray& tca,
275 int32_t& iEndPos,
276 FX_BOOL bAllChars = FALSE,
277 FX_BOOL bOnlyBrk = FALSE);
278 void SplitTextLine(CFX_RTFLine* pCurLine,
279 CFX_RTFLine* pNextLine,
280 FX_BOOL bAllChars = FALSE);
281 FX_BOOL EndBreak_SplitLine(CFX_RTFLine* pNextLine,
282 FX_BOOL bAllChars,
283 uint32_t dwStatus);
284 void EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus);
285 void EndBreak_Alignment(CFX_TPOArray& tpos,
286 FX_BOOL bAllChars,
287 uint32_t dwStatus);
288
293 uint32_t m_dwPolicies; 289 uint32_t m_dwPolicies;
294 int32_t m_iBoundaryStart; 290 int32_t m_iBoundaryStart;
295 int32_t m_iBoundaryEnd; 291 int32_t m_iBoundaryEnd;
296 uint32_t m_dwLayoutStyles; 292 uint32_t m_dwLayoutStyles;
297 FX_BOOL m_bPagination; 293 FX_BOOL m_bPagination;
298 FX_BOOL m_bVertical; 294 FX_BOOL m_bVertical;
299 FX_BOOL m_bSingleLine; 295 FX_BOOL m_bSingleLine;
300 FX_BOOL m_bCharCode; 296 FX_BOOL m_bCharCode;
301 CFGAS_GEFont* m_pFont; 297 CFGAS_GEFont* m_pFont;
302 int32_t m_iFontHeight; 298 int32_t m_iFontHeight;
(...skipping 15 matching lines...) Expand all
318 FX_BOOL m_bRTL; 314 FX_BOOL m_bRTL;
319 int32_t m_iAlignment; 315 int32_t m_iAlignment;
320 IFX_Retainable* m_pUserData; 316 IFX_Retainable* m_pUserData;
321 FX_CHARTYPE m_eCharType; 317 FX_CHARTYPE m_eCharType;
322 uint32_t m_dwIdentity; 318 uint32_t m_dwIdentity;
323 CFX_RTFLine m_RTFLine1; 319 CFX_RTFLine m_RTFLine1;
324 CFX_RTFLine m_RTFLine2; 320 CFX_RTFLine m_RTFLine2;
325 CFX_RTFLine* m_pCurLine; 321 CFX_RTFLine* m_pCurLine;
326 int32_t m_iReady; 322 int32_t m_iReady;
327 int32_t m_iTolerance; 323 int32_t m_iTolerance;
328 int32_t GetLineRotation(uint32_t dwStyles) const;
329 void SetBreakStatus();
330 CFX_RTFChar* GetLastChar(int32_t index) const;
331 CFX_RTFLine* GetRTFLine(FX_BOOL bReady) const;
332 CFX_RTFPieceArray* GetRTFPieces(FX_BOOL bReady) const;
333 FX_CHARTYPE GetUnifiedCharType(FX_CHARTYPE chartype) const;
334 int32_t GetLastPositionedTab() const;
335 FX_BOOL GetPositionedTab(int32_t& iTabPos) const;
336 int32_t GetBreakPos(CFX_RTFCharArray& tca,
337 int32_t& iEndPos,
338 FX_BOOL bAllChars = FALSE,
339 FX_BOOL bOnlyBrk = FALSE);
340 void SplitTextLine(CFX_RTFLine* pCurLine,
341 CFX_RTFLine* pNextLine,
342 FX_BOOL bAllChars = FALSE);
343 FX_BOOL EndBreak_SplitLine(CFX_RTFLine* pNextLine,
344 FX_BOOL bAllChars,
345 uint32_t dwStatus);
346 void EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus);
347 void EndBreak_Alignment(CFX_TPOArray& tpos,
348 FX_BOOL bAllChars,
349 uint32_t dwStatus);
350 }; 324 };
351 325
352 #endif // XFA_FGAS_LAYOUT_FGAS_RTFBREAK_H_ 326 #endif // XFA_FGAS_LAYOUT_FGAS_RTFBREAK_H_
OLDNEW
« no previous file with comments | « xfa/fgas/font/fgas_stdfontmgr.cpp ('k') | xfa/fgas/layout/fgas_rtfbreak.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698