Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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_CPDFSDK_FORMFILLENVIRONMENT_H_ | 7 #ifndef FPDFSDK_CPDFSDK_FORMFILLENVIRONMENT_H_ |
| 8 #define FPDFSDK_CPDFSDK_FORMFILLENVIRONMENT_H_ | 8 #define FPDFSDK_CPDFSDK_FORMFILLENVIRONMENT_H_ |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 class CPDFSDK_PageView; | 27 class CPDFSDK_PageView; |
| 28 class IJS_Runtime; | 28 class IJS_Runtime; |
| 29 | 29 |
| 30 class CPDFSDK_FormFillEnvironment | 30 class CPDFSDK_FormFillEnvironment |
| 31 : public CFX_Observable<CPDFSDK_FormFillEnvironment> { | 31 : public CFX_Observable<CPDFSDK_FormFillEnvironment> { |
| 32 public: | 32 public: |
| 33 CPDFSDK_FormFillEnvironment(UnderlyingDocumentType* pDoc, | 33 CPDFSDK_FormFillEnvironment(UnderlyingDocumentType* pDoc, |
| 34 FPDF_FORMFILLINFO* pFFinfo); | 34 FPDF_FORMFILLINFO* pFFinfo); |
| 35 ~CPDFSDK_FormFillEnvironment(); | 35 ~CPDFSDK_FormFillEnvironment(); |
| 36 | 36 |
| 37 CPDFSDK_InterForm* GetInterForm(); | 37 CPDFSDK_PageView* GetPageView(UnderlyingPageType* pPage, bool renew); |
| 38 | |
| 39 // Gets the document object for the next layer down; for master this is | |
| 40 // a CPDF_Document, but for XFA it is a CPDFXFA_Document. | |
| 41 UnderlyingDocumentType* GetUnderlyingDocument() const { | |
| 42 #ifdef PDF_ENABLE_XFA | |
| 43 return GetXFADocument(); | |
| 44 #else // PDF_ENABLE_XFA | |
| 45 return GetPDFDocument(); | |
| 46 #endif // PDF_ENABLE_XFA | |
| 47 } | |
| 48 | |
| 49 // Gets the CPDF_Document, either directly in master, or from the | |
| 50 // CPDFXFA_Document for XFA. | |
| 51 CPDF_Document* GetPDFDocument() const { | |
| 52 #ifdef PDF_ENABLE_XFA | |
| 53 return m_pUnderlyingDoc ? m_pUnderlyingDoc->GetPDFDoc() : nullptr; | |
| 54 #else // PDF_ENABLE_XFA | |
| 55 return m_pUnderlyingDoc; | |
| 56 #endif // PDF_ENABLE_XFA | |
| 57 } | |
| 58 | |
| 59 #ifdef PDF_ENABLE_XFA | |
| 60 // Gets the XFA document directly (XFA-only). | |
| 61 CPDFXFA_Document* GetXFADocument() const { return m_pUnderlyingDoc; } | |
| 62 void ResetXFADocument() { m_pUnderlyingDoc = nullptr; } | |
| 63 | |
| 64 int GetPageViewCount() const { return m_pageMap.size(); } | |
| 65 #endif // PDF_ENABLE_XFA | |
| 66 | |
| 67 CPDFSDK_PageView* GetPageView(UnderlyingPageType* pPage, bool ReNew); | |
| 68 CPDFSDK_PageView* GetPageView(int nIndex); | 38 CPDFSDK_PageView* GetPageView(int nIndex); |
| 69 CPDFSDK_PageView* GetCurrentView(); | 39 CPDFSDK_PageView* GetCurrentView(); |
| 70 void RemovePageView(UnderlyingPageType* pPage); | 40 void RemovePageView(UnderlyingPageType* pPage); |
| 71 void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot); | 41 void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot); |
| 72 | 42 |
| 73 CPDFSDK_Annot* GetFocusAnnot() { return m_pFocusAnnot.Get(); } | 43 CPDFSDK_Annot* GetFocusAnnot() { return m_pFocusAnnot.Get(); } |
| 74 FX_BOOL SetFocusAnnot(CPDFSDK_Annot::ObservedPtr* pAnnot); | 44 FX_BOOL SetFocusAnnot(CPDFSDK_Annot::ObservedPtr* pAnnot); |
| 75 FX_BOOL KillFocusAnnot(uint32_t nFlag); | 45 FX_BOOL KillFocusAnnot(uint32_t nFlag); |
| 76 void ClearAllFocusedAnnots(); | 46 void ClearAllFocusedAnnots(); |
| 77 | 47 |
| 78 FX_BOOL ExtractPages(const std::vector<uint16_t>& arrExtraPages, | 48 FX_BOOL ExtractPages(const std::vector<uint16_t>& arrExtraPages, |
| 79 CPDF_Document* pDstDoc); | 49 CPDF_Document* pDstDoc); |
| 80 FX_BOOL InsertPages(int nInsertAt, | 50 FX_BOOL InsertPages(int nInsertAt, |
| 81 const CPDF_Document* pSrcDoc, | 51 const CPDF_Document* pSrcDoc, |
| 82 const std::vector<uint16_t>& arrSrcPages); | 52 const std::vector<uint16_t>& arrSrcPages); |
| 83 FX_BOOL ReplacePages(int nPage, | 53 FX_BOOL ReplacePages(int nPage, |
| 84 const CPDF_Document* pSrcDoc, | 54 const CPDF_Document* pSrcDoc, |
| 85 const std::vector<uint16_t>& arrSrcPages); | 55 const std::vector<uint16_t>& arrSrcPages); |
| 86 | 56 |
| 87 int GetPageCount() { return m_pUnderlyingDoc->GetPageCount(); } | 57 int GetPageCount() { return m_pUnderlyingDoc->GetPageCount(); } |
| 88 FX_BOOL GetPermissions(int nFlag); | 58 FX_BOOL GetPermissions(int nFlag); |
| 89 | 59 |
| 90 FX_BOOL GetChangeMark() { return m_bChangeMask; } | 60 bool GetChangeMark() const { return m_bChangeMask; } |
| 91 void SetChangeMark() { m_bChangeMask = TRUE; } | 61 void SetChangeMark() { m_bChangeMask = true; } |
| 92 void ClearChangeMark() { m_bChangeMask = FALSE; } | 62 void ClearChangeMark() { m_bChangeMask = false; } |
| 93 | 63 |
| 94 UnderlyingPageType* GetPage(int nIndex); | 64 UnderlyingPageType* GetPage(int nIndex); |
| 95 | 65 |
| 96 void ProcJavascriptFun(); | 66 void ProcJavascriptFun(); |
| 97 FX_BOOL ProcOpenAction(); | 67 FX_BOOL ProcOpenAction(); |
| 98 | 68 |
| 99 void Invalidate(FPDF_PAGE page, | 69 void Invalidate(FPDF_PAGE page, |
| 100 double left, | 70 double left, |
| 101 double top, | 71 double top, |
| 102 double right, | 72 double right, |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 123 void ExecuteNamedAction(const FX_CHAR* namedAction); | 93 void ExecuteNamedAction(const FX_CHAR* namedAction); |
| 124 void OnSetFieldInputFocus(FPDF_WIDESTRING focusText, | 94 void OnSetFieldInputFocus(FPDF_WIDESTRING focusText, |
| 125 FPDF_DWORD nTextLen, | 95 FPDF_DWORD nTextLen, |
| 126 FX_BOOL bFocus); | 96 FX_BOOL bFocus); |
| 127 void DoURIAction(const FX_CHAR* bsURI); | 97 void DoURIAction(const FX_CHAR* bsURI); |
| 128 void DoGoToAction(int nPageIndex, | 98 void DoGoToAction(int nPageIndex, |
| 129 int zoomMode, | 99 int zoomMode, |
| 130 float* fPosArray, | 100 float* fPosArray, |
| 131 int sizeOfArray); | 101 int sizeOfArray); |
| 132 | 102 |
| 103 UnderlyingDocumentType* GetUnderlyingDocument() const { | |
| 104 return m_pUnderlyingDoc; | |
|
dsinclair
2016/10/12 19:44:13
This just returned the same thing in both branches
| |
| 105 } | |
| 106 | |
| 133 #ifdef PDF_ENABLE_XFA | 107 #ifdef PDF_ENABLE_XFA |
| 108 CPDF_Document* GetPDFDocument() const { | |
| 109 return m_pUnderlyingDoc ? m_pUnderlyingDoc->GetPDFDoc() : nullptr; | |
| 110 } | |
| 111 | |
| 112 CPDFXFA_Document* GetXFADocument() const { return m_pUnderlyingDoc; } | |
| 113 void ResetXFADocument() { m_pUnderlyingDoc = nullptr; } | |
| 114 | |
| 115 int GetPageViewCount() const { return m_pageMap.size(); } | |
| 116 | |
| 134 void DisplayCaret(FPDF_PAGE page, | 117 void DisplayCaret(FPDF_PAGE page, |
| 135 FPDF_BOOL bVisible, | 118 FPDF_BOOL bVisible, |
| 136 double left, | 119 double left, |
| 137 double top, | 120 double top, |
| 138 double right, | 121 double right, |
| 139 double bottom); | 122 double bottom); |
| 140 int GetCurrentPageIndex(FPDF_DOCUMENT document); | 123 int GetCurrentPageIndex(FPDF_DOCUMENT document); |
| 141 void SetCurrentPage(FPDF_DOCUMENT document, int iCurPage); | 124 void SetCurrentPage(FPDF_DOCUMENT document, int iCurPage); |
| 142 | 125 |
| 143 // TODO(dsinclair): This should probably change to PDFium? | 126 // TODO(dsinclair): This should probably change to PDFium? |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 169 const FX_WCHAR* wsData, | 152 const FX_WCHAR* wsData, |
| 170 const FX_WCHAR* wsContentType, | 153 const FX_WCHAR* wsContentType, |
| 171 const FX_WCHAR* wsEncode, | 154 const FX_WCHAR* wsEncode, |
| 172 const FX_WCHAR* wsHeader); | 155 const FX_WCHAR* wsHeader); |
| 173 FPDF_BOOL PutRequestURL(const FX_WCHAR* wsURL, | 156 FPDF_BOOL PutRequestURL(const FX_WCHAR* wsURL, |
| 174 const FX_WCHAR* wsData, | 157 const FX_WCHAR* wsData, |
| 175 const FX_WCHAR* wsEncode); | 158 const FX_WCHAR* wsEncode); |
| 176 CFX_WideString GetLanguage(); | 159 CFX_WideString GetLanguage(); |
| 177 | 160 |
| 178 void PageEvent(int iPageCount, uint32_t dwEventType) const; | 161 void PageEvent(int iPageCount, uint32_t dwEventType) const; |
| 162 #else // PDF_ENABLE_XFA | |
| 163 CPDF_Document* GetPDFDocument() const { return m_pUnderlyingDoc; } | |
| 179 #endif // PDF_ENABLE_XFA | 164 #endif // PDF_ENABLE_XFA |
| 180 | 165 |
| 181 int JS_appAlert(const FX_WCHAR* Msg, | 166 int JS_appAlert(const FX_WCHAR* Msg, |
| 182 const FX_WCHAR* Title, | 167 const FX_WCHAR* Title, |
| 183 uint32_t Type, | 168 uint32_t Type, |
| 184 uint32_t Icon); | 169 uint32_t Icon); |
| 185 int JS_appResponse(const FX_WCHAR* Question, | 170 int JS_appResponse(const FX_WCHAR* Question, |
| 186 const FX_WCHAR* Title, | 171 const FX_WCHAR* Title, |
| 187 const FX_WCHAR* Default, | 172 const FX_WCHAR* Default, |
| 188 const FX_WCHAR* cLabel, | 173 const FX_WCHAR* cLabel, |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 214 FX_BOOL IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; } | 199 FX_BOOL IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; } |
| 215 CFX_ByteString GetAppName() const { return ""; } | 200 CFX_ByteString GetAppName() const { return ""; } |
| 216 CFX_SystemHandler* GetSysHandler() const { return m_pSysHandler.get(); } | 201 CFX_SystemHandler* GetSysHandler() const { return m_pSysHandler.get(); } |
| 217 FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo; } | 202 FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo; } |
| 218 | 203 |
| 219 // Creates if not present. | 204 // Creates if not present. |
| 220 CFFL_InteractiveFormFiller* GetInteractiveFormFiller(); | 205 CFFL_InteractiveFormFiller* GetInteractiveFormFiller(); |
| 221 CPDFSDK_AnnotHandlerMgr* GetAnnotHandlerMgr(); // Creates if not present. | 206 CPDFSDK_AnnotHandlerMgr* GetAnnotHandlerMgr(); // Creates if not present. |
| 222 IJS_Runtime* GetJSRuntime(); // Creates if not present. | 207 IJS_Runtime* GetJSRuntime(); // Creates if not present. |
| 223 CPDFSDK_ActionHandler* GetActionHander(); // Creates if not present. | 208 CPDFSDK_ActionHandler* GetActionHander(); // Creates if not present. |
| 209 CPDFSDK_InterForm* GetInterForm(); // Creates if not present. | |
| 224 | 210 |
| 225 private: | 211 private: |
| 226 std::unique_ptr<CPDFSDK_AnnotHandlerMgr> m_pAnnotHandlerMgr; | 212 std::unique_ptr<CPDFSDK_AnnotHandlerMgr> m_pAnnotHandlerMgr; |
| 227 std::unique_ptr<CPDFSDK_ActionHandler> m_pActionHandler; | 213 std::unique_ptr<CPDFSDK_ActionHandler> m_pActionHandler; |
| 228 std::unique_ptr<IJS_Runtime> m_pJSRuntime; | 214 std::unique_ptr<IJS_Runtime> m_pJSRuntime; |
| 229 FPDF_FORMFILLINFO* const m_pInfo; | 215 FPDF_FORMFILLINFO* const m_pInfo; |
| 230 std::map<UnderlyingPageType*, CPDFSDK_PageView*> m_pageMap; | 216 std::map<UnderlyingPageType*, std::unique_ptr<CPDFSDK_PageView>> m_pageMap; |
| 231 std::unique_ptr<CPDFSDK_InterForm> m_pInterForm; | 217 std::unique_ptr<CPDFSDK_InterForm> m_pInterForm; |
| 232 CPDFSDK_Annot::ObservedPtr m_pFocusAnnot; | 218 CPDFSDK_Annot::ObservedPtr m_pFocusAnnot; |
| 233 UnderlyingDocumentType* m_pUnderlyingDoc; | 219 UnderlyingDocumentType* m_pUnderlyingDoc; |
| 234 std::unique_ptr<CFFL_InteractiveFormFiller> m_pFormFiller; | 220 std::unique_ptr<CFFL_InteractiveFormFiller> m_pFormFiller; |
| 235 std::unique_ptr<CFX_SystemHandler> m_pSysHandler; | 221 std::unique_ptr<CFX_SystemHandler> m_pSysHandler; |
| 236 FX_BOOL m_bChangeMask; | 222 bool m_bChangeMask; |
| 237 FX_BOOL m_bBeingDestroyed; | 223 bool m_bBeingDestroyed; |
| 238 }; | 224 }; |
| 239 | 225 |
| 240 #endif // FPDFSDK_CPDFSDK_FORMFILLENVIRONMENT_H_ | 226 #endif // FPDFSDK_CPDFSDK_FORMFILLENVIRONMENT_H_ |
| OLD | NEW |