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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 pTM->tm_mon + 1, pTM->tm_mday, pTM->tm_hour, pTM->tm_min, | 77 pTM->tm_mon + 1, pTM->tm_mday, pTM->tm_hour, pTM->tm_min, |
78 pTM->tm_sec); | 78 pTM->tm_sec); |
79 } | 79 } |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 CPDF_Dictionary* pInfoDict = nullptr; | 83 CPDF_Dictionary* pInfoDict = nullptr; |
84 pInfoDict = pDoc->GetInfo(); | 84 pInfoDict = pDoc->GetInfo(); |
85 if (pInfoDict) { | 85 if (pInfoDict) { |
86 if (FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) | 86 if (FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) |
87 pInfoDict->SetFor("CreationDate", new CPDF_String(DateStr, FALSE)); | 87 pInfoDict->SetFor("CreationDate", new CPDF_String(DateStr, false)); |
88 pInfoDict->SetFor("Creator", new CPDF_String(L"PDFium")); | 88 pInfoDict->SetFor("Creator", new CPDF_String(L"PDFium")); |
89 } | 89 } |
90 | 90 |
91 return FPDFDocumentFromCPDFDocument(pDoc); | 91 return FPDFDocumentFromCPDFDocument(pDoc); |
92 } | 92 } |
93 | 93 |
94 DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index) { | 94 DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index) { |
95 if (UnderlyingDocumentType* pDoc = UnderlyingFromFPDFDocument(document)) | 95 if (UnderlyingDocumentType* pDoc = UnderlyingFromFPDFDocument(document)) |
96 pDoc->DeletePage(page_index); | 96 pDoc->DeletePage(page_index); |
97 } | 97 } |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 210 } |
211 | 211 |
212 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page) { | 212 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page) { |
213 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 213 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
214 return pPage && pPage->BackgroundAlphaNeeded(); | 214 return pPage && pPage->BackgroundAlphaNeeded(); |
215 } | 215 } |
216 | 216 |
217 DLLEXPORT FPDF_BOOL STDCALL | 217 DLLEXPORT FPDF_BOOL STDCALL |
218 FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject) { | 218 FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject) { |
219 if (!pageObject) | 219 if (!pageObject) |
220 return FALSE; | 220 return false; |
221 | 221 |
222 CPDF_PageObject* pPageObj = reinterpret_cast<CPDF_PageObject*>(pageObject); | 222 CPDF_PageObject* pPageObj = reinterpret_cast<CPDF_PageObject*>(pageObject); |
223 int blend_type = pPageObj->m_GeneralState.GetBlendType(); | 223 int blend_type = pPageObj->m_GeneralState.GetBlendType(); |
224 if (blend_type != FXDIB_BLEND_NORMAL) | 224 if (blend_type != FXDIB_BLEND_NORMAL) |
225 return TRUE; | 225 return true; |
226 | 226 |
227 CPDF_Dictionary* pSMaskDict = | 227 CPDF_Dictionary* pSMaskDict = |
228 ToDictionary(pPageObj->m_GeneralState.GetSoftMask()); | 228 ToDictionary(pPageObj->m_GeneralState.GetSoftMask()); |
229 if (pSMaskDict) | 229 if (pSMaskDict) |
230 return TRUE; | 230 return true; |
231 | 231 |
232 if (pPageObj->m_GeneralState.GetFillAlpha() != 1.0f) | 232 if (pPageObj->m_GeneralState.GetFillAlpha() != 1.0f) |
233 return TRUE; | 233 return true; |
234 | 234 |
235 if (pPageObj->IsPath() && pPageObj->m_GeneralState.GetStrokeAlpha() != 1.0f) { | 235 if (pPageObj->IsPath() && pPageObj->m_GeneralState.GetStrokeAlpha() != 1.0f) { |
236 return TRUE; | 236 return true; |
237 } | 237 } |
238 | 238 |
239 if (pPageObj->IsForm()) { | 239 if (pPageObj->IsForm()) { |
240 const CPDF_Form* pForm = pPageObj->AsForm()->form(); | 240 const CPDF_Form* pForm = pPageObj->AsForm()->form(); |
241 if (pForm) { | 241 if (pForm) { |
242 int trans = pForm->m_Transparency; | 242 int trans = pForm->m_Transparency; |
243 if ((trans & PDFTRANS_ISOLATED) || (trans & PDFTRANS_GROUP)) | 243 if ((trans & PDFTRANS_ISOLATED) || (trans & PDFTRANS_GROUP)) |
244 return TRUE; | 244 return true; |
245 } | 245 } |
246 } | 246 } |
247 | 247 |
248 return FALSE; | 248 return false; |
249 } | 249 } |
250 | 250 |
251 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page) { | 251 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page) { |
252 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 252 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
253 if (!IsPageObject(pPage)) | 253 if (!IsPageObject(pPage)) |
254 return FALSE; | 254 return false; |
255 | 255 |
256 CPDF_PageContentGenerator CG(pPage); | 256 CPDF_PageContentGenerator CG(pPage); |
257 CG.GenerateContent(); | 257 CG.GenerateContent(); |
258 return TRUE; | 258 return true; |
259 } | 259 } |
260 | 260 |
261 DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object, | 261 DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object, |
262 double a, | 262 double a, |
263 double b, | 263 double b, |
264 double c, | 264 double c, |
265 double d, | 265 double d, |
266 double e, | 266 double e, |
267 double f) { | 267 double f) { |
268 CPDF_PageObject* pPageObj = reinterpret_cast<CPDF_PageObject*>(page_object); | 268 CPDF_PageObject* pPageObj = reinterpret_cast<CPDF_PageObject*>(page_object); |
(...skipping 40 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 |