• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/src/foxitlib.h"
8 #include "xfa/src/fxfa/src/common/xfa_common.h"
9 #include "xfa_ffwidget.h"
10 #include "xfa_fffield.h"
11 #include "xfa_ffpageview.h"
12 #include "xfa_ffsignature.h"
13 #include "xfa_ffdoc.h"
CXFA_FFSignature(CXFA_FFPageView * pPageView,CXFA_WidgetAcc * pDataAcc)14 CXFA_FFSignature::CXFA_FFSignature(CXFA_FFPageView* pPageView,
15                                    CXFA_WidgetAcc* pDataAcc)
16     : CXFA_FFField(pPageView, pDataAcc) {}
~CXFA_FFSignature()17 CXFA_FFSignature::~CXFA_FFSignature() {}
LoadWidget()18 FX_BOOL CXFA_FFSignature::LoadWidget() {
19   return CXFA_FFField::LoadWidget();
20 }
RenderWidget(CFX_Graphics * pGS,CFX_Matrix * pMatrix,FX_DWORD dwStatus,int32_t iRotate)21 void CXFA_FFSignature::RenderWidget(CFX_Graphics* pGS,
22                                     CFX_Matrix* pMatrix,
23                                     FX_DWORD dwStatus,
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 }
OnMouseEnter()43 FX_BOOL CXFA_FFSignature::OnMouseEnter() {
44   return FALSE;
45 }
OnMouseExit()46 FX_BOOL CXFA_FFSignature::OnMouseExit() {
47   return FALSE;
48 }
OnLButtonDown(FX_DWORD dwFlags,FX_FLOAT fx,FX_FLOAT fy)49 FX_BOOL CXFA_FFSignature::OnLButtonDown(FX_DWORD dwFlags,
50                                         FX_FLOAT fx,
51                                         FX_FLOAT fy) {
52   return FALSE;
53 }
OnLButtonUp(FX_DWORD dwFlags,FX_FLOAT fx,FX_FLOAT fy)54 FX_BOOL CXFA_FFSignature::OnLButtonUp(FX_DWORD dwFlags,
55                                       FX_FLOAT fx,
56                                       FX_FLOAT fy) {
57   return FALSE;
58 }
OnLButtonDblClk(FX_DWORD dwFlags,FX_FLOAT fx,FX_FLOAT fy)59 FX_BOOL CXFA_FFSignature::OnLButtonDblClk(FX_DWORD dwFlags,
60                                           FX_FLOAT fx,
61                                           FX_FLOAT fy) {
62   return FALSE;
63 }
OnMouseMove(FX_DWORD dwFlags,FX_FLOAT fx,FX_FLOAT fy)64 FX_BOOL CXFA_FFSignature::OnMouseMove(FX_DWORD dwFlags,
65                                       FX_FLOAT fx,
66                                       FX_FLOAT fy) {
67   return FALSE;
68 }
OnMouseWheel(FX_DWORD dwFlags,int16_t zDelta,FX_FLOAT fx,FX_FLOAT fy)69 FX_BOOL CXFA_FFSignature::OnMouseWheel(FX_DWORD dwFlags,
70                                        int16_t zDelta,
71                                        FX_FLOAT fx,
72                                        FX_FLOAT fy) {
73   return FALSE;
74 }
OnRButtonDown(FX_DWORD dwFlags,FX_FLOAT fx,FX_FLOAT fy)75 FX_BOOL CXFA_FFSignature::OnRButtonDown(FX_DWORD dwFlags,
76                                         FX_FLOAT fx,
77                                         FX_FLOAT fy) {
78   return FALSE;
79 }
OnRButtonUp(FX_DWORD dwFlags,FX_FLOAT fx,FX_FLOAT fy)80 FX_BOOL CXFA_FFSignature::OnRButtonUp(FX_DWORD dwFlags,
81                                       FX_FLOAT fx,
82                                       FX_FLOAT fy) {
83   return FALSE;
84 }
OnRButtonDblClk(FX_DWORD dwFlags,FX_FLOAT fx,FX_FLOAT fy)85 FX_BOOL CXFA_FFSignature::OnRButtonDblClk(FX_DWORD dwFlags,
86                                           FX_FLOAT fx,
87                                           FX_FLOAT fy) {
88   return FALSE;
89 }
OnKeyDown(FX_DWORD dwKeyCode,FX_DWORD dwFlags)90 FX_BOOL CXFA_FFSignature::OnKeyDown(FX_DWORD dwKeyCode, FX_DWORD dwFlags) {
91   return FALSE;
92 }
OnKeyUp(FX_DWORD dwKeyCode,FX_DWORD dwFlags)93 FX_BOOL CXFA_FFSignature::OnKeyUp(FX_DWORD dwKeyCode, FX_DWORD dwFlags) {
94   return FALSE;
95 }
OnChar(FX_DWORD dwChar,FX_DWORD dwFlags)96 FX_BOOL CXFA_FFSignature::OnChar(FX_DWORD dwChar, FX_DWORD dwFlags) {
97   return FALSE;
98 }
OnHitTest(FX_FLOAT fx,FX_FLOAT fy)99 FX_DWORD CXFA_FFSignature::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) {
100   if (m_pNormalWidget) {
101     FX_FLOAT ffx = fx, ffy = fy;
102     FWLToClient(ffx, ffy);
103     FX_DWORD dwWidgetHit = m_pNormalWidget->HitTest(ffx, ffy);
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 }
OnSetCursor(FX_FLOAT fx,FX_FLOAT fy)118 FX_BOOL CXFA_FFSignature::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) {
119   return FALSE;
120 }
121