Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1297)

Side by Side Diff: fpdfsdk/src/fpdf_ext.cpp

Issue 1395493007: Introduce CPDF_Document::FromFPDFDocument(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/fpdf_dataavail.cpp ('k') | fpdfsdk/src/fpdfdoc.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 // XFA Forms 177 // XFA Forms
178 CPDF_InterForm* pInterForm = new CPDF_InterForm(pDoc, FALSE); 178 CPDF_InterForm* pInterForm = new CPDF_InterForm(pDoc, FALSE);
179 if (pInterForm->HasXFAForm()) { 179 if (pInterForm->HasXFAForm()) {
180 FPDF_UnSupportError(FPDF_UNSP_DOC_XFAFORM); 180 FPDF_UnSupportError(FPDF_UNSP_DOC_XFAFORM);
181 } 181 }
182 delete pInterForm; 182 delete pInterForm;
183 } 183 }
184 184
185 DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document) { 185 DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document) {
186 if (!document) 186 CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
187 if (!pDoc)
187 return PAGEMODE_UNKNOWN; 188 return PAGEMODE_UNKNOWN;
188 189
189 CPDF_Dictionary* pRoot = ((CPDF_Document*)document)->GetRoot(); 190 CPDF_Dictionary* pRoot = pDoc->GetRoot();
190 if (!pRoot) 191 if (!pRoot)
191 return PAGEMODE_UNKNOWN; 192 return PAGEMODE_UNKNOWN;
192 193
193 CPDF_Object* pName = pRoot->GetElement("PageMode"); 194 CPDF_Object* pName = pRoot->GetElement("PageMode");
194 if (!pName) 195 if (!pName)
195 return PAGEMODE_USENONE; 196 return PAGEMODE_USENONE;
196 197
197 CFX_ByteString strPageMode = pName->GetString(); 198 CFX_ByteString strPageMode = pName->GetString();
198 if (strPageMode.IsEmpty() || strPageMode.EqualNoCase("UseNone")) 199 if (strPageMode.IsEmpty() || strPageMode.EqualNoCase("UseNone"))
199 return PAGEMODE_USENONE; 200 return PAGEMODE_USENONE;
200 if (strPageMode.EqualNoCase("UseOutlines")) 201 if (strPageMode.EqualNoCase("UseOutlines"))
201 return PAGEMODE_USEOUTLINES; 202 return PAGEMODE_USEOUTLINES;
202 if (strPageMode.EqualNoCase("UseThumbs")) 203 if (strPageMode.EqualNoCase("UseThumbs"))
203 return PAGEMODE_USETHUMBS; 204 return PAGEMODE_USETHUMBS;
204 if (strPageMode.EqualNoCase("FullScreen")) 205 if (strPageMode.EqualNoCase("FullScreen"))
205 return PAGEMODE_FULLSCREEN; 206 return PAGEMODE_FULLSCREEN;
206 if (strPageMode.EqualNoCase("UseOC")) 207 if (strPageMode.EqualNoCase("UseOC"))
207 return PAGEMODE_USEOC; 208 return PAGEMODE_USEOC;
208 if (strPageMode.EqualNoCase("UseAttachments")) 209 if (strPageMode.EqualNoCase("UseAttachments"))
209 return PAGEMODE_USEATTACHMENTS; 210 return PAGEMODE_USEATTACHMENTS;
210 211
211 return PAGEMODE_UNKNOWN; 212 return PAGEMODE_UNKNOWN;
212 } 213 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdf_dataavail.cpp ('k') | fpdfsdk/src/fpdfdoc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698