summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfxfa
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/fpdfxfa')
-rw-r--r--fpdfsdk/fpdfxfa/fpdfxfa_app.cpp6
-rw-r--r--fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp8
-rw-r--r--fpdfsdk/fpdfxfa/fpdfxfa_page.cpp6
-rw-r--r--fpdfsdk/fpdfxfa/fpdfxfa_util.cpp2
-rw-r--r--fpdfsdk/fpdfxfa/include/DEPS3
-rw-r--r--fpdfsdk/fpdfxfa/include/fpdfxfa_app.h98
-rw-r--r--fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h238
-rw-r--r--fpdfsdk/fpdfxfa/include/fpdfxfa_page.h77
-rw-r--r--fpdfsdk/fpdfxfa/include/fpdfxfa_util.h47
9 files changed, 474 insertions, 11 deletions
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp
index 0d3011e659..b7a5b15dd9 100644
--- a/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp
+++ b/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp
@@ -4,9 +4,9 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h"
-#include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h"
-#include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h"
+#include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h"
+#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h"
+#include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h"
#include "fpdfsdk/include/fsdk_define.h"
#include "fpdfsdk/include/fsdk_mgr.h"
#include "public/fpdf_formfill.h"
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
index 7ef369a04b..28b17fb6d1 100644
--- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
+++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
@@ -8,10 +8,10 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h"
-#include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h"
-#include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h"
-#include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h"
-#include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h"
+#include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h"
+#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h"
+#include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h"
+#include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h"
#include "fpdfsdk/include/fsdk_define.h"
#include "fpdfsdk/include/fsdk_mgr.h"
#include "fpdfsdk/javascript/ijs_runtime.h"
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp
index dc4185af2d..a62cabc2df 100644
--- a/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp
@@ -4,12 +4,12 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h"
+#include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h"
#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
-#include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h"
-#include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h"
+#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h"
+#include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h"
#include "fpdfsdk/include/fsdk_define.h"
#include "fpdfsdk/include/fsdk_mgr.h"
#include "xfa/include/fxfa/xfa_ffdocview.h"
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_util.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_util.cpp
index 49efceb8e4..4fb92e76ae 100644
--- a/fpdfsdk/fpdfxfa/fpdfxfa_util.cpp
+++ b/fpdfsdk/fpdfxfa/fpdfxfa_util.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h"
+#include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h"
#include <vector>
diff --git a/fpdfsdk/fpdfxfa/include/DEPS b/fpdfsdk/fpdfxfa/include/DEPS
new file mode 100644
index 0000000000..f207778cb2
--- /dev/null
+++ b/fpdfsdk/fpdfxfa/include/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+ "+xfa/fwl/core/include",
+]
diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_app.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_app.h
new file mode 100644
index 0000000000..2ad798c0e3
--- /dev/null
+++ b/fpdfsdk/fpdfxfa/include/fpdfxfa_app.h
@@ -0,0 +1,98 @@
+// 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 FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_APP_H_
+#define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_APP_H_
+
+#include "xfa/include/fxfa/fxfa.h"
+
+class CPDFDoc_Environment;
+class IFXJS_Runtime;
+
+class CPDFXFA_App : public IXFA_AppProvider {
+ public:
+ static CPDFXFA_App* GetInstance();
+ static void ReleaseInstance();
+
+ CPDFXFA_App();
+ ~CPDFXFA_App() override;
+
+ FX_BOOL Initialize(FXJSE_HRUNTIME hRuntime);
+ CXFA_FFApp* GetXFAApp() { return m_pXFAApp; }
+
+ FX_BOOL AddFormFillEnv(CPDFDoc_Environment* pEnv);
+ FX_BOOL RemoveFormFillEnv(CPDFDoc_Environment* pEnv);
+
+ FX_BOOL IsJavaScriptInitialized() const { return m_bJavaScriptInitialized; }
+ void SetJavaScriptInitialized(FX_BOOL bInitialized) {
+ m_bJavaScriptInitialized = bInitialized;
+ }
+
+ FXJSE_HRUNTIME GetJSERuntime() const { return m_hJSERuntime; }
+
+ // IFXA_AppProvider:
+ void GetAppType(CFX_WideString& wsAppType) override;
+ void SetAppType(const CFX_WideStringC& wsAppType) override;
+
+ void GetLanguage(CFX_WideString& wsLanguage) override;
+ void GetPlatform(CFX_WideString& wsPlatform) override;
+ void GetVariation(CFX_WideString& wsVariation) override;
+ void GetVersion(CFX_WideString& wsVersion) override;
+ void GetFoxitVersion(CFX_WideString& wsFoxitVersion) override {
+ wsFoxitVersion = L"7.0";
+ }
+
+ void GetAppName(CFX_WideString& wsName) override;
+ void GetFoxitAppName(CFX_WideString& wsFoxitName) override {
+ wsFoxitName = L"Foxit";
+ }
+
+ void Beep(uint32_t dwType) override;
+ int32_t MsgBox(const CFX_WideStringC& wsMessage,
+ const CFX_WideStringC& wsTitle,
+ uint32_t dwIconType,
+ uint32_t dwButtonType) override;
+ void Response(CFX_WideString& wsAnswer,
+ const CFX_WideStringC& wsQuestion,
+ const CFX_WideStringC& wsTitle,
+ const CFX_WideStringC& wsDefaultAnswer,
+ FX_BOOL bMark) override;
+
+ int32_t GetDocumentCountInBatch() override;
+ int32_t GetCurDocumentInBatch() override;
+
+ IFX_FileRead* DownloadURL(const CFX_WideStringC& wsURL) override;
+ FX_BOOL PostRequestURL(const CFX_WideStringC& wsURL,
+ const CFX_WideStringC& wsData,
+ const CFX_WideStringC& wsContentType,
+ const CFX_WideStringC& wsEncode,
+ const CFX_WideStringC& wsHeader,
+ CFX_WideString& wsResponse) override;
+ FX_BOOL PutRequestURL(const CFX_WideStringC& wsURL,
+ const CFX_WideStringC& wsData,
+ const CFX_WideStringC& wsEncode) override;
+
+ void LoadString(int32_t iStringID, CFX_WideString& wsString) override;
+ FX_BOOL ShowFileDialog(const CFX_WideStringC& wsTitle,
+ const CFX_WideStringC& wsFilter,
+ CFX_WideStringArray& wsPathArr,
+ FX_BOOL bOpen) override;
+ IFWL_AdapterTimerMgr* GetTimerMgr() override;
+
+ CFX_ArrayTemplate<CPDFDoc_Environment*> m_pEnvList;
+
+ protected:
+ static CPDFXFA_App* g_pApp;
+
+ FX_BOOL m_bJavaScriptInitialized;
+ CXFA_FFApp* m_pXFAApp;
+ FXJSE_HRUNTIME m_hJSERuntime;
+ IFXJS_Runtime* m_pJSRuntime;
+ CFX_WideString m_csAppType;
+ bool m_bOwnedRuntime;
+};
+
+#endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_APP_H_
diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h
new file mode 100644
index 0000000000..7fbf532923
--- /dev/null
+++ b/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h
@@ -0,0 +1,238 @@
+// 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 FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_
+#define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_
+
+#include <vector>
+
+#include "public/fpdfview.h"
+#include "xfa/include/fxfa/fxfa.h"
+#include "xfa/include/fxfa/xfa_ffdoc.h"
+#include "xfa/include/fxfa/xfa_ffdochandler.h"
+
+class CPDFXFA_App;
+class CPDFXFA_Document;
+class CPDFXFA_Page;
+class CPDFSDK_Document;
+class CPDFDoc_Environment;
+class IJS_Runtime;
+class IJS_Context;
+class CXFA_FFDocHandler;
+
+class CPDFXFA_Document : public IXFA_DocProvider {
+ public:
+ CPDFXFA_Document(CPDF_Document* pPDFDoc, CPDFXFA_App* pProvider);
+ ~CPDFXFA_Document();
+
+ FX_BOOL LoadXFADoc();
+ CPDFXFA_App* GetApp() { return m_pApp; }
+ CPDF_Document* GetPDFDoc() { return m_pPDFDoc; }
+ CXFA_FFDoc* GetXFADoc() { return m_pXFADoc; }
+ CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; }
+
+ int GetPageCount();
+ CPDFXFA_Page* GetPage(int page_index);
+ CPDFXFA_Page* GetPage(CXFA_FFPageView* pPage);
+
+ void DeletePage(int page_index);
+ void RemovePage(CPDFXFA_Page* page);
+ int GetDocType() { return m_iDocType; }
+
+ CPDFSDK_Document* GetSDKDocument(CPDFDoc_Environment* pFormFillEnv);
+
+ void FXRect2PDFRect(const CFX_RectF& fxRectF, CFX_FloatRect& pdfRect);
+
+ virtual void SetChangeMark(CXFA_FFDoc* hDoc);
+ virtual FX_BOOL GetChangeMark(CXFA_FFDoc* hDoc);
+ // used in dynamic xfa, dwFlags refer to XFA_INVALIDATE_XXX macros.
+ virtual void InvalidateRect(CXFA_FFPageView* pPageView,
+ const CFX_RectF& rt,
+ uint32_t dwFlags = 0);
+ // used in static xfa, dwFlags refer to XFA_INVALIDATE_XXX macros.
+ virtual void InvalidateRect(CXFA_FFWidget* hWidget, uint32_t dwFlags = 0);
+ // show or hide caret
+ virtual void DisplayCaret(CXFA_FFWidget* hWidget,
+ FX_BOOL bVisible,
+ const CFX_RectF* pRtAnchor);
+ // dwPos: (0:bottom 1:top)
+ virtual FX_BOOL GetPopupPos(CXFA_FFWidget* hWidget,
+ FX_FLOAT fMinPopup,
+ FX_FLOAT fMaxPopup,
+ const CFX_RectF& rtAnchor,
+ CFX_RectF& rtPopup);
+ virtual FX_BOOL PopupMenu(CXFA_FFWidget* hWidget,
+ CFX_PointF ptPopup,
+ const CFX_RectF* pRectExclude = NULL);
+
+ // dwFlags XFA_PAGEVIEWEVENT_Added, XFA_PAGEVIEWEVENT_Removing
+ virtual void PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags);
+ // dwEvent refer to XFA_WIDGETEVENT_XXX
+ virtual void WidgetEvent(CXFA_FFWidget* hWidget,
+ CXFA_WidgetAcc* pWidgetData,
+ uint32_t dwEvent,
+ void* pParam = NULL,
+ void* pAdditional = NULL);
+
+ // return true if render it.
+ virtual FX_BOOL RenderCustomWidget(CXFA_FFWidget* hWidget,
+ CFX_Graphics* pGS,
+ CFX_Matrix* pMatrix,
+ const CFX_RectF& rtUI) {
+ return FALSE;
+ }
+
+ // host method
+ virtual int32_t CountPages(CXFA_FFDoc* hDoc);
+ virtual int32_t GetCurrentPage(CXFA_FFDoc* hDoc);
+ virtual void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage);
+ virtual FX_BOOL IsCalculationsEnabled(CXFA_FFDoc* hDoc);
+ virtual void SetCalculationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled);
+ virtual void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle);
+ virtual void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsTitle);
+ virtual void ExportData(CXFA_FFDoc* hDoc,
+ const CFX_WideStringC& wsFilePath,
+ FX_BOOL bXDP = TRUE);
+ virtual void ImportData(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsFilePath);
+ virtual void GotoURL(CXFA_FFDoc* hDoc,
+ const CFX_WideStringC& bsURL,
+ FX_BOOL bAppend = TRUE);
+ virtual FX_BOOL IsValidationsEnabled(CXFA_FFDoc* hDoc);
+ virtual void SetValidationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled);
+ virtual void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget);
+ virtual void Print(CXFA_FFDoc* hDoc,
+ int32_t nStartPage,
+ int32_t nEndPage,
+ uint32_t dwOptions);
+
+ // LayoutPseudo method
+ virtual int32_t AbsPageCountInBatch(CXFA_FFDoc* hDoc) { return 0; }
+ virtual int32_t AbsPageInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) {
+ return 0;
+ }
+ virtual int32_t SheetCountInBatch(CXFA_FFDoc* hDoc) { return 0; }
+ virtual int32_t SheetInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) {
+ return 0;
+ }
+
+ virtual int32_t Verify(CXFA_FFDoc* hDoc,
+ CXFA_Node* pSigNode,
+ FX_BOOL bUsed = TRUE) {
+ return 0;
+ }
+ virtual FX_BOOL Sign(CXFA_FFDoc* hDoc,
+ CXFA_NodeList* pNodeList,
+ const CFX_WideStringC& wsExpression,
+ const CFX_WideStringC& wsXMLIdent,
+ const CFX_WideStringC& wsValue = FX_WSTRC(L"open"),
+ FX_BOOL bUsed = TRUE) {
+ return 0;
+ }
+ 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;
+ }
+
+ // Get document path
+ virtual void GetURL(CXFA_FFDoc* hDoc, CFX_WideString& wsDocURL);
+ virtual FX_ARGB GetHighlightColor(CXFA_FFDoc* hDoc);
+
+ /**
+ *Submit data to email, http, ftp.
+ * @param[in] hDoc The document handler.
+ * @param[in] eFormat Determines the format in which the data will be
+ *submitted. XFA_ATTRIBUTEENUM_Xdp, XFA_ATTRIBUTEENUM_Xml...
+ * @param[in] wsTarget The URL to which the data will be submitted.
+ * @param[in] eEncoding The encoding of text content.
+ * @param[in] pXDPContent Controls what subset of the data is submitted, used
+ *only when the format property is xdp.
+ * @param[in] bEmbedPDF, specifies whether PDF is embedded in the submitted
+ *content or not.
+ */
+ virtual FX_BOOL SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit);
+
+ virtual FX_BOOL CheckWord(CXFA_FFDoc* hDoc, const CFX_ByteStringC& sWord) {
+ return FALSE;
+ }
+ virtual FX_BOOL GetSuggestWords(CXFA_FFDoc* hDoc,
+ const CFX_ByteStringC& sWord,
+ std::vector<CFX_ByteString>& sSuggest) {
+ return FALSE;
+ }
+
+ // Get PDF javascript object, set the object to hValue.
+ virtual FX_BOOL GetPDFScriptObject(CXFA_FFDoc* hDoc,
+ const CFX_ByteStringC& utf8Name,
+ FXJSE_HVALUE hValue);
+
+ virtual FX_BOOL GetGlobalProperty(CXFA_FFDoc* hDoc,
+ const CFX_ByteStringC& szPropName,
+ FXJSE_HVALUE hValue);
+ virtual FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc,
+ const CFX_ByteStringC& szPropName,
+ FXJSE_HVALUE hValue);
+ virtual CPDF_Document* OpenPDF(CXFA_FFDoc* hDoc,
+ IFX_FileRead* pFile,
+ FX_BOOL bTakeOverFile) {
+ return NULL;
+ }
+
+ virtual IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc,
+ const CFX_WideString& wsLink);
+
+ FX_BOOL _GetHValueByName(const CFX_ByteStringC& utf8Name,
+ FXJSE_HVALUE hValue,
+ IJS_Runtime* runTime);
+ FX_BOOL _OnBeforeNotifySumbit();
+ void _OnAfterNotifySumbit();
+ FX_BOOL _NotifySubmit(FX_BOOL bPrevOrPost);
+ FX_BOOL _SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit);
+ FX_BOOL _MailToInfo(CFX_WideString& csURL,
+ CFX_WideString& csToAddress,
+ CFX_WideString& csCCAddress,
+ CFX_WideString& csBCCAddress,
+ CFX_WideString& csSubject,
+ CFX_WideString& csMsg);
+ FX_BOOL _ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler,
+ int fileType,
+ FPDF_DWORD encodeType,
+ FPDF_DWORD flag = 0x01111111);
+ void _ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag);
+ void _ClearChangeMark();
+
+ private:
+ enum LoadStatus {
+ FXFA_LOADSTATUS_PRELOAD = 0,
+ FXFA_LOADSTATUS_LOADING,
+ FXFA_LOADSTATUS_LOADED,
+ FXFA_LOADSTATUS_CLOSING,
+ FXFA_LOADSTATUS_CLOSED
+ };
+
+ void CloseXFADoc(CXFA_FFDocHandler* pDoc) {
+ if (pDoc) {
+ m_pXFADoc->CloseDoc();
+ delete m_pXFADoc;
+ m_pXFADoc = nullptr;
+ m_pXFADocView = nullptr;
+ }
+ }
+
+ int m_iDocType;
+ CPDF_Document* m_pPDFDoc;
+ CPDFSDK_Document* m_pSDKDoc;
+ CXFA_FFDoc* m_pXFADoc;
+ CXFA_FFDocView* m_pXFADocView;
+ CPDFXFA_App* m_pApp;
+ IJS_Context* m_pJSContext;
+ CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList;
+ LoadStatus m_nLoadStatus;
+ int m_nPageCount;
+};
+
+#endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_
diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_page.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_page.h
new file mode 100644
index 0000000000..2c860ffbdc
--- /dev/null
+++ b/fpdfsdk/fpdfxfa/include/fpdfxfa_page.h
@@ -0,0 +1,77 @@
+// 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 FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_PAGE_H_
+#define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_PAGE_H_
+
+#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
+#include "core/fpdfapi/include/cpdf_modulemgr.h"
+#include "core/fxcrt/include/fx_coordinates.h"
+#include "core/fxcrt/include/fx_system.h"
+
+class CPDFXFA_Document;
+class CPDF_Page;
+class CXFA_FFPageView;
+
+class CPDFXFA_Page {
+ public:
+ CPDFXFA_Page(CPDFXFA_Document* pDoc, int page_index);
+ ~CPDFXFA_Page();
+
+ void Release();
+ void AddRef() { m_iRef++; }
+ FX_BOOL LoadPage();
+ FX_BOOL LoadPDFPage(CPDF_Dictionary* pageDict);
+ CPDFXFA_Document* GetDocument() { return m_pDocument; }
+ int GetPageIndex() { return m_iPageIndex; }
+ CPDF_Page* GetPDFPage() { return m_pPDFPage; }
+ CXFA_FFPageView* GetXFAPageView() { return m_pXFAPageView; }
+ void SetXFAPageView(CXFA_FFPageView* pPageView) {
+ m_pXFAPageView = pPageView;
+ }
+
+ FX_FLOAT GetPageWidth();
+ FX_FLOAT GetPageHeight();
+
+ void DeviceToPage(int start_x,
+ int start_y,
+ int size_x,
+ int size_y,
+ int rotate,
+ int device_x,
+ int device_y,
+ double* page_x,
+ double* page_y);
+ void PageToDevice(int start_x,
+ int start_y,
+ int size_x,
+ int size_y,
+ int rotate,
+ double page_x,
+ double page_y,
+ int* device_x,
+ int* device_y);
+
+ void GetDisplayMatrix(CFX_Matrix& matrix,
+ int xPos,
+ int yPos,
+ int xSize,
+ int ySize,
+ int iRotate) const;
+
+ protected:
+ FX_BOOL LoadPDFPage();
+ FX_BOOL LoadXFAPageView();
+
+ private:
+ CPDF_Page* m_pPDFPage;
+ CXFA_FFPageView* m_pXFAPageView;
+ int m_iPageIndex;
+ CPDFXFA_Document* m_pDocument;
+ int m_iRef;
+};
+
+#endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_PAGE_H_
diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_util.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_util.h
new file mode 100644
index 0000000000..3f17662976
--- /dev/null
+++ b/fpdfsdk/fpdfxfa/include/fpdfxfa_util.h
@@ -0,0 +1,47 @@
+// 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 FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_UTIL_H_
+#define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_UTIL_H_
+
+#include <vector>
+
+#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h"
+#include "xfa/fwl/core/include/ifwl_adaptertimermgr.h"
+
+#define JS_STR_VIEWERTYPE_STANDARD L"Exchange"
+#define JS_STR_LANGUANGE L"ENU"
+#define JS_STR_VIEWERVARIATION L"Full"
+#define JS_STR_VIEWERVERSION_XFA L"11"
+
+struct CFWL_TimerInfo;
+
+class CXFA_FWLAdapterTimerMgr : public IFWL_AdapterTimerMgr {
+ public:
+ CXFA_FWLAdapterTimerMgr(CPDFDoc_Environment* pEnv) : m_pEnv(pEnv) {}
+ virtual FWL_ERR Start(IFWL_Timer* pTimer,
+ uint32_t dwElapse,
+ FWL_HTIMER& hTimer,
+ FX_BOOL bImmediately = TRUE);
+ virtual FWL_ERR Stop(FWL_HTIMER hTimer);
+
+ protected:
+ static void TimerProc(int32_t idEvent);
+
+ static std::vector<CFWL_TimerInfo*>* s_TimerArray;
+ CPDFDoc_Environment* const m_pEnv;
+};
+
+struct CFWL_TimerInfo {
+ CFWL_TimerInfo() : pTimer(nullptr) {}
+ CFWL_TimerInfo(int32_t event, IFWL_Timer* timer)
+ : idEvent(event), pTimer(timer) {}
+
+ int32_t idEvent;
+ IFWL_Timer* pTimer;
+};
+
+#endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_UTIL_H_