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 "../include/fsdk_define.h" | 8 #include "../include/fsdk_define.h" |
9 | 9 |
10 | 10 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 CPDF_AnnotList AnnotList(pPage); | 285 CPDF_AnnotList AnnotList(pPage); |
286 for (int i=0; i<AnnotList.Count();i++) | 286 for (int i=0; i<AnnotList.Count();i++) |
287 { | 287 { |
288 CPDF_Annot* pAnnot = AnnotList.GetAt(i); | 288 CPDF_Annot* pAnnot = AnnotList.GetAt(i); |
289 // transformAnnots Rectangle | 289 // transformAnnots Rectangle |
290 CPDF_Rect rect; | 290 CPDF_Rect rect; |
291 pAnnot->GetRect(rect); | 291 pAnnot->GetRect(rect); |
292 CFX_AffineMatrix matrix((FX_FLOAT)a,(FX_FLOAT)b,(FX_FLOAT)c,(FX_
FLOAT)d,(FX_FLOAT)e,(FX_FLOAT)f); | 292 CFX_AffineMatrix matrix((FX_FLOAT)a,(FX_FLOAT)b,(FX_FLOAT)c,(FX_
FLOAT)d,(FX_FLOAT)e,(FX_FLOAT)f); |
293 rect.Transform(&matrix); | 293 rect.Transform(&matrix); |
294 CPDF_Array *pRectArray = NULL; | 294 CPDF_Array *pRectArray = NULL; |
295 » » pRectArray = pAnnot->m_pAnnotDict->GetArray("Rect"); | 295 » » pRectArray = pAnnot->GetAnnotDict()->GetArray("Rect"); |
296 if (!pRectArray) pRectArray=CPDF_Array::Create(); | 296 if (!pRectArray) pRectArray=CPDF_Array::Create(); |
297 pRectArray->SetAt(0, new CPDF_Number(rect.left)); | 297 pRectArray->SetAt(0, new CPDF_Number(rect.left)); |
298 pRectArray->SetAt(1, new CPDF_Number(rect.bottom)); | 298 pRectArray->SetAt(1, new CPDF_Number(rect.bottom)); |
299 pRectArray->SetAt(2, new CPDF_Number(rect.right)); | 299 pRectArray->SetAt(2, new CPDF_Number(rect.right)); |
300 pRectArray->SetAt(3, new CPDF_Number(rect.top)); | 300 pRectArray->SetAt(3, new CPDF_Number(rect.top)); |
301 » » pAnnot->m_pAnnotDict->SetAt("Rect",pRectArray); | 301 » » pAnnot->GetAnnotDict()->SetAt("Rect",pRectArray); |
302 | 302 |
303 //Transform AP's rectangle | 303 //Transform AP's rectangle |
304 //To Do | 304 //To Do |
305 } | 305 } |
306 | 306 |
307 } | 307 } |
308 | 308 |
309 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) | 309 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) |
310 { | 310 { |
311 CPDF_Page* pPage = (CPDF_Page*)page; | 311 CPDF_Page* pPage = (CPDF_Page*)page; |
312 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type
") || !pPage->m_pFormDict->GetElement("Type")->GetDirect() | 312 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type
") || !pPage->m_pFormDict->GetElement("Type")->GetDirect() |
313 || pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetStrin
g().Compare("Page")) | 313 || pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetStrin
g().Compare("Page")) |
314 { | 314 { |
315 return; | 315 return; |
316 } | 316 } |
317 CPDF_Dictionary* pDict = pPage->m_pFormDict; | 317 CPDF_Dictionary* pDict = pPage->m_pFormDict; |
318 rotate %=4; | 318 rotate %=4; |
319 | 319 |
320 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); | 320 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); |
321 } | 321 } |
OLD | NEW |