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

Side by Side Diff: xfa/fxfa/app/xfa_textlayout.h

Issue 1835703002: Remove FX_DWORD from XFA, part 2 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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/fxfa/app/xfa_rendercontext.h ('k') | xfa/fxfa/fm2js/xfa_error.h » ('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_FXFA_APP_XFA_TEXTLAYOUT_H_ 7 #ifndef XFA_FXFA_APP_XFA_TEXTLAYOUT_H_
8 #define XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ 8 #define XFA_FXFA_APP_XFA_TEXTLAYOUT_H_
9 9
10 #include "xfa/fde/css/fde_css.h" 10 #include "xfa/fde/css/fde_css.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 if (m_pParentStyle) 67 if (m_pParentStyle)
68 m_pParentStyle->Release(); 68 m_pParentStyle->Release();
69 FX_Free(m_ppMatchedDecls); 69 FX_Free(m_ppMatchedDecls);
70 } 70 }
71 void SetDisplay(FDE_CSSDISPLAY eDisplay) { m_eDisplay = eDisplay; } 71 void SetDisplay(FDE_CSSDISPLAY eDisplay) { m_eDisplay = eDisplay; }
72 FDE_CSSDISPLAY GetDisplay() const { return m_eDisplay; } 72 FDE_CSSDISPLAY GetDisplay() const { return m_eDisplay; }
73 void SetDecls(const IFDE_CSSDeclaration** ppDeclArray, int32_t iDeclCount); 73 void SetDecls(const IFDE_CSSDeclaration** ppDeclArray, int32_t iDeclCount);
74 const IFDE_CSSDeclaration** GetDecls() { 74 const IFDE_CSSDeclaration** GetDecls() {
75 return (const IFDE_CSSDeclaration**)m_ppMatchedDecls; 75 return (const IFDE_CSSDeclaration**)m_ppMatchedDecls;
76 } 76 }
77 FX_DWORD CountDecls() const { return m_dwMatchedDecls; } 77 uint32_t CountDecls() const { return m_dwMatchedDecls; }
78 IFDE_CSSComputedStyle* m_pParentStyle; 78 IFDE_CSSComputedStyle* m_pParentStyle;
79 79
80 protected: 80 protected:
81 IFDE_CSSDeclaration** m_ppMatchedDecls; 81 IFDE_CSSDeclaration** m_ppMatchedDecls;
82 FX_DWORD m_dwMatchedDecls; 82 uint32_t m_dwMatchedDecls;
83 FDE_CSSDISPLAY m_eDisplay; 83 FDE_CSSDISPLAY m_eDisplay;
84 }; 84 };
85 85
86 class CXFA_TextParser { 86 class CXFA_TextParser {
87 public: 87 public:
88 CXFA_TextParser() : m_pAllocator(NULL), m_pSelector(NULL), m_pUASheet(NULL) {} 88 CXFA_TextParser() : m_pAllocator(NULL), m_pSelector(NULL), m_pUASheet(NULL) {}
89 virtual ~CXFA_TextParser(); 89 virtual ~CXFA_TextParser();
90 void Reset(); 90 void Reset();
91 void DoParse(IFDE_XMLNode* pXMLContainer, IXFA_TextProvider* pTextProvider); 91 void DoParse(IFDE_XMLNode* pXMLContainer, IXFA_TextProvider* pTextProvider);
92 IFDE_CSSComputedStyle* CreateRootStyle(IXFA_TextProvider* pTextProvider); 92 IFDE_CSSComputedStyle* CreateRootStyle(IXFA_TextProvider* pTextProvider);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 FX_FLOAT m_fHeight; 162 FX_FLOAT m_fHeight;
163 FX_FLOAT m_fLastPos; 163 FX_FLOAT m_fLastPos;
164 FX_FLOAT m_fStartLineOffset; 164 FX_FLOAT m_fStartLineOffset;
165 int32_t m_iChar; 165 int32_t m_iChar;
166 int32_t m_iLines; 166 int32_t m_iLines;
167 int32_t m_iTotalLines; 167 int32_t m_iTotalLines;
168 IFDE_XMLNode* m_pXMLNode; 168 IFDE_XMLNode* m_pXMLNode;
169 CXFA_Node* m_pNode; 169 CXFA_Node* m_pNode;
170 IFDE_CSSComputedStyle* m_pParentStyle; 170 IFDE_CSSComputedStyle* m_pParentStyle;
171 CFX_ArrayTemplate<FX_FLOAT> m_lineHeights; 171 CFX_ArrayTemplate<FX_FLOAT> m_lineHeights;
172 FX_DWORD m_dwFlags; 172 uint32_t m_dwFlags;
173 CFX_FloatArray m_BlocksHeight; 173 CFX_FloatArray m_BlocksHeight;
174 }; 174 };
175 175
176 class CXFA_LinkUserData : public IFX_Unknown, public CFX_Target { 176 class CXFA_LinkUserData : public IFX_Unknown, public CFX_Target {
177 public: 177 public:
178 CXFA_LinkUserData(IFX_MEMAllocator* pAllocator, FX_WCHAR* pszText) 178 CXFA_LinkUserData(IFX_MEMAllocator* pAllocator, FX_WCHAR* pszText)
179 : m_pAllocator(pAllocator), m_dwRefCount(1) { 179 : m_pAllocator(pAllocator), m_dwRefCount(1) {
180 m_pszURLContent = pszText; 180 m_pszURLContent = pszText;
181 } 181 }
182 ~CXFA_LinkUserData() {} 182 ~CXFA_LinkUserData() {}
183 virtual FX_DWORD Release() { 183 virtual uint32_t Release() {
184 FX_DWORD dwRefCount = --m_dwRefCount; 184 uint32_t dwRefCount = --m_dwRefCount;
185 if (dwRefCount <= 0) { 185 if (dwRefCount <= 0) {
186 FXTARGET_DeleteWith(CXFA_LinkUserData, m_pAllocator, this); 186 FXTARGET_DeleteWith(CXFA_LinkUserData, m_pAllocator, this);
187 } 187 }
188 return dwRefCount; 188 return dwRefCount;
189 } 189 }
190 virtual FX_DWORD AddRef() { return ++m_dwRefCount; } 190 virtual uint32_t AddRef() { return ++m_dwRefCount; }
191 191
192 public: 192 public:
193 const FX_WCHAR* GetLinkURL() { return m_pszURLContent; } 193 const FX_WCHAR* GetLinkURL() { return m_pszURLContent; }
194 194
195 protected: 195 protected:
196 IFX_MEMAllocator* m_pAllocator; 196 IFX_MEMAllocator* m_pAllocator;
197 FX_DWORD m_dwRefCount; 197 uint32_t m_dwRefCount;
198 CFX_WideString m_pszURLContent; 198 CFX_WideString m_pszURLContent;
199 }; 199 };
200 200
201 class CXFA_TextUserData : public IFX_Unknown, public CFX_Target { 201 class CXFA_TextUserData : public IFX_Unknown, public CFX_Target {
202 public: 202 public:
203 CXFA_TextUserData(IFX_MEMAllocator* pAllocator, IFDE_CSSComputedStyle* pStyle) 203 CXFA_TextUserData(IFX_MEMAllocator* pAllocator, IFDE_CSSComputedStyle* pStyle)
204 : m_pStyle(pStyle), 204 : m_pStyle(pStyle),
205 m_pLinkData(nullptr), 205 m_pLinkData(nullptr),
206 m_pAllocator(pAllocator), 206 m_pAllocator(pAllocator),
207 m_dwRefCount(0) { 207 m_dwRefCount(0) {
(...skipping 11 matching lines...) Expand all
219 FXSYS_assert(m_pAllocator); 219 FXSYS_assert(m_pAllocator);
220 if (m_pStyle) 220 if (m_pStyle)
221 m_pStyle->AddRef(); 221 m_pStyle->AddRef();
222 } 222 }
223 ~CXFA_TextUserData() { 223 ~CXFA_TextUserData() {
224 if (m_pStyle) 224 if (m_pStyle)
225 m_pStyle->Release(); 225 m_pStyle->Release();
226 if (m_pLinkData) 226 if (m_pLinkData)
227 m_pLinkData->Release(); 227 m_pLinkData->Release();
228 } 228 }
229 virtual FX_DWORD Release() { 229 virtual uint32_t Release() {
230 FX_DWORD dwRefCount = --m_dwRefCount; 230 uint32_t dwRefCount = --m_dwRefCount;
231 if (dwRefCount == 0) { 231 if (dwRefCount == 0) {
232 FXTARGET_DeleteWith(CXFA_TextUserData, m_pAllocator, this); 232 FXTARGET_DeleteWith(CXFA_TextUserData, m_pAllocator, this);
233 } 233 }
234 return dwRefCount; 234 return dwRefCount;
235 } 235 }
236 virtual FX_DWORD AddRef() { return ++m_dwRefCount; } 236 virtual uint32_t AddRef() { return ++m_dwRefCount; }
237 237
238 IFDE_CSSComputedStyle* m_pStyle; 238 IFDE_CSSComputedStyle* m_pStyle;
239 CXFA_LinkUserData* m_pLinkData; 239 CXFA_LinkUserData* m_pLinkData;
240 240
241 protected: 241 protected:
242 IFX_MEMAllocator* m_pAllocator; 242 IFX_MEMAllocator* m_pAllocator;
243 FX_DWORD m_dwRefCount; 243 uint32_t m_dwRefCount;
244 }; 244 };
245 245
246 class XFA_TextPiece : public CFX_Target { 246 class XFA_TextPiece : public CFX_Target {
247 public: 247 public:
248 XFA_TextPiece() : pszText(nullptr), pFont(nullptr), pLinkData(nullptr) {} 248 XFA_TextPiece() : pszText(nullptr), pFont(nullptr), pLinkData(nullptr) {}
249 ~XFA_TextPiece() { 249 ~XFA_TextPiece() {
250 if (pLinkData) 250 if (pLinkData)
251 pLinkData->Release(); 251 pLinkData->Release();
252 } 252 }
253 253
(...skipping 16 matching lines...) Expand all
270 270
271 class CXFA_PieceLine : public CFX_Target { 271 class CXFA_PieceLine : public CFX_Target {
272 public: 272 public:
273 CXFA_PieceLine() {} 273 CXFA_PieceLine() {}
274 CXFA_PieceArray m_textPieces; 274 CXFA_PieceArray m_textPieces;
275 CFX_Int32Array m_charCounts; 275 CFX_Int32Array m_charCounts;
276 }; 276 };
277 typedef CFX_ArrayTemplate<CXFA_PieceLine*> CXFA_PieceLineArray; 277 typedef CFX_ArrayTemplate<CXFA_PieceLine*> CXFA_PieceLineArray;
278 278
279 struct XFA_TABSTOPS { 279 struct XFA_TABSTOPS {
280 FX_DWORD dwAlign; 280 uint32_t dwAlign;
281 FX_FLOAT fTabstops; 281 FX_FLOAT fTabstops;
282 }; 282 };
283 283
284 class CXFA_TextTabstopsContext { 284 class CXFA_TextTabstopsContext {
285 public: 285 public:
286 CXFA_TextTabstopsContext() 286 CXFA_TextTabstopsContext()
287 : m_iTabCount(0), 287 : m_iTabCount(0),
288 m_iTabIndex(-1), 288 m_iTabIndex(-1),
289 m_bTabstops(FALSE), 289 m_bTabstops(FALSE),
290 m_fTabWidth(0), 290 m_fTabWidth(0),
291 m_fLeft(0) {} 291 m_fLeft(0) {}
292 void Append(FX_DWORD dwAlign, FX_FLOAT fTabstops) { 292 void Append(uint32_t dwAlign, FX_FLOAT fTabstops) {
293 int32_t i = 0; 293 int32_t i = 0;
294 for (i = 0; i < m_iTabCount; i++) { 294 for (i = 0; i < m_iTabCount; i++) {
295 XFA_TABSTOPS* pTabstop = m_tabstops.GetDataPtr(i); 295 XFA_TABSTOPS* pTabstop = m_tabstops.GetDataPtr(i);
296 if (fTabstops < pTabstop->fTabstops) { 296 if (fTabstops < pTabstop->fTabstops) {
297 break; 297 break;
298 } 298 }
299 } 299 }
300 m_tabstops.InsertSpaceAt(i, 1); 300 m_tabstops.InsertSpaceAt(i, 1);
301 XFA_TABSTOPS tabstop; 301 XFA_TABSTOPS tabstop;
302 tabstop.dwAlign = dwAlign; 302 tabstop.dwAlign = dwAlign;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 IFDE_CSSComputedStyle* pParentStyle, 373 IFDE_CSSComputedStyle* pParentStyle,
374 FX_BOOL bSavePieces, 374 FX_BOOL bSavePieces,
375 CXFA_LinkUserData* pLinkData = NULL, 375 CXFA_LinkUserData* pLinkData = NULL,
376 FX_BOOL bEndBreak = TRUE, 376 FX_BOOL bEndBreak = TRUE,
377 FX_BOOL bIsOl = FALSE, 377 FX_BOOL bIsOl = FALSE,
378 int32_t iLiCount = 0); 378 int32_t iLiCount = 0);
379 FX_BOOL AppendChar(const CFX_WideString& wsText, 379 FX_BOOL AppendChar(const CFX_WideString& wsText,
380 FX_FLOAT& fLinePos, 380 FX_FLOAT& fLinePos,
381 FX_FLOAT fSpaceAbove, 381 FX_FLOAT fSpaceAbove,
382 FX_BOOL bSavePieces); 382 FX_BOOL bSavePieces);
383 void AppendTextLine(FX_DWORD dwStatus, 383 void AppendTextLine(uint32_t dwStatus,
384 FX_FLOAT& fLinePos, 384 FX_FLOAT& fLinePos,
385 FX_BOOL bSavePieces, 385 FX_BOOL bSavePieces,
386 FX_BOOL bEndBreak = FALSE); 386 FX_BOOL bEndBreak = FALSE);
387 void EndBreak(FX_DWORD dwStatus, FX_FLOAT& fLinePos, FX_BOOL bDefault); 387 void EndBreak(uint32_t dwStatus, FX_FLOAT& fLinePos, FX_BOOL bDefault);
388 FX_BOOL IsEnd(FX_BOOL bSavePieces); 388 FX_BOOL IsEnd(FX_BOOL bSavePieces);
389 void ProcessText(CFX_WideString& wsText); 389 void ProcessText(CFX_WideString& wsText);
390 void UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom); 390 void UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom);
391 void RenderString(IFDE_RenderDevice* pDevice, 391 void RenderString(IFDE_RenderDevice* pDevice,
392 IFDE_SolidBrush* pBrush, 392 IFDE_SolidBrush* pBrush,
393 CXFA_PieceLine* pPieceLine, 393 CXFA_PieceLine* pPieceLine,
394 int32_t iPiece, 394 int32_t iPiece,
395 FXTEXT_CHARPOS* pCharPos, 395 FXTEXT_CHARPOS* pCharPos,
396 const CFX_Matrix& tmDoc2Device); 396 const CFX_Matrix& tmDoc2Device);
397 void RenderPath(IFDE_RenderDevice* pDevice, 397 void RenderPath(IFDE_RenderDevice* pDevice,
(...skipping 18 matching lines...) Expand all
416 CXFA_LoaderContext* m_pLoader; 416 CXFA_LoaderContext* m_pLoader;
417 int32_t m_iLines; 417 int32_t m_iLines;
418 FX_FLOAT m_fMaxWidth; 418 FX_FLOAT m_fMaxWidth;
419 CXFA_TextParser m_textParser; 419 CXFA_TextParser m_textParser;
420 CXFA_PieceLineArray m_pieceLines; 420 CXFA_PieceLineArray m_pieceLines;
421 CXFA_TextTabstopsContext* m_pTabstopContext; 421 CXFA_TextTabstopsContext* m_pTabstopContext;
422 FX_BOOL m_bBlockContinue; 422 FX_BOOL m_bBlockContinue;
423 }; 423 };
424 424
425 #endif // XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ 425 #endif // XFA_FXFA_APP_XFA_TEXTLAYOUT_H_
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_rendercontext.h ('k') | xfa/fxfa/fm2js/xfa_error.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698