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 CPDFXFA_Page* pPage = pWidget->GetPDFXFAPage(); | 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 CPDFXFA_Page* pPage = m_pAnnot->GetPDFXFAPage(); | 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); | 609 InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); |
610 | 610 |
611 if (bDestroyPDFWindow) | 611 if (bDestroyPDFWindow) |
612 DestroyPDFWindow(pPageView); | 612 DestroyPDFWindow(pPageView); |
613 } | 613 } |
614 | 614 |
615 void CFFL_FormFiller::InvalidateRect(double left, | 615 void CFFL_FormFiller::InvalidateRect(double left, |
616 double top, | 616 double top, |
617 double right, | 617 double right, |
618 double bottom) { | 618 double bottom) { |
619 CPDFXFA_Page* pPage = m_pWidget->GetPDFXFAPage(); | 619 UnderlyingPageType* pPage = m_pWidget->GetUnderlyingPage(); |
620 m_pApp->FFI_Invalidate(pPage, left, top, right, bottom); | 620 m_pApp->FFI_Invalidate(pPage, left, top, right, bottom); |
621 } | 621 } |
622 | 622 |
623 /* ------------------------- CFFL_Button ------------------------- */ | 623 /* ------------------------- CFFL_Button ------------------------- */ |
624 | 624 |
625 CFFL_Button::CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget) | 625 CFFL_Button::CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget) |
626 : CFFL_FormFiller(pApp, pWidget), m_bMouseIn(FALSE), m_bMouseDown(FALSE) {} | 626 : CFFL_FormFiller(pApp, pWidget), m_bMouseIn(FALSE), m_bMouseDown(FALSE) {} |
627 | 627 |
628 CFFL_Button::~CFFL_Button() {} | 628 CFFL_Button::~CFFL_Button() {} |
629 | 629 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); | 715 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); |
716 } | 716 } |
717 | 717 |
718 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, | 718 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, |
719 CPDFSDK_Annot* pAnnot, | 719 CPDFSDK_Annot* pAnnot, |
720 CFX_RenderDevice* pDevice, | 720 CFX_RenderDevice* pDevice, |
721 CPDF_Matrix* pUser2Device, | 721 CPDF_Matrix* pUser2Device, |
722 FX_DWORD dwFlags) { | 722 FX_DWORD dwFlags) { |
723 OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); | 723 OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); |
724 } | 724 } |
OLD | NEW |