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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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->GetString("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(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; |
95 for (i = 0; i < count; i++) { | 95 for (i = 0; i < count; i++) { |
96 CFX_ByteString space, name; | 96 CFX_ByteString space, name; |
97 CFX_WideString value; | 97 CFX_WideString value; |
98 pElement->GetAttrByIndex(i, space, name, value); | 98 pElement->GetAttrByIndex(i, space, name, value); |
99 if (space == FX_BSTRC("xmlns") && name == FX_BSTRC("adhocwf") && | 99 if (space == FX_BSTRC("xmlns") && name == FX_BSTRC("adhocwf") && |
100 value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/") { | 100 value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/") { |
101 CXML_Element* pVersion = pElement->GetElement("adhocwf", cbName); | 101 CXML_Element* pVersion = pElement->GetElement("adhocwf", cbName); |
102 if (!pVersion) | 102 if (!pVersion) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDREVIEW); | 162 FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDREVIEW); |
163 return; | 163 return; |
164 } | 164 } |
165 } | 165 } |
166 } | 166 } |
167 } | 167 } |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 // SharedForm | 171 // SharedForm |
172 CPDF_Metadata metaData; | 172 CPDF_Metadata metaData(pDoc); |
173 metaData.LoadDoc(pDoc); | 173 const CXML_Element* pElement = metaData.GetRoot(); |
174 CXML_Element* pElement = metaData.GetRoot(); | |
175 if (pElement) | 174 if (pElement) |
176 CheckSharedForm(pElement, "workflowType"); | 175 CheckSharedForm(pElement, "workflowType"); |
177 } | 176 } |
178 | 177 |
179 DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document) { | 178 DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document) { |
180 if (!document) | 179 if (!document) |
181 return PAGEMODE_UNKNOWN; | 180 return PAGEMODE_UNKNOWN; |
182 | 181 |
183 CPDF_Dictionary* pRoot = | 182 CPDF_Dictionary* pRoot = |
184 (((CPDFXFA_Document*)document)->GetPDFDoc())->GetRoot(); | 183 (((CPDFXFA_Document*)document)->GetPDFDoc())->GetRoot(); |
(...skipping 13 matching lines...) Expand all Loading... |
198 return PAGEMODE_USETHUMBS; | 197 return PAGEMODE_USETHUMBS; |
199 if (strPageMode.EqualNoCase("FullScreen")) | 198 if (strPageMode.EqualNoCase("FullScreen")) |
200 return PAGEMODE_FULLSCREEN; | 199 return PAGEMODE_FULLSCREEN; |
201 if (strPageMode.EqualNoCase("UseOC")) | 200 if (strPageMode.EqualNoCase("UseOC")) |
202 return PAGEMODE_USEOC; | 201 return PAGEMODE_USEOC; |
203 if (strPageMode.EqualNoCase("UseAttachments")) | 202 if (strPageMode.EqualNoCase("UseAttachments")) |
204 return PAGEMODE_USEATTACHMENTS; | 203 return PAGEMODE_USEATTACHMENTS; |
205 | 204 |
206 return PAGEMODE_UNKNOWN; | 205 return PAGEMODE_UNKNOWN; |
207 } | 206 } |
OLD | NEW |