| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ | 7 #ifndef FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ |
| 8 #define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ | 8 #define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ |
| 9 | 9 |
| 10 #include "xfa/fxfa/include/xfa_ffdoc.h" |
| 11 |
| 10 #include <vector> | 12 #include <vector> |
| 11 | 13 |
| 12 #include "public/fpdfview.h" | 14 #include "public/fpdfview.h" |
| 13 #include "xfa/fxfa/include/fxfa.h" | 15 #include "xfa/fxfa/include/fxfa.h" |
| 14 #include "xfa/fxfa/include/xfa_ffdoc.h" | |
| 15 #include "xfa/fxfa/include/xfa_ffdochandler.h" | 16 #include "xfa/fxfa/include/xfa_ffdochandler.h" |
| 16 | 17 |
| 17 class CPDFXFA_App; | 18 class CPDFXFA_App; |
| 18 class CPDFXFA_Document; | 19 class CPDFXFA_Document; |
| 19 class CPDFXFA_Page; | 20 class CPDFXFA_Page; |
| 20 class CPDFSDK_Document; | 21 class CPDFSDK_Document; |
| 21 class CPDFDoc_Environment; | 22 class CPDFDoc_Environment; |
| 22 class IJS_Runtime; | 23 class IJS_Runtime; |
| 23 class IJS_Context; | 24 class IJS_Context; |
| 24 class CXFA_FFDocHandler; | 25 class CXFA_FFDocHandler; |
| 25 | 26 |
| 26 class CPDFXFA_Document : public IXFA_DocProvider { | 27 class CPDFXFA_Document : public IXFA_DocProvider { |
| 27 public: | 28 public: |
| 28 CPDFXFA_Document(CPDF_Document* pPDFDoc, CPDFXFA_App* pProvider); | 29 CPDFXFA_Document(CPDF_Document* pPDFDoc, CPDFXFA_App* pProvider); |
| 29 ~CPDFXFA_Document(); | 30 ~CPDFXFA_Document() override; |
| 30 | 31 |
| 31 FX_BOOL LoadXFADoc(); | 32 FX_BOOL LoadXFADoc(); |
| 32 CPDFXFA_App* GetApp() { return m_pApp; } | 33 CPDFXFA_App* GetApp() { return m_pApp; } |
| 33 CPDF_Document* GetPDFDoc() { return m_pPDFDoc; } | 34 CPDF_Document* GetPDFDoc() { return m_pPDFDoc; } |
| 34 CXFA_FFDoc* GetXFADoc() { return m_pXFADoc; } | 35 CXFA_FFDoc* GetXFADoc() { return m_pXFADoc; } |
| 35 CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; } | 36 CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; } |
| 36 | 37 |
| 37 int GetPageCount(); | 38 int GetPageCount(); |
| 38 CPDFXFA_Page* GetPage(int page_index); | 39 CPDFXFA_Page* GetPage(int page_index); |
| 39 CPDFXFA_Page* GetPage(CXFA_FFPageView* pPage); | 40 CPDFXFA_Page* GetPage(CXFA_FFPageView* pPage); |
| 40 | 41 |
| 41 void DeletePage(int page_index); | 42 void DeletePage(int page_index); |
| 42 void RemovePage(CPDFXFA_Page* page); | 43 void RemovePage(CPDFXFA_Page* page); |
| 43 int GetDocType() { return m_iDocType; } | 44 int GetDocType() { return m_iDocType; } |
| 44 | 45 |
| 45 CPDFSDK_Document* GetSDKDocument(CPDFDoc_Environment* pFormFillEnv); | 46 CPDFSDK_Document* GetSDKDocument(CPDFDoc_Environment* pFormFillEnv); |
| 46 | 47 |
| 47 void FXRect2PDFRect(const CFX_RectF& fxRectF, CFX_FloatRect& pdfRect); | 48 void FXRect2PDFRect(const CFX_RectF& fxRectF, CFX_FloatRect& pdfRect); |
| 48 | 49 |
| 49 virtual void SetChangeMark(CXFA_FFDoc* hDoc); | 50 // IXFA_DocProvider |
| 50 virtual FX_BOOL GetChangeMark(CXFA_FFDoc* hDoc); | 51 void SetChangeMark(CXFA_FFDoc* hDoc) override; |
| 51 // used in dynamic xfa, dwFlags refer to XFA_INVALIDATE_XXX macros. | 52 // used in dynamic xfa, dwFlags refer to XFA_INVALIDATE_XXX macros. |
| 52 virtual void InvalidateRect(CXFA_FFPageView* pPageView, | 53 void InvalidateRect(CXFA_FFPageView* pPageView, |
| 53 const CFX_RectF& rt, | 54 const CFX_RectF& rt, |
| 54 uint32_t dwFlags = 0); | 55 uint32_t dwFlags = 0) override; |
| 55 // used in static xfa, dwFlags refer to XFA_INVALIDATE_XXX macros. | |
| 56 virtual void InvalidateRect(CXFA_FFWidget* hWidget, uint32_t dwFlags = 0); | |
| 57 // show or hide caret | 56 // show or hide caret |
| 58 virtual void DisplayCaret(CXFA_FFWidget* hWidget, | 57 void DisplayCaret(CXFA_FFWidget* hWidget, |
| 59 FX_BOOL bVisible, | 58 FX_BOOL bVisible, |
| 60 const CFX_RectF* pRtAnchor); | 59 const CFX_RectF* pRtAnchor) override; |
| 61 // dwPos: (0:bottom 1:top) | 60 // dwPos: (0:bottom 1:top) |
| 62 virtual FX_BOOL GetPopupPos(CXFA_FFWidget* hWidget, | 61 FX_BOOL GetPopupPos(CXFA_FFWidget* hWidget, |
| 63 FX_FLOAT fMinPopup, | 62 FX_FLOAT fMinPopup, |
| 64 FX_FLOAT fMaxPopup, | 63 FX_FLOAT fMaxPopup, |
| 65 const CFX_RectF& rtAnchor, | 64 const CFX_RectF& rtAnchor, |
| 66 CFX_RectF& rtPopup); | 65 CFX_RectF& rtPopup) override; |
| 67 virtual FX_BOOL PopupMenu(CXFA_FFWidget* hWidget, | 66 FX_BOOL PopupMenu(CXFA_FFWidget* hWidget, |
| 68 CFX_PointF ptPopup, | 67 CFX_PointF ptPopup, |
| 69 const CFX_RectF* pRectExclude = nullptr); | 68 const CFX_RectF* pRectExclude = nullptr) override; |
| 70 | 69 |
| 71 // dwFlags XFA_PAGEVIEWEVENT_Added, XFA_PAGEVIEWEVENT_Removing | 70 // dwFlags XFA_PAGEVIEWEVENT_Added, XFA_PAGEVIEWEVENT_Removing |
| 72 virtual void PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags); | 71 void PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags) override; |
| 73 virtual void WidgetPostAdd(CXFA_FFWidget* hWidget, | 72 void WidgetPostAdd(CXFA_FFWidget* hWidget, |
| 74 CXFA_WidgetAcc* pWidgetData); | 73 CXFA_WidgetAcc* pWidgetData) override; |
| 75 virtual void WidgetPreRemove(CXFA_FFWidget* hWidget, | 74 void WidgetPreRemove(CXFA_FFWidget* hWidget, |
| 76 CXFA_WidgetAcc* pWidgetData); | 75 CXFA_WidgetAcc* pWidgetData) override; |
| 77 | 76 |
| 78 // return true if render it. | 77 // return true if render it. |
| 79 virtual FX_BOOL RenderCustomWidget(CXFA_FFWidget* hWidget, | 78 FX_BOOL RenderCustomWidget(CXFA_FFWidget* hWidget, |
| 80 CFX_Graphics* pGS, | 79 CFX_Graphics* pGS, |
| 81 CFX_Matrix* pMatrix, | 80 CFX_Matrix* pMatrix, |
| 82 const CFX_RectF& rtUI) { | 81 const CFX_RectF& rtUI) override; |
| 83 return FALSE; | |
| 84 } | |
| 85 | 82 |
| 86 // host method | 83 // Host method |
| 87 virtual int32_t CountPages(CXFA_FFDoc* hDoc); | 84 int32_t CountPages(CXFA_FFDoc* hDoc) override; |
| 88 virtual int32_t GetCurrentPage(CXFA_FFDoc* hDoc); | 85 int32_t GetCurrentPage(CXFA_FFDoc* hDoc) override; |
| 89 virtual void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage); | 86 void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) override; |
| 90 virtual FX_BOOL IsCalculationsEnabled(CXFA_FFDoc* hDoc); | 87 FX_BOOL IsCalculationsEnabled(CXFA_FFDoc* hDoc) override; |
| 91 virtual void SetCalculationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled); | 88 void SetCalculationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) override; |
| 92 virtual void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle); | 89 void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) override; |
| 93 virtual void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideString& wsTitle); | 90 void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideString& wsTitle) override; |
| 94 virtual void ExportData(CXFA_FFDoc* hDoc, | 91 void ExportData(CXFA_FFDoc* hDoc, |
| 95 const CFX_WideString& wsFilePath, | 92 const CFX_WideString& wsFilePath, |
| 96 FX_BOOL bXDP = TRUE); | 93 FX_BOOL bXDP = TRUE) override; |
| 97 virtual void ImportData(CXFA_FFDoc* hDoc, const CFX_WideString& wsFilePath); | 94 void ImportData(CXFA_FFDoc* hDoc, const CFX_WideString& wsFilePath) override; |
| 98 virtual void GotoURL(CXFA_FFDoc* hDoc, | 95 void GotoURL(CXFA_FFDoc* hDoc, |
| 99 const CFX_WideString& bsURL, | 96 const CFX_WideString& bsURL, |
| 100 FX_BOOL bAppend = TRUE); | 97 FX_BOOL bAppend = TRUE) override; |
| 101 virtual FX_BOOL IsValidationsEnabled(CXFA_FFDoc* hDoc); | 98 FX_BOOL IsValidationsEnabled(CXFA_FFDoc* hDoc) override; |
| 102 virtual void SetValidationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled); | 99 void SetValidationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) override; |
| 103 virtual void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget); | 100 void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) override; |
| 104 virtual void Print(CXFA_FFDoc* hDoc, | 101 void Print(CXFA_FFDoc* hDoc, |
| 105 int32_t nStartPage, | 102 int32_t nStartPage, |
| 106 int32_t nEndPage, | 103 int32_t nEndPage, |
| 107 uint32_t dwOptions); | 104 uint32_t dwOptions) override; |
| 108 | 105 |
| 109 // LayoutPseudo method | 106 // LayoutPseudo method |
| 110 virtual int32_t AbsPageCountInBatch(CXFA_FFDoc* hDoc) { return 0; } | 107 int32_t AbsPageCountInBatch(CXFA_FFDoc* hDoc) override; |
| 111 virtual int32_t AbsPageInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) { | 108 int32_t AbsPageInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) override; |
| 112 return 0; | 109 int32_t SheetCountInBatch(CXFA_FFDoc* hDoc) override; |
| 113 } | 110 int32_t SheetInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) override; |
| 114 virtual int32_t SheetCountInBatch(CXFA_FFDoc* hDoc) { return 0; } | |
| 115 virtual int32_t SheetInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) { | |
| 116 return 0; | |
| 117 } | |
| 118 | 111 |
| 119 virtual int32_t Verify(CXFA_FFDoc* hDoc, | 112 int32_t Verify(CXFA_FFDoc* hDoc, |
| 120 CXFA_Node* pSigNode, | 113 CXFA_Node* pSigNode, |
| 121 FX_BOOL bUsed = TRUE) { | 114 FX_BOOL bUsed = TRUE) override; |
| 122 return 0; | 115 FX_BOOL Sign(CXFA_FFDoc* hDoc, |
| 123 } | 116 CXFA_NodeList* pNodeList, |
| 124 virtual FX_BOOL Sign(CXFA_FFDoc* hDoc, | 117 const CFX_WideStringC& wsExpression, |
| 125 CXFA_NodeList* pNodeList, | 118 const CFX_WideStringC& wsXMLIdent, |
| 126 const CFX_WideStringC& wsExpression, | 119 const CFX_WideStringC& wsValue = FX_WSTRC(L"open"), |
| 127 const CFX_WideStringC& wsXMLIdent, | 120 FX_BOOL bUsed = TRUE) override; |
| 128 const CFX_WideStringC& wsValue = FX_WSTRC(L"open"), | 121 CXFA_NodeList* Enumerate(CXFA_FFDoc* hDoc) override; |
| 129 FX_BOOL bUsed = TRUE) { | 122 FX_BOOL Clear(CXFA_FFDoc* hDoc, |
| 130 return 0; | 123 CXFA_Node* pSigNode, |
| 131 } | 124 FX_BOOL bCleared = TRUE) override; |
| 132 virtual CXFA_NodeList* Enumerate(CXFA_FFDoc* hDoc) { return 0; } | |
| 133 virtual FX_BOOL Clear(CXFA_FFDoc* hDoc, | |
| 134 CXFA_Node* pSigNode, | |
| 135 FX_BOOL bCleared = TRUE) { | |
| 136 return 0; | |
| 137 } | |
| 138 | 125 |
| 139 // Get document path | 126 // Get document path |
| 140 virtual void GetURL(CXFA_FFDoc* hDoc, CFX_WideString& wsDocURL); | 127 void GetURL(CXFA_FFDoc* hDoc, CFX_WideString& wsDocURL) override; |
| 141 virtual FX_ARGB GetHighlightColor(CXFA_FFDoc* hDoc); | 128 FX_ARGB GetHighlightColor(CXFA_FFDoc* hDoc) override; |
| 142 | 129 |
| 143 /** | 130 /** |
| 144 *Submit data to email, http, ftp. | 131 *Submit data to email, http, ftp. |
| 145 * @param[in] hDoc The document handler. | 132 * @param[in] hDoc The document handler. |
| 146 * @param[in] eFormat Determines the format in which the data will be | 133 * @param[in] eFormat Determines the format in which the data will be |
| 147 *submitted. XFA_ATTRIBUTEENUM_Xdp, XFA_ATTRIBUTEENUM_Xml... | 134 *submitted. XFA_ATTRIBUTEENUM_Xdp, XFA_ATTRIBUTEENUM_Xml... |
| 148 * @param[in] wsTarget The URL to which the data will be submitted. | 135 * @param[in] wsTarget The URL to which the data will be submitted. |
| 149 * @param[in] eEncoding The encoding of text content. | 136 * @param[in] eEncoding The encoding of text content. |
| 150 * @param[in] pXDPContent Controls what subset of the data is submitted, used | 137 * @param[in] pXDPContent Controls what subset of the data is submitted, used |
| 151 *only when the format property is xdp. | 138 *only when the format property is xdp. |
| 152 * @param[in] bEmbedPDF, specifies whether PDF is embedded in the submitted | 139 * @param[in] bEmbedPDF, specifies whether PDF is embedded in the submitted |
| 153 *content or not. | 140 *content or not. |
| 154 */ | 141 */ |
| 155 virtual FX_BOOL SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit); | 142 FX_BOOL SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) override; |
| 156 | 143 |
| 157 virtual FX_BOOL CheckWord(CXFA_FFDoc* hDoc, const CFX_ByteStringC& sWord) { | 144 FX_BOOL CheckWord(CXFA_FFDoc* hDoc, const CFX_ByteStringC& sWord) override; |
| 158 return FALSE; | 145 FX_BOOL GetSuggestWords(CXFA_FFDoc* hDoc, |
| 159 } | 146 const CFX_ByteStringC& sWord, |
| 160 virtual FX_BOOL GetSuggestWords(CXFA_FFDoc* hDoc, | 147 std::vector<CFX_ByteString>& sSuggest) override; |
| 161 const CFX_ByteStringC& sWord, | |
| 162 std::vector<CFX_ByteString>& sSuggest) { | |
| 163 return FALSE; | |
| 164 } | |
| 165 | 148 |
| 166 // Get PDF javascript object, set the object to pValue. | 149 // Get PDF javascript object, set the object to pValue. |
| 167 virtual FX_BOOL GetPDFScriptObject(CXFA_FFDoc* hDoc, | 150 FX_BOOL GetPDFScriptObject(CXFA_FFDoc* hDoc, |
| 168 const CFX_ByteStringC& utf8Name, | 151 const CFX_ByteStringC& utf8Name, |
| 169 CFXJSE_Value* pValue); | 152 CFXJSE_Value* pValue) override; |
| 170 | 153 |
| 171 virtual FX_BOOL GetGlobalProperty(CXFA_FFDoc* hDoc, | 154 FX_BOOL GetGlobalProperty(CXFA_FFDoc* hDoc, |
| 172 const CFX_ByteStringC& szPropName, | 155 const CFX_ByteStringC& szPropName, |
| 173 CFXJSE_Value* pValue); | 156 CFXJSE_Value* pValue) override; |
| 174 virtual FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc, | 157 FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc, |
| 175 const CFX_ByteStringC& szPropName, | 158 const CFX_ByteStringC& szPropName, |
| 176 CFXJSE_Value* pValue); | 159 CFXJSE_Value* pValue) override; |
| 177 virtual CPDF_Document* OpenPDF(CXFA_FFDoc* hDoc, | 160 CPDF_Document* OpenPDF(CXFA_FFDoc* hDoc, |
| 178 IFX_FileRead* pFile, | 161 IFX_FileRead* pFile, |
| 179 FX_BOOL bTakeOverFile) { | 162 FX_BOOL bTakeOverFile) override; |
| 180 return nullptr; | |
| 181 } | |
| 182 | 163 |
| 183 virtual IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc, | 164 IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc, |
| 184 const CFX_WideString& wsLink); | 165 const CFX_WideString& wsLink) override; |
| 185 | 166 |
| 186 FX_BOOL _OnBeforeNotifySumbit(); | 167 FX_BOOL _OnBeforeNotifySumbit(); |
| 187 void _OnAfterNotifySumbit(); | 168 void _OnAfterNotifySumbit(); |
| 188 FX_BOOL _NotifySubmit(FX_BOOL bPrevOrPost); | 169 FX_BOOL _NotifySubmit(FX_BOOL bPrevOrPost); |
| 189 FX_BOOL _SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit); | 170 FX_BOOL _SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit); |
| 190 FX_BOOL _MailToInfo(CFX_WideString& csURL, | 171 FX_BOOL _MailToInfo(CFX_WideString& csURL, |
| 191 CFX_WideString& csToAddress, | 172 CFX_WideString& csToAddress, |
| 192 CFX_WideString& csCCAddress, | 173 CFX_WideString& csCCAddress, |
| 193 CFX_WideString& csBCCAddress, | 174 CFX_WideString& csBCCAddress, |
| 194 CFX_WideString& csSubject, | 175 CFX_WideString& csSubject, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 224 CXFA_FFDoc* m_pXFADoc; | 205 CXFA_FFDoc* m_pXFADoc; |
| 225 CXFA_FFDocView* m_pXFADocView; | 206 CXFA_FFDocView* m_pXFADocView; |
| 226 CPDFXFA_App* m_pApp; | 207 CPDFXFA_App* m_pApp; |
| 227 IJS_Context* m_pJSContext; | 208 IJS_Context* m_pJSContext; |
| 228 CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList; | 209 CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList; |
| 229 LoadStatus m_nLoadStatus; | 210 LoadStatus m_nLoadStatus; |
| 230 int m_nPageCount; | 211 int m_nPageCount; |
| 231 }; | 212 }; |
| 232 | 213 |
| 233 #endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ | 214 #endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ |
| OLD | NEW |