OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../include/formfiller/FFL_FormFiller.h" | 7 #include "../../include/formfiller/FFL_FormFiller.h" |
8 #include "../../include/formfiller/FFL_IFormFiller.h" | 8 #include "../../include/formfiller/FFL_IFormFiller.h" |
9 #include "../../include/formfiller/FFL_CheckBox.h" | 9 #include "../../include/formfiller/FFL_CheckBox.h" |
10 #include "../../include/formfiller/FFL_ComboBox.h" | 10 #include "../../include/formfiller/FFL_ComboBox.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 ASSERT(pPageView != NULL); | 74 ASSERT(pPageView != NULL); |
75 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 75 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
76 | 76 |
77 if (IsVisible(pWidget)) | 77 if (IsVisible(pWidget)) |
78 { | 78 { |
79 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 79 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
80 { | 80 { |
81 if (pFormFiller->IsValid()) | 81 if (pFormFiller->IsValid()) |
82 { | 82 { |
83 pFormFiller->OnDraw(pPageView, pAnnot, pDevice,
pUser2Device, dwFlags); | 83 pFormFiller->OnDraw(pPageView, pAnnot, pDevice,
pUser2Device, dwFlags); |
84 | |
85 pAnnot->GetPDFPage(); | 84 pAnnot->GetPDFPage(); |
86 | 85 |
87 | 86 » » » » CPDFSDK_Document* pDocument = m_pApp->GetSDKDocu
ment(); |
88 » » » » CPDFSDK_Document* pDocument = m_pApp->GetCurrent
Doc(); | |
89 » » » » ASSERT(pDocument != NULL); | |
90 | |
91 if (pDocument->GetFocusAnnot() == pAnnot) | 87 if (pDocument->GetFocusAnnot() == pAnnot) |
92 { | 88 { |
93 CPDF_Rect rcFocus = pFormFiller->GetFocu
sBox(pPageView); | 89 CPDF_Rect rcFocus = pFormFiller->GetFocu
sBox(pPageView); |
94 if (!rcFocus.IsEmpty()) | 90 if (!rcFocus.IsEmpty()) |
95 { | 91 { |
96 CFX_PathData path; | 92 CFX_PathData path; |
97 | |
98 path.SetPointCount(5); | 93 path.SetPointCount(5); |
99 path.SetPoint(0, rcFocus.left,
rcFocus.top, FXPT_MOVETO); | 94 path.SetPoint(0, rcFocus.left,
rcFocus.top, FXPT_MOVETO); |
100 path.SetPoint(1, rcFocus.left,
rcFocus.bottom, FXPT_LINETO); | 95 path.SetPoint(1, rcFocus.left,
rcFocus.bottom, FXPT_LINETO); |
101 path.SetPoint(2, rcFocus.right,
rcFocus.bottom, FXPT_LINETO); | 96 path.SetPoint(2, rcFocus.right,
rcFocus.bottom, FXPT_LINETO); |
102 path.SetPoint(3, rcFocus.right,
rcFocus.top, FXPT_LINETO); | 97 path.SetPoint(3, rcFocus.right,
rcFocus.top, FXPT_LINETO); |
103 path.SetPoint(4, rcFocus.left,
rcFocus.top, FXPT_LINETO); | 98 path.SetPoint(4, rcFocus.left,
rcFocus.top, FXPT_LINETO); |
104 | 99 |
105 CFX_GraphStateData gsd; | 100 CFX_GraphStateData gsd; |
106 gsd.SetDashCount(1); | 101 gsd.SetDashCount(1); |
107 gsd.m_DashArray[0] = 1.0f; | 102 gsd.m_DashArray[0] = 1.0f; |
108 gsd.m_DashPhase = 0; | 103 gsd.m_DashPhase = 0; |
109 | |
110 gsd.m_LineWidth = 1.0f; | 104 gsd.m_LineWidth = 1.0f; |
111 pDevice->DrawPath(&path, pUser2D
evice, &gsd, 0, ArgbEncode(255,0,0,0), FXFILL_ALTERNATE); | 105 pDevice->DrawPath(&path, pUser2D
evice, &gsd, 0, ArgbEncode(255,0,0,0), FXFILL_ALTERNATE); |
112 | |
113 // ::DrawFocusRect(hDC, &rcFocus); | |
114 } | 106 } |
115 } | 107 } |
116 | |
117 return; | 108 return; |
118 } | 109 } |
119 } | 110 } |
120 | 111 |
121 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 112 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
122 pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice,
pUser2Device, dwFlags); | 113 pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice,
pUser2Device, dwFlags); |
123 else | 114 else |
124 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Anno
t::Normal, NULL); | 115 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Anno
t::Normal, NULL); |
125 | 116 |
126 if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget)) | 117 if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget)) |
127 { | |
128 pWidget->DrawShadow(pDevice, pPageView); | 118 pWidget->DrawShadow(pDevice, pPageView); |
129 } | |
130 | |
131 } | 119 } |
132 } | 120 } |
133 | 121 |
134 void CFFL_IFormFiller::OnCreate(CPDFSDK_Annot* pAnnot) | 122 void CFFL_IFormFiller::OnCreate(CPDFSDK_Annot* pAnnot) |
135 { | 123 { |
136 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 124 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
137 { | 125 { |
138 pFormFiller->OnCreate(pAnnot); | 126 pFormFiller->OnCreate(pAnnot); |
139 } | 127 } |
140 } | 128 } |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 273 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
286 { | 274 { |
287 return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, poi
nt); | 275 return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, poi
nt); |
288 } | 276 } |
289 | 277 |
290 return FALSE; | 278 return FALSE; |
291 } | 279 } |
292 | 280 |
293 FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 281 FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
294 { | 282 { |
295 ASSERT(pAnnot != NULL); | |
296 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 283 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
297 | |
298 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 284 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
299 » // » CReader_Page* pPage = pAnnot->GetPage(); | 285 » CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); |
300 » // » ASSERT(pPage != NULL); | |
301 » CPDFSDK_Document* pDocument = m_pApp->GetCurrentDoc(); | |
302 » ASSERT(pDocument != NULL); | |
303 | 286 |
304 switch (pWidget->GetFieldType()) | 287 switch (pWidget->GetFieldType()) |
305 { | 288 { |
306 case FIELDTYPE_PUSHBUTTON: | 289 case FIELDTYPE_PUSHBUTTON: |
307 case FIELDTYPE_CHECKBOX: | 290 case FIELDTYPE_CHECKBOX: |
308 case FIELDTYPE_RADIOBUTTON: | 291 case FIELDTYPE_RADIOBUTTON: |
309 if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)p
oint.y)) | 292 if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)p
oint.y)) |
310 { | |
311 pDocument->SetFocusAnnot(pAnnot); | 293 pDocument->SetFocusAnnot(pAnnot); |
312 } | |
313 break; | 294 break; |
314 default: | 295 default: |
315 pDocument->SetFocusAnnot(pAnnot); | 296 pDocument->SetFocusAnnot(pAnnot); |
316 break; | 297 break; |
317 } | 298 } |
318 | 299 |
319 FX_BOOL bRet = FALSE; | 300 FX_BOOL bRet = FALSE; |
320 | 301 |
321 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 302 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
322 { | 303 { |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 ASSERT(pPrivateData != NULL); | 967 ASSERT(pPrivateData != NULL); |
987 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 968 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
988 ASSERT(pData->pWidget != NULL); | 969 ASSERT(pData->pWidget != NULL); |
989 | 970 |
990 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); | 971 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); |
991 ASSERT(pFormFiller != NULL); | 972 ASSERT(pFormFiller != NULL); |
992 | 973 |
993 if (!bEditOrList) | 974 if (!bEditOrList) |
994 pFormFiller->OnKeyStroke(bExit); | 975 pFormFiller->OnKeyStroke(bExit); |
995 } | 976 } |
OLD | NEW |