| 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_CBA_Fontmap.h" | 7 #include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h" |
| 8 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" | 8 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" |
| 9 | 9 |
| 10 #define GetRed(rgb) ((uint8_t)(rgb)) | 10 #define GetRed(rgb) ((uint8_t)(rgb)) |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { | 236 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
| 237 return pWnd->OnChar(nChar, nFlags); | 237 return pWnd->OnChar(nChar, nFlags); |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 | 240 |
| 241 return FALSE; | 241 return FALSE; |
| 242 } | 242 } |
| 243 | 243 |
| 244 void CFFL_FormFiller::SetFocusForAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { | 244 void CFFL_FormFiller::SetFocusForAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { |
| 245 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 245 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 246 CPDF_Page* pPage = pWidget->GetPDFPage(); | 246 UnderlyingPageType* pPage = pWidget->GetUnderlyingPage(); |
| 247 CPDFSDK_Document* pDoc = m_pApp->GetSDKDocument(); | 247 CPDFSDK_Document* pDoc = m_pApp->GetSDKDocument(); |
| 248 CPDFSDK_PageView* pPageView = pDoc->GetPageView(pPage); | 248 CPDFSDK_PageView* pPageView = pDoc->GetPageView(pPage); |
| 249 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) | 249 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) |
| 250 pWnd->SetFocus(); | 250 pWnd->SetFocus(); |
| 251 | 251 |
| 252 m_bValid = TRUE; | 252 m_bValid = TRUE; |
| 253 FX_RECT rcRect = GetViewBBox(pPageView, pAnnot); | 253 FX_RECT rcRect = GetViewBBox(pPageView, pAnnot); |
| 254 InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); | 254 InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); |
| 255 } | 255 } |
| 256 | 256 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 | 454 |
| 455 FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left; | 455 FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left; |
| 456 FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom; | 456 FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom; |
| 457 if ((m_pWidget->GetRotate() / 90) & 0x01) | 457 if ((m_pWidget->GetRotate() / 90) & 0x01) |
| 458 return CPDF_Rect(0, 0, fHeight, fWidth); | 458 return CPDF_Rect(0, 0, fHeight, fWidth); |
| 459 | 459 |
| 460 return CPDF_Rect(0, 0, fWidth, fHeight); | 460 return CPDF_Rect(0, 0, fWidth, fHeight); |
| 461 } | 461 } |
| 462 | 462 |
| 463 CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView() { | 463 CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView() { |
| 464 CPDF_Page* pPage = m_pAnnot->GetPDFPage(); | 464 UnderlyingPageType* pPage = m_pAnnot->GetUnderlyingPage(); |
| 465 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); | 465 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); |
| 466 return pSDKDoc ? pSDKDoc->GetPageView(pPage) : nullptr; | 466 return pSDKDoc ? pSDKDoc->GetPageView(pPage) : nullptr; |
| 467 } | 467 } |
| 468 | 468 |
| 469 CPDF_Rect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) { | 469 CPDF_Rect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) { |
| 470 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { | 470 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
| 471 CPDF_Rect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocusRect())); | 471 CPDF_Rect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocusRect())); |
| 472 CPDF_Rect rcPage = pPageView->GetPDFPage()->GetPageBBox(); | 472 CPDF_Rect rcPage = pPageView->GetPDFPage()->GetPageBBox(); |
| 473 if (rcPage.Contains(rcFocus)) | 473 if (rcPage.Contains(rcFocus)) |
| 474 return rcFocus; | 474 return rcFocus; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); | 605 InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); |
| 606 | 606 |
| 607 if (bDestroyPDFWindow) | 607 if (bDestroyPDFWindow) |
| 608 DestroyPDFWindow(pPageView); | 608 DestroyPDFWindow(pPageView); |
| 609 } | 609 } |
| 610 | 610 |
| 611 void CFFL_FormFiller::InvalidateRect(double left, | 611 void CFFL_FormFiller::InvalidateRect(double left, |
| 612 double top, | 612 double top, |
| 613 double right, | 613 double right, |
| 614 double bottom) { | 614 double bottom) { |
| 615 CPDF_Page* pPage = m_pWidget->GetPDFPage(); | 615 UnderlyingPageType* pPage = m_pWidget->GetUnderlyingPage(); |
| 616 m_pApp->FFI_Invalidate(pPage, left, top, right, bottom); | 616 m_pApp->FFI_Invalidate(pPage, left, top, right, bottom); |
| 617 } | 617 } |
| 618 | 618 |
| 619 /* ------------------------- CFFL_Button ------------------------- */ | 619 /* ------------------------- CFFL_Button ------------------------- */ |
| 620 | 620 |
| 621 CFFL_Button::CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget) | 621 CFFL_Button::CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget) |
| 622 : CFFL_FormFiller(pApp, pWidget), m_bMouseIn(FALSE), m_bMouseDown(FALSE) {} | 622 : CFFL_FormFiller(pApp, pWidget), m_bMouseIn(FALSE), m_bMouseDown(FALSE) {} |
| 623 | 623 |
| 624 CFFL_Button::~CFFL_Button() {} | 624 CFFL_Button::~CFFL_Button() {} |
| 625 | 625 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); | 711 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); |
| 712 } | 712 } |
| 713 | 713 |
| 714 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, | 714 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, |
| 715 CPDFSDK_Annot* pAnnot, | 715 CPDFSDK_Annot* pAnnot, |
| 716 CFX_RenderDevice* pDevice, | 716 CFX_RenderDevice* pDevice, |
| 717 CPDF_Matrix* pUser2Device, | 717 CPDF_Matrix* pUser2Device, |
| 718 FX_DWORD dwFlags) { | 718 FX_DWORD dwFlags) { |
| 719 OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); | 719 OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); |
| 720 } | 720 } |
| OLD | NEW |