blob: 65a7be2f5c5dd933e010ccc7b50064e0ecf3e9a0 [file] [log] [blame]
Dan Sinclair1770c022016-03-14 14:14:16 -04001// 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 Sinclair1770c022016-03-14 14:14:16 -04009#include "xfa/fxfa/app/xfa_fffield.h"
Dan Sinclair1770c022016-03-14 14:14:16 -040010#include "xfa/fxfa/app/xfa_ffwidget.h"
dsinclairdf4bc592016-03-31 20:34:43 -070011#include "xfa/include/fxfa/xfa_ffdoc.h"
12#include "xfa/include/fxfa/xfa_ffpageview.h"
Dan Sinclair1770c022016-03-14 14:14:16 -040013
14CXFA_FFSignature::CXFA_FFSignature(CXFA_FFPageView* pPageView,
15 CXFA_WidgetAcc* pDataAcc)
16 : CXFA_FFField(pPageView, pDataAcc) {}
17CXFA_FFSignature::~CXFA_FFSignature() {}
18FX_BOOL CXFA_FFSignature::LoadWidget() {
19 return CXFA_FFField::LoadWidget();
20}
21void CXFA_FFSignature::RenderWidget(CFX_Graphics* pGS,
22 CFX_Matrix* pMatrix,
tsepez736f28a2016-03-25 14:19:51 -070023 uint32_t dwStatus,
Dan Sinclair1770c022016-03-14 14:14:16 -040024 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}
43FX_BOOL CXFA_FFSignature::OnMouseEnter() {
44 return FALSE;
45}
46FX_BOOL CXFA_FFSignature::OnMouseExit() {
47 return FALSE;
48}
tsepez736f28a2016-03-25 14:19:51 -070049FX_BOOL CXFA_FFSignature::OnLButtonDown(uint32_t dwFlags,
Dan Sinclair1770c022016-03-14 14:14:16 -040050 FX_FLOAT fx,
51 FX_FLOAT fy) {
52 return FALSE;
53}
tsepez736f28a2016-03-25 14:19:51 -070054FX_BOOL CXFA_FFSignature::OnLButtonUp(uint32_t dwFlags,
Dan Sinclair1770c022016-03-14 14:14:16 -040055 FX_FLOAT fx,
56 FX_FLOAT fy) {
57 return FALSE;
58}
tsepez736f28a2016-03-25 14:19:51 -070059FX_BOOL CXFA_FFSignature::OnLButtonDblClk(uint32_t dwFlags,
Dan Sinclair1770c022016-03-14 14:14:16 -040060 FX_FLOAT fx,
61 FX_FLOAT fy) {
62 return FALSE;
63}
tsepez736f28a2016-03-25 14:19:51 -070064FX_BOOL CXFA_FFSignature::OnMouseMove(uint32_t dwFlags,
Dan Sinclair1770c022016-03-14 14:14:16 -040065 FX_FLOAT fx,
66 FX_FLOAT fy) {
67 return FALSE;
68}
tsepez736f28a2016-03-25 14:19:51 -070069FX_BOOL CXFA_FFSignature::OnMouseWheel(uint32_t dwFlags,
Dan Sinclair1770c022016-03-14 14:14:16 -040070 int16_t zDelta,
71 FX_FLOAT fx,
72 FX_FLOAT fy) {
73 return FALSE;
74}
tsepez736f28a2016-03-25 14:19:51 -070075FX_BOOL CXFA_FFSignature::OnRButtonDown(uint32_t dwFlags,
Dan Sinclair1770c022016-03-14 14:14:16 -040076 FX_FLOAT fx,
77 FX_FLOAT fy) {
78 return FALSE;
79}
tsepez736f28a2016-03-25 14:19:51 -070080FX_BOOL CXFA_FFSignature::OnRButtonUp(uint32_t dwFlags,
Dan Sinclair1770c022016-03-14 14:14:16 -040081 FX_FLOAT fx,
82 FX_FLOAT fy) {
83 return FALSE;
84}
tsepez736f28a2016-03-25 14:19:51 -070085FX_BOOL CXFA_FFSignature::OnRButtonDblClk(uint32_t dwFlags,
Dan Sinclair1770c022016-03-14 14:14:16 -040086 FX_FLOAT fx,
87 FX_FLOAT fy) {
88 return FALSE;
89}
tsepez736f28a2016-03-25 14:19:51 -070090FX_BOOL CXFA_FFSignature::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) {
Dan Sinclair1770c022016-03-14 14:14:16 -040091 return FALSE;
92}
tsepez736f28a2016-03-25 14:19:51 -070093FX_BOOL CXFA_FFSignature::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) {
Dan Sinclair1770c022016-03-14 14:14:16 -040094 return FALSE;
95}
tsepez736f28a2016-03-25 14:19:51 -070096FX_BOOL CXFA_FFSignature::OnChar(uint32_t dwChar, uint32_t dwFlags) {
Dan Sinclair1770c022016-03-14 14:14:16 -040097 return FALSE;
98}
tsepez736f28a2016-03-25 14:19:51 -070099uint32_t CXFA_FFSignature::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) {
Dan Sinclair1770c022016-03-14 14:14:16 -0400100 if (m_pNormalWidget) {
101 FX_FLOAT ffx = fx, ffy = fy;
102 FWLToClient(ffx, ffy);
tsepez736f28a2016-03-25 14:19:51 -0700103 uint32_t dwWidgetHit = m_pNormalWidget->HitTest(ffx, ffy);
Dan Sinclair1770c022016-03-14 14:14:16 -0400104 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}
118FX_BOOL CXFA_FFSignature::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) {
119 return FALSE;
120}