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 
17 CXFA_FFSignature::~CXFA_FFSignature() = default;
18 
LoadWidget()19 bool CXFA_FFSignature::LoadWidget() {
20   ASSERT(!IsLoaded());
21   return CXFA_FFField::LoadWidget();
22 }
23 
RenderWidget(CXFA_Graphics * pGS,const CFX_Matrix & matrix,HighlightOption highlight)24 void CXFA_FFSignature::RenderWidget(CXFA_Graphics* pGS,
25                                     const CFX_Matrix& matrix,
26                                     HighlightOption highlight) {
27   if (!HasVisibleStatus())
28     return;
29 
30   CFX_Matrix mtRotate = GetRotateMatrix();
31   mtRotate.Concat(matrix);
32 
33   CXFA_FFWidget::RenderWidget(pGS, mtRotate, highlight);
34 
35   DrawBorder(pGS, m_pNode->GetUIBorder(), m_rtUI, mtRotate);
36   RenderCaption(pGS, &mtRotate);
37   DrawHighlight(pGS, &mtRotate, highlight, kSquareShape);
38 }
39 
OnMouseEnter()40 bool CXFA_FFSignature::OnMouseEnter() {
41   return false;
42 }
43 
OnMouseExit()44 bool CXFA_FFSignature::OnMouseExit() {
45   return false;
46 }
47 
AcceptsFocusOnButtonDown(uint32_t dwFlags,const CFX_PointF & point,FWL_MouseCommand command)48 bool CXFA_FFSignature::AcceptsFocusOnButtonDown(uint32_t dwFlags,
49                                                 const CFX_PointF& point,
50                                                 FWL_MouseCommand command) {
51   return false;
52 }
53 
OnLButtonDown(uint32_t dwFlags,const CFX_PointF & point)54 bool CXFA_FFSignature::OnLButtonDown(uint32_t dwFlags,
55                                      const CFX_PointF& point) {
56   return false;
57 }
58 
OnLButtonUp(uint32_t dwFlags,const CFX_PointF & point)59 bool CXFA_FFSignature::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
60   return false;
61 }
62 
OnLButtonDblClk(uint32_t dwFlags,const CFX_PointF & point)63 bool CXFA_FFSignature::OnLButtonDblClk(uint32_t dwFlags,
64                                        const CFX_PointF& point) {
65   return false;
66 }
67 
OnMouseMove(uint32_t dwFlags,const CFX_PointF & point)68 bool CXFA_FFSignature::OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) {
69   return false;
70 }
71 
OnMouseWheel(uint32_t dwFlags,int16_t zDelta,const CFX_PointF & point)72 bool CXFA_FFSignature::OnMouseWheel(uint32_t dwFlags,
73                                     int16_t zDelta,
74                                     const CFX_PointF& point) {
75   return false;
76 }
77 
OnRButtonDown(uint32_t dwFlags,const CFX_PointF & point)78 bool CXFA_FFSignature::OnRButtonDown(uint32_t dwFlags,
79                                      const CFX_PointF& point) {
80   return false;
81 }
82 
OnRButtonUp(uint32_t dwFlags,const CFX_PointF & point)83 bool CXFA_FFSignature::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
84   return false;
85 }
86 
OnRButtonDblClk(uint32_t dwFlags,const CFX_PointF & point)87 bool CXFA_FFSignature::OnRButtonDblClk(uint32_t dwFlags,
88                                        const CFX_PointF& point) {
89   return false;
90 }
91 
OnKeyDown(uint32_t dwKeyCode,uint32_t dwFlags)92 bool CXFA_FFSignature::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) {
93   return false;
94 }
95 
OnKeyUp(uint32_t dwKeyCode,uint32_t dwFlags)96 bool CXFA_FFSignature::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) {
97   return false;
98 }
99 
OnChar(uint32_t dwChar,uint32_t dwFlags)100 bool CXFA_FFSignature::OnChar(uint32_t dwChar, uint32_t dwFlags) {
101   return false;
102 }
103 
HitTest(const CFX_PointF & point)104 FWL_WidgetHit CXFA_FFSignature::HitTest(const CFX_PointF& point) {
105   auto* pNorm = GetNormalWidget();
106   if (pNorm && pNorm->HitTest(FWLToClient(point)) != FWL_WidgetHit::Unknown)
107     return FWL_WidgetHit::Client;
108   if (!GetRectWithoutRotate().Contains(point))
109     return FWL_WidgetHit::Unknown;
110   if (m_rtCaption.Contains(point))
111     return FWL_WidgetHit::Titlebar;
112   return FWL_WidgetHit::Client;
113 }
114 
OnSetCursor(const CFX_PointF & point)115 bool CXFA_FFSignature::OnSetCursor(const CFX_PointF& point) {
116   return false;
117 }
118 
GetFormFieldType()119 FormFieldType CXFA_FFSignature::GetFormFieldType() {
120   return FormFieldType::kXFA_Signature;
121 }
122