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