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 "fpdfsdk/include/formfiller/FFL_FormFiller.h" | 7 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" |
8 #include "fpdfsdk/include/fsdk_actionhandler.h" | 8 #include "fpdfsdk/include/fsdk_actionhandler.h" |
9 #include "fpdfsdk/include/fsdk_baseannot.h" | 9 #include "fpdfsdk/include/fsdk_baseannot.h" |
10 #include "fpdfsdk/include/fsdk_baseform.h" | 10 #include "fpdfsdk/include/fsdk_baseform.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 void CPDFSDK_Widget::ResetFieldAppearance(FX_BOOL bValueChanged) { | 322 void CPDFSDK_Widget::ResetFieldAppearance(FX_BOOL bValueChanged) { |
323 CPDF_FormField* pFormField = GetFormField(); | 323 CPDF_FormField* pFormField = GetFormField(); |
324 ASSERT(pFormField != NULL); | 324 ASSERT(pFormField != NULL); |
325 | 325 |
326 ASSERT(m_pInterForm != NULL); | 326 ASSERT(m_pInterForm != NULL); |
327 | 327 |
328 m_pInterForm->ResetFieldAppearance(pFormField, NULL, bValueChanged); | 328 m_pInterForm->ResetFieldAppearance(pFormField, NULL, bValueChanged); |
329 } | 329 } |
330 | 330 |
331 void CPDFSDK_Widget::DrawAppearance(CFX_RenderDevice* pDevice, | 331 void CPDFSDK_Widget::DrawAppearance(CFX_RenderDevice* pDevice, |
332 const CPDF_Matrix* pUser2Device, | 332 const CFX_Matrix* pUser2Device, |
333 CPDF_Annot::AppearanceMode mode, | 333 CPDF_Annot::AppearanceMode mode, |
334 const CPDF_RenderOptions* pOptions) { | 334 const CPDF_RenderOptions* pOptions) { |
335 int nFieldType = GetFieldType(); | 335 int nFieldType = GetFieldType(); |
336 | 336 |
337 if ((nFieldType == FIELDTYPE_CHECKBOX || | 337 if ((nFieldType == FIELDTYPE_CHECKBOX || |
338 nFieldType == FIELDTYPE_RADIOBUTTON) && | 338 nFieldType == FIELDTYPE_RADIOBUTTON) && |
339 mode == CPDF_Annot::Normal && | 339 mode == CPDF_Annot::Normal && |
340 !IsWidgetAppearanceValid(CPDF_Annot::Normal)) { | 340 !IsWidgetAppearanceValid(CPDF_Annot::Normal)) { |
341 CFX_PathData pathData; | 341 CFX_PathData pathData; |
342 | 342 |
(...skipping 28 matching lines...) Expand all Loading... |
371 if (m_pInterForm->IsNeedHighLight(nFieldType)) { | 371 if (m_pInterForm->IsNeedHighLight(nFieldType)) { |
372 CPDF_Rect rc = GetRect(); | 372 CPDF_Rect rc = GetRect(); |
373 FX_COLORREF color = m_pInterForm->GetHighlightColor(nFieldType); | 373 FX_COLORREF color = m_pInterForm->GetHighlightColor(nFieldType); |
374 uint8_t alpha = m_pInterForm->GetHighlightAlpha(); | 374 uint8_t alpha = m_pInterForm->GetHighlightAlpha(); |
375 | 375 |
376 CFX_FloatRect rcDevice; | 376 CFX_FloatRect rcDevice; |
377 ASSERT(m_pInterForm->GetDocument()); | 377 ASSERT(m_pInterForm->GetDocument()); |
378 CPDFDoc_Environment* pEnv = m_pInterForm->GetDocument()->GetEnv(); | 378 CPDFDoc_Environment* pEnv = m_pInterForm->GetDocument()->GetEnv(); |
379 if (!pEnv) | 379 if (!pEnv) |
380 return; | 380 return; |
381 CFX_AffineMatrix page2device; | 381 CFX_Matrix page2device; |
382 pPageView->GetCurrentMatrix(page2device); | 382 pPageView->GetCurrentMatrix(page2device); |
383 page2device.Transform(((FX_FLOAT)rc.left), ((FX_FLOAT)rc.bottom), | 383 page2device.Transform(((FX_FLOAT)rc.left), ((FX_FLOAT)rc.bottom), |
384 rcDevice.left, rcDevice.bottom); | 384 rcDevice.left, rcDevice.bottom); |
385 page2device.Transform(((FX_FLOAT)rc.right), ((FX_FLOAT)rc.top), | 385 page2device.Transform(((FX_FLOAT)rc.right), ((FX_FLOAT)rc.top), |
386 rcDevice.right, rcDevice.top); | 386 rcDevice.right, rcDevice.top); |
387 | 387 |
388 rcDevice.Normalize(); | 388 rcDevice.Normalize(); |
389 | 389 |
390 FX_ARGB argb = ArgbEncode((int)alpha, color); | 390 FX_ARGB argb = ArgbEncode((int)alpha, color); |
391 FX_RECT rcDev((int)rcDevice.left, (int)rcDevice.top, (int)rcDevice.right, | 391 FX_RECT rcDev((int)rcDevice.left, (int)rcDevice.top, (int)rcDevice.right, |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 default: | 1305 default: |
1306 nBorderStyle = PBS_SOLID; | 1306 nBorderStyle = PBS_SOLID; |
1307 break; | 1307 break; |
1308 } | 1308 } |
1309 | 1309 |
1310 return CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, | 1310 return CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, |
1311 crLeftTop, crRightBottom, nBorderStyle, | 1311 crLeftTop, crRightBottom, nBorderStyle, |
1312 dsBorder); | 1312 dsBorder); |
1313 } | 1313 } |
1314 | 1314 |
1315 CPDF_Matrix CPDFSDK_Widget::GetMatrix() const { | 1315 CFX_Matrix CPDFSDK_Widget::GetMatrix() const { |
1316 CPDF_Matrix mt; | 1316 CFX_Matrix mt; |
1317 CPDF_FormControl* pControl = GetFormControl(); | 1317 CPDF_FormControl* pControl = GetFormControl(); |
1318 ASSERT(pControl != NULL); | 1318 ASSERT(pControl != NULL); |
1319 | 1319 |
1320 CPDF_Rect rcAnnot = GetRect(); | 1320 CPDF_Rect rcAnnot = GetRect(); |
1321 FX_FLOAT fWidth = rcAnnot.right - rcAnnot.left; | 1321 FX_FLOAT fWidth = rcAnnot.right - rcAnnot.left; |
1322 FX_FLOAT fHeight = rcAnnot.top - rcAnnot.bottom; | 1322 FX_FLOAT fHeight = rcAnnot.top - rcAnnot.bottom; |
1323 | 1323 |
1324 switch (abs(pControl->GetRotation() % 360)) { | 1324 switch (abs(pControl->GetRotation() % 360)) { |
1325 case 0: | 1325 case 0: |
1326 default: | 1326 default: |
1327 mt = CPDF_Matrix(1, 0, 0, 1, 0, 0); | 1327 mt = CFX_Matrix(1, 0, 0, 1, 0, 0); |
1328 break; | 1328 break; |
1329 case 90: | 1329 case 90: |
1330 mt = CPDF_Matrix(0, 1, -1, 0, fWidth, 0); | 1330 mt = CFX_Matrix(0, 1, -1, 0, fWidth, 0); |
1331 break; | 1331 break; |
1332 case 180: | 1332 case 180: |
1333 mt = CPDF_Matrix(-1, 0, 0, -1, fWidth, fHeight); | 1333 mt = CFX_Matrix(-1, 0, 0, -1, fWidth, fHeight); |
1334 break; | 1334 break; |
1335 case 270: | 1335 case 270: |
1336 mt = CPDF_Matrix(0, -1, 1, 0, 0, fHeight); | 1336 mt = CFX_Matrix(0, -1, 1, 0, 0, fHeight); |
1337 break; | 1337 break; |
1338 } | 1338 } |
1339 | 1339 |
1340 return mt; | 1340 return mt; |
1341 } | 1341 } |
1342 | 1342 |
1343 CPWL_Color CPDFSDK_Widget::GetTextPWLColor() const { | 1343 CPWL_Color CPDFSDK_Widget::GetTextPWLColor() const { |
1344 CPWL_Color crText = CPWL_Color(COLORTYPE_GRAY, 0); | 1344 CPWL_Color crText = CPWL_Color(COLORTYPE_GRAY, 0); |
1345 | 1345 |
1346 CPDF_FormControl* pFormCtrl = GetFormControl(); | 1346 CPDF_FormControl* pFormCtrl = GetFormControl(); |
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2488 break; | 2488 break; |
2489 } | 2489 } |
2490 } | 2490 } |
2491 } | 2491 } |
2492 | 2492 |
2493 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(CPDFSDK_Annot* pAnnot) { | 2493 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(CPDFSDK_Annot* pAnnot) { |
2494 CPDF_Rect rcAnnot; | 2494 CPDF_Rect rcAnnot; |
2495 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); | 2495 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); |
2496 return rcAnnot; | 2496 return rcAnnot; |
2497 } | 2497 } |
OLD | NEW |