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