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 _REFLOWED_PAGE_H | 7 #ifndef _REFLOWED_PAGE_H |
8 #define _REFLOWED_PAGE_H | 8 #define _REFLOWED_PAGE_H |
9 #include "../../include/reflow/reflowengine.h" | 9 #include "../../include/reflow/reflowengine.h" |
10 #define GET_SIGNED(a) ( (a)>0 ? a/a : (a==0 ? 0 : -a/a) ) | 10 #define GET_SIGNED(a) ( (a)>0 ? a/a : (a==0 ? 0 : -a/a) ) |
11 class CRF_Data; | 11 class CRF_Data; |
12 class CRF_LineData; | 12 class CRF_LineData; |
13 class CRF_CharData; | 13 class CRF_CharData; |
14 class CRF_PathData; | 14 class CRF_PathData; |
15 class CRF_ImageData; | 15 class CRF_ImageData; |
16 class CRF_Table; | 16 class CRF_Table; |
17 class CRF_AttrOperation; | 17 class CRF_AttrOperation; |
18 class CRF_OperationDate; | 18 class CRF_OperationDate; |
19 class CPDF_ReflowedPage; | 19 class CPDF_ReflowedPage; |
20 class CPDF_Rect; | 20 class CPDF_Rect; |
21 class CFX_Object; | |
22 typedef CFX_SegmentedArray<CRF_Data*> CRF_DataPtrArray; | 21 typedef CFX_SegmentedArray<CRF_Data*> CRF_DataPtrArray; |
23 class CRF_CharState; | 22 class CRF_CharState; |
24 typedef CFX_SegmentedArray<CRF_CharState> CRF_CharStateArray; | 23 typedef CFX_SegmentedArray<CRF_CharState> CRF_CharStateArray; |
25 #define SST_GE 1 | 24 #define SST_GE 1 |
26 #define SST_BLSE 2 | 25 #define SST_BLSE 2 |
27 #define SST_ILSE 3 | 26 #define SST_ILSE 3 |
28 #define SST_IE 4 | 27 #define SST_IE 4 |
29 class CPDF_LayoutProcessor_Reflow : public IPDF_LayoutProcessor, public CFX_Obje
ct | 28 class CPDF_LayoutProcessor_Reflow : public IPDF_LayoutProcessor |
30 { | 29 { |
31 public: | 30 public: |
32 CPDF_LayoutProcessor_Reflow(); | 31 CPDF_LayoutProcessor_Reflow(); |
33 ~CPDF_LayoutProcessor_Reflow(); | 32 ~CPDF_LayoutProcessor_Reflow(); |
34 void Init(FX_FLOAT TopIndent, FX_FLOAT fWidth, FX_FLOAT fHeight, CPDF_Reflow
edPage* pReflowedPage, int flags, FX_FLOAT lineSpace); | 33 void Init(FX_FLOAT TopIndent, FX_FLOAT fWidth, FX_FLOAT fHeight, CPDF_Reflow
edPage* pReflowedPage, int flags, FX_FLOAT lineSpace); |
35 | 34 |
36 LayoutStatus StartProcess(IPDF_LayoutElement* pElement, IFX_Pause* pP
ause, const CFX_AffineMatrix* pPDFMatrix = NULL); | 35 LayoutStatus StartProcess(IPDF_LayoutElement* pElement, IFX_Pause* pP
ause, const CFX_AffineMatrix* pPDFMatrix = NULL); |
37 LayoutStatus Continue(); | 36 LayoutStatus Continue(); |
38 int GetPosition(); | 37 int GetPosition(); |
39 protected: | 38 protected: |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 FX_FLOAT m_PosX; | 98 FX_FLOAT m_PosX; |
100 FX_FLOAT m_PosY; | 99 FX_FLOAT m_PosY; |
101 FX_FLOAT m_CellWidth; | 100 FX_FLOAT m_CellWidth; |
102 FX_FLOAT m_CellHeight; | 101 FX_FLOAT m_CellHeight; |
103 int m_RowSpan; | 102 int m_RowSpan; |
104 int m_ColSpan; | 103 int m_ColSpan; |
105 LayoutEnum m_BlockAlign; | 104 LayoutEnum m_BlockAlign; |
106 LayoutEnum m_InlineAlign; | 105 LayoutEnum m_InlineAlign; |
107 }; | 106 }; |
108 typedef CFX_ArrayTemplate<RF_TableCell*> CRF_TableCellArray; | 107 typedef CFX_ArrayTemplate<RF_TableCell*> CRF_TableCellArray; |
109 class CRF_Table : public CFX_Object | 108 class CRF_Table |
110 { | 109 { |
111 public: | 110 public: |
112 CRF_Table() | 111 CRF_Table() |
113 { | 112 { |
114 m_TableWidth = 0; | 113 m_TableWidth = 0; |
115 m_nCol = 0; | 114 m_nCol = 0; |
116 } | 115 } |
117 CRF_TableCellArray m_pCellArray; | 116 CRF_TableCellArray m_pCellArray; |
118 CFX_WordArray m_nCell; | 117 CFX_WordArray m_nCell; |
119 int m_nCol; | 118 int m_nCol; |
120 FX_FLOAT m_TableWidth; | 119 FX_FLOAT m_TableWidth; |
121 FX_FLOAT m_ReflowPageHeight; | 120 FX_FLOAT m_ReflowPageHeight; |
122 }; | 121 }; |
123 class CRF_CharState : public CFX_Object | 122 class CRF_CharState |
124 { | 123 { |
125 public: | 124 public: |
126 CPDF_Font* m_pFont; | 125 CPDF_Font* m_pFont; |
127 FX_ARGB m_Color; | 126 FX_ARGB m_Color; |
128 FX_BOOL m_bVert; | 127 FX_BOOL m_bVert; |
129 FX_FLOAT m_fFontSize; | 128 FX_FLOAT m_fFontSize; |
130 FX_FLOAT m_fAscent; | 129 FX_FLOAT m_fAscent; |
131 FX_FLOAT m_fDescent; | 130 FX_FLOAT m_fDescent; |
132 | 131 |
133 CPDF_TextObject* m_pTextObj; | 132 CPDF_TextObject* m_pTextObj; |
134 }; | 133 }; |
135 class CRF_PageInfo : public CFX_Object | 134 class CRF_PageInfo |
136 { | 135 { |
137 public: | 136 public: |
138 CRF_PageInfo(CPDF_PageObject* pPageObj, CRF_PageInfo* pParent = NULL) | 137 CRF_PageInfo(CPDF_PageObject* pPageObj, CRF_PageInfo* pParent = NULL) |
139 : m_pPageObj(pPageObj) , m_pParent(pParent) | 138 : m_pPageObj(pPageObj) , m_pParent(pParent) |
140 { | 139 { |
141 } | 140 } |
142 CPDF_PageObject* GetPageObj() | 141 CPDF_PageObject* GetPageObj() |
143 { | 142 { |
144 return m_pPageObj; | 143 return m_pPageObj; |
145 } | 144 } |
146 CPDF_Dictionary* GetFormDict() | 145 CPDF_Dictionary* GetFormDict() |
147 { | 146 { |
148 if (NULL == m_pParent) { | 147 if (NULL == m_pParent) { |
149 return NULL; | 148 return NULL; |
150 } | 149 } |
151 CPDF_PageObject* pParentObj = m_pParent->GetPageObj(); | 150 CPDF_PageObject* pParentObj = m_pParent->GetPageObj(); |
152 if (NULL == pParentObj || PDFPAGE_FORM != pParentObj->m_Type) { | 151 if (NULL == pParentObj || PDFPAGE_FORM != pParentObj->m_Type) { |
153 return NULL; | 152 return NULL; |
154 } | 153 } |
155 return ((CPDF_FormObject*)pParentObj)->m_pForm->m_pResources; | 154 return ((CPDF_FormObject*)pParentObj)->m_pForm->m_pResources; |
156 } | 155 } |
157 protected: | 156 protected: |
158 CPDF_PageObject* m_pPageObj; | 157 CPDF_PageObject* m_pPageObj; |
159 CRF_PageInfo* m_pParent; | 158 CRF_PageInfo* m_pParent; |
160 }; | 159 }; |
161 class CPDF_ReflowedPage : public IPDF_ReflowedPage, public CFX_PrivateData, publ
ic CFX_Object | 160 class CPDF_ReflowedPage : public IPDF_ReflowedPage, public CFX_PrivateData |
162 { | 161 { |
163 public: | 162 public: |
164 | 163 |
165 CPDF_ReflowedPage(CFX_GrowOnlyPool* pMemoryPool); | 164 CPDF_ReflowedPage(CFX_GrowOnlyPool* pMemoryPool); |
166 ~CPDF_ReflowedPage(); | 165 ~CPDF_ReflowedPage(); |
167 CFX_PrivateData* GetPrivateDataCtrl() | 166 CFX_PrivateData* GetPrivateDataCtrl() |
168 { | 167 { |
169 return this; | 168 return this; |
170 }; | 169 }; |
171 void GetDisplayMatrix(CFX_AffineMatrix& matrix, FX_INT32 xPos
, FX_INT32 yPos, FX_INT32 xSize, FX_INT32 ySize, FX_INT32 iRotate, const CFX_Aff
ineMatrix* pPageMatrix); | 170 void GetDisplayMatrix(CFX_AffineMatrix& matrix, FX_INT32 xPos
, FX_INT32 yPos, FX_INT32 xSize, FX_INT32 ySize, FX_INT32 iRotate, const CFX_Aff
ineMatrix* pPageMatrix); |
(...skipping 13 matching lines...) Expand all Loading... |
185 CFX_GrowOnlyPool* m_pMemoryPool; | 184 CFX_GrowOnlyPool* m_pMemoryPool; |
186 FX_BOOL m_bCreateMemoryPool; | 185 FX_BOOL m_bCreateMemoryPool; |
187 CPDF_Page* m_pPDFPage; | 186 CPDF_Page* m_pPDFPage; |
188 FX_BOOL RetainPageObjsMemberShip(); | 187 FX_BOOL RetainPageObjsMemberShip(); |
189 void MarkPageObjMemberShip(CPDF_PageO
bject* pObj, CRF_PageInfo* pParent); | 188 void MarkPageObjMemberShip(CPDF_PageO
bject* pObj, CRF_PageInfo* pParent); |
190 void ReleasePageObjsMemberShip(); | 189 void ReleasePageObjsMemberShip(); |
191 CPDF_Dictionary* GetFormResDict(CPDF_PageObject* pObj); | 190 CPDF_Dictionary* GetFormResDict(CPDF_PageObject* pObj); |
192 | 191 |
193 CFX_MapPtrToPtr* m_pPageInfos; | 192 CFX_MapPtrToPtr* m_pPageInfos; |
194 }; | 193 }; |
195 class CPDF_ProgressiveReflowPageParser : public IPDF_ProgressiveReflowPageParser
, public CFX_Object | 194 class CPDF_ProgressiveReflowPageParser : public IPDF_ProgressiveReflowPageParser |
196 { | 195 { |
197 public: | 196 public: |
198 CPDF_ProgressiveReflowPageParser(); | 197 CPDF_ProgressiveReflowPageParser(); |
199 ~CPDF_ProgressiveReflowPageParser() ; | 198 ~CPDF_ProgressiveReflowPageParser() ; |
200 void Init(); | 199 void Init(); |
201 | 200 |
202 ParseStatus GetStatus() | 201 ParseStatus GetStatus() |
203 { | 202 { |
204 return m_Status; | 203 return m_Status; |
205 }; | 204 }; |
(...skipping 14 matching lines...) Expand all Loading... |
220 IFX_Pause* m_pPause; | 219 IFX_Pause* m_pPause; |
221 CPDF_ReflowedPage* m_pReflowPage; | 220 CPDF_ReflowedPage* m_pReflowPage; |
222 FX_FLOAT m_TopIndent; | 221 FX_FLOAT m_TopIndent; |
223 FX_FLOAT m_ReflowedWidth; | 222 FX_FLOAT m_ReflowedWidth; |
224 FX_FLOAT m_fScreenHeight; | 223 FX_FLOAT m_fScreenHeight; |
225 IPDF_LayoutProvider* m_pProvider; | 224 IPDF_LayoutProvider* m_pProvider; |
226 IPDF_LayoutProcessor* m_pReflowEngine; | 225 IPDF_LayoutProcessor* m_pReflowEngine; |
227 int m_nObjProcessed; | 226 int m_nObjProcessed; |
228 int m_flags; | 227 int m_flags; |
229 }; | 228 }; |
230 class CPDF_ProgressiveReflowPageRender : public IPDF_ProgressiveReflowPageRender
, public CFX_Object | 229 class CPDF_ProgressiveReflowPageRender : public IPDF_ProgressiveReflowPageRender |
231 { | 230 { |
232 public: | 231 public: |
233 CPDF_ProgressiveReflowPageRender(); | 232 CPDF_ProgressiveReflowPageRender(); |
234 ~CPDF_ProgressiveReflowPageRender() ; | 233 ~CPDF_ProgressiveReflowPageRender() ; |
235 | 234 |
236 RenderStatus GetStatus() | 235 RenderStatus GetStatus() |
237 { | 236 { |
238 return m_Status; | 237 return m_Status; |
239 }; | 238 }; |
240 | 239 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 return false; | 284 return false; |
286 } | 285 } |
287 return true; | 286 return true; |
288 }; | 287 }; |
289 }; | 288 }; |
290 #define TYPE_UNKNOW 0 | 289 #define TYPE_UNKNOW 0 |
291 #define TYPE_TEXT 1 | 290 #define TYPE_TEXT 1 |
292 #define TYPE_PATH 2 | 291 #define TYPE_PATH 2 |
293 #define TYPE_IMAGE 3 | 292 #define TYPE_IMAGE 3 |
294 #define TYPE_LINE 4 | 293 #define TYPE_LINE 4 |
295 class CRF_Data : public CFX_Object | 294 class CRF_Data |
296 { | 295 { |
297 public: | 296 public: |
298 typedef enum {Unknow, Text, Image, Path, Line, paragraph} RF_DataType; | 297 typedef enum {Unknow, Text, Image, Path, Line, paragraph} RF_DataType; |
299 CRF_Data() | 298 CRF_Data() |
300 { | 299 { |
301 m_Type = Unknow; | 300 m_Type = Unknow; |
302 m_Width = 0; | 301 m_Width = 0; |
303 m_PosY = 0; | 302 m_PosY = 0; |
304 m_PosX = 0; | 303 m_PosX = 0; |
305 m_Height = 0; | 304 m_Height = 0; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 ~CRF_PathData() {}; | 362 ~CRF_PathData() {}; |
364 FX_BOOL m_bDecoration; | 363 FX_BOOL m_bDecoration; |
365 CPDF_Path m_pPathData; | 364 CPDF_Path m_pPathData; |
366 CFX_AffineMatrix m_pPath2Device; | 365 CFX_AffineMatrix m_pPath2Device; |
367 CPDF_GraphState m_pGraphState; | 366 CPDF_GraphState m_pGraphState; |
368 FX_ARGB m_fill_argb; | 367 FX_ARGB m_fill_argb; |
369 FX_ARGB m_stroke_argb; | 368 FX_ARGB m_stroke_argb; |
370 int m_fill_mode; | 369 int m_fill_mode; |
371 }; | 370 }; |
372 #endif | 371 #endif |
OLD | NEW |