• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  // Copyright 2014 PDFium Authors. All rights reserved.
2  // Use of this source code is governed by a BSD-style license that can be
3  // found in the LICENSE file.
4  
5  // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6  
7  #ifndef CORE_INCLUDE_REFLOW_FPDF_LAYOUT_H_
8  #define CORE_INCLUDE_REFLOW_FPDF_LAYOUT_H_
9  
10  class IPDF_LayoutElement;
11  class IPDF_LayoutProcessor;
12  class IPDF_LayoutProvider;
13  typedef enum {
14      LayoutUnknown,
15      LayoutArifact,
16      LayoutDocument,
17      LayoutPart,
18      LayoutArt,
19      LayoutSect,
20      LayoutDiv,
21      LayoutBlockQuote,
22      LayoutCaption,
23      LayoutTOC,
24      LayoutTOCI,
25      LayoutIndex,
26      LayoutNonStruct,
27      LayoutPrivate,
28      LayoutParagraph,
29      LayoutHeading,
30      LayoutHeading1,
31      LayoutHeading2,
32      LayoutHeading3,
33      LayoutHeading4,
34      LayoutHeading5,
35      LayoutHeading6,
36      LayoutList,
37      LayoutListItem,
38      LayoutListLabel,
39      LayoutListBody,
40      LayoutTable,
41      LayoutTableRow,
42      LayoutTableHeaderCell,
43      LayoutTableDataCell,
44      LayoutTableHeaderGroup,
45      LayoutTableBodyGroup,
46      LayoutTableFootGroup,
47      LayoutSpan,
48      LayoutQuote,
49      LayoutNote,
50      LayoutReference,
51      LayoutBibEntry,
52      LayoutCode,
53      LayoutLink,
54      LayoutAnnot,
55      LayoutRuby,
56      LayoutRubyBase,
57      LayoutRubyAnnot,
58      LayoutRubyPunc,
59      LayoutWarichu,
60      LayoutWarichuText,
61      LayoutWarichuPunc,
62      LayoutFigure,
63      LayoutFormula,
64      LayoutForm,
65  } LayoutType;
66  typedef enum {
67      LayoutArtifactType,
68      LayoutArtifactAttached,
69      LayoutArtifactSubType,
70      LayoutPlacement,
71      LayoutWritingMode,
72      LayoutBackgroundColor,
73      LayoutBorderColor,
74      LayoutBorderStyle,
75      LayoutBorderThickness,
76      LayoutPadding,
77      LayoutColor,
78      LayoutSpaceBefore,
79      LayoutSpaceAfter,
80      LayoutStartIndent,
81      LayoutEndIndent,
82      LayoutTextIndent,
83      LayoutTextAlign,
84      LayoutBBox,
85      LayoutWidth,
86      LayoutHeight,
87      LayoutBlockAlign,
88      LayoutInlineAlign,
89      LayoutTBorderStyle,
90      LayoutTPadding,
91      LayoutBaselineShift,
92      LayoutLineHeight,
93      LayoutTextDecorationColor,
94      LayoutTextDecorationThickness,
95      LayoutTextDecorationType,
96      LayoutRubyAlign,
97      LayoutRubyPosition,
98      LayoutGlyphOrientationVertical,
99      LayoutColumnCount,
100      LayoutColumnGap,
101      LayoutColumnWidths,
102      LayoutListNumbering,
103      LayoutFieldRole,
104      LayoutFieldChecked,
105      LayoutFieldDesc,
106      LayoutRowSpan,
107      LayoutColSpan,
108      LayoutTableHeaders,
109      LayoutTableHeaderScope,
110      LayoutTableSummary,
111  } LayoutAttr;
112  typedef enum {
113      LayoutInvalid = 0,
114      LayoutBlock,
115      LayoutInline,
116      LayoutBefore,
117      LayoutAfter,
118      LayoutStart,
119      LayoutEnd,
120      LayoutLrTb,
121      LayoutRlTb,
122      LayoutTbRl,
123      LayoutNone,
124      LayoutHidden,
125      LayoutDotted,
126      LayoutDashed,
127      LayoutSolid,
128      LayoutDouble,
129      LayoutGroove,
130      LayoutRidge,
131      LayoutInset,
132      LayoutOutset,
133      LayoutNormal,
134      LayoutAuto,
135      LayoutCenter,
136      LayoutJustify,
137      LayoutMiddle,
138      LayoutUnderline,
139      LayoutOverline,
140      LayoutLineThrough,
141      LayoutDistribute,
142      LayoutMinus90Degree,
143      LayoutZeroDegree,
144      Layout90Degree,
145      Layout180Degree,
146      Layout270Degree,
147      LayoutDisc,
148      LayoutCircle,
149      LayoutSquare,
150      LayoutDecimal,
151      LayoutUpperRoman,
152      LayoutLowerRoman,
153      LayoutUpperAlpha,
154      LayoutLowerAlpha,
155      LayoutRB,
156      LayoutCB,
157      LayoutPB,
158      LayoutTV,
159      LayoutOn,
160      LayoutOff,
161      LayoutNeutral,
162      LayoutRow,
163      LayoutColumn,
164      LayoutBoth,
165      LayoutLeft,
166      LayoutTop,
167      LayoutBottom,
168      LayoutRight,
169      LayoutPagination,
170      LayoutLayout,
171      LayoutPage,
172      LayoutBackground,
173      LayoutHeader,
174      LayoutFooter,
175      LayoutWatermark,
176  } LayoutEnum;
177  class IPDF_LayoutElement
178  {
179  public:
180  
~IPDF_LayoutElement()181      virtual ~IPDF_LayoutElement() {};
182  
183  
184      virtual LayoutType	GetType() = 0;
185  
186      virtual int		CountAttrValues(LayoutAttr attr_type) = 0;
187  
188  
189      virtual LayoutEnum	GetEnumAttr(LayoutAttr attr_type, int index = 0) = 0;
190  
191      virtual FX_FLOAT	GetNumberAttr(LayoutAttr attr_type, int index = 0) = 0;
192  
193      virtual FX_COLORREF	GetColorAttr(LayoutAttr attr_type, int index = 0) = 0;
194  
195  
196      virtual int		CountChildren() = 0;
197  
198  
199      virtual IPDF_LayoutElement* GetChild(int index) = 0;
200  
201  
202      virtual IPDF_LayoutElement* GetParent() = 0;
203  
204  
205      virtual int		CountObjects() = 0;
206  
207      virtual CPDF_PageObject*	GetObject(int index) = 0;
208  };
209  typedef enum {
210      LayoutReady,
211      LayoutFinished,
212      LayoutToBeContinued,
213      LayoutError
214  } LayoutStatus;
215  #define RF_PARSER_IMAGE		0x1
216  #define RF_PARSER_DEBUGINFO	0x2
217  #define RF_PARSER_PAGEMODE	0x4
218  #define RF_PARSER_READERORDER	0x8
219  class IPDF_LayoutProcessor
220  {
221  public:
222  
~IPDF_LayoutProcessor()223      virtual ~IPDF_LayoutProcessor() {};
224  
225      static IPDF_LayoutProcessor* Create_LayoutProcessor_Reflow(FX_FLOAT TopIndent, FX_FLOAT fWidth, FX_FLOAT fHeight, void* pReflowedPage, int flags, FX_FLOAT lineSpace = 0);
226  
227      static IPDF_LayoutProcessor* Create_LayoutProcessor_2HTML(FX_LPCSTR fileName);
228  
229      virtual LayoutStatus	StartProcess(IPDF_LayoutElement* pElement, IFX_Pause* pPause, const CFX_AffineMatrix* pPDFMatrix = NULL) = 0;
230  
231      virtual LayoutStatus	Continue() = 0;
232      virtual int				GetPosition() = 0;
233  };
234  #define LP_Lang_Unknow	 		0x0
235  #define LP_Lang_English	 		0x1
236  #define LP_Lang_French			0x2
237  #define LP_Lang_Italian			0x4
238  #define LP_Lang_German			0x8
239  #define LP_Lang_Spanish			0x10
240  #define LP_Lang_Polish			0x20
241  #define LP_Lang_Russian			0x40
242  #define LP_Lang_ChinesePRC		0x80
243  #define LP_Lang_ChineseTaiwan	0x100
244  #define LP_Lang_Japanese		0x200
245  #define LP_Lang_Korean			0x400
246  #define LP_Lang_Portuguese		0x800
247  #define LP_Lang_Turkish			0x1000
248  #define LP_Lang_Dutch			0x2000
249  typedef struct _LayoutProviderStyle {
_LayoutProviderStyle_LayoutProviderStyle250      _LayoutProviderStyle()
251      {
252          m_Language = LP_Lang_Unknow;
253          m_bIgnoreInvisibleText = TRUE;
254      }
255      FX_INT32	m_Language;
256      FX_BOOL		m_bIgnoreInvisibleText;
257  } LAYOUTPROVIDER_STYLE;
258  class IPDF_LayoutProvider
259  {
260  public:
261  
~IPDF_LayoutProvider()262      virtual ~IPDF_LayoutProvider() {};
263  
264      static IPDF_LayoutProvider* Create_LayoutProvider_TaggedPDF(CPDF_PageObjects* pPageObjs);
265  
266      static IPDF_LayoutProvider* Create_LayoutProvider_AutoReflow(CPDF_PageObjects* pPageObjs, FX_BOOL bReadOrder);
267  
268      virtual void			SetLayoutProviderStyle(LAYOUTPROVIDER_STYLE Style) = 0;
269  
270  
271  
272  
273      virtual LayoutStatus	StartLoad(IFX_Pause* pPause = NULL) = 0;
274  
275      virtual LayoutStatus	Continue() = 0;
276      virtual int				GetPosition() = 0;
277  
278  
279      virtual IPDF_LayoutElement* GetRoot() = 0;
280  };
281  #endif  // CORE_INCLUDE_REFLOW_FPDF_LAYOUT_H_
282