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 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "core/fpdfapi/parser/cpdf_document.h" | 22 #include "core/fpdfapi/parser/cpdf_document.h" |
23 #include "core/fpdfapi/parser/cpdf_number.h" | 23 #include "core/fpdfapi/parser/cpdf_number.h" |
24 #include "core/fpdfapi/parser/cpdf_string.h" | 24 #include "core/fpdfapi/parser/cpdf_string.h" |
25 #include "core/fpdfdoc/cpdf_annot.h" | 25 #include "core/fpdfdoc/cpdf_annot.h" |
26 #include "core/fpdfdoc/cpdf_annotlist.h" | 26 #include "core/fpdfdoc/cpdf_annotlist.h" |
27 #include "fpdfsdk/fsdk_define.h" | 27 #include "fpdfsdk/fsdk_define.h" |
28 #include "public/fpdf_formfill.h" | 28 #include "public/fpdf_formfill.h" |
29 #include "third_party/base/stl_util.h" | 29 #include "third_party/base/stl_util.h" |
30 | 30 |
31 #ifdef PDF_ENABLE_XFA | 31 #ifdef PDF_ENABLE_XFA |
32 #include "fpdfsdk/fpdfxfa/cpdfxfa_document.h" | 32 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" |
33 #include "fpdfsdk/fpdfxfa/cpdfxfa_page.h" | 33 #include "fpdfsdk/fpdfxfa/cpdfxfa_page.h" |
34 #endif // PDF_ENABLE_XFA | 34 #endif // PDF_ENABLE_XFA |
35 | 35 |
36 #if _FX_OS_ == _FX_ANDROID_ | 36 #if _FX_OS_ == _FX_ANDROID_ |
37 #include "time.h" | 37 #include "time.h" |
38 #else | 38 #else |
39 #include <ctime> | 39 #include <ctime> |
40 #endif | 40 #endif |
41 | 41 |
42 namespace { | 42 namespace { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 pMediaBoxArray->Add(new CPDF_Number(0)); | 114 pMediaBoxArray->Add(new CPDF_Number(0)); |
115 pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(width))); | 115 pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(width))); |
116 pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(height))); | 116 pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(height))); |
117 pPageDict->SetFor("MediaBox", pMediaBoxArray); | 117 pPageDict->SetFor("MediaBox", pMediaBoxArray); |
118 pPageDict->SetFor("Rotate", new CPDF_Number(0)); | 118 pPageDict->SetFor("Rotate", new CPDF_Number(0)); |
119 pPageDict->SetFor("Resources", | 119 pPageDict->SetFor("Resources", |
120 new CPDF_Dictionary(pDoc->GetByteStringPool())); | 120 new CPDF_Dictionary(pDoc->GetByteStringPool())); |
121 | 121 |
122 #ifdef PDF_ENABLE_XFA | 122 #ifdef PDF_ENABLE_XFA |
123 CPDFXFA_Page* pPage = | 123 CPDFXFA_Page* pPage = |
124 new CPDFXFA_Page((CPDFXFA_Document*)document, page_index); | 124 new CPDFXFA_Page(static_cast<CPDFXFA_Context*>(document), page_index); |
125 pPage->LoadPDFPage(pPageDict); | 125 pPage->LoadPDFPage(pPageDict); |
126 #else // PDF_ENABLE_XFA | 126 #else // PDF_ENABLE_XFA |
127 CPDF_Page* pPage = new CPDF_Page(pDoc, pPageDict, true); | 127 CPDF_Page* pPage = new CPDF_Page(pDoc, pPageDict, true); |
128 pPage->ParseContent(); | 128 pPage->ParseContent(); |
129 #endif // PDF_ENABLE_XFA | 129 #endif // PDF_ENABLE_XFA |
130 | 130 |
131 return pPage; | 131 return pPage; |
132 } | 132 } |
133 | 133 |
134 DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page) { | 134 DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page) { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 309 |
310 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) { | 310 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) { |
311 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 311 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
312 if (!IsPageObject(pPage)) | 312 if (!IsPageObject(pPage)) |
313 return; | 313 return; |
314 | 314 |
315 CPDF_Dictionary* pDict = pPage->m_pFormDict; | 315 CPDF_Dictionary* pDict = pPage->m_pFormDict; |
316 rotate %= 4; | 316 rotate %= 4; |
317 pDict->SetFor("Rotate", new CPDF_Number(rotate * 90)); | 317 pDict->SetFor("Rotate", new CPDF_Number(rotate * 90)); |
318 } | 318 } |
OLD | NEW |