| 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 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 } | 46 } |
| 47 | 47 |
| 48 void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) { | 48 void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) { |
| 49 CPDF_Annot::Subtype nAnnotSubtype = pPDFAnnot->GetSubtype(); | 49 CPDF_Annot::Subtype nAnnotSubtype = pPDFAnnot->GetSubtype(); |
| 50 if (nAnnotSubtype == CPDF_Annot::Subtype::THREED) { | 50 if (nAnnotSubtype == CPDF_Annot::Subtype::THREED) { |
| 51 FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT); | 51 FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT); |
| 52 } else if (nAnnotSubtype == CPDF_Annot::Subtype::SCREEN) { | 52 } else if (nAnnotSubtype == CPDF_Annot::Subtype::SCREEN) { |
| 53 const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict(); | 53 const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict(); |
| 54 CFX_ByteString cbString; | 54 CFX_ByteString cbString; |
| 55 if (pAnnotDict->KeyExist("IT")) | 55 if (pAnnotDict->KeyExist("IT")) |
| 56 cbString = pAnnotDict->GetStringBy("IT"); | 56 cbString = pAnnotDict->GetStringFor("IT"); |
| 57 if (cbString.Compare("Img") != 0) | 57 if (cbString.Compare("Img") != 0) |
| 58 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SCREEN_MEDIA); | 58 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SCREEN_MEDIA); |
| 59 } else if (nAnnotSubtype == CPDF_Annot::Subtype::MOVIE) { | 59 } else if (nAnnotSubtype == CPDF_Annot::Subtype::MOVIE) { |
| 60 FPDF_UnSupportError(FPDF_UNSP_ANNOT_MOVIE); | 60 FPDF_UnSupportError(FPDF_UNSP_ANNOT_MOVIE); |
| 61 } else if (nAnnotSubtype == CPDF_Annot::Subtype::SOUND) { | 61 } else if (nAnnotSubtype == CPDF_Annot::Subtype::SOUND) { |
| 62 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SOUND); | 62 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SOUND); |
| 63 } else if (nAnnotSubtype == CPDF_Annot::Subtype::RICHMEDIA) { | 63 } else if (nAnnotSubtype == CPDF_Annot::Subtype::RICHMEDIA) { |
| 64 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA); | 64 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA); |
| 65 } else if (nAnnotSubtype == CPDF_Annot::Subtype::FILEATTACHMENT) { | 65 } else if (nAnnotSubtype == CPDF_Annot::Subtype::FILEATTACHMENT) { |
| 66 FPDF_UnSupportError(FPDF_UNSP_ANNOT_ATTACHMENT); | 66 FPDF_UnSupportError(FPDF_UNSP_ANNOT_ATTACHMENT); |
| 67 } else if (nAnnotSubtype == CPDF_Annot::Subtype::WIDGET) { | 67 } else if (nAnnotSubtype == CPDF_Annot::Subtype::WIDGET) { |
| 68 const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict(); | 68 const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict(); |
| 69 CFX_ByteString cbString; | 69 CFX_ByteString cbString; |
| 70 if (pAnnotDict->KeyExist("FT")) | 70 if (pAnnotDict->KeyExist("FT")) |
| 71 cbString = pAnnotDict->GetStringBy("FT"); | 71 cbString = pAnnotDict->GetStringFor("FT"); |
| 72 if (cbString.Compare("Sig") == 0) | 72 if (cbString.Compare("Sig") == 0) |
| 73 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SIG); | 73 FPDF_UnSupportError(FPDF_UNSP_ANNOT_SIG); |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 FX_BOOL CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) { | 77 FX_BOOL CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) { |
| 78 int count = pElement->CountAttrs(); | 78 int count = pElement->CountAttrs(); |
| 79 int i = 0; | 79 int i = 0; |
| 80 for (i = 0; i < count; i++) { | 80 for (i = 0; i < count; i++) { |
| 81 CFX_ByteString space, name; | 81 CFX_ByteString space, name; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 // Portfolios and Packages | 127 // Portfolios and Packages |
| 128 CPDF_Dictionary* pRootDict = pDoc->GetRoot(); | 128 CPDF_Dictionary* pRootDict = pDoc->GetRoot(); |
| 129 if (pRootDict) { | 129 if (pRootDict) { |
| 130 CFX_ByteString cbString; | 130 CFX_ByteString cbString; |
| 131 if (pRootDict->KeyExist("Collection")) { | 131 if (pRootDict->KeyExist("Collection")) { |
| 132 FPDF_UnSupportError(FPDF_UNSP_DOC_PORTABLECOLLECTION); | 132 FPDF_UnSupportError(FPDF_UNSP_DOC_PORTABLECOLLECTION); |
| 133 return; | 133 return; |
| 134 } | 134 } |
| 135 if (pRootDict->KeyExist("Names")) { | 135 if (pRootDict->KeyExist("Names")) { |
| 136 CPDF_Dictionary* pNameDict = pRootDict->GetDictBy("Names"); | 136 CPDF_Dictionary* pNameDict = pRootDict->GetDictFor("Names"); |
| 137 if (pNameDict && pNameDict->KeyExist("EmbeddedFiles")) { | 137 if (pNameDict && pNameDict->KeyExist("EmbeddedFiles")) { |
| 138 FPDF_UnSupportError(FPDF_UNSP_DOC_ATTACHMENT); | 138 FPDF_UnSupportError(FPDF_UNSP_DOC_ATTACHMENT); |
| 139 return; | 139 return; |
| 140 } | 140 } |
| 141 if (pNameDict && pNameDict->KeyExist("JavaScript")) { | 141 if (pNameDict && pNameDict->KeyExist("JavaScript")) { |
| 142 CPDF_Dictionary* pJSDict = pNameDict->GetDictBy("JavaScript"); | 142 CPDF_Dictionary* pJSDict = pNameDict->GetDictFor("JavaScript"); |
| 143 CPDF_Array* pArray = pJSDict ? pJSDict->GetArrayBy("Names") : nullptr; | 143 CPDF_Array* pArray = pJSDict ? pJSDict->GetArrayFor("Names") : nullptr; |
| 144 if (pArray) { | 144 if (pArray) { |
| 145 for (size_t i = 0; i < pArray->GetCount(); i++) { | 145 for (size_t i = 0; i < pArray->GetCount(); i++) { |
| 146 CFX_ByteString cbStr = pArray->GetStringAt(i); | 146 CFX_ByteString cbStr = pArray->GetStringAt(i); |
| 147 if (cbStr.Compare("com.adobe.acrobat.SharedReview.Register") == 0) { | 147 if (cbStr.Compare("com.adobe.acrobat.SharedReview.Register") == 0) { |
| 148 FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDREVIEW); | 148 FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDREVIEW); |
| 149 return; | 149 return; |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 } | 153 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 170 | 170 |
| 171 DLLEXPORT int STDCALL FPDFDoc_GetPageMode(FPDF_DOCUMENT document) { | 171 DLLEXPORT int STDCALL FPDFDoc_GetPageMode(FPDF_DOCUMENT document) { |
| 172 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); | 172 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); |
| 173 if (!pDoc) | 173 if (!pDoc) |
| 174 return PAGEMODE_UNKNOWN; | 174 return PAGEMODE_UNKNOWN; |
| 175 | 175 |
| 176 CPDF_Dictionary* pRoot = pDoc->GetRoot(); | 176 CPDF_Dictionary* pRoot = pDoc->GetRoot(); |
| 177 if (!pRoot) | 177 if (!pRoot) |
| 178 return PAGEMODE_UNKNOWN; | 178 return PAGEMODE_UNKNOWN; |
| 179 | 179 |
| 180 CPDF_Object* pName = pRoot->GetObjectBy("PageMode"); | 180 CPDF_Object* pName = pRoot->GetObjectFor("PageMode"); |
| 181 if (!pName) | 181 if (!pName) |
| 182 return PAGEMODE_USENONE; | 182 return PAGEMODE_USENONE; |
| 183 | 183 |
| 184 CFX_ByteString strPageMode = pName->GetString(); | 184 CFX_ByteString strPageMode = pName->GetString(); |
| 185 if (strPageMode.IsEmpty() || strPageMode.EqualNoCase("UseNone")) | 185 if (strPageMode.IsEmpty() || strPageMode.EqualNoCase("UseNone")) |
| 186 return PAGEMODE_USENONE; | 186 return PAGEMODE_USENONE; |
| 187 if (strPageMode.EqualNoCase("UseOutlines")) | 187 if (strPageMode.EqualNoCase("UseOutlines")) |
| 188 return PAGEMODE_USEOUTLINES; | 188 return PAGEMODE_USEOUTLINES; |
| 189 if (strPageMode.EqualNoCase("UseThumbs")) | 189 if (strPageMode.EqualNoCase("UseThumbs")) |
| 190 return PAGEMODE_USETHUMBS; | 190 return PAGEMODE_USETHUMBS; |
| 191 if (strPageMode.EqualNoCase("FullScreen")) | 191 if (strPageMode.EqualNoCase("FullScreen")) |
| 192 return PAGEMODE_FULLSCREEN; | 192 return PAGEMODE_FULLSCREEN; |
| 193 if (strPageMode.EqualNoCase("UseOC")) | 193 if (strPageMode.EqualNoCase("UseOC")) |
| 194 return PAGEMODE_USEOC; | 194 return PAGEMODE_USEOC; |
| 195 if (strPageMode.EqualNoCase("UseAttachments")) | 195 if (strPageMode.EqualNoCase("UseAttachments")) |
| 196 return PAGEMODE_USEATTACHMENTS; | 196 return PAGEMODE_USEATTACHMENTS; |
| 197 | 197 |
| 198 return PAGEMODE_UNKNOWN; | 198 return PAGEMODE_UNKNOWN; |
| 199 } | 199 } |
| OLD | NEW |