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

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

Issue 1846993002: Remove IXFA_* interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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.cpp ('k') | xfa/fxfa/app/xfa_textlayout.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_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"
11 #include "xfa/fde/fde_brush.h" 11 #include "xfa/fde/fde_brush.h"
12 #include "xfa/fde/fde_renderdevice.h" 12 #include "xfa/fde/fde_renderdevice.h"
13 #include "xfa/fgas/layout/fgas_rtfbreak.h" 13 #include "xfa/fgas/layout/fgas_rtfbreak.h"
14 #include "xfa/fxfa/app/xfa_ffdoc.h"
15 #include "xfa/fxfa/parser/xfa_object.h" 14 #include "xfa/fxfa/parser/xfa_object.h"
15 #include "xfa/include/fxfa/xfa_ffdoc.h"
16 16
17 #define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001 17 #define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001
18 18
19 class CXFA_Para; 19 class CXFA_Para;
20 class CXFA_Font; 20 class CXFA_Font;
21 class CXFA_TextProvider;
21 class CXFA_TextTabstopsContext; 22 class CXFA_TextTabstopsContext;
22 23
23 class IXFA_TextProvider {
24 public:
25 virtual ~IXFA_TextProvider() {}
26 virtual CXFA_Node* GetTextNode(FX_BOOL& bRichText) = 0;
27 virtual CXFA_Para GetParaNode() = 0;
28 virtual CXFA_Font GetFontNode() = 0;
29 virtual FX_BOOL IsCheckButtonAndAutoWidth() = 0;
30 virtual CXFA_FFDoc* GetDocNode() = 0;
31 virtual FX_BOOL GetEmbbedObj(FX_BOOL bURI,
32 FX_BOOL bRaw,
33 const CFX_WideString& wsAttr,
34 CFX_WideString& wsValue) = 0;
35 };
36
37 class CXFA_CSSTagProvider : public IFDE_CSSTagProvider { 24 class CXFA_CSSTagProvider : public IFDE_CSSTagProvider {
38 public: 25 public:
39 CXFA_CSSTagProvider() : m_bTagAviliable(FALSE), m_bContent(FALSE) {} 26 CXFA_CSSTagProvider() : m_bTagAviliable(FALSE), m_bContent(FALSE) {}
40 virtual ~CXFA_CSSTagProvider(); 27 virtual ~CXFA_CSSTagProvider();
41 virtual CFX_WideStringC GetTagName() { return m_wsTagName; } 28 virtual CFX_WideStringC GetTagName() { return m_wsTagName; }
42 virtual FX_POSITION GetFirstAttribute() { 29 virtual FX_POSITION GetFirstAttribute() {
43 return m_Attributes.GetStartPosition(); 30 return m_Attributes.GetStartPosition();
44 } 31 }
45 virtual void GetNextAttribute(FX_POSITION& pos, 32 virtual void GetNextAttribute(FX_POSITION& pos,
46 CFX_WideStringC& wsAttr, 33 CFX_WideStringC& wsAttr,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 IFDE_CSSDeclaration** m_ppMatchedDecls; 68 IFDE_CSSDeclaration** m_ppMatchedDecls;
82 uint32_t m_dwMatchedDecls; 69 uint32_t m_dwMatchedDecls;
83 FDE_CSSDISPLAY m_eDisplay; 70 FDE_CSSDISPLAY m_eDisplay;
84 }; 71 };
85 72
86 class CXFA_TextParser { 73 class CXFA_TextParser {
87 public: 74 public:
88 CXFA_TextParser() : m_pAllocator(NULL), m_pSelector(NULL), m_pUASheet(NULL) {} 75 CXFA_TextParser() : m_pAllocator(NULL), m_pSelector(NULL), m_pUASheet(NULL) {}
89 virtual ~CXFA_TextParser(); 76 virtual ~CXFA_TextParser();
90 void Reset(); 77 void Reset();
91 void DoParse(CFDE_XMLNode* pXMLContainer, IXFA_TextProvider* pTextProvider); 78 void DoParse(CFDE_XMLNode* pXMLContainer, CXFA_TextProvider* pTextProvider);
92 IFDE_CSSComputedStyle* CreateRootStyle(IXFA_TextProvider* pTextProvider); 79 IFDE_CSSComputedStyle* CreateRootStyle(CXFA_TextProvider* pTextProvider);
93 IFDE_CSSComputedStyle* ComputeStyle(CFDE_XMLNode* pXMLNode, 80 IFDE_CSSComputedStyle* ComputeStyle(CFDE_XMLNode* pXMLNode,
94 IFDE_CSSComputedStyle* pParentStyle); 81 IFDE_CSSComputedStyle* pParentStyle);
95 FX_BOOL IsParsed() const { return m_pAllocator != NULL; } 82 FX_BOOL IsParsed() const { return m_pAllocator != NULL; }
96 83
97 int32_t GetVAlgin(IXFA_TextProvider* pTextProvider) const; 84 int32_t GetVAlgin(CXFA_TextProvider* pTextProvider) const;
98 FX_FLOAT GetTabInterval(IFDE_CSSComputedStyle* pStyle) const; 85 FX_FLOAT GetTabInterval(IFDE_CSSComputedStyle* pStyle) const;
99 int32_t CountTabs(IFDE_CSSComputedStyle* pStyle) const; 86 int32_t CountTabs(IFDE_CSSComputedStyle* pStyle) const;
100 FX_BOOL IsSpaceRun(IFDE_CSSComputedStyle* pStyle) const; 87 FX_BOOL IsSpaceRun(IFDE_CSSComputedStyle* pStyle) const;
101 FX_BOOL GetTabstops(IFDE_CSSComputedStyle* pStyle, 88 FX_BOOL GetTabstops(IFDE_CSSComputedStyle* pStyle,
102 CXFA_TextTabstopsContext* pTabstopContext); 89 CXFA_TextTabstopsContext* pTabstopContext);
103 IFX_Font* GetFont(IXFA_TextProvider* pTextProvider, 90 IFX_Font* GetFont(CXFA_TextProvider* pTextProvider,
104 IFDE_CSSComputedStyle* pStyle) const; 91 IFDE_CSSComputedStyle* pStyle) const;
105 FX_FLOAT GetFontSize(IXFA_TextProvider* pTextProvider, 92 FX_FLOAT GetFontSize(CXFA_TextProvider* pTextProvider,
106 IFDE_CSSComputedStyle* pStyle) const; 93 IFDE_CSSComputedStyle* pStyle) const;
107 int32_t GetHorScale(IXFA_TextProvider* pTextProvider, 94 int32_t GetHorScale(CXFA_TextProvider* pTextProvider,
108 IFDE_CSSComputedStyle* pStyle, 95 IFDE_CSSComputedStyle* pStyle,
109 CFDE_XMLNode* pXMLNode) const; 96 CFDE_XMLNode* pXMLNode) const;
110 int32_t GetVerScale(IXFA_TextProvider* pTextProvider, 97 int32_t GetVerScale(CXFA_TextProvider* pTextProvider,
111 IFDE_CSSComputedStyle* pStyle) const; 98 IFDE_CSSComputedStyle* pStyle) const;
112 void GetUnderline(IXFA_TextProvider* pTextProvider, 99 void GetUnderline(CXFA_TextProvider* pTextProvider,
113 IFDE_CSSComputedStyle* pStyle, 100 IFDE_CSSComputedStyle* pStyle,
114 int32_t& iUnderline, 101 int32_t& iUnderline,
115 int32_t& iPeriod) const; 102 int32_t& iPeriod) const;
116 void GetLinethrough(IXFA_TextProvider* pTextProvider, 103 void GetLinethrough(CXFA_TextProvider* pTextProvider,
117 IFDE_CSSComputedStyle* pStyle, 104 IFDE_CSSComputedStyle* pStyle,
118 int32_t& iLinethrough) const; 105 int32_t& iLinethrough) const;
119 FX_ARGB GetColor(IXFA_TextProvider* pTextProvider, 106 FX_ARGB GetColor(CXFA_TextProvider* pTextProvider,
120 IFDE_CSSComputedStyle* pStyle) const; 107 IFDE_CSSComputedStyle* pStyle) const;
121 FX_FLOAT GetBaseline(IXFA_TextProvider* pTextProvider, 108 FX_FLOAT GetBaseline(CXFA_TextProvider* pTextProvider,
122 IFDE_CSSComputedStyle* pStyle) const; 109 IFDE_CSSComputedStyle* pStyle) const;
123 FX_FLOAT GetLineHeight(IXFA_TextProvider* pTextProvider, 110 FX_FLOAT GetLineHeight(CXFA_TextProvider* pTextProvider,
124 IFDE_CSSComputedStyle* pStyle, 111 IFDE_CSSComputedStyle* pStyle,
125 FX_BOOL bFirst, 112 FX_BOOL bFirst,
126 FX_FLOAT fVerScale) const; 113 FX_FLOAT fVerScale) const;
127 FX_BOOL GetEmbbedObj(IXFA_TextProvider* pTextProvider, 114 FX_BOOL GetEmbbedObj(CXFA_TextProvider* pTextProvider,
128 CFDE_XMLNode* pXMLNode, 115 CFDE_XMLNode* pXMLNode,
129 CFX_WideString& wsValue); 116 CFX_WideString& wsValue);
130 CXFA_TextParseContext* GetParseContextFromMap(CFDE_XMLNode* pXMLNode); 117 CXFA_TextParseContext* GetParseContextFromMap(CFDE_XMLNode* pXMLNode);
131 118
132 private: 119 private:
133 void InitCSSData(IXFA_TextProvider* pTextProvider); 120 void InitCSSData(CXFA_TextProvider* pTextProvider);
134 void ParseRichText(CFDE_XMLNode* pXMLNode, 121 void ParseRichText(CFDE_XMLNode* pXMLNode,
135 IFDE_CSSComputedStyle* pParentStyle); 122 IFDE_CSSComputedStyle* pParentStyle);
136 void ParseTagInfo(CFDE_XMLNode* pXMLNode, CXFA_CSSTagProvider& tagProvider); 123 void ParseTagInfo(CFDE_XMLNode* pXMLNode, CXFA_CSSTagProvider& tagProvider);
137 IFDE_CSSStyleSheet* LoadDefaultSheetStyle(); 124 IFDE_CSSStyleSheet* LoadDefaultSheetStyle();
138 IFDE_CSSComputedStyle* CreateStyle(IFDE_CSSComputedStyle* pParentStyle); 125 IFDE_CSSComputedStyle* CreateStyle(IFDE_CSSComputedStyle* pParentStyle);
139 IFX_MEMAllocator* m_pAllocator; 126 IFX_MEMAllocator* m_pAllocator;
140 IFDE_CSSStyleSelector* m_pSelector; 127 IFDE_CSSStyleSelector* m_pSelector;
141 IFDE_CSSStyleSheet* m_pUASheet; 128 IFDE_CSSStyleSheet* m_pUASheet;
142 CFX_MapPtrTemplate<CFDE_XMLNode*, CXFA_TextParseContext*> 129 CFX_MapPtrTemplate<CFDE_XMLNode*, CXFA_TextParseContext*>
143 m_mapXMLNodeToParseContext; 130 m_mapXMLNodeToParseContext;
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 CFX_ArrayTemplate<XFA_TABSTOPS> m_tabstops; 304 CFX_ArrayTemplate<XFA_TABSTOPS> m_tabstops;
318 int32_t m_iTabCount; 305 int32_t m_iTabCount;
319 int32_t m_iTabIndex; 306 int32_t m_iTabIndex;
320 FX_BOOL m_bTabstops; 307 FX_BOOL m_bTabstops;
321 FX_FLOAT m_fTabWidth; 308 FX_FLOAT m_fTabWidth;
322 FX_FLOAT m_fLeft; 309 FX_FLOAT m_fLeft;
323 }; 310 };
324 311
325 class CXFA_TextLayout { 312 class CXFA_TextLayout {
326 public: 313 public:
327 CXFA_TextLayout(IXFA_TextProvider* pTextProvider); 314 CXFA_TextLayout(CXFA_TextProvider* pTextProvider);
328 virtual ~CXFA_TextLayout(); 315 virtual ~CXFA_TextLayout();
329 int32_t GetText(CFX_WideString& wsText); 316 int32_t GetText(CFX_WideString& wsText);
330 FX_FLOAT GetLayoutHeight(); 317 FX_FLOAT GetLayoutHeight();
331 FX_FLOAT StartLayout(FX_FLOAT fWidth = -1); 318 FX_FLOAT StartLayout(FX_FLOAT fWidth = -1);
332 FX_BOOL DoLayout(int32_t iBlockIndex, 319 FX_BOOL DoLayout(int32_t iBlockIndex,
333 FX_FLOAT& fCalcHeight, 320 FX_FLOAT& fCalcHeight,
334 FX_FLOAT fContentAreaHeight = -1, 321 FX_FLOAT fContentAreaHeight = -1,
335 FX_FLOAT fTextHeight = -1); 322 FX_FLOAT fTextHeight = -1);
336 323
337 FX_BOOL CalcSize(const CFX_SizeF& minSize, 324 FX_BOOL CalcSize(const CFX_SizeF& minSize,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 FXTEXT_CHARPOS* pCharPos, 388 FXTEXT_CHARPOS* pCharPos,
402 const CFX_Matrix& tmDoc2Device); 389 const CFX_Matrix& tmDoc2Device);
403 int32_t GetDisplayPos(const XFA_TextPiece* pPiece, 390 int32_t GetDisplayPos(const XFA_TextPiece* pPiece,
404 FXTEXT_CHARPOS* pCharPos, 391 FXTEXT_CHARPOS* pCharPos,
405 FX_BOOL bCharCode = FALSE); 392 FX_BOOL bCharCode = FALSE);
406 FX_BOOL ToRun(const XFA_TextPiece* pPiece, FX_RTFTEXTOBJ& tr); 393 FX_BOOL ToRun(const XFA_TextPiece* pPiece, FX_RTFTEXTOBJ& tr);
407 void DoTabstops(IFDE_CSSComputedStyle* pStyle, CXFA_PieceLine* pPieceLine); 394 void DoTabstops(IFDE_CSSComputedStyle* pStyle, CXFA_PieceLine* pPieceLine);
408 FX_BOOL Layout(int32_t iBlock); 395 FX_BOOL Layout(int32_t iBlock);
409 int32_t CountBlocks() const; 396 int32_t CountBlocks() const;
410 397
411 IXFA_TextProvider* m_pTextProvider; 398 CXFA_TextProvider* m_pTextProvider;
412 CXFA_Node* m_pTextDataNode; 399 CXFA_Node* m_pTextDataNode;
413 FX_BOOL m_bRichText; 400 FX_BOOL m_bRichText;
414 IFX_MEMAllocator* m_pAllocator; 401 IFX_MEMAllocator* m_pAllocator;
415 IFX_RTFBreak* m_pBreak; 402 IFX_RTFBreak* m_pBreak;
416 CXFA_LoaderContext* m_pLoader; 403 CXFA_LoaderContext* m_pLoader;
417 int32_t m_iLines; 404 int32_t m_iLines;
418 FX_FLOAT m_fMaxWidth; 405 FX_FLOAT m_fMaxWidth;
419 CXFA_TextParser m_textParser; 406 CXFA_TextParser m_textParser;
420 CXFA_PieceLineArray m_pieceLines; 407 CXFA_PieceLineArray m_pieceLines;
421 CXFA_TextTabstopsContext* m_pTabstopContext; 408 CXFA_TextTabstopsContext* m_pTabstopContext;
422 FX_BOOL m_bBlockContinue; 409 FX_BOOL m_bBlockContinue;
423 }; 410 };
424 411
425 #endif // XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ 412 #endif // XFA_FXFA_APP_XFA_TEXTLAYOUT_H_
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_rendercontext.cpp ('k') | xfa/fxfa/app/xfa_textlayout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698