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_REFLOWENGINE_H_ 8 #define CORE_INCLUDE_REFLOW_REFLOWENGINE_H_ 9 10 #include "../fpdfapi/fpdf_pageobj.h" 11 #include "../fpdfapi/fpdf_render.h" 12 #include "../fpdfdoc/fpdf_tagged.h" 13 #include "../fpdftext/fpdf_text.h" 14 #include "fpdf_layout.h" 15 16 class IPDF_ReflowedPage 17 { 18 public: 19 static IPDF_ReflowedPage* Create(); 20 ~IPDF_ReflowedPage()21 virtual ~IPDF_ReflowedPage() {} 22 virtual CFX_PrivateData* GetPrivateDataCtrl() = 0; 23 24 25 virtual void GetDisplayMatrix(CFX_AffineMatrix& matrix, FX_INT32 xPos, FX_INT32 yPos, FX_INT32 xSize, FX_INT32 ySize, FX_INT32 iRotate, const CFX_AffineMatrix* pPageMatrix) = 0; 26 virtual FX_FLOAT GetPageHeight() = 0; 27 virtual FX_FLOAT GetPageWidth() = 0; 28 virtual void FocusGetData(const CFX_AffineMatrix matrix, FX_INT32 x, FX_INT32 y, CFX_ByteString& str) = 0; 29 virtual FX_BOOL FocusGetPosition(const CFX_AffineMatrix matrix, CFX_ByteString str, FX_INT32& x, FX_INT32& y) = 0; 30 }; 31 typedef struct _RF_ParseStyle { _RF_ParseStyle_RF_ParseStyle32 _RF_ParseStyle() 33 { 34 m_LineSpace = 0; 35 }; 36 FX_FLOAT m_LineSpace; 37 } RF_ParseStyle; 38 class IPDF_ProgressiveReflowPageParser 39 { 40 public: 41 static IPDF_ProgressiveReflowPageParser* Create(); 42 static FX_BOOL IsTaggedPage(CPDF_PageObjects*pPage); 43 ~IPDF_ProgressiveReflowPageParser()44 virtual ~IPDF_ProgressiveReflowPageParser() {} 45 typedef enum { Ready, ToBeContinued, Done, Failed } ParseStatus; 46 47 virtual ParseStatus GetStatus() = 0; 48 virtual void SetParserStyle(RF_ParseStyle style) = 0; 49 virtual void Start(IPDF_ReflowedPage* pReflowPage, CPDF_Page* pPage, FX_FLOAT TopIndent, FX_FLOAT fWidth, FX_FLOAT fHeight, IFX_Pause* pPause, int flags) = 0; 50 virtual void Continue(IFX_Pause* pPause) = 0; 51 52 virtual int GetPosition() = 0; 53 54 55 virtual void Clear() = 0; 56 }; 57 class IPDF_ProgressiveReflowPageRender 58 { 59 public: 60 static IPDF_ProgressiveReflowPageRender* Create(); 61 ~IPDF_ProgressiveReflowPageRender()62 virtual ~IPDF_ProgressiveReflowPageRender() {} 63 typedef enum { Ready, ToBeContinued, Waiting, Done, Failed } RenderStatus; 64 65 virtual RenderStatus GetStatus() = 0; 66 67 68 virtual void Start(IPDF_ReflowedPage* pReflowPage, CFX_RenderDevice* pDevice, const CFX_AffineMatrix* pMatrix, IFX_Pause* pPause, int DitherBits ) = 0; 69 virtual void Continue(IFX_Pause* pPause) = 0; 70 virtual int GetPosition() = 0; 71 72 73 virtual void Clear() = 0; 74 }; 75 IPDF_ReflowedPage* Create_ReflowPage(); 76 IPDF_ProgressiveReflowPageParser* Create_ReflowPageParser(); 77 IPDF_ProgressiveReflowPageRender* Create_ReflowPageRender(); 78 79 #endif // CORE_INCLUDE_REFLOW_REFLOWENGINE_H_ 80