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