Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 1 | // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
| 7 | #include "xfa/fxfa/app/xfa_ffsignature.h" |
| 8 | |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 9 | #include "xfa/fxfa/app/xfa_fffield.h" |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 10 | #include "xfa/fxfa/app/xfa_ffwidget.h" |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame^] | 11 | #include "xfa/include/fxfa/xfa_ffdoc.h" |
| 12 | #include "xfa/include/fxfa/xfa_ffpageview.h" |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 13 | |
| 14 | CXFA_FFSignature::CXFA_FFSignature(CXFA_FFPageView* pPageView, |
| 15 | CXFA_WidgetAcc* pDataAcc) |
| 16 | : CXFA_FFField(pPageView, pDataAcc) {} |
| 17 | CXFA_FFSignature::~CXFA_FFSignature() {} |
| 18 | FX_BOOL CXFA_FFSignature::LoadWidget() { |
| 19 | return CXFA_FFField::LoadWidget(); |
| 20 | } |
| 21 | void CXFA_FFSignature::RenderWidget(CFX_Graphics* pGS, |
| 22 | CFX_Matrix* pMatrix, |
tsepez | 736f28a | 2016-03-25 14:19:51 -0700 | [diff] [blame] | 23 | uint32_t dwStatus, |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 24 | int32_t iRotate) { |
| 25 | if (!IsMatchVisibleStatus(dwStatus)) { |
| 26 | return; |
| 27 | } |
| 28 | CFX_Matrix mtRotate; |
| 29 | GetRotateMatrix(mtRotate); |
| 30 | if (pMatrix) { |
| 31 | mtRotate.Concat(*pMatrix); |
| 32 | } |
| 33 | CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus); |
| 34 | CXFA_Border borderUI = m_pDataAcc->GetUIBorder(); |
| 35 | DrawBorder(pGS, borderUI, m_rtUI, &mtRotate); |
| 36 | RenderCaption(pGS, &mtRotate); |
| 37 | DrawHighlight(pGS, &mtRotate, dwStatus, FALSE); |
| 38 | CFX_RectF rtWidget = m_rtUI; |
| 39 | IXFA_DocProvider* pDocProvider = m_pDataAcc->GetDoc()->GetDocProvider(); |
| 40 | FXSYS_assert(pDocProvider); |
| 41 | pDocProvider->RenderCustomWidget(this, pGS, &mtRotate, rtWidget); |
| 42 | } |
| 43 | FX_BOOL CXFA_FFSignature::OnMouseEnter() { |
| 44 | return FALSE; |
| 45 | } |
| 46 | FX_BOOL CXFA_FFSignature::OnMouseExit() { |
| 47 | return FALSE; |
| 48 | } |
tsepez | 736f28a | 2016-03-25 14:19:51 -0700 | [diff] [blame] | 49 | FX_BOOL CXFA_FFSignature::OnLButtonDown(uint32_t dwFlags, |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 50 | FX_FLOAT fx, |
| 51 | FX_FLOAT fy) { |
| 52 | return FALSE; |
| 53 | } |
tsepez | 736f28a | 2016-03-25 14:19:51 -0700 | [diff] [blame] | 54 | FX_BOOL CXFA_FFSignature::OnLButtonUp(uint32_t dwFlags, |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 55 | FX_FLOAT fx, |
| 56 | FX_FLOAT fy) { |
| 57 | return FALSE; |
| 58 | } |
tsepez | 736f28a | 2016-03-25 14:19:51 -0700 | [diff] [blame] | 59 | FX_BOOL CXFA_FFSignature::OnLButtonDblClk(uint32_t dwFlags, |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 60 | FX_FLOAT fx, |
| 61 | FX_FLOAT fy) { |
| 62 | return FALSE; |
| 63 | } |
tsepez | 736f28a | 2016-03-25 14:19:51 -0700 | [diff] [blame] | 64 | FX_BOOL CXFA_FFSignature::OnMouseMove(uint32_t dwFlags, |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 65 | FX_FLOAT fx, |
| 66 | FX_FLOAT fy) { |
| 67 | return FALSE; |
| 68 | } |
tsepez | 736f28a | 2016-03-25 14:19:51 -0700 | [diff] [blame] | 69 | FX_BOOL CXFA_FFSignature::OnMouseWheel(uint32_t dwFlags, |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 70 | int16_t zDelta, |
| 71 | FX_FLOAT fx, |
| 72 | FX_FLOAT fy) { |
| 73 | return FALSE; |
| 74 | } |
tsepez | 736f28a | 2016-03-25 14:19:51 -0700 | [diff] [blame] | 75 | FX_BOOL CXFA_FFSignature::OnRButtonDown(uint32_t dwFlags, |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 76 | FX_FLOAT fx, |
| 77 | FX_FLOAT fy) { |
| 78 | return FALSE; |
| 79 | } |
tsepez | 736f28a | 2016-03-25 14:19:51 -0700 | [diff] [blame] | 80 | FX_BOOL CXFA_FFSignature::OnRButtonUp(uint32_t dwFlags, |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 81 | FX_FLOAT fx, |
| 82 | FX_FLOAT fy) { |
| 83 | return FALSE; |
| 84 | } |
tsepez | 736f28a | 2016-03-25 14:19:51 -0700 | [diff] [blame] | 85 | FX_BOOL CXFA_FFSignature::OnRButtonDblClk(uint32_t dwFlags, |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 86 | FX_FLOAT fx, |
| 87 | FX_FLOAT fy) { |
| 88 | return FALSE; |
| 89 | } |
tsepez | 736f28a | 2016-03-25 14:19:51 -0700 | [diff] [blame] | 90 | FX_BOOL CXFA_FFSignature::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) { |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 91 | return FALSE; |
| 92 | } |
tsepez | 736f28a | 2016-03-25 14:19:51 -0700 | [diff] [blame] | 93 | FX_BOOL CXFA_FFSignature::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) { |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 94 | return FALSE; |
| 95 | } |
tsepez | 736f28a | 2016-03-25 14:19:51 -0700 | [diff] [blame] | 96 | FX_BOOL CXFA_FFSignature::OnChar(uint32_t dwChar, uint32_t dwFlags) { |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 97 | return FALSE; |
| 98 | } |
tsepez | 736f28a | 2016-03-25 14:19:51 -0700 | [diff] [blame] | 99 | uint32_t CXFA_FFSignature::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 100 | if (m_pNormalWidget) { |
| 101 | FX_FLOAT ffx = fx, ffy = fy; |
| 102 | FWLToClient(ffx, ffy); |
tsepez | 736f28a | 2016-03-25 14:19:51 -0700 | [diff] [blame] | 103 | uint32_t dwWidgetHit = m_pNormalWidget->HitTest(ffx, ffy); |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 104 | if (dwWidgetHit != FWL_WGTHITTEST_Unknown) { |
| 105 | return FWL_WGTHITTEST_Client; |
| 106 | } |
| 107 | } |
| 108 | CFX_RectF rtBox; |
| 109 | GetRectWithoutRotate(rtBox); |
| 110 | if (!rtBox.Contains(fx, fy)) { |
| 111 | return FWL_WGTHITTEST_Unknown; |
| 112 | } |
| 113 | if (m_rtCaption.Contains(fx, fy)) { |
| 114 | return FWL_WGTHITTEST_Titlebar; |
| 115 | } |
| 116 | return FWL_WGTHITTEST_Client; |
| 117 | } |
| 118 | FX_BOOL CXFA_FFSignature::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) { |
| 119 | return FALSE; |
| 120 | } |