summaryrefslogtreecommitdiff
path: root/fpdfsdk/include/fpdfxfa
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2015-08-04 13:00:21 -0700
committerNico Weber <thakis@chromium.org>2015-08-04 13:00:21 -0700
commit9d8ec5a6e37e8d1d4d4edca9040de234e2d4728f (patch)
treec97037f398d714665aefccb6eb54d0969ad7030c /fpdfsdk/include/fpdfxfa
parent780cee82236d1b3b0f9b01a22424e4b8ec9a6f12 (diff)
downloadpdfium-9d8ec5a6e37e8d1d4d4edca9040de234e2d4728f.tar.xz
XFA: clang-format all pdfium code.
No behavior change. Generated by: find . -name '*.cpp' -o -name '*.h' | \ grep -E -v 'third_party|thirdparties|lpng_v163|tiff_v403' | \ xargs ../../buildtools/mac/clang-format -i Then manually merged https://codereview.chromium.org/1269223002/ See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion. BUG=none
Diffstat (limited to 'fpdfsdk/include/fpdfxfa')
-rw-r--r--fpdfsdk/include/fpdfxfa/fpdfxfa_app.h148
-rw-r--r--fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h351
-rw-r--r--fpdfsdk/include/fpdfxfa/fpdfxfa_page.h91
-rw-r--r--fpdfsdk/include/fpdfxfa/fpdfxfa_util.h58
4 files changed, 375 insertions, 273 deletions
diff --git a/fpdfsdk/include/fpdfxfa/fpdfxfa_app.h b/fpdfsdk/include/fpdfxfa/fpdfxfa_app.h
index e650c6235b..bf96993bd3 100644
--- a/fpdfsdk/include/fpdfxfa/fpdfxfa_app.h
+++ b/fpdfsdk/include/fpdfxfa/fpdfxfa_app.h
@@ -10,73 +10,87 @@
class IFXJS_Runtime;
class CJS_RuntimeFactory;
-class CPDFXFA_App : public IXFA_AppProvider
-{
-public:
- static CPDFXFA_App* GetInstance();
- static void ReleaseInstance();
-
- CPDFXFA_App();
- ~CPDFXFA_App() override;
-
- FX_BOOL Initialize();
- IXFA_App* GetXFAApp() { return m_pXFAApp; }
-
- FX_BOOL AddFormFillEnv(CPDFDoc_Environment* pEnv);
- FX_BOOL RemoveFormFillEnv(CPDFDoc_Environment* pEnv);
-
- FXJSE_HRUNTIME GetJSERuntime() { return m_hJSERuntime; }
- void ReleaseRuntime();
- FX_BOOL InitRuntime(FX_BOOL bReset=FALSE);
-
- CJS_RuntimeFactory* GetRuntimeFactory() { return m_pJSRuntimeFactory; }
-
- // 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(FX_DWORD dwType) override;
- int32_t MsgBox(const CFX_WideStringC& wsMessage, const CFX_WideStringC& wsTitle, FX_DWORD dwIconType, FX_DWORD 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_bInitRuntime;
- IXFA_App* m_pXFAApp;
- IXFA_FontMgr* m_pFontMgr;
- FXJSE_HRUNTIME m_hJSERuntime;
- IFXJS_Runtime* m_pJSRuntime;
- CJS_RuntimeFactory* m_pJSRuntimeFactory;
- CFX_WideString m_csAppType;
+class CPDFXFA_App : public IXFA_AppProvider {
+ public:
+ static CPDFXFA_App* GetInstance();
+ static void ReleaseInstance();
+
+ CPDFXFA_App();
+ ~CPDFXFA_App() override;
+
+ FX_BOOL Initialize();
+ IXFA_App* GetXFAApp() { return m_pXFAApp; }
+
+ FX_BOOL AddFormFillEnv(CPDFDoc_Environment* pEnv);
+ FX_BOOL RemoveFormFillEnv(CPDFDoc_Environment* pEnv);
+
+ FXJSE_HRUNTIME GetJSERuntime() { return m_hJSERuntime; }
+ void ReleaseRuntime();
+ FX_BOOL InitRuntime(FX_BOOL bReset = FALSE);
+
+ CJS_RuntimeFactory* GetRuntimeFactory() { return m_pJSRuntimeFactory; }
+
+ // 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(FX_DWORD dwType) override;
+ int32_t MsgBox(const CFX_WideStringC& wsMessage,
+ const CFX_WideStringC& wsTitle,
+ FX_DWORD dwIconType,
+ FX_DWORD 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_bInitRuntime;
+ IXFA_App* m_pXFAApp;
+ IXFA_FontMgr* m_pFontMgr;
+ FXJSE_HRUNTIME m_hJSERuntime;
+ IFXJS_Runtime* m_pJSRuntime;
+ CJS_RuntimeFactory* m_pJSRuntimeFactory;
+ CFX_WideString m_csAppType;
};
#endif // FPDFXFA_APP_H_
diff --git a/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h b/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h
index f8d691ebfa..27e7a91cd5 100644
--- a/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h
+++ b/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h
@@ -1,7 +1,7 @@
// 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 FPDFXFA_DOC_H_
@@ -18,142 +18,219 @@ class IFXJS_Runtime;
class IFXJS_Context;
class IXFA_DocHandler;
-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; }
- IXFA_Doc* GetXFADoc() { return m_pXFADoc; }
- IXFA_DocView* GetXFADocView() { return m_pXFADocView; }
-
- int GetPageCount();
- CPDFXFA_Page* GetPage(int page_index);
- CPDFXFA_Page* GetPage(IXFA_PageView* pPage);
- void RemovePage(CPDFXFA_Page* page);
- int GetDocType(){ return m_iDocType; }
-
- CPDFSDK_Document* GetSDKDocument(CPDFDoc_Environment* pFormFillEnv);
- void ReleaseSDKDoc();
-
- void FXRect2PDFRect(const CFX_RectF& fxRectF, CPDF_Rect& pdfRect);
-
-public:
- virtual void SetChangeMark(IXFA_Doc* hDoc);
- virtual FX_BOOL GetChangeMark(IXFA_Doc* hDoc);
- //used in dynamic xfa, dwFlags refer to XFA_INVALIDATE_XXX macros.
- virtual void InvalidateRect(IXFA_PageView* pPageView, const CFX_RectF& rt, FX_DWORD dwFlags = 0);
- //used in static xfa, dwFlags refer to XFA_INVALIDATE_XXX macros.
- virtual void InvalidateRect(IXFA_Widget* hWidget, FX_DWORD dwFlags = 0);
- //show or hide caret
- virtual void DisplayCaret(IXFA_Widget* hWidget, FX_BOOL bVisible, const CFX_RectF* pRtAnchor);
- //dwPos: (0:bottom 1:top)
- virtual FX_BOOL GetPopupPos(IXFA_Widget* hWidget, FX_FLOAT fMinPopup, FX_FLOAT fMaxPopup,
- const CFX_RectF &rtAnchor, CFX_RectF &rtPopup);
- virtual FX_BOOL PopupMenu(IXFA_Widget* hWidget, CFX_PointF ptPopup, const CFX_RectF* pRectExclude = NULL);
-
- //dwFlags XFA_PAGEVIEWEVENT_Added, XFA_PAGEVIEWEVENT_Removing
- virtual void PageViewEvent(IXFA_PageView* pPageView, FX_DWORD dwFlags);
- //dwEvent refer to XFA_WIDGETEVENT_XXX
- virtual void WidgetEvent(IXFA_Widget* hWidget, CXFA_WidgetAcc* pWidgetData, FX_DWORD dwEvent, void* pParam = NULL, void* pAdditional = NULL);
-
- //return true if render it.
- virtual FX_BOOL RenderCustomWidget(IXFA_Widget* hWidget, CFX_Graphics* pGS, CFX_Matrix* pMatrix, const CFX_RectF& rtUI){return FALSE;}
-
- //host method
- virtual int32_t CountPages(IXFA_Doc* hDoc);
- virtual int32_t GetCurrentPage(IXFA_Doc* hDoc);
- virtual void SetCurrentPage(IXFA_Doc* hDoc, int32_t iCurPage);
- virtual FX_BOOL IsCalculationsEnabled(IXFA_Doc* hDoc);
- virtual void SetCalculationsEnabled(IXFA_Doc* hDoc, FX_BOOL bEnabled);
- virtual void GetTitle(IXFA_Doc* hDoc, CFX_WideString &wsTitle);
- virtual void SetTitle(IXFA_Doc* hDoc, const CFX_WideStringC& wsTitle);
- virtual void ExportData(IXFA_Doc* hDoc, const CFX_WideStringC& wsFilePath, FX_BOOL bXDP = TRUE);
- virtual void ImportData(IXFA_Doc* hDoc, const CFX_WideStringC& wsFilePath);
- virtual void GotoURL(IXFA_Doc* hDoc, const CFX_WideStringC& bsURL, FX_BOOL bAppend = TRUE);
- virtual FX_BOOL IsValidationsEnabled(IXFA_Doc* hDoc);
- virtual void SetValidationsEnabled(IXFA_Doc* hDoc, FX_BOOL bEnabled);
- virtual void SetFocusWidget(IXFA_Doc* hDoc, IXFA_Widget* hWidget);
- virtual void Print(IXFA_Doc* hDoc, int32_t nStartPage, int32_t nEndPage, FX_DWORD dwOptions);
-
- //LayoutPseudo method
- virtual int32_t AbsPageCountInBatch(IXFA_Doc* hDoc){return 0;}
- virtual int32_t AbsPageInBatch(IXFA_Doc* hDoc, IXFA_Widget* hWidget){return 0;}
- virtual int32_t SheetCountInBatch(IXFA_Doc* hDoc){return 0;}
- virtual int32_t SheetInBatch(IXFA_Doc* hDoc, IXFA_Widget* hWidget){return 0;}
-
- //SignaturePseudoModel method
- //TODO:
- virtual int32_t Verify(IXFA_Doc* hDoc, CXFA_Node* pSigNode, FX_BOOL bUsed = TRUE/*, SecurityHandler* pHandler, SignatureInfo &info*/) {return 0;}
- virtual FX_BOOL Sign(IXFA_Doc* hDoc, CXFA_NodeList* pNodeList, const CFX_WideStringC& wsExpression, const CFX_WideStringC& wsXMLIdent, const CFX_WideStringC& wsValue = FX_WSTRC(L"open"), FX_BOOL bUsed = TRUE/*, SecurityHandler* pHandler = NULL, SignatureInfo &info*/) {return 0;}
- virtual CXFA_NodeList* Enumerate(IXFA_Doc* hDoc) {return 0;}
- virtual FX_BOOL Clear(IXFA_Doc* hDoc, CXFA_Node* pSigNode, FX_BOOL bCleared = TRUE) {return 0;}
-
- //Get document path
- virtual void GetURL(IXFA_Doc* hDoc, CFX_WideString &wsDocURL);
- virtual FX_ARGB GetHighlightColor(IXFA_Doc* hDoc);
- virtual void AddDoRecord(IXFA_Widget* hWidget);
- /**
- *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(IXFA_Doc* hDoc, CXFA_Submit submit);
-
- virtual FX_BOOL CheckWord(IXFA_Doc* hDoc, const CFX_ByteStringC& sWord){return FALSE;}
- virtual FX_BOOL GetSuggestWords(IXFA_Doc* hDoc, const CFX_ByteStringC& sWord, CFX_ByteStringArray& sSuggest){return FALSE;}
-
- //Get PDF javascript object, set the object to hValue.
- virtual FX_BOOL GetPDFScriptObject(IXFA_Doc* hDoc, const CFX_ByteStringC& utf8Name, FXJSE_HVALUE hValue);
-
- virtual FX_BOOL GetGlobalProperty(IXFA_Doc* hDoc, const CFX_ByteStringC& szPropName, FXJSE_HVALUE hValue);
- virtual FX_BOOL SetGlobalProperty(IXFA_Doc* hDoc, const CFX_ByteStringC& szPropName, FXJSE_HVALUE hValue);
- virtual CPDF_Document* OpenPDF(IXFA_Doc* hDoc, IFX_FileRead* pFile, FX_BOOL bTakeOverFile){return NULL;}
-
- virtual IFX_FileRead* OpenLinkedFile(IXFA_Doc* hDoc, const CFX_WideString& wsLink);
-
- FX_BOOL _GetHValueByName(const CFX_ByteStringC& utf8Name, FXJSE_HVALUE hValue, IFXJS_Runtime* runTime);
- FX_BOOL _OnBeforeNotifySumbit();
- void _OnAfterNotifySumbit();
- FX_BOOL _NotifySubmit(FX_BOOL bPrevOrPost);
- FX_BOOL _SubmitData(IXFA_Doc* 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:
- void CloseXFADoc(IXFA_DocHandler* pDoc) {
- if (pDoc) {
- pDoc->CloseDoc(m_pXFADoc);
- pDoc->ReleaseDoc(m_pXFADoc);
- m_pXFADoc = NULL;
- m_pXFADocView = NULL;
- }
- }
-
- CPDF_Document* m_pPDFDoc;
- IXFA_Doc* m_pXFADoc;
- IXFA_DocView* m_pXFADocView;
- CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList;
-
- CPDFSDK_Document* m_pSDKDoc;
- CPDFXFA_App* m_pApp;
-
- CFX_MapByteStringToPtr m_XfaGlobalProperty;
-
- CFX_MapByteStringToPtr m_ValueMap;
-
- IFXJS_Context* m_pJSContext;
-
- int m_iDocType;
+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; }
+ IXFA_Doc* GetXFADoc() { return m_pXFADoc; }
+ IXFA_DocView* GetXFADocView() { return m_pXFADocView; }
+
+ int GetPageCount();
+ CPDFXFA_Page* GetPage(int page_index);
+ CPDFXFA_Page* GetPage(IXFA_PageView* pPage);
+ void RemovePage(CPDFXFA_Page* page);
+ int GetDocType() { return m_iDocType; }
+
+ CPDFSDK_Document* GetSDKDocument(CPDFDoc_Environment* pFormFillEnv);
+ void ReleaseSDKDoc();
+
+ void FXRect2PDFRect(const CFX_RectF& fxRectF, CPDF_Rect& pdfRect);
+
+ public:
+ virtual void SetChangeMark(IXFA_Doc* hDoc);
+ virtual FX_BOOL GetChangeMark(IXFA_Doc* hDoc);
+ // used in dynamic xfa, dwFlags refer to XFA_INVALIDATE_XXX macros.
+ virtual void InvalidateRect(IXFA_PageView* pPageView,
+ const CFX_RectF& rt,
+ FX_DWORD dwFlags = 0);
+ // used in static xfa, dwFlags refer to XFA_INVALIDATE_XXX macros.
+ virtual void InvalidateRect(IXFA_Widget* hWidget, FX_DWORD dwFlags = 0);
+ // show or hide caret
+ virtual void DisplayCaret(IXFA_Widget* hWidget,
+ FX_BOOL bVisible,
+ const CFX_RectF* pRtAnchor);
+ // dwPos: (0:bottom 1:top)
+ virtual FX_BOOL GetPopupPos(IXFA_Widget* hWidget,
+ FX_FLOAT fMinPopup,
+ FX_FLOAT fMaxPopup,
+ const CFX_RectF& rtAnchor,
+ CFX_RectF& rtPopup);
+ virtual FX_BOOL PopupMenu(IXFA_Widget* hWidget,
+ CFX_PointF ptPopup,
+ const CFX_RectF* pRectExclude = NULL);
+
+ // dwFlags XFA_PAGEVIEWEVENT_Added, XFA_PAGEVIEWEVENT_Removing
+ virtual void PageViewEvent(IXFA_PageView* pPageView, FX_DWORD dwFlags);
+ // dwEvent refer to XFA_WIDGETEVENT_XXX
+ virtual void WidgetEvent(IXFA_Widget* hWidget,
+ CXFA_WidgetAcc* pWidgetData,
+ FX_DWORD dwEvent,
+ void* pParam = NULL,
+ void* pAdditional = NULL);
+
+ // return true if render it.
+ virtual FX_BOOL RenderCustomWidget(IXFA_Widget* hWidget,
+ CFX_Graphics* pGS,
+ CFX_Matrix* pMatrix,
+ const CFX_RectF& rtUI) {
+ return FALSE;
+ }
+
+ // host method
+ virtual int32_t CountPages(IXFA_Doc* hDoc);
+ virtual int32_t GetCurrentPage(IXFA_Doc* hDoc);
+ virtual void SetCurrentPage(IXFA_Doc* hDoc, int32_t iCurPage);
+ virtual FX_BOOL IsCalculationsEnabled(IXFA_Doc* hDoc);
+ virtual void SetCalculationsEnabled(IXFA_Doc* hDoc, FX_BOOL bEnabled);
+ virtual void GetTitle(IXFA_Doc* hDoc, CFX_WideString& wsTitle);
+ virtual void SetTitle(IXFA_Doc* hDoc, const CFX_WideStringC& wsTitle);
+ virtual void ExportData(IXFA_Doc* hDoc,
+ const CFX_WideStringC& wsFilePath,
+ FX_BOOL bXDP = TRUE);
+ virtual void ImportData(IXFA_Doc* hDoc, const CFX_WideStringC& wsFilePath);
+ virtual void GotoURL(IXFA_Doc* hDoc,
+ const CFX_WideStringC& bsURL,
+ FX_BOOL bAppend = TRUE);
+ virtual FX_BOOL IsValidationsEnabled(IXFA_Doc* hDoc);
+ virtual void SetValidationsEnabled(IXFA_Doc* hDoc, FX_BOOL bEnabled);
+ virtual void SetFocusWidget(IXFA_Doc* hDoc, IXFA_Widget* hWidget);
+ virtual void Print(IXFA_Doc* hDoc,
+ int32_t nStartPage,
+ int32_t nEndPage,
+ FX_DWORD dwOptions);
+
+ // LayoutPseudo method
+ virtual int32_t AbsPageCountInBatch(IXFA_Doc* hDoc) { return 0; }
+ virtual int32_t AbsPageInBatch(IXFA_Doc* hDoc, IXFA_Widget* hWidget) {
+ return 0;
+ }
+ virtual int32_t SheetCountInBatch(IXFA_Doc* hDoc) { return 0; }
+ virtual int32_t SheetInBatch(IXFA_Doc* hDoc, IXFA_Widget* hWidget) {
+ return 0;
+ }
+
+ // SignaturePseudoModel method
+ // TODO:
+ virtual int32_t Verify(
+ IXFA_Doc* hDoc,
+ CXFA_Node* pSigNode,
+ FX_BOOL
+ bUsed = TRUE /*, SecurityHandler* pHandler, SignatureInfo &info*/) {
+ return 0;
+ }
+ virtual FX_BOOL Sign(
+ IXFA_Doc* hDoc,
+ CXFA_NodeList* pNodeList,
+ const CFX_WideStringC& wsExpression,
+ const CFX_WideStringC& wsXMLIdent,
+ const CFX_WideStringC& wsValue = FX_WSTRC(L"open"),
+ FX_BOOL
+ bUsed = TRUE /*, SecurityHandler* pHandler = NULL, SignatureInfo &info*/) {
+ return 0;
+ }
+ virtual CXFA_NodeList* Enumerate(IXFA_Doc* hDoc) { return 0; }
+ virtual FX_BOOL Clear(IXFA_Doc* hDoc,
+ CXFA_Node* pSigNode,
+ FX_BOOL bCleared = TRUE) {
+ return 0;
+ }
+
+ // Get document path
+ virtual void GetURL(IXFA_Doc* hDoc, CFX_WideString& wsDocURL);
+ virtual FX_ARGB GetHighlightColor(IXFA_Doc* hDoc);
+ virtual void AddDoRecord(IXFA_Widget* hWidget);
+ /**
+ *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(IXFA_Doc* hDoc, CXFA_Submit submit);
+
+ virtual FX_BOOL CheckWord(IXFA_Doc* hDoc, const CFX_ByteStringC& sWord) {
+ return FALSE;
+ }
+ virtual FX_BOOL GetSuggestWords(IXFA_Doc* hDoc,
+ const CFX_ByteStringC& sWord,
+ CFX_ByteStringArray& sSuggest) {
+ return FALSE;
+ }
+
+ // Get PDF javascript object, set the object to hValue.
+ virtual FX_BOOL GetPDFScriptObject(IXFA_Doc* hDoc,
+ const CFX_ByteStringC& utf8Name,
+ FXJSE_HVALUE hValue);
+
+ virtual FX_BOOL GetGlobalProperty(IXFA_Doc* hDoc,
+ const CFX_ByteStringC& szPropName,
+ FXJSE_HVALUE hValue);
+ virtual FX_BOOL SetGlobalProperty(IXFA_Doc* hDoc,
+ const CFX_ByteStringC& szPropName,
+ FXJSE_HVALUE hValue);
+ virtual CPDF_Document* OpenPDF(IXFA_Doc* hDoc,
+ IFX_FileRead* pFile,
+ FX_BOOL bTakeOverFile) {
+ return NULL;
+ }
+
+ virtual IFX_FileRead* OpenLinkedFile(IXFA_Doc* hDoc,
+ const CFX_WideString& wsLink);
+
+ FX_BOOL _GetHValueByName(const CFX_ByteStringC& utf8Name,
+ FXJSE_HVALUE hValue,
+ IFXJS_Runtime* runTime);
+ FX_BOOL _OnBeforeNotifySumbit();
+ void _OnAfterNotifySumbit();
+ FX_BOOL _NotifySubmit(FX_BOOL bPrevOrPost);
+ FX_BOOL _SubmitData(IXFA_Doc* 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:
+ void CloseXFADoc(IXFA_DocHandler* pDoc) {
+ if (pDoc) {
+ pDoc->CloseDoc(m_pXFADoc);
+ pDoc->ReleaseDoc(m_pXFADoc);
+ m_pXFADoc = NULL;
+ m_pXFADocView = NULL;
+ }
+ }
+
+ CPDF_Document* m_pPDFDoc;
+ IXFA_Doc* m_pXFADoc;
+ IXFA_DocView* m_pXFADocView;
+ CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList;
+
+ CPDFSDK_Document* m_pSDKDoc;
+ CPDFXFA_App* m_pApp;
+
+ CFX_MapByteStringToPtr m_XfaGlobalProperty;
+
+ CFX_MapByteStringToPtr m_ValueMap;
+
+ IFXJS_Context* m_pJSContext;
+
+ int m_iDocType;
};
#endif // FPDFXFA_DOC_H_
diff --git a/fpdfsdk/include/fpdfxfa/fpdfxfa_page.h b/fpdfsdk/include/fpdfxfa/fpdfxfa_page.h
index f55a42496d..1a97fe4a5a 100644
--- a/fpdfsdk/include/fpdfxfa/fpdfxfa_page.h
+++ b/fpdfsdk/include/fpdfxfa/fpdfxfa_page.h
@@ -1,48 +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 _FPDFXFA_PAGEVIEW_H_
#define _FPDFXFA_PAGEVIEW_H_
-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; }
- IXFA_PageView* GetXFAPageView() { return m_pXFAPageView; }
-
- 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_AffineMatrix& matrix, int xPos, int yPos,
- int xSize, int ySize, int iRotate) const;
-
-protected:
- FX_BOOL LoadPDFPage();
- FX_BOOL LoadXFAPageView();
-
-private:
- CPDF_Page* m_pPDFPage;
- IXFA_PageView* m_pXFAPageView;
- int m_iPageIndex;
- CPDFXFA_Document* m_pDocument;
- int m_iRef;
+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; }
+ IXFA_PageView* GetXFAPageView() { return m_pXFAPageView; }
+
+ 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_AffineMatrix& matrix,
+ int xPos,
+ int yPos,
+ int xSize,
+ int ySize,
+ int iRotate) const;
+
+ protected:
+ FX_BOOL LoadPDFPage();
+ FX_BOOL LoadXFAPageView();
+
+ private:
+ CPDF_Page* m_pPDFPage;
+ IXFA_PageView* m_pXFAPageView;
+ int m_iPageIndex;
+ CPDFXFA_Document* m_pDocument;
+ int m_iRef;
};
#endif
diff --git a/fpdfsdk/include/fpdfxfa/fpdfxfa_util.h b/fpdfsdk/include/fpdfxfa/fpdfxfa_util.h
index 9676b1399f..a6f327a201 100644
--- a/fpdfsdk/include/fpdfxfa/fpdfxfa_util.h
+++ b/fpdfsdk/include/fpdfxfa/fpdfxfa_util.h
@@ -1,44 +1,38 @@
// 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 _FPDFXFA_UTIL_H_
#define _FPDFXFA_UTIL_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"
-
-class CXFA_FWLAdapterTimerMgr : public IFWL_AdapterTimerMgr
-{
-public:
- CXFA_FWLAdapterTimerMgr(CPDFDoc_Environment* pEnv) : m_pEnv(pEnv)
- {
-
- }
- virtual FWL_ERR Start(IFWL_Timer *pTimer, FX_DWORD dwElapse, FWL_HTIMER &hTimer, FX_BOOL bImmediately = TRUE);
- virtual FWL_ERR Stop(FWL_HTIMER hTimer);
-
-protected:
- static void TimerProc(int32_t idEvent);
-
- static CFX_PtrArray ms_timerArray;
- CPDFDoc_Environment* m_pEnv;
+#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"
+
+class CXFA_FWLAdapterTimerMgr : public IFWL_AdapterTimerMgr {
+ public:
+ CXFA_FWLAdapterTimerMgr(CPDFDoc_Environment* pEnv) : m_pEnv(pEnv) {}
+ virtual FWL_ERR Start(IFWL_Timer* pTimer,
+ FX_DWORD dwElapse,
+ FWL_HTIMER& hTimer,
+ FX_BOOL bImmediately = TRUE);
+ virtual FWL_ERR Stop(FWL_HTIMER hTimer);
+
+ protected:
+ static void TimerProc(int32_t idEvent);
+
+ static CFX_PtrArray ms_timerArray;
+ CPDFDoc_Environment* m_pEnv;
};
-class CFWL_TimerInfo
-{
-public:
- CFWL_TimerInfo()
- : pTimer(NULL)
- {
-
- }
- uint32_t uIDEvent;
- IFWL_Timer *pTimer;
+class CFWL_TimerInfo {
+ public:
+ CFWL_TimerInfo() : pTimer(NULL) {}
+ uint32_t uIDEvent;
+ IFWL_Timer* pTimer;
};
-#endif
+#endif