| 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 "../../core/include/fxcrt/fx_xml.h" | 7 #include "../../core/include/fxcrt/fx_xml.h" |
| 8 #include "../../public/fpdf_ext.h" | 8 #include "../../public/fpdf_ext.h" |
| 9 #include "../include/fsdk_define.h" | 9 #include "../include/fsdk_define.h" |
| 10 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 10 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 170 } |
| 171 | 171 |
| 172 // SharedForm | 172 // SharedForm |
| 173 CPDF_Metadata metaData(pDoc); | 173 CPDF_Metadata metaData(pDoc); |
| 174 const CXML_Element* pElement = metaData.GetRoot(); | 174 const CXML_Element* pElement = metaData.GetRoot(); |
| 175 if (pElement) | 175 if (pElement) |
| 176 CheckSharedForm(pElement, "workflowType"); | 176 CheckSharedForm(pElement, "workflowType"); |
| 177 } | 177 } |
| 178 | 178 |
| 179 DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document) { | 179 DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document) { |
| 180 if (!document) | 180 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); |
| 181 if (!pDoc) |
| 181 return PAGEMODE_UNKNOWN; | 182 return PAGEMODE_UNKNOWN; |
| 182 | 183 |
| 183 CPDF_Dictionary* pRoot = | 184 CPDF_Dictionary* pRoot = pDoc->GetRoot(); |
| 184 (((CPDFXFA_Document*)document)->GetPDFDoc())->GetRoot(); | |
| 185 if (!pRoot) | 185 if (!pRoot) |
| 186 return PAGEMODE_UNKNOWN; | 186 return PAGEMODE_UNKNOWN; |
| 187 | 187 |
| 188 CPDF_Object* pName = pRoot->GetElement("PageMode"); | 188 CPDF_Object* pName = pRoot->GetElement("PageMode"); |
| 189 if (!pName) | 189 if (!pName) |
| 190 return PAGEMODE_USENONE; | 190 return PAGEMODE_USENONE; |
| 191 | 191 |
| 192 CFX_ByteString strPageMode = pName->GetString(); | 192 CFX_ByteString strPageMode = pName->GetString(); |
| 193 if (strPageMode.IsEmpty() || strPageMode.EqualNoCase("UseNone")) | 193 if (strPageMode.IsEmpty() || strPageMode.EqualNoCase("UseNone")) |
| 194 return PAGEMODE_USENONE; | 194 return PAGEMODE_USENONE; |
| 195 if (strPageMode.EqualNoCase("UseOutlines")) | 195 if (strPageMode.EqualNoCase("UseOutlines")) |
| 196 return PAGEMODE_USEOUTLINES; | 196 return PAGEMODE_USEOUTLINES; |
| 197 if (strPageMode.EqualNoCase("UseThumbs")) | 197 if (strPageMode.EqualNoCase("UseThumbs")) |
| 198 return PAGEMODE_USETHUMBS; | 198 return PAGEMODE_USETHUMBS; |
| 199 if (strPageMode.EqualNoCase("FullScreen")) | 199 if (strPageMode.EqualNoCase("FullScreen")) |
| 200 return PAGEMODE_FULLSCREEN; | 200 return PAGEMODE_FULLSCREEN; |
| 201 if (strPageMode.EqualNoCase("UseOC")) | 201 if (strPageMode.EqualNoCase("UseOC")) |
| 202 return PAGEMODE_USEOC; | 202 return PAGEMODE_USEOC; |
| 203 if (strPageMode.EqualNoCase("UseAttachments")) | 203 if (strPageMode.EqualNoCase("UseAttachments")) |
| 204 return PAGEMODE_USEATTACHMENTS; | 204 return PAGEMODE_USEATTACHMENTS; |
| 205 | 205 |
| 206 return PAGEMODE_UNKNOWN; | 206 return PAGEMODE_UNKNOWN; |
| 207 } | 207 } |
| OLD | NEW |