summaryrefslogtreecommitdiff
path: root/xfa/include/fxfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/include/fxfa')
-rw-r--r--xfa/include/fxfa/fxfa.h385
-rw-r--r--xfa/include/fxfa/xfa_checksum.h74
-rw-r--r--xfa/include/fxfa/xfa_ffapp.h81
-rw-r--r--xfa/include/fxfa/xfa_ffdoc.h65
-rw-r--r--xfa/include/fxfa/xfa_ffdochandler.h53
-rw-r--r--xfa/include/fxfa/xfa_ffdocview.h172
-rw-r--r--xfa/include/fxfa/xfa_ffpageview.h113
-rw-r--r--xfa/include/fxfa/xfa_ffwidgethandler.h171
-rw-r--r--xfa/include/fxfa/xfa_fontmgr.h99
-rw-r--r--xfa/include/fxfa/xfa_rendercontext.h36
10 files changed, 911 insertions, 338 deletions
diff --git a/xfa/include/fxfa/fxfa.h b/xfa/include/fxfa/fxfa.h
index c55ddf25f0..624502aa83 100644
--- a/xfa/include/fxfa/fxfa.h
+++ b/xfa/include/fxfa/fxfa.h
@@ -14,40 +14,17 @@
class CFX_Graphics;
class CPDF_Document;
+class CXFA_FFPageView;
class CXFA_Node;
class CXFA_NodeList;
class CXFA_WidgetAcc;
class IFWL_AdapterTimerMgr;
class IFX_Font;
-class IXFA_App;
class IXFA_AppProvider;
-class IXFA_ChecksumContext;
-class IXFA_DocHandler;
class IXFA_DocProvider;
-class IXFA_DocView;
-class IXFA_FontMgr;
-class IXFA_MenuHandler;
-class IXFA_PageView;
class IXFA_WidgetAccIterator;
-class IXFA_WidgetHandler;
class IXFA_WidgetIterator;
-class IXFA_Doc {
- public:
- virtual ~IXFA_Doc() {}
-
- protected:
- IXFA_Doc() {}
-};
-
-class IXFA_Widget {
- public:
- virtual ~IXFA_Widget() {}
-
- protected:
- IXFA_Widget() {}
-};
-
#define XFA_MBICON_Error 0
#define XFA_MBICON_Warning 1
#define XFA_MBICON_Question 2
@@ -288,62 +265,7 @@ class IXFA_AppProvider {
FX_BOOL bOpen = TRUE) = 0;
virtual IFWL_AdapterTimerMgr* GetTimerMgr() = 0;
};
-class IXFA_FontMgr {
- public:
- static IXFA_FontMgr* CreateDefault();
- virtual ~IXFA_FontMgr();
-
- virtual IFX_Font* GetFont(IXFA_Doc* hDoc,
- const CFX_WideStringC& wsFontFamily,
- uint32_t dwFontStyles,
- uint16_t wCodePage = 0xFFFF) = 0;
- virtual IFX_Font* GetDefaultFont(IXFA_Doc* hDoc,
- const CFX_WideStringC& wsFontFamily,
- uint32_t dwFontStyles,
- uint16_t wCodePage = 0xFFFF) = 0;
-};
-class IXFA_App {
- public:
- static IXFA_App* Create(IXFA_AppProvider* pProvider);
- virtual ~IXFA_App();
- virtual IXFA_DocHandler* GetDocHandler() = 0;
- virtual IXFA_Doc* CreateDoc(IXFA_DocProvider* pProvider,
- IFX_FileRead* pStream,
- FX_BOOL bTakeOverFile = TRUE) = 0;
- virtual IXFA_Doc* CreateDoc(IXFA_DocProvider* pProvider,
- CPDF_Document* pPDFDoc) = 0;
- virtual IXFA_AppProvider* GetAppProvider() = 0;
- virtual void SetDefaultFontMgr(IXFA_FontMgr* pFontMgr) = 0;
- virtual IXFA_MenuHandler* GetMenuHandler() = 0;
-};
-class IXFA_MenuHandler {
- public:
- virtual ~IXFA_MenuHandler() {}
-
- virtual FX_BOOL CanCopy(IXFA_Widget* hWidget) = 0;
- virtual FX_BOOL CanCut(IXFA_Widget* hWidget) = 0;
- virtual FX_BOOL CanPaste(IXFA_Widget* hWidget) = 0;
- virtual FX_BOOL CanSelectAll(IXFA_Widget* hWidget) = 0;
- virtual FX_BOOL CanDelete(IXFA_Widget* hWidget) = 0;
- virtual FX_BOOL CanDeSelect(IXFA_Widget* hWidget) = 0;
- virtual FX_BOOL Copy(IXFA_Widget* hWidget, CFX_WideString& wsText) = 0;
- virtual FX_BOOL Cut(IXFA_Widget* hWidget, CFX_WideString& wsText) = 0;
- virtual FX_BOOL Paste(IXFA_Widget* hWidget, const CFX_WideString& wsText) = 0;
- virtual FX_BOOL SelectAll(IXFA_Widget* hWidget) = 0;
- virtual FX_BOOL Delete(IXFA_Widget* hWidget) = 0;
- virtual FX_BOOL DeSelect(IXFA_Widget* hWidget) = 0;
- virtual FX_BOOL CanUndo(IXFA_Widget* hWidget) = 0;
- virtual FX_BOOL CanRedo(IXFA_Widget* hWidget) = 0;
- virtual FX_BOOL Undo(IXFA_Widget* hWidget) = 0;
- virtual FX_BOOL Redo(IXFA_Widget* hWidget) = 0;
- virtual FX_BOOL GetSuggestWords(IXFA_Widget* hWidget,
- CFX_PointF pointf,
- std::vector<CFX_ByteString>& sSuggest) = 0;
- virtual FX_BOOL ReplaceSpellCheckWord(IXFA_Widget* hWidget,
- CFX_PointF pointf,
- const CFX_ByteStringC& bsReplace) = 0;
-};
#define XFA_INVALIDATE_AllPages 0x00000000
#define XFA_INVALIDATE_CurrentPage 0x00000001
#define XFA_PRINTOPT_ShowDialog 0x00000001
@@ -365,65 +287,65 @@ class IXFA_DocProvider {
public:
virtual ~IXFA_DocProvider() {}
- virtual void SetChangeMark(IXFA_Doc* hDoc) = 0;
- virtual void InvalidateRect(IXFA_PageView* pPageView,
+ virtual void SetChangeMark(CXFA_FFDoc* hDoc) = 0;
+ virtual void InvalidateRect(CXFA_FFPageView* pPageView,
const CFX_RectF& rt,
uint32_t dwFlags = 0) = 0;
- virtual void DisplayCaret(IXFA_Widget* hWidget,
+ virtual void DisplayCaret(CXFA_FFWidget* hWidget,
FX_BOOL bVisible,
const CFX_RectF* pRtAnchor) = 0;
- virtual FX_BOOL GetPopupPos(IXFA_Widget* hWidget,
+ virtual FX_BOOL GetPopupPos(CXFA_FFWidget* hWidget,
FX_FLOAT fMinPopup,
FX_FLOAT fMaxPopup,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup) = 0;
- virtual FX_BOOL PopupMenu(IXFA_Widget* hWidget,
+ virtual FX_BOOL PopupMenu(CXFA_FFWidget* hWidget,
CFX_PointF ptPopup,
const CFX_RectF* pRectExclude = NULL) = 0;
- virtual void PageViewEvent(IXFA_PageView* pPageView, uint32_t dwFlags) = 0;
- virtual void WidgetEvent(IXFA_Widget* hWidget,
+ virtual void PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags) = 0;
+ virtual void WidgetEvent(CXFA_FFWidget* hWidget,
CXFA_WidgetAcc* pWidgetData,
uint32_t dwEvent,
void* pParam = NULL,
void* pAdditional = NULL) = 0;
- virtual FX_BOOL RenderCustomWidget(IXFA_Widget* hWidget,
+ virtual FX_BOOL RenderCustomWidget(CXFA_FFWidget* hWidget,
CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
const CFX_RectF& rtUI) {
return FALSE;
}
- virtual int32_t CountPages(IXFA_Doc* hDoc) = 0;
- virtual int32_t GetCurrentPage(IXFA_Doc* hDoc) = 0;
- virtual void SetCurrentPage(IXFA_Doc* hDoc, int32_t iCurPage) = 0;
- virtual FX_BOOL IsCalculationsEnabled(IXFA_Doc* hDoc) = 0;
- virtual void SetCalculationsEnabled(IXFA_Doc* hDoc, FX_BOOL bEnabled) = 0;
- virtual void GetTitle(IXFA_Doc* hDoc, CFX_WideString& wsTitle) = 0;
- virtual void SetTitle(IXFA_Doc* hDoc, const CFX_WideStringC& wsTitle) = 0;
- virtual void ExportData(IXFA_Doc* hDoc,
+ virtual int32_t CountPages(CXFA_FFDoc* hDoc) = 0;
+ virtual int32_t GetCurrentPage(CXFA_FFDoc* hDoc) = 0;
+ virtual void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) = 0;
+ virtual FX_BOOL IsCalculationsEnabled(CXFA_FFDoc* hDoc) = 0;
+ virtual void SetCalculationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) = 0;
+ virtual void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) = 0;
+ virtual void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsTitle) = 0;
+ virtual void ExportData(CXFA_FFDoc* hDoc,
const CFX_WideStringC& wsFilePath,
FX_BOOL bXDP = TRUE) = 0;
- virtual void ImportData(IXFA_Doc* hDoc,
+ virtual void ImportData(CXFA_FFDoc* hDoc,
const CFX_WideStringC& wsFilePath) = 0;
- virtual void GotoURL(IXFA_Doc* hDoc,
+ virtual void GotoURL(CXFA_FFDoc* hDoc,
const CFX_WideStringC& bsURL,
FX_BOOL bAppend = TRUE) = 0;
- virtual FX_BOOL IsValidationsEnabled(IXFA_Doc* hDoc) = 0;
- virtual void SetValidationsEnabled(IXFA_Doc* hDoc, FX_BOOL bEnabled) = 0;
- virtual void SetFocusWidget(IXFA_Doc* hDoc, IXFA_Widget* hWidget) = 0;
- virtual void Print(IXFA_Doc* hDoc,
+ virtual FX_BOOL IsValidationsEnabled(CXFA_FFDoc* hDoc) = 0;
+ virtual void SetValidationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) = 0;
+ virtual void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) = 0;
+ virtual void Print(CXFA_FFDoc* hDoc,
int32_t nStartPage,
int32_t nEndPage,
uint32_t dwOptions) = 0;
- virtual int32_t AbsPageCountInBatch(IXFA_Doc* hDoc) = 0;
- virtual int32_t AbsPageInBatch(IXFA_Doc* hDoc, IXFA_Widget* hWidget) = 0;
- virtual int32_t SheetCountInBatch(IXFA_Doc* hDoc) = 0;
- virtual int32_t SheetInBatch(IXFA_Doc* hDoc, IXFA_Widget* hWidget) = 0;
- virtual int32_t Verify(IXFA_Doc* hDoc,
+ virtual int32_t AbsPageCountInBatch(CXFA_FFDoc* hDoc) = 0;
+ virtual int32_t AbsPageInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) = 0;
+ virtual int32_t SheetCountInBatch(CXFA_FFDoc* hDoc) = 0;
+ virtual int32_t SheetInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) = 0;
+ virtual int32_t Verify(CXFA_FFDoc* hDoc,
CXFA_Node* pSigNode,
FX_BOOL bUsed = TRUE) {
return 0;
}
- virtual FX_BOOL Sign(IXFA_Doc* hDoc,
+ virtual FX_BOOL Sign(CXFA_FFDoc* hDoc,
CXFA_NodeList* pNodeList,
const CFX_WideStringC& wsExpression,
const CFX_WideStringC& wsXMLIdent,
@@ -431,33 +353,33 @@ class IXFA_DocProvider {
FX_BOOL bUsed = TRUE) {
return 0;
}
- virtual CXFA_NodeList* Enumerate(IXFA_Doc* hDoc) { return 0; }
- virtual FX_BOOL Clear(IXFA_Doc* hDoc,
+ virtual CXFA_NodeList* Enumerate(CXFA_FFDoc* hDoc) { return 0; }
+ virtual FX_BOOL Clear(CXFA_FFDoc* hDoc,
CXFA_Node* pSigNode,
FX_BOOL bCleared = TRUE) {
return 0;
}
- virtual void GetURL(IXFA_Doc* hDoc, CFX_WideString& wsDocURL) = 0;
- virtual FX_ARGB GetHighlightColor(IXFA_Doc* hDoc) = 0;
+ virtual void GetURL(CXFA_FFDoc* hDoc, CFX_WideString& wsDocURL) = 0;
+ virtual FX_ARGB GetHighlightColor(CXFA_FFDoc* hDoc) = 0;
- virtual FX_BOOL SubmitData(IXFA_Doc* hDoc, CXFA_Submit submit) = 0;
- virtual FX_BOOL CheckWord(IXFA_Doc* hDoc, const CFX_ByteStringC& sWord) = 0;
- virtual FX_BOOL GetSuggestWords(IXFA_Doc* hDoc,
+ virtual FX_BOOL SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) = 0;
+ virtual FX_BOOL CheckWord(CXFA_FFDoc* hDoc, const CFX_ByteStringC& sWord) = 0;
+ virtual FX_BOOL GetSuggestWords(CXFA_FFDoc* hDoc,
const CFX_ByteStringC& sWord,
std::vector<CFX_ByteString>& sSuggest) = 0;
- virtual FX_BOOL GetPDFScriptObject(IXFA_Doc* hDoc,
+ virtual FX_BOOL GetPDFScriptObject(CXFA_FFDoc* hDoc,
const CFX_ByteStringC& utf8Name,
FXJSE_HVALUE hValue) = 0;
- virtual FX_BOOL GetGlobalProperty(IXFA_Doc* hDoc,
+ virtual FX_BOOL GetGlobalProperty(CXFA_FFDoc* hDoc,
const CFX_ByteStringC& szPropName,
FXJSE_HVALUE hValue) = 0;
- virtual FX_BOOL SetGlobalProperty(IXFA_Doc* hDoc,
+ virtual FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc,
const CFX_ByteStringC& szPropName,
FXJSE_HVALUE hValue) = 0;
- virtual CPDF_Document* OpenPDF(IXFA_Doc* hDoc,
+ virtual CPDF_Document* OpenPDF(CXFA_FFDoc* hDoc,
IFX_FileRead* pFile,
FX_BOOL bTakeOverFile) = 0;
- virtual IFX_FileRead* OpenLinkedFile(IXFA_Doc* hDoc,
+ virtual IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc,
const CFX_WideString& wsLink) = 0;
};
#define XFA_DOCVIEW_View 0x00000000
@@ -471,43 +393,7 @@ class IXFA_DocProvider {
#define XFA_PARSESTATUS_SyntaxErr -1
#define XFA_PARSESTATUS_Ready 0
#define XFA_PARSESTATUS_Done 100
-class IXFA_DocHandler {
- public:
- virtual ~IXFA_DocHandler() {}
-
- virtual void ReleaseDoc(IXFA_Doc* hDoc) = 0;
- virtual IXFA_DocProvider* GetDocProvider(IXFA_Doc* hDoc) = 0;
- virtual uint32_t GetDocType(IXFA_Doc* hDoc) = 0;
- virtual int32_t StartLoad(IXFA_Doc* hDoc) = 0;
- virtual int32_t DoLoad(IXFA_Doc* hDoc, IFX_Pause* pPause = NULL) = 0;
- virtual void StopLoad(IXFA_Doc* hDoc) = 0;
-
- virtual IXFA_DocView* CreateDocView(IXFA_Doc* hDoc, uint32_t dwView = 0) = 0;
-
- virtual int32_t CountPackages(IXFA_Doc* hDoc) = 0;
- virtual void GetPackageName(IXFA_Doc* hDoc,
- int32_t iPackage,
- CFX_WideStringC& wsPackage) = 0;
-
- virtual FX_BOOL SavePackage(IXFA_Doc* hDoc,
- const CFX_WideStringC& wsPackage,
- IFX_FileWrite* pFile,
- IXFA_ChecksumContext* pCSContext = NULL) = 0;
- virtual FX_BOOL CloseDoc(IXFA_Doc* hDoc) = 0;
-
- virtual FX_BOOL ImportData(IXFA_Doc* hDoc,
- IFX_FileRead* pStream,
- FX_BOOL bXDP = TRUE) = 0;
- virtual void SetJSERuntime(IXFA_Doc* hDoc, FXJSE_HRUNTIME hRuntime) = 0;
- virtual FXJSE_HVALUE GetXFAScriptObject(IXFA_Doc* hDoc) = 0;
- virtual XFA_ATTRIBUTEENUM GetRestoreState(IXFA_Doc* hDoc) = 0;
- virtual FX_BOOL RunDocScript(IXFA_Doc* hDoc,
- XFA_SCRIPTTYPE eScriptType,
- const CFX_WideStringC& wsScript,
- FXJSE_HVALUE hRetValue,
- FXJSE_HVALUE hThisObject) = 0;
-};
enum XFA_EVENTTYPE {
XFA_EVENT_Click,
XFA_EVENT_Change,
@@ -601,32 +487,7 @@ class CXFA_EventParam {
enum XFA_WIDGETORDER {
XFA_WIDGETORDER_PreOrder,
};
-class IXFA_DocView {
- public:
- virtual ~IXFA_DocView() {}
- virtual IXFA_Doc* GetDoc() = 0;
- virtual int32_t StartLayout(int32_t iStartPage = 0) = 0;
- virtual int32_t DoLayout(IFX_Pause* pPause = NULL) = 0;
- virtual void StopLayout() = 0;
-
- virtual int32_t GetLayoutStatus() = 0;
- virtual void UpdateDocView() = 0;
- virtual int32_t CountPageViews() = 0;
- virtual IXFA_PageView* GetPageView(int32_t nIndex) = 0;
- virtual IXFA_Widget* GetWidgetByName(const CFX_WideStringC& wsName) = 0;
- virtual CXFA_WidgetAcc* GetWidgetAccByName(const CFX_WideStringC& wsName) = 0;
- virtual void ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc = NULL) = 0;
- virtual int32_t ProcessWidgetEvent(CXFA_EventParam* pParam,
- CXFA_WidgetAcc* pWidgetAcc = NULL) = 0;
- virtual IXFA_WidgetHandler* GetWidgetHandler() = 0;
- virtual IXFA_WidgetIterator* CreateWidgetIterator() = 0;
- virtual IXFA_WidgetAccIterator* CreateWidgetAccIterator(
- XFA_WIDGETORDER eOrder = XFA_WIDGETORDER_PreOrder) = 0;
- virtual IXFA_Widget* GetFocusWidget() = 0;
- virtual void KillFocus() = 0;
- virtual FX_BOOL SetFocus(IXFA_Widget* hWidget) = 0;
-};
#define XFA_TRAVERSEWAY_Tranvalse 0x0001
#define XFA_TRAVERSEWAY_Form 0x0002
#define XFA_WIDGETFILTER_Visible 0x0001
@@ -634,27 +495,7 @@ class IXFA_DocView {
#define XFA_WIDGETFILTER_Printable 0x0020
#define XFA_WIDGETFILTER_Field 0x0100
#define XFA_WIDGETFILTER_AllType 0x0F00
-class IXFA_PageView {
- public:
- virtual ~IXFA_PageView() {}
-
- virtual IXFA_DocView* GetDocView() = 0;
- virtual int32_t GetPageViewIndex() = 0;
- virtual void GetPageViewRect(CFX_RectF& rtPage) = 0;
- virtual void GetDisplayMatrix(CFX_Matrix& mt,
- const CFX_Rect& rtDisp,
- int32_t iRotate) = 0;
-
- virtual int32_t LoadPageView(IFX_Pause* pPause = NULL) = 0;
- virtual void UnloadPageView() = 0;
- virtual IXFA_Widget* GetWidgetByPos(FX_FLOAT fx, FX_FLOAT fy) = 0;
- virtual IXFA_WidgetIterator* CreateWidgetIterator(
- uint32_t dwTraverseWay = XFA_TRAVERSEWAY_Form,
- uint32_t dwWidgetFilter = XFA_WIDGETFILTER_Visible |
- XFA_WIDGETFILTER_Viewable |
- XFA_WIDGETFILTER_AllType) = 0;
-};
class CXFA_RenderOptions {
public:
CXFA_RenderOptions() : m_bPrint(FALSE), m_bHighlight(TRUE) {}
@@ -665,20 +506,7 @@ class CXFA_RenderOptions {
#define XFA_RENDERSTATUS_ToBeContinued 2
#define XFA_RENDERSTATUS_Done 3
#define XFA_RENDERSTATUS_Failed -1
-class IXFA_RenderContext {
- public:
- virtual void Release() = 0;
- virtual int32_t StartRender(IXFA_PageView* pPageView,
- CFX_Graphics* pGS,
- const CFX_Matrix& pMatrix,
- const CXFA_RenderOptions& options) = 0;
- virtual int32_t DoRender(IFX_Pause* pPause = NULL) = 0;
- virtual void StopRender() = 0;
- protected:
- ~IXFA_RenderContext() {}
-};
-IXFA_RenderContext* XFA_RenderContext_Create();
enum XFA_WIDGETTYPE {
XFA_WIDGETTYPE_Barcode,
XFA_WIDGETTYPE_PushButton,
@@ -708,139 +536,20 @@ enum XFA_WIDGETTYPE {
#define XFA_WIDGETSTATUS_Viewable 0x00000010
#define XFA_WIDGETSTATUS_Printable 0x00000020
#define XFA_WIDGETSTATUS_Focused 0x00000100
-class IXFA_WidgetHandler {
- public:
- virtual ~IXFA_WidgetHandler() {}
-
- virtual IXFA_Widget* CreateWidget(IXFA_Widget* hParent,
- XFA_WIDGETTYPE eType,
- IXFA_Widget* hBefore = NULL) = 0;
- virtual IXFA_PageView* GetPageView(IXFA_Widget* hWidget) = 0;
- virtual void GetRect(IXFA_Widget* hWidget, CFX_RectF& rt) = 0;
- virtual uint32_t GetStatus(IXFA_Widget* hWidget) = 0;
- virtual FX_BOOL GetBBox(IXFA_Widget* hWidget,
- CFX_RectF& rtBox,
- uint32_t dwStatus,
- FX_BOOL bDrawFocus = FALSE) = 0;
- virtual CXFA_WidgetAcc* GetDataAcc(IXFA_Widget* hWidget) = 0;
-
- virtual void GetName(IXFA_Widget* hWidget,
- CFX_WideString& wsName,
- int32_t iNameType = 0) = 0;
- virtual FX_BOOL GetToolTip(IXFA_Widget* hWidget,
- CFX_WideString& wsToolTip) = 0;
- virtual void SetPrivateData(IXFA_Widget* hWidget,
- void* module_id,
- void* pData,
- PD_CALLBACK_FREEDATA callback) = 0;
- virtual void* GetPrivateData(IXFA_Widget* hWidget, void* module_id) = 0;
- virtual FX_BOOL OnMouseEnter(IXFA_Widget* hWidget) = 0;
- virtual FX_BOOL OnMouseExit(IXFA_Widget* hWidget) = 0;
- virtual FX_BOOL OnLButtonDown(IXFA_Widget* hWidget,
- uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) = 0;
- virtual FX_BOOL OnLButtonUp(IXFA_Widget* hWidget,
- uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) = 0;
- virtual FX_BOOL OnLButtonDblClk(IXFA_Widget* hWidget,
- uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) = 0;
- virtual FX_BOOL OnMouseMove(IXFA_Widget* hWidget,
- uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) = 0;
- virtual FX_BOOL OnMouseWheel(IXFA_Widget* hWidget,
- uint32_t dwFlags,
- int16_t zDelta,
- FX_FLOAT fx,
- FX_FLOAT fy) = 0;
- virtual FX_BOOL OnRButtonDown(IXFA_Widget* hWidget,
- uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) = 0;
- virtual FX_BOOL OnRButtonUp(IXFA_Widget* hWidget,
- uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) = 0;
- virtual FX_BOOL OnRButtonDblClk(IXFA_Widget* hWidget,
- uint32_t dwFlags,
- FX_FLOAT fx,
- FX_FLOAT fy) = 0;
-
- virtual FX_BOOL OnKeyDown(IXFA_Widget* hWidget,
- uint32_t dwKeyCode,
- uint32_t dwFlags) = 0;
- virtual FX_BOOL OnKeyUp(IXFA_Widget* hWidget,
- uint32_t dwKeyCode,
- uint32_t dwFlags) = 0;
- virtual FX_BOOL OnChar(IXFA_Widget* hWidget,
- uint32_t dwChar,
- uint32_t dwFlags) = 0;
- virtual uint32_t OnHitTest(IXFA_Widget* hWidget,
- FX_FLOAT fx,
- FX_FLOAT fy) = 0;
- virtual FX_BOOL OnSetCursor(IXFA_Widget* hWidget,
- FX_FLOAT fx,
- FX_FLOAT fy) = 0;
- virtual void RenderWidget(IXFA_Widget* hWidget,
- CFX_Graphics* pGS,
- CFX_Matrix* pMatrix = NULL,
- FX_BOOL bHighlight = FALSE) = 0;
- virtual FX_BOOL HasEvent(CXFA_WidgetAcc* pWidgetAcc,
- XFA_EVENTTYPE eEventType) = 0;
- virtual int32_t ProcessEvent(CXFA_WidgetAcc* pWidgetAcc,
- CXFA_EventParam* pParam) = 0;
-};
class IXFA_WidgetIterator {
public:
virtual void Release() = 0;
virtual void Reset() = 0;
- virtual IXFA_Widget* MoveToFirst() = 0;
- virtual IXFA_Widget* MoveToLast() = 0;
- virtual IXFA_Widget* MoveToNext() = 0;
- virtual IXFA_Widget* MoveToPrevious() = 0;
- virtual IXFA_Widget* GetCurrentWidget() = 0;
- virtual FX_BOOL SetCurrentWidget(IXFA_Widget* hWidget) = 0;
+ virtual CXFA_FFWidget* MoveToFirst() = 0;
+ virtual CXFA_FFWidget* MoveToLast() = 0;
+ virtual CXFA_FFWidget* MoveToNext() = 0;
+ virtual CXFA_FFWidget* MoveToPrevious() = 0;
+ virtual CXFA_FFWidget* GetCurrentWidget() = 0;
+ virtual FX_BOOL SetCurrentWidget(CXFA_FFWidget* hWidget) = 0;
protected:
~IXFA_WidgetIterator() {}
};
-class IXFA_WidgetAccIterator {
- public:
- virtual void Release() = 0;
- virtual void Reset() = 0;
- virtual CXFA_WidgetAcc* MoveToFirst() = 0;
- virtual CXFA_WidgetAcc* MoveToLast() = 0;
- virtual CXFA_WidgetAcc* MoveToNext() = 0;
- virtual CXFA_WidgetAcc* MoveToPrevious() = 0;
- virtual CXFA_WidgetAcc* GetCurrentWidgetAcc() = 0;
- virtual FX_BOOL SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) = 0;
- virtual void SkipTree() = 0;
-
- protected:
- ~IXFA_WidgetAccIterator() {}
-};
-IXFA_WidgetAccIterator* XFA_WidgetAccIterator_Create(
- CXFA_WidgetAcc* pTravelRoot,
- XFA_WIDGETORDER eOrder = XFA_WIDGETORDER_PreOrder);
-class IXFA_ChecksumContext {
- public:
- virtual void Release() = 0;
-
- virtual FX_BOOL StartChecksum() = 0;
- virtual FX_BOOL UpdateChecksum(IFX_FileRead* pSrcFile,
- FX_FILESIZE offset = 0,
- size_t size = 0) = 0;
- virtual void FinishChecksum() = 0;
- virtual void GetChecksum(CFX_ByteString& bsChecksum) = 0;
-
- protected:
- ~IXFA_ChecksumContext() {}
-};
-IXFA_ChecksumContext* XFA_Checksum_Create();
#endif // XFA_INCLUDE_FXFA_FXFA_H_
diff --git a/xfa/include/fxfa/xfa_checksum.h b/xfa/include/fxfa/xfa_checksum.h
new file mode 100644
index 0000000000..3ca79efe58
--- /dev/null
+++ b/xfa/include/fxfa/xfa_checksum.h
@@ -0,0 +1,74 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_INCLUDE_FXFA_XFA_CHECKSUM_H_
+#define XFA_INCLUDE_FXFA_XFA_CHECKSUM_H_
+
+#include "xfa/fgas/xml/fgas_sax.h"
+#include "xfa/include/fxfa/fxfa.h"
+
+class CXFA_SAXReaderHandler;
+class CXFA_ChecksumContext;
+
+class CXFA_SAXContext {
+ public:
+ CXFA_SAXContext() : m_eNode(FX_SAXNODE_Unknown) {}
+ CFX_ByteTextBuf m_TextBuf;
+ CFX_ByteString m_bsTagName;
+ FX_SAXNODE m_eNode;
+};
+class CXFA_SAXReaderHandler : public IFX_SAXReaderHandler {
+ public:
+ CXFA_SAXReaderHandler(CXFA_ChecksumContext* pContext);
+ virtual ~CXFA_SAXReaderHandler();
+ virtual void* OnTagEnter(const CFX_ByteStringC& bsTagName,
+ FX_SAXNODE eType,
+ uint32_t dwStartPos);
+ virtual void OnTagAttribute(void* pTag,
+ const CFX_ByteStringC& bsAttri,
+ const CFX_ByteStringC& bsValue);
+ virtual void OnTagBreak(void* pTag);
+ virtual void OnTagData(void* pTag,
+ FX_SAXNODE eType,
+ const CFX_ByteStringC& bsData,
+ uint32_t dwStartPos);
+ virtual void OnTagClose(void* pTag, uint32_t dwEndPos);
+ virtual void OnTagEnd(void* pTag,
+ const CFX_ByteStringC& bsTagName,
+ uint32_t dwEndPos);
+
+ virtual void OnTargetData(void* pTag,
+ FX_SAXNODE eType,
+ const CFX_ByteStringC& bsData,
+ uint32_t dwStartPos);
+
+ protected:
+ void UpdateChecksum(FX_BOOL bCheckSpace);
+ CXFA_ChecksumContext* m_pContext;
+ CXFA_SAXContext m_SAXContext;
+};
+
+class CXFA_ChecksumContext {
+ public:
+ CXFA_ChecksumContext();
+ ~CXFA_ChecksumContext();
+
+ void Release() { delete this; }
+ FX_BOOL StartChecksum();
+ FX_BOOL UpdateChecksum(IFX_FileRead* pSrcFile,
+ FX_FILESIZE offset = 0,
+ size_t size = 0);
+ void FinishChecksum();
+ void GetChecksum(CFX_ByteString& bsChecksum);
+ void Update(const CFX_ByteStringC& bsText);
+
+ protected:
+ IFX_SAXReader* m_pSAXReader;
+ uint8_t* m_pByteContext;
+ CFX_ByteString m_bsChecksum;
+};
+
+#endif // XFA_INCLUDE_FXFA_XFA_CHECKSUM_H_
diff --git a/xfa/include/fxfa/xfa_ffapp.h b/xfa/include/fxfa/xfa_ffapp.h
new file mode 100644
index 0000000000..c3bae4874c
--- /dev/null
+++ b/xfa/include/fxfa/xfa_ffapp.h
@@ -0,0 +1,81 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_INCLUDE_FXFA_XFA_FFAPP_H_
+#define XFA_INCLUDE_FXFA_XFA_FFAPP_H_
+
+#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h"
+#include "xfa/fgas/font/fgas_font.h"
+#include "xfa/fwl/core/fwl_sdadapterimp.h"
+#include "xfa/fwl/core/ifwl_adapternative.h"
+#include "xfa/fwl/core/ifwl_app.h"
+#include "xfa/include/fxfa/fxfa.h"
+
+class CXFA_DefFontMgr;
+class CXFA_FWLAdapterWidgetMgr;
+class CXFA_FWLTheme;
+class CXFA_FFDocHandler;
+class CXFA_FFMenuHandler;
+class CXFA_FontMgr;
+
+class CXFA_FileRead : public IFX_FileRead {
+ public:
+ explicit CXFA_FileRead(const CFX_ArrayTemplate<CPDF_Stream*>& streams);
+
+ virtual FX_FILESIZE GetSize();
+ virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size);
+
+ virtual void Release() { delete this; }
+
+ protected:
+ CFX_ObjectArray<CPDF_StreamAcc> m_Data;
+};
+
+class CXFA_FFApp : public IFWL_AdapterNative {
+ public:
+ CXFA_FFApp(IXFA_AppProvider* pProvider);
+ ~CXFA_FFApp() override;
+
+ CXFA_FFDocHandler* GetDocHandler();
+ CXFA_FFDoc* CreateDoc(IXFA_DocProvider* pProvider,
+ IFX_FileRead* pStream,
+ FX_BOOL bTakeOverFile);
+ CXFA_FFDoc* CreateDoc(IXFA_DocProvider* pProvider, CPDF_Document* pPDFDoc);
+ IXFA_AppProvider* GetAppProvider() { return m_pProvider; }
+ void SetDefaultFontMgr(CXFA_DefFontMgr* pFontMgr);
+ CXFA_FFMenuHandler* GetMenuHandler();
+
+ // IFWL_AdapterNative:
+ IFWL_AdapterWidgetMgr* GetWidgetMgr(
+ IFWL_WidgetMgrDelegate* pDelegate) override;
+ IFWL_AdapterThreadMgr* GetThreadMgr() override;
+ IFWL_AdapterTimerMgr* GetTimerMgr() override;
+
+ CXFA_FontMgr* GetXFAFontMgr();
+ IFX_FontMgr* GetFDEFontMgr();
+ CXFA_FWLTheme* GetFWLTheme();
+ IFWL_WidgetMgrDelegate* GetWidgetMgrDelegate() {
+ return m_pWidgetMgrDelegate;
+ }
+
+ protected:
+ CXFA_FFDocHandler* m_pDocHandler;
+ IFWL_App* m_pFWLApp;
+ CXFA_FWLTheme* m_pFWLTheme;
+ IXFA_AppProvider* m_pProvider;
+ CXFA_FontMgr* m_pFontMgr;
+#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
+ IFX_FontSourceEnum* m_pFontSource;
+#endif
+ CXFA_FWLAdapterWidgetMgr* m_pAdapterWidgetMgr;
+ IFWL_WidgetMgrDelegate* m_pWidgetMgrDelegate;
+ IFX_FontMgr* m_pFDEFontMgr;
+ CXFA_FFMenuHandler* m_pMenuHandler;
+ CFWL_SDAdapterThreadMgr* m_pAdapterThreadMgr;
+};
+
+#endif // XFA_INCLUDE_FXFA_XFA_FFAPP_H_
diff --git a/xfa/include/fxfa/xfa_ffdoc.h b/xfa/include/fxfa/xfa_ffdoc.h
new file mode 100644
index 0000000000..ebae04b791
--- /dev/null
+++ b/xfa/include/fxfa/xfa_ffdoc.h
@@ -0,0 +1,65 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_INCLUDE_FXFA_XFA_FFDOC_H_
+#define XFA_INCLUDE_FXFA_XFA_FFDOC_H_
+
+#include "xfa/fxfa/parser/xfa_document.h"
+#include "xfa/include/fxfa/fxfa.h"
+
+class CXFA_ChecksumContext;
+class CXFA_FFApp;
+class CXFA_FFNotify;
+class CXFA_FFDocView;
+
+struct FX_IMAGEDIB_AND_DPI {
+ CFX_DIBSource* pDibSource;
+ int32_t iImageXDpi;
+ int32_t iImageYDpi;
+};
+
+class CXFA_FFDoc {
+ public:
+ CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocProvider* pDocProvider);
+ ~CXFA_FFDoc();
+ IXFA_DocProvider* GetDocProvider() { return m_pDocProvider; }
+ uint32_t GetDocType();
+ int32_t StartLoad();
+ int32_t DoLoad(IFX_Pause* pPause = NULL);
+ void StopLoad();
+ CXFA_FFDocView* CreateDocView(uint32_t dwView = 0);
+ FX_BOOL OpenDoc(IFX_FileRead* pStream, FX_BOOL bTakeOverFile);
+ FX_BOOL OpenDoc(CPDF_Document* pPDFDoc);
+ FX_BOOL CloseDoc();
+ void SetDocType(uint32_t dwType);
+ CXFA_Document* GetXFADoc() { return m_pDocument; }
+ CXFA_FFApp* GetApp() { return m_pApp; }
+ CXFA_FFDocView* GetDocView(CXFA_LayoutProcessor* pLayout);
+ CXFA_FFDocView* GetDocView();
+ CPDF_Document* GetPDFDoc();
+ CFX_DIBitmap* GetPDFNamedImage(const CFX_WideStringC& wsName,
+ int32_t& iImageXDpi,
+ int32_t& iImageYDpi);
+ CFDE_XMLElement* GetPackageData(const CFX_WideStringC& wsPackage);
+ FX_BOOL SavePackage(const CFX_WideStringC& wsPackage,
+ IFX_FileWrite* pFile,
+ CXFA_ChecksumContext* pCSContext = NULL);
+ FX_BOOL ImportData(IFX_FileRead* pStream, FX_BOOL bXDP = TRUE);
+
+ protected:
+ IXFA_DocProvider* m_pDocProvider;
+ CXFA_Document* m_pDocument;
+ IFX_FileRead* m_pStream;
+ CXFA_FFApp* m_pApp;
+ CXFA_FFNotify* m_pNotify;
+ CPDF_Document* m_pPDFDoc;
+ CFX_MapPtrToPtr m_mapNamedImages;
+ CFX_MapPtrToPtr m_mapTypeToDocView;
+ uint32_t m_dwDocType;
+ FX_BOOL m_bOwnStream;
+};
+
+#endif // XFA_INCLUDE_FXFA_XFA_FFDOC_H_
diff --git a/xfa/include/fxfa/xfa_ffdochandler.h b/xfa/include/fxfa/xfa_ffdochandler.h
new file mode 100644
index 0000000000..7eaa20b4cc
--- /dev/null
+++ b/xfa/include/fxfa/xfa_ffdochandler.h
@@ -0,0 +1,53 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_INCLUDE_FXFA_XFA_FFDOCHANDLER_H_
+#define XFA_INCLUDE_FXFA_XFA_FFDOCHANDLER_H_
+
+#include "xfa/include/fxfa/fxfa.h"
+
+class CXFA_ChecksumContext;
+
+class CXFA_FFDocHandler {
+ public:
+ CXFA_FFDocHandler();
+ ~CXFA_FFDocHandler();
+
+ void ReleaseDoc(CXFA_FFDoc* hDoc);
+ IXFA_DocProvider* GetDocProvider(CXFA_FFDoc* hDoc);
+ uint32_t GetDocType(CXFA_FFDoc* hDoc);
+ int32_t StartLoad(CXFA_FFDoc* hDoc);
+ int32_t DoLoad(CXFA_FFDoc* hDoc, IFX_Pause* pPause = NULL);
+ void StopLoad(CXFA_FFDoc* hDoc);
+
+ CXFA_FFDocView* CreateDocView(CXFA_FFDoc* hDoc, uint32_t dwView = 0);
+ int32_t CountPackages(CXFA_FFDoc* hDoc);
+ void GetPackageName(CXFA_FFDoc* hDoc,
+ int32_t iPackage,
+ CFX_WideStringC& wsPackage);
+ CFDE_XMLElement* GetPackageData(CXFA_FFDoc* hDoc,
+ const CFX_WideStringC& wsPackage);
+ FX_BOOL SavePackage(CXFA_FFDoc* hDoc,
+ const CFX_WideStringC& wsPackage,
+ IFX_FileWrite* pFile,
+ CXFA_ChecksumContext* pCSContext = NULL);
+ FX_BOOL CloseDoc(CXFA_FFDoc* hDoc);
+ FX_BOOL ImportData(CXFA_FFDoc* hDoc,
+ IFX_FileRead* pStream,
+ FX_BOOL bXDP = TRUE);
+ void SetJSERuntime(CXFA_FFDoc* hDoc, FXJSE_HRUNTIME hRuntime);
+ FXJSE_HVALUE GetXFAScriptObject(CXFA_FFDoc* hDoc);
+ XFA_ATTRIBUTEENUM GetRestoreState(CXFA_FFDoc* hDoc);
+ FX_BOOL RunDocScript(CXFA_FFDoc* hDoc,
+ XFA_SCRIPTTYPE eScriptType,
+ const CFX_WideStringC& wsScript,
+ FXJSE_HVALUE hRetValue,
+ FXJSE_HVALUE hThisObject);
+
+ protected:
+};
+
+#endif // XFA_INCLUDE_FXFA_XFA_FFDOCHANDLER_H_
diff --git a/xfa/include/fxfa/xfa_ffdocview.h b/xfa/include/fxfa/xfa_ffdocview.h
new file mode 100644
index 0000000000..e8a29111a7
--- /dev/null
+++ b/xfa/include/fxfa/xfa_ffdocview.h
@@ -0,0 +1,172 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_INCLUDE_FXFA_XFA_FFDOCVIEW_H_
+#define XFA_INCLUDE_FXFA_XFA_FFDOCVIEW_H_
+
+#include "xfa/include/fxfa/xfa_ffdoc.h"
+
+class CXFA_FFWidgetHandler;
+class CXFA_FFDoc;
+class CXFA_FFWidget;
+class CXFA_WidgetAccIterator;
+
+extern const XFA_ATTRIBUTEENUM gs_EventActivity[];
+enum XFA_DOCVIEW_LAYOUTSTATUS {
+ XFA_DOCVIEW_LAYOUTSTATUS_None,
+ XFA_DOCVIEW_LAYOUTSTATUS_Start,
+ XFA_DOCVIEW_LAYOUTSTATUS_FormInitialize,
+ XFA_DOCVIEW_LAYOUTSTATUS_FormInitCalculate,
+ XFA_DOCVIEW_LAYOUTSTATUS_FormInitValidate,
+ XFA_DOCVIEW_LAYOUTSTATUS_FormFormReady,
+ XFA_DOCVIEW_LAYOUTSTATUS_Doing,
+ XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitialize,
+ XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitCalculate,
+ XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitValidate,
+ XFA_DOCVIEW_LAYOUTSTATUS_PagesetFormReady,
+ XFA_DOCVIEW_LAYOUTSTATUS_LayoutReady,
+ XFA_DOCVIEW_LAYOUTSTATUS_DocReady,
+ XFA_DOCVIEW_LAYOUTSTATUS_End
+};
+class CXFA_FFDocView {
+ public:
+ CXFA_FFDocView(CXFA_FFDoc* pDoc);
+ ~CXFA_FFDocView();
+
+ CXFA_FFDoc* GetDoc() { return m_pDoc; }
+ int32_t StartLayout(int32_t iStartPage = 0);
+ int32_t DoLayout(IFX_Pause* pPause = NULL);
+ void StopLayout();
+ int32_t GetLayoutStatus();
+ void UpdateDocView();
+ int32_t CountPageViews();
+ CXFA_FFPageView* GetPageView(int32_t nIndex);
+
+ void ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc = NULL);
+ int32_t ProcessWidgetEvent(CXFA_EventParam* pParam,
+ CXFA_WidgetAcc* pWidgetAcc = NULL);
+ CXFA_FFWidgetHandler* GetWidgetHandler();
+ IXFA_WidgetIterator* CreateWidgetIterator();
+ CXFA_WidgetAccIterator* CreateWidgetAccIterator(
+ XFA_WIDGETORDER eOrder = XFA_WIDGETORDER_PreOrder);
+ CXFA_FFWidget* GetFocusWidget();
+ void KillFocus();
+ FX_BOOL SetFocus(CXFA_FFWidget* hWidget);
+ CXFA_FFWidget* GetWidgetByName(const CFX_WideStringC& wsName,
+ CXFA_FFWidget* pRefWidget = NULL);
+ CXFA_WidgetAcc* GetWidgetAccByName(const CFX_WideStringC& wsName,
+ CXFA_WidgetAcc* pRefWidgetAcc = NULL);
+ CXFA_LayoutProcessor* GetXFALayout() const;
+ void OnPageEvent(CXFA_ContainerLayoutItem* pSender,
+ XFA_PAGEEVENT eEvent,
+ int32_t iPageIndex);
+ void LockUpdate();
+ void UnlockUpdate();
+ FX_BOOL IsUpdateLocked();
+ void ClearInvalidateList();
+ void AddInvalidateRect(CXFA_FFWidget* pWidget, const CFX_RectF& rtInvalidate);
+ void AddInvalidateRect(CXFA_FFPageView* pPageView,
+ const CFX_RectF& rtInvalidate);
+ void RunInvalidate();
+ void RunDocClose();
+ void DestroyDocView();
+
+ FX_BOOL InitValidate(CXFA_Node* pNode);
+ FX_BOOL RunValidate();
+
+ void SetChangeMark();
+
+ void AddValidateWidget(CXFA_WidgetAcc* pWidget);
+ void AddCalculateNodeNotify(CXFA_Node* pNodeChange);
+ void AddCalculateWidgetAcc(CXFA_WidgetAcc* pWidgetAcc);
+ int32_t RunCalculateWidgets();
+ FX_BOOL IsStaticNotify();
+ FX_BOOL RunLayout();
+ void RunSubformIndexChange();
+ void AddNewFormNode(CXFA_Node* pNode);
+ void AddIndexChangedSubform(CXFA_Node* pNode);
+ CXFA_WidgetAcc* GetFocusWidgetAcc();
+ void SetFocusWidgetAcc(CXFA_WidgetAcc* pWidgetAcc);
+ void DeleteLayoutItem(CXFA_FFWidget* pWidget);
+ int32_t ExecEventActivityByDeepFirst(CXFA_Node* pFormNode,
+ XFA_EVENTTYPE eEventType,
+ FX_BOOL bIsFormReady = FALSE,
+ FX_BOOL bRecursive = TRUE,
+ CXFA_Node* pExclude = NULL);
+ FX_BOOL m_bLayoutEvent;
+ CFX_WideStringArray m_arrNullTestMsg;
+ CXFA_FFWidget* m_pListFocusWidget;
+ FX_BOOL m_bInLayoutStatus;
+
+ protected:
+ FX_BOOL RunEventLayoutReady();
+ void RunBindItems();
+ FX_BOOL InitCalculate(CXFA_Node* pNode);
+ void InitLayout(CXFA_Node* pNode);
+ void RunCalculateRecursive(int32_t& iIndex);
+ void ShowNullTestMsg();
+ FX_BOOL ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc);
+ CXFA_Node* GetRootSubform();
+
+ CXFA_FFDoc* m_pDoc;
+ CXFA_FFWidgetHandler* m_pWidgetHandler;
+ CXFA_LayoutProcessor* m_pXFADocLayout;
+ CXFA_WidgetAcc* m_pFocusAcc;
+ CXFA_FFWidget* m_pFocusWidget;
+ CXFA_FFWidget* m_pOldFocusWidget;
+ CFX_MapPtrToPtr m_mapPageInvalidate;
+ CFX_PtrArray m_ValidateAccs;
+ CFX_PtrArray m_bindItems;
+ CFX_PtrArray m_CalculateAccs;
+
+ CFX_PtrArray m_NewAddedNodes;
+ CFX_PtrArray m_IndexChangedSubforms;
+ XFA_DOCVIEW_LAYOUTSTATUS m_iStatus;
+ int32_t m_iLock;
+ friend class CXFA_FFNotify;
+};
+class CXFA_FFDocWidgetIterator : public IXFA_WidgetIterator {
+ public:
+ CXFA_FFDocWidgetIterator(CXFA_FFDocView* pDocView, CXFA_Node* pTravelRoot);
+ virtual ~CXFA_FFDocWidgetIterator();
+
+ virtual void Release() { delete this; }
+
+ virtual void Reset();
+ virtual CXFA_FFWidget* MoveToFirst();
+ virtual CXFA_FFWidget* MoveToLast();
+ virtual CXFA_FFWidget* MoveToNext();
+ virtual CXFA_FFWidget* MoveToPrevious();
+ virtual CXFA_FFWidget* GetCurrentWidget();
+ virtual FX_BOOL SetCurrentWidget(CXFA_FFWidget* hWidget);
+
+ protected:
+ CXFA_ContainerIterator m_ContentIterator;
+ CXFA_FFDocView* m_pDocView;
+ CXFA_FFWidget* m_pCurWidget;
+};
+class CXFA_WidgetAccIterator {
+ public:
+ CXFA_WidgetAccIterator(CXFA_FFDocView* pDocView, CXFA_Node* pTravelRoot);
+ ~CXFA_WidgetAccIterator();
+
+ void Release() { delete this; }
+ void Reset();
+ CXFA_WidgetAcc* MoveToFirst();
+ CXFA_WidgetAcc* MoveToLast();
+ CXFA_WidgetAcc* MoveToNext();
+ CXFA_WidgetAcc* MoveToPrevious();
+ CXFA_WidgetAcc* GetCurrentWidgetAcc();
+ FX_BOOL SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget);
+ void SkipTree();
+
+ protected:
+ CXFA_ContainerIterator m_ContentIterator;
+ CXFA_FFDocView* m_pDocView;
+ CXFA_WidgetAcc* m_pCurWidgetAcc;
+};
+
+#endif // XFA_INCLUDE_FXFA_XFA_FFDOCVIEW_H_
diff --git a/xfa/include/fxfa/xfa_ffpageview.h b/xfa/include/fxfa/xfa_ffpageview.h
new file mode 100644
index 0000000000..cce1cc13e1
--- /dev/null
+++ b/xfa/include/fxfa/xfa_ffpageview.h
@@ -0,0 +1,113 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_INCLUDE_FXFA_XFA_FFPAGEVIEW_H_
+#define XFA_INCLUDE_FXFA_XFA_FFPAGEVIEW_H_
+
+#include "xfa/fxfa/parser/xfa_doclayout.h"
+
+class CXFA_FFWidget;
+class CXFA_FFDocView;
+class CXFA_FFPageView : public CXFA_ContainerLayoutItem {
+ public:
+ CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea);
+ ~CXFA_FFPageView() override;
+
+ CXFA_FFDocView* GetDocView();
+ int32_t GetPageViewIndex();
+ void GetPageViewRect(CFX_RectF& rtPage);
+ void GetDisplayMatrix(CFX_Matrix& mt,
+ const CFX_Rect& rtDisp,
+ int32_t iRotate);
+ int32_t LoadPageView(IFX_Pause* pPause = NULL);
+ void UnloadPageView();
+ CXFA_FFWidget* GetWidgetByPos(FX_FLOAT fx, FX_FLOAT fy);
+ IXFA_WidgetIterator* CreateWidgetIterator(
+ uint32_t dwTraverseWay = XFA_TRAVERSEWAY_Form,
+ uint32_t dwWidgetFilter = XFA_WIDGETFILTER_Visible |
+ XFA_WIDGETFILTER_Viewable |
+ XFA_WIDGETFILTER_AllType);
+
+ FX_BOOL IsPageViewLoaded();
+
+ protected:
+ CXFA_FFDocView* m_pDocView;
+ FX_BOOL m_bLoaded;
+};
+typedef CXFA_NodeIteratorTemplate<CXFA_LayoutItem,
+ CXFA_TraverseStrategy_LayoutItem>
+ CXFA_LayoutItemIterator;
+class CXFA_FFPageWidgetIterator : public IXFA_WidgetIterator {
+ public:
+ CXFA_FFPageWidgetIterator(CXFA_FFPageView* pPageView, uint32_t dwFilter);
+ virtual ~CXFA_FFPageWidgetIterator();
+
+ void Release() override { delete this; }
+
+ void Reset() override;
+ CXFA_FFWidget* MoveToFirst() override;
+ CXFA_FFWidget* MoveToLast() override;
+ CXFA_FFWidget* MoveToNext() override;
+ CXFA_FFWidget* MoveToPrevious() override;
+ CXFA_FFWidget* GetCurrentWidget() override;
+ FX_BOOL SetCurrentWidget(CXFA_FFWidget* hWidget) override;
+
+ protected:
+ CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem);
+
+ CXFA_FFPageView* m_pPageView;
+ CXFA_FFWidget* m_hCurWidget;
+ uint32_t m_dwFilter;
+ FX_BOOL m_bIgnorerelevant;
+ CXFA_LayoutItemIterator m_sIterator;
+};
+typedef CFX_ArrayTemplate<CXFA_FFWidget*> CXFA_WidgetArray;
+class CXFA_TabParam {
+ public:
+ CXFA_TabParam() : m_pWidget(NULL) {}
+ ~CXFA_TabParam() {}
+
+ CXFA_FFWidget* m_pWidget;
+ CXFA_WidgetArray m_Children;
+};
+class CXFA_FFTabOrderPageWidgetIterator : public IXFA_WidgetIterator {
+ public:
+ CXFA_FFTabOrderPageWidgetIterator(CXFA_FFPageView* pPageView,
+ uint32_t dwFilter);
+ virtual ~CXFA_FFTabOrderPageWidgetIterator();
+
+ void Release() override;
+
+ void Reset() override;
+ CXFA_FFWidget* MoveToFirst() override;
+ CXFA_FFWidget* MoveToLast() override;
+ CXFA_FFWidget* MoveToNext() override;
+ CXFA_FFWidget* MoveToPrevious() override;
+ CXFA_FFWidget* GetCurrentWidget() override;
+ FX_BOOL SetCurrentWidget(CXFA_FFWidget* hWidget) override;
+
+ protected:
+ CXFA_FFWidget* GetTraverseWidget(CXFA_FFWidget* pWidget);
+ CXFA_FFWidget* FindWidgetByName(const CFX_WideStringC& wsWidgetName,
+ CXFA_FFWidget* pRefWidget);
+ void CreateTabOrderWidgetArray();
+ void CreateSpaceOrderWidgetArray(CXFA_WidgetArray& WidgetArray);
+ CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem);
+ void OrderContainer(CXFA_LayoutItemIterator* sIterator,
+ CXFA_LayoutItem* pContainerItem,
+ CXFA_TabParam* pContainer,
+ FX_BOOL& bCurrentItem,
+ FX_BOOL& bContentArea,
+ FX_BOOL bMarsterPage = FALSE);
+
+ CXFA_WidgetArray m_TabOrderWidgetArray;
+ CXFA_FFPageView* m_pPageView;
+ uint32_t m_dwFilter;
+ int32_t m_iCurWidget;
+ FX_BOOL m_bIgnorerelevant;
+};
+
+#endif // XFA_INCLUDE_FXFA_XFA_FFPAGEVIEW_H_
diff --git a/xfa/include/fxfa/xfa_ffwidgethandler.h b/xfa/include/fxfa/xfa_ffwidgethandler.h
new file mode 100644
index 0000000000..28c6b4b20b
--- /dev/null
+++ b/xfa/include/fxfa/xfa_ffwidgethandler.h
@@ -0,0 +1,171 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_INCLUDE_FXFA_XFA_FFWIDGETHANDLER_H_
+#define XFA_INCLUDE_FXFA_XFA_FFWIDGETHANDLER_H_
+
+#include <vector>
+
+#include "xfa/fxfa/parser/xfa_document.h"
+#include "xfa/include/fxfa/fxfa.h"
+
+class CXFA_FFDocView;
+
+class CXFA_FFWidgetHandler {
+ public:
+ CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView);
+ ~CXFA_FFWidgetHandler();
+ CXFA_FFWidget* CreateWidget(CXFA_FFWidget* hParent,
+ XFA_WIDGETTYPE eType,
+ CXFA_FFWidget* hBefore = NULL);
+ CXFA_FFPageView* GetPageView(CXFA_FFWidget* hWidget);
+ void GetRect(CXFA_FFWidget* hWidget, CFX_RectF& rt);
+ uint32_t GetStatus(CXFA_FFWidget* hWidget);
+ FX_BOOL GetBBox(CXFA_FFWidget* hWidget,
+ CFX_RectF& rtBox,
+ uint32_t dwStatus,
+ FX_BOOL bDrawFocus = FALSE);
+ CXFA_WidgetAcc* GetDataAcc(CXFA_FFWidget* hWidget);
+ void GetName(CXFA_FFWidget* hWidget,
+ CFX_WideString& wsName,
+ int32_t iNameType = 0);
+ FX_BOOL GetToolTip(CXFA_FFWidget* hWidget, CFX_WideString& wsToolTip);
+ void SetPrivateData(CXFA_FFWidget* hWidget,
+ void* module_id,
+ void* pData,
+ PD_CALLBACK_FREEDATA callback);
+ void* GetPrivateData(CXFA_FFWidget* hWidget, void* module_id);
+ FX_BOOL OnMouseEnter(CXFA_FFWidget* hWidget);
+ FX_BOOL OnMouseExit(CXFA_FFWidget* hWidget);
+ FX_BOOL OnLButtonDown(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ FX_FLOAT fx,
+ FX_FLOAT fy);
+ FX_BOOL OnLButtonUp(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ FX_FLOAT fx,
+ FX_FLOAT fy);
+ FX_BOOL OnLButtonDblClk(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ FX_FLOAT fx,
+ FX_FLOAT fy);
+ FX_BOOL OnMouseMove(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ FX_FLOAT fx,
+ FX_FLOAT fy);
+ FX_BOOL OnMouseWheel(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ int16_t zDelta,
+ FX_FLOAT fx,
+ FX_FLOAT fy);
+ FX_BOOL OnRButtonDown(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ FX_FLOAT fx,
+ FX_FLOAT fy);
+ FX_BOOL OnRButtonUp(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ FX_FLOAT fx,
+ FX_FLOAT fy);
+ FX_BOOL OnRButtonDblClk(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ FX_FLOAT fx,
+ FX_FLOAT fy);
+
+ FX_BOOL OnKeyDown(CXFA_FFWidget* hWidget,
+ uint32_t dwKeyCode,
+ uint32_t dwFlags);
+ FX_BOOL OnKeyUp(CXFA_FFWidget* hWidget, uint32_t dwKeyCode, uint32_t dwFlags);
+ FX_BOOL OnChar(CXFA_FFWidget* hWidget, uint32_t dwChar, uint32_t dwFlags);
+ uint32_t OnHitTest(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy);
+ FX_BOOL OnSetCursor(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy);
+ void RenderWidget(CXFA_FFWidget* hWidget,
+ CFX_Graphics* pGS,
+ CFX_Matrix* pMatrix = NULL,
+ FX_BOOL bHighlight = FALSE);
+ FX_BOOL HasEvent(CXFA_WidgetAcc* pWidgetAcc, XFA_EVENTTYPE eEventType);
+ int32_t ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, CXFA_EventParam* pParam);
+
+ protected:
+ CXFA_Node* CreateWidgetFormItem(XFA_WIDGETTYPE eType,
+ CXFA_Node* pParent,
+ CXFA_Node* pBefore) const;
+
+ CXFA_Node* CreatePushButton(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateCheckButton(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateExclGroup(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateRadioButton(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateDatetimeEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateDecimalField(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateNumericField(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateSignature(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateTextEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateDropdownList(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateListBox(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateImageField(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreatePasswordEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateField(XFA_ELEMENT eElement,
+ CXFA_Node* pParent,
+ CXFA_Node* pBefore) const;
+ CXFA_Node* CreateArc(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateRectangle(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateImage(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateLine(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateText(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateDraw(XFA_ELEMENT eElement,
+ CXFA_Node* pParent,
+ CXFA_Node* pBefore) const;
+
+ CXFA_Node* CreateSubform(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateFormItem(XFA_ELEMENT eElement,
+ CXFA_Node* pParent,
+ CXFA_Node* pBefore) const;
+ CXFA_Node* CreateCopyNode(XFA_ELEMENT eElement,
+ CXFA_Node* pParent,
+ CXFA_Node* pBefore = NULL) const;
+ CXFA_Node* CreateTemplateNode(XFA_ELEMENT eElement,
+ CXFA_Node* pParent,
+ CXFA_Node* pBefore) const;
+ CXFA_Node* CreateFontNode(CXFA_Node* pParent) const;
+ CXFA_Node* CreateMarginNode(CXFA_Node* pParent,
+ uint32_t dwFlags,
+ FX_FLOAT fInsets[4]) const;
+ CXFA_Node* CreateValueNode(XFA_ELEMENT eValue, CXFA_Node* pParent) const;
+ CXFA_Document* GetObjFactory() const;
+ CXFA_Document* GetXFADoc() const;
+
+ CXFA_FFDocView* m_pDocView;
+};
+
+class CXFA_FFMenuHandler {
+ public:
+ CXFA_FFMenuHandler();
+ ~CXFA_FFMenuHandler();
+
+ FX_BOOL CanCopy(CXFA_FFWidget* hWidget);
+ FX_BOOL CanCut(CXFA_FFWidget* hWidget);
+ FX_BOOL CanPaste(CXFA_FFWidget* hWidget);
+ FX_BOOL CanSelectAll(CXFA_FFWidget* hWidget);
+ FX_BOOL CanDelete(CXFA_FFWidget* hWidget);
+ FX_BOOL CanDeSelect(CXFA_FFWidget* hWidget);
+ FX_BOOL Copy(CXFA_FFWidget* hWidget, CFX_WideString& wsText);
+ FX_BOOL Cut(CXFA_FFWidget* hWidget, CFX_WideString& wsText);
+ FX_BOOL Paste(CXFA_FFWidget* hWidget, const CFX_WideString& wsText);
+ FX_BOOL SelectAll(CXFA_FFWidget* hWidget);
+ FX_BOOL Delete(CXFA_FFWidget* hWidget);
+ FX_BOOL DeSelect(CXFA_FFWidget* hWidget);
+ FX_BOOL CanUndo(CXFA_FFWidget* hWidget);
+ FX_BOOL CanRedo(CXFA_FFWidget* hWidget);
+ FX_BOOL Undo(CXFA_FFWidget* hWidget);
+ FX_BOOL Redo(CXFA_FFWidget* hWidget);
+ FX_BOOL GetSuggestWords(CXFA_FFWidget* hWidget,
+ CFX_PointF pointf,
+ std::vector<CFX_ByteString>& sSuggest);
+ FX_BOOL ReplaceSpellCheckWord(CXFA_FFWidget* hWidget,
+ CFX_PointF pointf,
+ const CFX_ByteStringC& bsReplace);
+};
+
+#endif // XFA_INCLUDE_FXFA_XFA_FFWIDGETHANDLER_H_
diff --git a/xfa/include/fxfa/xfa_fontmgr.h b/xfa/include/fxfa/xfa_fontmgr.h
new file mode 100644
index 0000000000..082c672805
--- /dev/null
+++ b/xfa/include/fxfa/xfa_fontmgr.h
@@ -0,0 +1,99 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_INCLUDE_FXFA_XFA_FONTMGR_H_
+#define XFA_INCLUDE_FXFA_XFA_FONTMGR_H_
+
+#include <map>
+
+#include "core/fxcrt/include/fx_ext.h"
+#include "core/fxcrt/include/fx_system.h"
+#include "xfa/fgas/font/fgas_font.h"
+#include "xfa/include/fxfa/fxfa.h"
+
+class CPDF_Font;
+
+struct XFA_FONTINFO {
+ uint32_t dwFontNameHash;
+ const FX_WCHAR* pPsName;
+ const FX_WCHAR* pReplaceFont;
+ uint16_t dwStyles;
+ uint16_t wCodePage;
+};
+
+class CXFA_DefFontMgr {
+ public:
+ CXFA_DefFontMgr() {}
+ ~CXFA_DefFontMgr();
+
+ IFX_Font* GetFont(CXFA_FFDoc* hDoc,
+ const CFX_WideStringC& wsFontFamily,
+ uint32_t dwFontStyles,
+ uint16_t wCodePage = 0xFFFF);
+ IFX_Font* GetDefaultFont(CXFA_FFDoc* hDoc,
+ const CFX_WideStringC& wsFontFamily,
+ uint32_t dwFontStyles,
+ uint16_t wCodePage = 0xFFFF);
+
+ protected:
+ CFX_PtrArray m_CacheFonts;
+};
+
+class CXFA_PDFFontMgr : public IFX_FontProvider {
+ public:
+ CXFA_PDFFontMgr(CXFA_FFDoc* pDoc);
+ ~CXFA_PDFFontMgr();
+ IFX_Font* GetFont(const CFX_WideStringC& wsFontFamily,
+ uint32_t dwFontStyles,
+ CPDF_Font** pPDFFont,
+ FX_BOOL bStrictMatch = TRUE);
+ FX_BOOL GetCharWidth(IFX_Font* pFont,
+ FX_WCHAR wUnicode,
+ int32_t& iWidth,
+ FX_BOOL bCharCode);
+ CFX_MapPtrToPtr m_FDE2PDFFont;
+
+ protected:
+ IFX_Font* FindFont(CFX_ByteString strFamilyName,
+ FX_BOOL bBold,
+ FX_BOOL bItalic,
+ CPDF_Font** pPDFFont,
+ FX_BOOL bStrictMatch = TRUE);
+ CFX_ByteString PsNameToFontName(const CFX_ByteString& strPsName,
+ FX_BOOL bBold,
+ FX_BOOL bItalic);
+ FX_BOOL PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName,
+ FX_BOOL bBold,
+ FX_BOOL bItalic,
+ const CFX_ByteString& bsDRFontName,
+ FX_BOOL bStrictMatch = TRUE);
+
+ CXFA_FFDoc* m_pDoc;
+ std::map<CFX_ByteString, IFX_Font*> m_FontMap;
+};
+
+class CXFA_FontMgr {
+ public:
+ CXFA_FontMgr();
+ ~CXFA_FontMgr();
+ IFX_Font* GetFont(CXFA_FFDoc* hDoc,
+ const CFX_WideStringC& wsFontFamily,
+ uint32_t dwFontStyles,
+ uint16_t wCodePage = 0xFFFF);
+ void LoadDocFonts(CXFA_FFDoc* hDoc);
+ void ReleaseDocFonts(CXFA_FFDoc* hDoc);
+
+ void SetDefFontMgr(CXFA_DefFontMgr* pFontMgr);
+
+ protected:
+ void DelAllMgrMap();
+
+ CFX_MapPtrToPtr m_PDFFontMgrArray;
+ CXFA_DefFontMgr* m_pDefFontMgr;
+ std::map<CFX_ByteString, IFX_Font*> m_FontMap;
+};
+
+#endif // XFA_INCLUDE_FXFA_XFA_FONTMGR_H_
diff --git a/xfa/include/fxfa/xfa_rendercontext.h b/xfa/include/fxfa/xfa_rendercontext.h
new file mode 100644
index 0000000000..d6205275df
--- /dev/null
+++ b/xfa/include/fxfa/xfa_rendercontext.h
@@ -0,0 +1,36 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_INCLUDE_FXFA_XFA_RENDERCONTEXT_H_
+#define XFA_INCLUDE_FXFA_XFA_RENDERCONTEXT_H_
+
+#include "xfa/include/fxfa/fxfa.h"
+
+class CXFA_RenderContext {
+ public:
+ CXFA_RenderContext();
+ ~CXFA_RenderContext();
+
+ void Release() { delete this; }
+ int32_t StartRender(CXFA_FFPageView* pPageView,
+ CFX_Graphics* pGS,
+ const CFX_Matrix& matrix,
+ const CXFA_RenderOptions& options);
+ int32_t DoRender(IFX_Pause* pPause = NULL);
+ void StopRender();
+
+ protected:
+ IXFA_WidgetIterator* m_pWidgetIterator;
+ CXFA_FFWidget* m_pWidget;
+ CXFA_FFPageView* m_pPageView;
+ CFX_Graphics* m_pGS;
+ CFX_Matrix m_matrix;
+ CXFA_RenderOptions m_options;
+ uint32_t m_dwStatus;
+ CFX_RectF m_rtClipRect;
+};
+
+#endif // XFA_INCLUDE_FXFA_XFA_RENDERCONTEXT_H_