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

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

Issue 1477583002: Inflict PDF_ENABLE_XFA ifdefs on XFA fpdfsdk/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years 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
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 "public/fpdf_edit.h" 7 #include "public/fpdf_edit.h"
8 8
9 #ifdef PDF_ENABLE_XFA
9 #include "../include/fpdfxfa/fpdfxfa_app.h" 10 #include "../include/fpdfxfa/fpdfxfa_app.h"
10 #include "../include/fpdfxfa/fpdfxfa_doc.h" 11 #include "../include/fpdfxfa/fpdfxfa_doc.h"
11 #include "../include/fpdfxfa/fpdfxfa_page.h" 12 #include "../include/fpdfxfa/fpdfxfa_page.h"
13 #endif
12 #include "fpdfsdk/include/fsdk_define.h" 14 #include "fpdfsdk/include/fsdk_define.h"
13 #include "public/fpdf_formfill.h" 15 #include "public/fpdf_formfill.h"
14 16
15 #if _FX_OS_ == _FX_ANDROID_ 17 #if _FX_OS_ == _FX_ANDROID_
16 #include "time.h" 18 #include "time.h"
17 #else 19 #else
18 #include <ctime> 20 #include <ctime>
19 #endif 21 #endif
20 22
21 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument() { 23 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument() {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 CPDF_Array* pMediaBoxArray = new CPDF_Array; 76 CPDF_Array* pMediaBoxArray = new CPDF_Array;
75 pMediaBoxArray->Add(new CPDF_Number(0)); 77 pMediaBoxArray->Add(new CPDF_Number(0));
76 pMediaBoxArray->Add(new CPDF_Number(0)); 78 pMediaBoxArray->Add(new CPDF_Number(0));
77 pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(width))); 79 pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(width)));
78 pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(height))); 80 pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(height)));
79 81
80 pPageDict->SetAt("MediaBox", pMediaBoxArray); 82 pPageDict->SetAt("MediaBox", pMediaBoxArray);
81 pPageDict->SetAt("Rotate", new CPDF_Number(0)); 83 pPageDict->SetAt("Rotate", new CPDF_Number(0));
82 pPageDict->SetAt("Resources", new CPDF_Dictionary); 84 pPageDict->SetAt("Resources", new CPDF_Dictionary);
83 85
86 #ifndef PDF_ENABLE_XFA
87 CPDF_Page* pPage = new CPDF_Page;
88 pPage->Load(pDoc, pPageDict);
89 pPage->ParseContent();
90 #else
84 CPDFXFA_Page* pPage = 91 CPDFXFA_Page* pPage =
85 new CPDFXFA_Page((CPDFXFA_Document*)document, page_index); 92 new CPDFXFA_Page((CPDFXFA_Document*)document, page_index);
86 pPage->LoadPDFPage(pPageDict); 93 pPage->LoadPDFPage(pPageDict);
94 #endif
87 95
88 return pPage; 96 return pPage;
89 } 97 }
90 98
91 DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page) { 99 DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page) {
92 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); 100 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
93 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || 101 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") ||
94 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || 102 !pPage->m_pFormDict->GetElement("Type")->GetDirect() ||
95 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( 103 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare(
96 "Page")) { 104 "Page")) {
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || 302 !pPage->m_pFormDict->GetElement("Type")->GetDirect() ||
295 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( 303 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare(
296 "Page")) { 304 "Page")) {
297 return; 305 return;
298 } 306 }
299 CPDF_Dictionary* pDict = pPage->m_pFormDict; 307 CPDF_Dictionary* pDict = pPage->m_pFormDict;
300 rotate %= 4; 308 rotate %= 4;
301 309
302 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); 310 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90));
303 } 311 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698