| 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 "core/include/fxcrt/fx_xml.h" | 9 #include "core/include/fxcrt/fx_xml.h" |
| 10 #include "fpdfsdk/include/fsdk_define.h" | 10 #include "fpdfsdk/include/fsdk_define.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) { | 61 void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) { |
| 62 CFX_ByteString cbSubType = pPDFAnnot->GetSubType(); | 62 CFX_ByteString cbSubType = pPDFAnnot->GetSubType(); |
| 63 if (cbSubType.Compare("3D") == 0) { | 63 if (cbSubType.Compare("3D") == 0) { |
| 64 FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT); | 64 FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT); |
| 65 } else if (cbSubType.Compare("Screen") == 0) { | 65 } else if (cbSubType.Compare("Screen") == 0) { |
| 66 const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict(); | 66 const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict(); |
| 67 CFX_ByteString cbString; | 67 CFX_ByteString cbString; |
| 68 if (pAnnotDict->KeyExist("IT")) | 68 if (pAnnotDict->KeyExist("IT")) |
| 69 cbString = pAnnotDict->GetString("IT"); | 69 cbString = pAnnotDict->GetStringBy("IT"); |
| 70 if (cbString.Compare("Img") != 0) | 70 if (cbString.Compare("Img") != 0) |
| 71 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SCREEN_MEDIA); | 71 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SCREEN_MEDIA); |
| 72 } else if (cbSubType.Compare("Movie") == 0) { | 72 } else if (cbSubType.Compare("Movie") == 0) { |
| 73 FPDF_UnSupportError(FPDF_UNSP_ANNOT_MOVIE); | 73 FPDF_UnSupportError(FPDF_UNSP_ANNOT_MOVIE); |
| 74 } else if (cbSubType.Compare("Sound") == 0) { | 74 } else if (cbSubType.Compare("Sound") == 0) { |
| 75 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SOUND); | 75 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SOUND); |
| 76 } else if (cbSubType.Compare("RichMedia") == 0) { | 76 } else if (cbSubType.Compare("RichMedia") == 0) { |
| 77 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA); | 77 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA); |
| 78 } else if (cbSubType.Compare("FileAttachment") == 0) { | 78 } else if (cbSubType.Compare("FileAttachment") == 0) { |
| 79 FPDF_UnSupportError(FPDF_UNSP_ANNOT_ATTACHMENT); | 79 FPDF_UnSupportError(FPDF_UNSP_ANNOT_ATTACHMENT); |
| 80 } else if (cbSubType.Compare("Widget") == 0) { | 80 } else if (cbSubType.Compare("Widget") == 0) { |
| 81 const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict(); | 81 const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict(); |
| 82 CFX_ByteString cbString; | 82 CFX_ByteString cbString; |
| 83 if (pAnnotDict->KeyExist("FT")) { | 83 if (pAnnotDict->KeyExist("FT")) { |
| 84 cbString = pAnnotDict->GetString("FT"); | 84 cbString = pAnnotDict->GetStringBy("FT"); |
| 85 } | 85 } |
| 86 if (cbString.Compare("Sig") == 0) { | 86 if (cbString.Compare("Sig") == 0) { |
| 87 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SIG); | 87 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SIG); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 | 91 |
| 92 FX_BOOL CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) { | 92 FX_BOOL CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) { |
| 93 int count = pElement->CountAttrs(); | 93 int count = pElement->CountAttrs(); |
| 94 int i = 0; | 94 int i = 0; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 // Portfolios and Packages | 141 // Portfolios and Packages |
| 142 CPDF_Dictionary* pRootDict = pDoc->GetRoot(); | 142 CPDF_Dictionary* pRootDict = pDoc->GetRoot(); |
| 143 if (pRootDict) { | 143 if (pRootDict) { |
| 144 CFX_ByteString cbString; | 144 CFX_ByteString cbString; |
| 145 if (pRootDict->KeyExist("Collection")) { | 145 if (pRootDict->KeyExist("Collection")) { |
| 146 FPDF_UnSupportError(FPDF_UNSP_DOC_PORTABLECOLLECTION); | 146 FPDF_UnSupportError(FPDF_UNSP_DOC_PORTABLECOLLECTION); |
| 147 return; | 147 return; |
| 148 } | 148 } |
| 149 if (pRootDict->KeyExist("Names")) { | 149 if (pRootDict->KeyExist("Names")) { |
| 150 CPDF_Dictionary* pNameDict = pRootDict->GetDict("Names"); | 150 CPDF_Dictionary* pNameDict = pRootDict->GetDictBy("Names"); |
| 151 if (pNameDict && pNameDict->KeyExist("EmbeddedFiles")) { | 151 if (pNameDict && pNameDict->KeyExist("EmbeddedFiles")) { |
| 152 FPDF_UnSupportError(FPDF_UNSP_DOC_ATTACHMENT); | 152 FPDF_UnSupportError(FPDF_UNSP_DOC_ATTACHMENT); |
| 153 return; | 153 return; |
| 154 } | 154 } |
| 155 if (pNameDict && pNameDict->KeyExist("JavaScript")) { | 155 if (pNameDict && pNameDict->KeyExist("JavaScript")) { |
| 156 CPDF_Dictionary* pJSDict = pNameDict->GetDict("JavaScript"); | 156 CPDF_Dictionary* pJSDict = pNameDict->GetDictBy("JavaScript"); |
| 157 CPDF_Array* pArray = pJSDict ? pJSDict->GetArray("Names") : NULL; | 157 CPDF_Array* pArray = pJSDict ? pJSDict->GetArrayBy("Names") : NULL; |
| 158 if (pArray) { | 158 if (pArray) { |
| 159 int nCount = pArray->GetCount(); | 159 int nCount = pArray->GetCount(); |
| 160 for (int i = 0; i < nCount; i++) { | 160 for (int i = 0; i < nCount; i++) { |
| 161 CFX_ByteString cbStr = pArray->GetString(i); | 161 CFX_ByteString cbStr = pArray->GetStringAt(i); |
| 162 if (cbStr.Compare("com.adobe.acrobat.SharedReview.Register") == 0) { | 162 if (cbStr.Compare("com.adobe.acrobat.SharedReview.Register") == 0) { |
| 163 FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDREVIEW); | 163 FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDREVIEW); |
| 164 return; | 164 return; |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 return PAGEMODE_USETHUMBS; | 205 return PAGEMODE_USETHUMBS; |
| 206 if (strPageMode.EqualNoCase("FullScreen")) | 206 if (strPageMode.EqualNoCase("FullScreen")) |
| 207 return PAGEMODE_FULLSCREEN; | 207 return PAGEMODE_FULLSCREEN; |
| 208 if (strPageMode.EqualNoCase("UseOC")) | 208 if (strPageMode.EqualNoCase("UseOC")) |
| 209 return PAGEMODE_USEOC; | 209 return PAGEMODE_USEOC; |
| 210 if (strPageMode.EqualNoCase("UseAttachments")) | 210 if (strPageMode.EqualNoCase("UseAttachments")) |
| 211 return PAGEMODE_USEATTACHMENTS; | 211 return PAGEMODE_USEATTACHMENTS; |
| 212 | 212 |
| 213 return PAGEMODE_UNKNOWN; | 213 return PAGEMODE_UNKNOWN; |
| 214 } | 214 } |
| OLD | NEW |