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/cpdf_modulemgr.h" | 11 #include "core/fpdfapi/cpdf_modulemgr.h" |
12 #include "core/fpdfapi/fpdf_parser/cpdf_array.h" | 12 #include "core/fpdfapi/fpdf_parser/cpdf_array.h" |
13 #include "core/fpdfapi/fpdf_parser/cpdf_document.h" | 13 #include "core/fpdfapi/fpdf_parser/cpdf_document.h" |
14 #include "core/fpdfdoc/cpdf_annot.h" | 14 #include "core/fpdfdoc/cpdf_annot.h" |
15 #include "core/fpdfdoc/cpdf_interform.h" | 15 #include "core/fpdfdoc/cpdf_interform.h" |
16 #include "core/fpdfdoc/cpdf_metadata.h" | 16 #include "core/fpdfdoc/cpdf_metadata.h" |
17 #include "core/fxcrt/fx_basic.h" | 17 #include "core/fxcrt/fx_basic.h" |
18 #include "core/fxcrt/fx_memory.h" | 18 #include "core/fxcrt/fx_memory.h" |
19 #include "core/fxcrt/fx_xml.h" | 19 #include "core/fxcrt/fx_xml.h" |
20 #include "fpdfsdk/fsdk_define.h" | 20 #include "fpdfsdk/fsdk_define.h" |
| 21 #include "third_party/base/ptr_util.h" |
21 | 22 |
22 #ifdef PDF_ENABLE_XFA | 23 #ifdef PDF_ENABLE_XFA |
23 #include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" | 24 #include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" |
24 #endif // PDF_ENABLE_XFA | 25 #endif // PDF_ENABLE_XFA |
25 | 26 |
26 FX_BOOL FPDF_UnSupportError(int nError) { | 27 FX_BOOL FPDF_UnSupportError(int nError) { |
27 CFSDK_UnsupportInfo_Adapter* pAdapter = | 28 CFSDK_UnsupportInfo_Adapter* pAdapter = |
28 CPDF_ModuleMgr::Get()->GetUnsupportInfoAdapter(); | 29 CPDF_ModuleMgr::Get()->GetUnsupportInfoAdapter(); |
29 if (!pAdapter) | 30 if (!pAdapter) |
30 return FALSE; | 31 return FALSE; |
31 | 32 |
32 UNSUPPORT_INFO* info = static_cast<UNSUPPORT_INFO*>(pAdapter->GetUnspInfo()); | 33 UNSUPPORT_INFO* info = static_cast<UNSUPPORT_INFO*>(pAdapter->GetUnspInfo()); |
33 if (info && info->FSDK_UnSupport_Handler) | 34 if (info && info->FSDK_UnSupport_Handler) |
34 info->FSDK_UnSupport_Handler(info, nError); | 35 info->FSDK_UnSupport_Handler(info, nError); |
35 return TRUE; | 36 return TRUE; |
36 } | 37 } |
37 | 38 |
38 DLLEXPORT FPDF_BOOL STDCALL | 39 DLLEXPORT FPDF_BOOL STDCALL |
39 FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info) { | 40 FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info) { |
40 if (!unsp_info || unsp_info->version != 1) | 41 if (!unsp_info || unsp_info->version != 1) |
41 return FALSE; | 42 return FALSE; |
42 | 43 |
43 CPDF_ModuleMgr::Get()->SetUnsupportInfoAdapter( | 44 CPDF_ModuleMgr::Get()->SetUnsupportInfoAdapter( |
44 WrapUnique(new CFSDK_UnsupportInfo_Adapter(unsp_info))); | 45 pdfium::MakeUnique<CFSDK_UnsupportInfo_Adapter>(unsp_info)); |
45 return TRUE; | 46 return TRUE; |
46 } | 47 } |
47 | 48 |
48 void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) { | 49 void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) { |
49 CPDF_Annot::Subtype nAnnotSubtype = pPDFAnnot->GetSubtype(); | 50 CPDF_Annot::Subtype nAnnotSubtype = pPDFAnnot->GetSubtype(); |
50 if (nAnnotSubtype == CPDF_Annot::Subtype::THREED) { | 51 if (nAnnotSubtype == CPDF_Annot::Subtype::THREED) { |
51 FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT); | 52 FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT); |
52 } else if (nAnnotSubtype == CPDF_Annot::Subtype::SCREEN) { | 53 } else if (nAnnotSubtype == CPDF_Annot::Subtype::SCREEN) { |
53 const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict(); | 54 const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict(); |
54 CFX_ByteString cbString; | 55 CFX_ByteString cbString; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 return PAGEMODE_USETHUMBS; | 191 return PAGEMODE_USETHUMBS; |
191 if (strPageMode.EqualNoCase("FullScreen")) | 192 if (strPageMode.EqualNoCase("FullScreen")) |
192 return PAGEMODE_FULLSCREEN; | 193 return PAGEMODE_FULLSCREEN; |
193 if (strPageMode.EqualNoCase("UseOC")) | 194 if (strPageMode.EqualNoCase("UseOC")) |
194 return PAGEMODE_USEOC; | 195 return PAGEMODE_USEOC; |
195 if (strPageMode.EqualNoCase("UseAttachments")) | 196 if (strPageMode.EqualNoCase("UseAttachments")) |
196 return PAGEMODE_USEATTACHMENTS; | 197 return PAGEMODE_USEATTACHMENTS; |
197 | 198 |
198 return PAGEMODE_UNKNOWN; | 199 return PAGEMODE_UNKNOWN; |
199 } | 200 } |
OLD | NEW |