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/cxfa_ffsignature.h"
8
9 #include "xfa/fxfa/cxfa_ffdoc.h"
10 #include "xfa/fxfa/cxfa_fffield.h"
11 #include "xfa/fxfa/cxfa_ffpageview.h"
12 #include "xfa/fxfa/cxfa_ffwidget.h"
13 #include "xfa/fxfa/parser/cxfa_border.h"
14
CXFA_FFSignature(CXFA_Node * pNode)15 CXFA_FFSignature::CXFA_FFSignature(CXFA_Node* pNode) : CXFA_FFField(pNode) {}
16
~CXFA_FFSignature()17 CXFA_FFSignature::~CXFA_FFSignature() {}
18
LoadWidget()19 bool CXFA_FFSignature::LoadWidget() {
20 return CXFA_FFField::LoadWidget();
21 }
22
RenderWidget(CXFA_Graphics * pGS,const CFX_Matrix & matrix,uint32_t dwStatus)23 void CXFA_FFSignature::RenderWidget(CXFA_Graphics* pGS,
24 const CFX_Matrix& matrix,
25 uint32_t dwStatus) {
26 if (!IsMatchVisibleStatus(dwStatus))
27 return;
28
29 CFX_Matrix mtRotate = GetRotateMatrix();
30 mtRotate.Concat(matrix);
31
32 CXFA_FFWidget::RenderWidget(pGS, mtRotate, dwStatus);
33
34 DrawBorder(pGS, m_pNode->GetWidgetAcc()->GetUIBorder(), m_rtUI, mtRotate);
35 RenderCaption(pGS, &mtRotate);
36 DrawHighlight(pGS, &mtRotate, dwStatus, false);
37 }
38
OnMouseEnter()39 bool CXFA_FFSignature::OnMouseEnter() {
40 return false;
41 }
42
OnMouseExit()43 bool CXFA_FFSignature::OnMouseExit() {
44 return false;
45 }
46
OnLButtonDown(uint32_t dwFlags,const CFX_PointF & point)47 bool CXFA_FFSignature::OnLButtonDown(uint32_t dwFlags,
48 const CFX_PointF& point) {
49 return false;
50 }
51
OnLButtonUp(uint32_t dwFlags,const CFX_PointF & point)52 bool CXFA_FFSignature::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
53 return false;
54 }
55
OnLButtonDblClk(uint32_t dwFlags,const CFX_PointF & point)56 bool CXFA_FFSignature::OnLButtonDblClk(uint32_t dwFlags,
57 const CFX_PointF& point) {
58 return false;
59 }
60
OnMouseMove(uint32_t dwFlags,const CFX_PointF & point)61 bool CXFA_FFSignature::OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) {
62 return false;
63 }
64
OnMouseWheel(uint32_t dwFlags,int16_t zDelta,const CFX_PointF & point)65 bool CXFA_FFSignature::OnMouseWheel(uint32_t dwFlags,
66 int16_t zDelta,
67 const CFX_PointF& point) {
68 return false;
69 }
70
OnRButtonDown(uint32_t dwFlags,const CFX_PointF & point)71 bool CXFA_FFSignature::OnRButtonDown(uint32_t dwFlags,
72 const CFX_PointF& point) {
73 return false;
74 }
75
OnRButtonUp(uint32_t dwFlags,const CFX_PointF & point)76 bool CXFA_FFSignature::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
77 return false;
78 }
79
OnRButtonDblClk(uint32_t dwFlags,const CFX_PointF & point)80 bool CXFA_FFSignature::OnRButtonDblClk(uint32_t dwFlags,
81 const CFX_PointF& point) {
82 return false;
83 }
84
OnKeyDown(uint32_t dwKeyCode,uint32_t dwFlags)85 bool CXFA_FFSignature::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) {
86 return false;
87 }
88
OnKeyUp(uint32_t dwKeyCode,uint32_t dwFlags)89 bool CXFA_FFSignature::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) {
90 return false;
91 }
92
OnChar(uint32_t dwChar,uint32_t dwFlags)93 bool CXFA_FFSignature::OnChar(uint32_t dwChar, uint32_t dwFlags) {
94 return false;
95 }
96
OnHitTest(const CFX_PointF & point)97 FWL_WidgetHit CXFA_FFSignature::OnHitTest(const CFX_PointF& point) {
98 if (m_pNormalWidget &&
99 m_pNormalWidget->HitTest(FWLToClient(point)) != FWL_WidgetHit::Unknown) {
100 return FWL_WidgetHit::Client;
101 }
102
103 if (!GetRectWithoutRotate().Contains(point))
104 return FWL_WidgetHit::Unknown;
105 if (m_rtCaption.Contains(point))
106 return FWL_WidgetHit::Titlebar;
107 return FWL_WidgetHit::Client;
108 }
109
OnSetCursor(const CFX_PointF & point)110 bool CXFA_FFSignature::OnSetCursor(const CFX_PointF& point) {
111 return false;
112 }
113
GetFormFieldType()114 FormFieldType CXFA_FFSignature::GetFormFieldType() {
115 return FormFieldType::kXFA_Signature;
116 }
117