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_edit.h" | 7 #include "../../public/fpdf_edit.h" |
8 #include "../../public/fpdf_formfill.h" | 8 #include "../../public/fpdf_formfill.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 25 matching lines...) Expand all Loading... |
36 } | 36 } |
37 | 37 |
38 CPDF_Dictionary* pInfoDict = NULL; | 38 CPDF_Dictionary* pInfoDict = NULL; |
39 pInfoDict = pDoc->GetInfo(); | 39 pInfoDict = pDoc->GetInfo(); |
40 if (pInfoDict) { | 40 if (pInfoDict) { |
41 if (FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) | 41 if (FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) |
42 pInfoDict->SetAt("CreationDate", new CPDF_String(DateStr)); | 42 pInfoDict->SetAt("CreationDate", new CPDF_String(DateStr)); |
43 pInfoDict->SetAt("Creator", new CPDF_String(L"PDFium")); | 43 pInfoDict->SetAt("Creator", new CPDF_String(L"PDFium")); |
44 } | 44 } |
45 | 45 |
46 CPDFXFA_App* pApp = CPDFXFA_App::GetInstance(); | 46 return FPDFDocumentFromCPDFDocument(pDoc); |
47 return new CPDFXFA_Document(pDoc, pApp); | |
48 } | 47 } |
49 | 48 |
50 DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index) { | 49 DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index) { |
51 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); | 50 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); |
52 if (!pDoc || page_index < 0 || page_index >= pDoc->GetPageCount()) | 51 if (!pDoc || page_index < 0 || page_index >= pDoc->GetPageCount()) |
53 return; | 52 return; |
54 | 53 |
55 pDoc->DeletePage(page_index); | 54 pDoc->DeletePage(page_index); |
56 } | 55 } |
57 | 56 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 CPDF_FormObject* pFormObj = (CPDF_FormObject*)pPageObj; | 169 CPDF_FormObject* pFormObj = (CPDF_FormObject*)pPageObj; |
171 pFormObj->CalcBoundingBox(); | 170 pFormObj->CalcBoundingBox(); |
172 break; | 171 break; |
173 } | 172 } |
174 default: | 173 default: |
175 break; | 174 break; |
176 } | 175 } |
177 } | 176 } |
178 | 177 |
179 DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page) { | 178 DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page) { |
180 CPDF_Page* pPage = ((CPDFXFA_Page*)page)->GetPDFPage(); | 179 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
181 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || | 180 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || |
182 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || | 181 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || |
183 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( | 182 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( |
184 "Page")) { | 183 "Page")) { |
185 return -1; | 184 return -1; |
186 } | 185 } |
187 return pPage->CountObjects(); | 186 return pPage->CountObjects(); |
188 } | 187 } |
189 | 188 |
190 DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, | 189 DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || | 309 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || |
311 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( | 310 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( |
312 "Page")) { | 311 "Page")) { |
313 return; | 312 return; |
314 } | 313 } |
315 CPDF_Dictionary* pDict = pPage->m_pFormDict; | 314 CPDF_Dictionary* pDict = pPage->m_pFormDict; |
316 rotate %= 4; | 315 rotate %= 4; |
317 | 316 |
318 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); | 317 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); |
319 } | 318 } |
OLD | NEW |