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 "fpdfsdk/include/fsdk_define.h" | 9 #include "fpdfsdk/include/fsdk_define.h" |
10 #include "public/fpdf_formfill.h" | 10 #include "public/fpdf_formfill.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 CPDF_AnnotList AnnotList(pPage); | 276 CPDF_AnnotList AnnotList(pPage); |
277 for (size_t i = 0; i < AnnotList.Count(); ++i) { | 277 for (size_t i = 0; i < AnnotList.Count(); ++i) { |
278 CPDF_Annot* pAnnot = AnnotList.GetAt(i); | 278 CPDF_Annot* pAnnot = AnnotList.GetAt(i); |
279 // transformAnnots Rectangle | 279 // transformAnnots Rectangle |
280 CPDF_Rect rect; | 280 CPDF_Rect rect; |
281 pAnnot->GetRect(rect); | 281 pAnnot->GetRect(rect); |
282 CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d, | 282 CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d, |
283 (FX_FLOAT)e, (FX_FLOAT)f); | 283 (FX_FLOAT)e, (FX_FLOAT)f); |
284 rect.Transform(&matrix); | 284 rect.Transform(&matrix); |
285 CPDF_Array* pRectArray = NULL; | 285 CPDF_Array* pRectArray = NULL; |
286 pRectArray = pAnnot->GetAnnotDict()->GetArray("Rect"); | 286 pRectArray = pAnnot->GetAnnotDict()->GetArrayBy("Rect"); |
287 if (!pRectArray) | 287 if (!pRectArray) |
288 pRectArray = new CPDF_Array; | 288 pRectArray = new CPDF_Array; |
289 pRectArray->SetAt(0, new CPDF_Number(rect.left)); | 289 pRectArray->SetAt(0, new CPDF_Number(rect.left)); |
290 pRectArray->SetAt(1, new CPDF_Number(rect.bottom)); | 290 pRectArray->SetAt(1, new CPDF_Number(rect.bottom)); |
291 pRectArray->SetAt(2, new CPDF_Number(rect.right)); | 291 pRectArray->SetAt(2, new CPDF_Number(rect.right)); |
292 pRectArray->SetAt(3, new CPDF_Number(rect.top)); | 292 pRectArray->SetAt(3, new CPDF_Number(rect.top)); |
293 pAnnot->GetAnnotDict()->SetAt("Rect", pRectArray); | 293 pAnnot->GetAnnotDict()->SetAt("Rect", pRectArray); |
294 | 294 |
295 // Transform AP's rectangle | 295 // Transform AP's rectangle |
296 // To Do | 296 // To Do |
297 } | 297 } |
298 } | 298 } |
299 | 299 |
300 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) { | 300 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) { |
301 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 301 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
302 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || | 302 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || |
303 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || | 303 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || |
304 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( | 304 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( |
305 "Page")) { | 305 "Page")) { |
306 return; | 306 return; |
307 } | 307 } |
308 CPDF_Dictionary* pDict = pPage->m_pFormDict; | 308 CPDF_Dictionary* pDict = pPage->m_pFormDict; |
309 rotate %= 4; | 309 rotate %= 4; |
310 | 310 |
311 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); | 311 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); |
312 } | 312 } |
OLD | NEW |