| 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> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 12 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 12 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| 13 #include "core/fpdfapi/include/cpdf_modulemgr.h" | 13 #include "core/fpdfapi/include/cpdf_modulemgr.h" |
| 14 #include "core/fxcrt/include/fx_basic.h" | 14 #include "core/fxcrt/include/fx_basic.h" |
| 15 #include "core/fxcrt/include/fx_memory.h" |
| 15 #include "core/fxcrt/include/fx_xml.h" | 16 #include "core/fxcrt/include/fx_xml.h" |
| 16 #include "fpdfsdk/include/fsdk_define.h" | 17 #include "fpdfsdk/include/fsdk_define.h" |
| 17 | 18 |
| 18 #ifdef PDF_ENABLE_XFA | 19 #ifdef PDF_ENABLE_XFA |
| 19 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" | 20 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" |
| 20 #endif // PDF_ENABLE_XFA | 21 #endif // PDF_ENABLE_XFA |
| 21 | 22 |
| 22 #define FPDFSDK_UNSUPPORT_CALL 100 | |
| 23 | |
| 24 class CFSDK_UnsupportInfo_Adapter : public CFX_Deletable { | |
| 25 public: | |
| 26 explicit CFSDK_UnsupportInfo_Adapter(UNSUPPORT_INFO* unsp_info) | |
| 27 : m_unsp_info(unsp_info) {} | |
| 28 | |
| 29 void ReportError(int nErrorType); | |
| 30 | |
| 31 private: | |
| 32 UNSUPPORT_INFO* const m_unsp_info; | |
| 33 }; | |
| 34 | |
| 35 void CFSDK_UnsupportInfo_Adapter::ReportError(int nErrorType) { | 23 void CFSDK_UnsupportInfo_Adapter::ReportError(int nErrorType) { |
| 36 if (m_unsp_info && m_unsp_info->FSDK_UnSupport_Handler) { | 24 if (m_unsp_info && m_unsp_info->FSDK_UnSupport_Handler) { |
| 37 m_unsp_info->FSDK_UnSupport_Handler(m_unsp_info, nErrorType); | 25 m_unsp_info->FSDK_UnSupport_Handler(m_unsp_info, nErrorType); |
| 38 } | 26 } |
| 39 } | 27 } |
| 40 | 28 |
| 41 FX_BOOL FPDF_UnSupportError(int nError) { | 29 FX_BOOL FPDF_UnSupportError(int nError) { |
| 42 CFSDK_UnsupportInfo_Adapter* pAdapter = | 30 CFSDK_UnsupportInfo_Adapter* pAdapter = |
| 43 static_cast<CFSDK_UnsupportInfo_Adapter*>( | 31 CPDF_ModuleMgr::Get()->GetUnsupportInfoAdapter(); |
| 44 CPDF_ModuleMgr::Get()->GetUnsupportInfoAdapter()); | |
| 45 if (!pAdapter) | 32 if (!pAdapter) |
| 46 return FALSE; | 33 return FALSE; |
| 47 | 34 |
| 48 pAdapter->ReportError(nError); | 35 pAdapter->ReportError(nError); |
| 49 return TRUE; | 36 return TRUE; |
| 50 } | 37 } |
| 51 | 38 |
| 52 DLLEXPORT FPDF_BOOL STDCALL | 39 DLLEXPORT FPDF_BOOL STDCALL |
| 53 FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info) { | 40 FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info) { |
| 54 if (!unsp_info || unsp_info->version != 1) | 41 if (!unsp_info || unsp_info->version != 1) |
| 55 return FALSE; | 42 return FALSE; |
| 56 | 43 |
| 57 CPDF_ModuleMgr::Get()->SetUnsupportInfoAdapter(std::unique_ptr<CFX_Deletable>( | 44 CPDF_ModuleMgr::Get()->SetUnsupportInfoAdapter( |
| 58 new CFSDK_UnsupportInfo_Adapter(unsp_info))); | 45 WrapUnique(new CFSDK_UnsupportInfo_Adapter(unsp_info))); |
| 59 return TRUE; | 46 return TRUE; |
| 60 } | 47 } |
| 61 | 48 |
| 62 void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) { | 49 void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) { |
| 63 CFX_ByteString cbSubType = pPDFAnnot->GetSubType(); | 50 CFX_ByteString cbSubType = pPDFAnnot->GetSubType(); |
| 64 if (cbSubType.Compare("3D") == 0) { | 51 if (cbSubType.Compare("3D") == 0) { |
| 65 FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT); | 52 FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT); |
| 66 } else if (cbSubType.Compare("Screen") == 0) { | 53 } else if (cbSubType.Compare("Screen") == 0) { |
| 67 const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict(); | 54 const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict(); |
| 68 CFX_ByteString cbString; | 55 CFX_ByteString cbString; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 return PAGEMODE_USETHUMBS; | 193 return PAGEMODE_USETHUMBS; |
| 207 if (strPageMode.EqualNoCase("FullScreen")) | 194 if (strPageMode.EqualNoCase("FullScreen")) |
| 208 return PAGEMODE_FULLSCREEN; | 195 return PAGEMODE_FULLSCREEN; |
| 209 if (strPageMode.EqualNoCase("UseOC")) | 196 if (strPageMode.EqualNoCase("UseOC")) |
| 210 return PAGEMODE_USEOC; | 197 return PAGEMODE_USEOC; |
| 211 if (strPageMode.EqualNoCase("UseAttachments")) | 198 if (strPageMode.EqualNoCase("UseAttachments")) |
| 212 return PAGEMODE_USEATTACHMENTS; | 199 return PAGEMODE_USEATTACHMENTS; |
| 213 | 200 |
| 214 return PAGEMODE_UNKNOWN; | 201 return PAGEMODE_UNKNOWN; |
| 215 } | 202 } |
| OLD | NEW |