| 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 #include "public/fpdf_ext.h" | 7 #include "public/fpdf_ext.h" |
| 8 | 8 |
| 9 #include <memory> |
| 10 |
| 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 12 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| 11 #include "core/fpdfapi/include/cpdf_modulemgr.h" | 13 #include "core/fpdfapi/include/cpdf_modulemgr.h" |
| 12 #include "core/fxcrt/include/fx_xml.h" | 14 #include "core/fxcrt/include/fx_xml.h" |
| 13 #include "fpdfsdk/include/fsdk_define.h" | 15 #include "fpdfsdk/include/fsdk_define.h" |
| 14 | 16 |
| 15 #ifdef PDF_ENABLE_XFA | 17 #ifdef PDF_ENABLE_XFA |
| 16 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" | 18 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" |
| 17 #endif // PDF_ENABLE_XFA | 19 #endif // PDF_ENABLE_XFA |
| 18 | 20 |
| 19 #define FPDFSDK_UNSUPPORT_CALL 100 | 21 #define FPDFSDK_UNSUPPORT_CALL 100 |
| 20 | 22 |
| 21 class CFSDK_UnsupportInfo_Adapter { | 23 class CFSDK_UnsupportInfo_Adapter { |
| 22 public: | 24 public: |
| 23 CFSDK_UnsupportInfo_Adapter(UNSUPPORT_INFO* unsp_info) { | 25 explicit CFSDK_UnsupportInfo_Adapter(UNSUPPORT_INFO* unsp_info) |
| 24 m_unsp_info = unsp_info; | 26 : m_unsp_info(unsp_info) {} |
| 25 } | 27 |
| 26 void ReportError(int nErrorType); | 28 void ReportError(int nErrorType); |
| 27 | 29 |
| 28 private: | 30 private: |
| 29 UNSUPPORT_INFO* m_unsp_info; | 31 UNSUPPORT_INFO* const m_unsp_info; |
| 30 }; | 32 }; |
| 31 | 33 |
| 32 void CFSDK_UnsupportInfo_Adapter::ReportError(int nErrorType) { | 34 void CFSDK_UnsupportInfo_Adapter::ReportError(int nErrorType) { |
| 33 if (m_unsp_info && m_unsp_info->FSDK_UnSupport_Handler) { | 35 if (m_unsp_info && m_unsp_info->FSDK_UnSupport_Handler) { |
| 34 m_unsp_info->FSDK_UnSupport_Handler(m_unsp_info, nErrorType); | 36 m_unsp_info->FSDK_UnSupport_Handler(m_unsp_info, nErrorType); |
| 35 } | 37 } |
| 36 } | 38 } |
| 37 | 39 |
| 38 void FreeUnsupportInfo(void* pData) { | 40 void FreeUnsupportInfo(void* pData) { |
| 39 CFSDK_UnsupportInfo_Adapter* pAdapter = (CFSDK_UnsupportInfo_Adapter*)pData; | 41 CFSDK_UnsupportInfo_Adapter* pAdapter = (CFSDK_UnsupportInfo_Adapter*)pData; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 } | 178 } |
| 177 | 179 |
| 178 // SharedForm | 180 // SharedForm |
| 179 CPDF_Metadata metaData(pDoc); | 181 CPDF_Metadata metaData(pDoc); |
| 180 const CXML_Element* pElement = metaData.GetRoot(); | 182 const CXML_Element* pElement = metaData.GetRoot(); |
| 181 if (pElement) | 183 if (pElement) |
| 182 CheckSharedForm(pElement, "workflowType"); | 184 CheckSharedForm(pElement, "workflowType"); |
| 183 | 185 |
| 184 #ifndef PDF_ENABLE_XFA | 186 #ifndef PDF_ENABLE_XFA |
| 185 // XFA Forms | 187 // XFA Forms |
| 186 CPDF_InterForm* pInterForm = new CPDF_InterForm(pDoc, FALSE); | 188 CPDF_InterForm interform(pDoc); |
| 187 if (pInterForm->HasXFAForm()) { | 189 if (interform.HasXFAForm()) |
| 188 FPDF_UnSupportError(FPDF_UNSP_DOC_XFAFORM); | 190 FPDF_UnSupportError(FPDF_UNSP_DOC_XFAFORM); |
| 189 } | |
| 190 delete pInterForm; | |
| 191 #endif // PDF_ENABLE_XFA | 191 #endif // PDF_ENABLE_XFA |
| 192 } | 192 } |
| 193 | 193 |
| 194 DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document) { | 194 DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document) { |
| 195 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); | 195 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); |
| 196 if (!pDoc) | 196 if (!pDoc) |
| 197 return PAGEMODE_UNKNOWN; | 197 return PAGEMODE_UNKNOWN; |
| 198 | 198 |
| 199 CPDF_Dictionary* pRoot = pDoc->GetRoot(); | 199 CPDF_Dictionary* pRoot = pDoc->GetRoot(); |
| 200 if (!pRoot) | 200 if (!pRoot) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 213 return PAGEMODE_USETHUMBS; | 213 return PAGEMODE_USETHUMBS; |
| 214 if (strPageMode.EqualNoCase("FullScreen")) | 214 if (strPageMode.EqualNoCase("FullScreen")) |
| 215 return PAGEMODE_FULLSCREEN; | 215 return PAGEMODE_FULLSCREEN; |
| 216 if (strPageMode.EqualNoCase("UseOC")) | 216 if (strPageMode.EqualNoCase("UseOC")) |
| 217 return PAGEMODE_USEOC; | 217 return PAGEMODE_USEOC; |
| 218 if (strPageMode.EqualNoCase("UseAttachments")) | 218 if (strPageMode.EqualNoCase("UseAttachments")) |
| 219 return PAGEMODE_USEATTACHMENTS; | 219 return PAGEMODE_USEATTACHMENTS; |
| 220 | 220 |
| 221 return PAGEMODE_UNKNOWN; | 221 return PAGEMODE_UNKNOWN; |
| 222 } | 222 } |
| OLD | NEW |