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