Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: fpdfsdk/src/formfiller/FFL_IFormFiller.cpp

Issue 1239313005: Merge to XFA - else after returns. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "../../include/formfiller/FFL_ListBox.h" 11 #include "../../include/formfiller/FFL_ListBox.h"
12 #include "../../include/formfiller/FFL_PushButton.h" 12 #include "../../include/formfiller/FFL_PushButton.h"
13 #include "../../include/formfiller/FFL_RadioButton.h" 13 #include "../../include/formfiller/FFL_RadioButton.h"
14 #include "../../include/formfiller/FFL_TextField.h" 14 #include "../../include/formfiller/FFL_TextField.h"
15 15
16 #define FFL_MAXLISTBOXHEIGHT» » 140.0f 16 #define FFL_MAXLISTBOXHEIGHT 140.0f
17 17
18 // HHOOK CFFL_IFormFiller::m_hookSheet = NULL; 18 // HHOOK CFFL_IFormFiller::m_hookSheet = NULL;
19 // MSG CFFL_IFormFiller::g_Msg; 19 // MSG CFFL_IFormFiller::g_Msg;
20 20
21 /* ----------------------------- CFFL_IFormFiller ----------------------------- */ 21 /* ----------------------------- CFFL_IFormFiller ----------------------------- */
22 22
23 CFFL_IFormFiller::CFFL_IFormFiller(CPDFDoc_Environment* pApp) : 23 CFFL_IFormFiller::CFFL_IFormFiller(CPDFDoc_Environment* pApp) :
24 » m_pApp(pApp), 24 m_pApp(pApp),
25 » m_bNotifying(FALSE) 25 m_bNotifying(FALSE)
26 { 26 {
27 } 27 }
28 28
29 CFFL_IFormFiller::~CFFL_IFormFiller() 29 CFFL_IFormFiller::~CFFL_IFormFiller()
30 { 30 {
31 for (auto& it : m_Maps) 31 for (auto& it : m_Maps)
32 delete it.second; 32 delete it.second;
33 m_Maps.clear(); 33 m_Maps.clear();
34 } 34 }
35 35
36 FX_BOOL»CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView,CPDFSDK_Anno t* pAnnot, CPDF_Point point) 36 FX_BOOL CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView,CPDFSDK_Anno t* pAnnot, CPDF_Point point)
37 { 37 {
38 » CPDF_Rect rc = pAnnot->GetRect(); 38 CPDF_Rect rc = pAnnot->GetRect();
39 » if(rc.Contains(point.x, point.y)) 39 if(rc.Contains(point.x, point.y))
40 » » return TRUE; 40 return TRUE;
41 » return FALSE; 41 return FALSE;
42 } 42 }
43 43
44 FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot * pAnnot) 44 FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot * pAnnot)
45 { 45 {
46 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 46 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
47 » { 47 return pFormFiller->GetViewBBox(pPageView, pAnnot);
48 » » return pFormFiller->GetViewBBox(pPageView, pAnnot); 48
49 » } 49 ASSERT(pPageView != NULL);
50 » else 50
51 » { 51 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
52 » » ASSERT(pPageView != NULL); 52 CPDF_Rect rcAnnot;
53 » » ASSERT(pAnnot != NULL); 53 pPDFAnnot->GetRect(rcAnnot);
54 54
55 » » CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); 55 CPDF_Rect rcWin = CPWL_Utils::InflateRect(rcAnnot, 1);
56 » » ASSERT(pPDFAnnot != NULL); 56 return rcWin.GetOutterRect();
57
58 » » CPDF_Rect rcAnnot;
59 » » pPDFAnnot->GetRect(rcAnnot);
60
61 // » » CRect rcWin;
62 // » » pPageView->DocToWindow(rcAnnot, rcWin);
63 » » CPDF_Rect rcWin = CPWL_Utils::InflateRect(rcAnnot,1);
64 //» » rcWin.InflateRect(1, 1);
65
66 » » return rcWin.GetOutterRect();
67 » }
68 } 57 }
69 58
70 void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_ Annot* pAnnot, 59 void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_ Annot* pAnnot,
71 » » » » » » CFX_RenderDevice* pDevice, CPDF_ Matrix* pUser2Device, 60 CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
72 » » » » » » /*const CRect& rcWindow,*/ FX_DW ORD dwFlags) 61 /*const CRect& rcWindow,*/ FX_DWORD dwFlags)
73 { 62 {
74 » ASSERT(pPageView != NULL); 63 ASSERT(pPageView != NULL);
75 » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 64 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
76 65
77 » if (IsVisible(pWidget)) 66 if (IsVisible(pWidget))
78 » { 67 {
79 » » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 68 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
80 » » { 69 {
81 » » » if (pFormFiller->IsValid()) 70 if (pFormFiller->IsValid())
82 » » » { 71 {
83 » » » » pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); 72 pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dw Flags);
84 » » » » pAnnot->GetPDFPage(); 73 pAnnot->GetPDFPage();
85 74
86 » » » » CPDFSDK_Document* pDocument = m_pApp->GetSDKDocu ment(); 75 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument();
87 » » » » if (pDocument->GetFocusAnnot() == pAnnot) 76 if (pDocument->GetFocusAnnot() == pAnnot)
88 » » » » { 77 {
89 » » » » » CPDF_Rect rcFocus = pFormFiller->GetFocu sBox(pPageView); 78 CPDF_Rect rcFocus = pFormFiller->GetFocusBox(pPageView);
90 » » » » » if (!rcFocus.IsEmpty()) 79 if (!rcFocus.IsEmpty())
91 » » » » » { 80 {
92 » » » » » » CFX_PathData path; 81 CFX_PathData path;
93 » » » » » » path.SetPointCount(5); 82 path.SetPointCount(5);
94 » » » » » » path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO); 83 path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO );
95 » » » » » » path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LINETO); 84 path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LIN ETO);
96 » » » » » » path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LINETO); 85 path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LI NETO);
97 » » » » » » path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINETO); 86 path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINET O);
98 » » » » » » path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO); 87 path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO );
99 88
100 » » » » » » CFX_GraphStateData gsd; 89 CFX_GraphStateData gsd;
101 » » » » » » gsd.SetDashCount(1); 90 gsd.SetDashCount(1);
102 » » » » » » gsd.m_DashArray[0] = 1.0f; 91 gsd.m_DashArray[0] = 1.0f;
103 » » » » » » gsd.m_DashPhase = 0; 92 gsd.m_DashPhase = 0;
104 » » » » » » gsd.m_LineWidth = 1.0f; 93 gsd.m_LineWidth = 1.0f;
105 » » » » » » pDevice->DrawPath(&path, pUser2D evice, &gsd, 0, ArgbEncode(255,0,0,0), FXFILL_ALTERNATE); 94 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEnco de(255,0,0,0), FXFILL_ALTERNATE);
106 » » » » » } 95 }
107 » » » » } 96 }
108 » » » » return; 97 return;
109 » » » } 98 }
110 » » } 99 }
111 100
112 » » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 101 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
113 » » » pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); 102 pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device , dwFlags);
114 » » else 103 else
115 » » » pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Anno t::Normal, NULL); 104 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, N ULL);
116 105
117 » » if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget)) 106 if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget))
118 » » » pWidget->DrawShadow(pDevice, pPageView); 107 pWidget->DrawShadow(pDevice, pPageView);
119 » } 108 }
120 } 109 }
121 110
122 void CFFL_IFormFiller::OnCreate(CPDFSDK_Annot* pAnnot) 111 void CFFL_IFormFiller::OnCreate(CPDFSDK_Annot* pAnnot)
123 { 112 {
124 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 113 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
125 » { 114 {
126 » » pFormFiller->OnCreate(pAnnot); 115 pFormFiller->OnCreate(pAnnot);
127 » } 116 }
128 } 117 }
129 118
130 void CFFL_IFormFiller::OnLoad(CPDFSDK_Annot* pAnnot) 119 void CFFL_IFormFiller::OnLoad(CPDFSDK_Annot* pAnnot)
131 { 120 {
132 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 121 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
133 » { 122 {
134 » » pFormFiller->OnLoad(pAnnot); 123 pFormFiller->OnLoad(pAnnot);
135 » } 124 }
136 } 125 }
137 126
138 void CFFL_IFormFiller::OnDelete(CPDFSDK_Annot* pAnnot) 127 void CFFL_IFormFiller::OnDelete(CPDFSDK_Annot* pAnnot)
139 { 128 {
140 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 129 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
141 » { 130 {
142 » » pFormFiller->OnDelete(pAnnot); 131 pFormFiller->OnDelete(pAnnot);
143 » } 132 }
144 133
145 » UnRegisterFormFiller(pAnnot); 134 UnRegisterFormFiller(pAnnot);
146 } 135 }
147 136
148 void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag) 137 void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag)
149 { 138 {
150 » ASSERT(pAnnot != NULL); 139 ASSERT(pAnnot != NULL);
151 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 140 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
152 141
153 » if (!m_bNotifying) 142 if (!m_bNotifying)
154 » { 143 {
155 » » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 144 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
156 » » if (pWidget->GetAAction(CPDF_AAction::CursorEnter)) 145 if (pWidget->GetAAction(CPDF_AAction::CursorEnter))
157 » » { 146 {
158 » » » m_bNotifying = TRUE; 147 m_bNotifying = TRUE;
159 148
160 » » » int nValueAge = pWidget->GetValueAge(); 149 int nValueAge = pWidget->GetValueAge();
161 150
162 » » » pWidget->ClearAppModified(); 151 pWidget->ClearAppModified();
163 152
164 » » » ASSERT(pPageView != NULL); 153 ASSERT(pPageView != NULL);
165 154
166 155
167 156
168 » » » PDFSDK_FieldAction fa; 157 PDFSDK_FieldAction fa;
169 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); 158 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
170 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); 159 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
171 » » » pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageV iew ); 160 pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView );
172 » » » m_bNotifying = FALSE; 161 m_bNotifying = FALSE;
173 162
174 » » » //if ( !IsValidAnnot(pPageView, pAnnot) ) return; 163 //if ( !IsValidAnnot(pPageView, pAnnot) ) return;
175 164
176 » » » if (pWidget->IsAppModified()) 165 if (pWidget->IsAppModified())
177 » » » { 166 {
178 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller (pWidget, FALSE)) 167 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE) )
179 » » » » { 168 {
180 » » » » » pFormFiller->ResetPDFWindow(pPageView, p Widget->GetValueAge() == nValueAge); 169 pFormFiller->ResetPDFWindow(pPageView, pWidget->GetValueAge( ) == nValueAge);
181 » » » » } 170 }
182 » » » } 171 }
183 » » } 172 }
184 » } 173 }
185 174
186 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) 175 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE))
187 » { 176 {
188 » » pFormFiller->OnMouseEnter(pPageView, pAnnot); 177 pFormFiller->OnMouseEnter(pPageView, pAnnot);
189 » } 178 }
190 } 179 }
191 180
192 void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* p Annot, FX_UINT nFlag) 181 void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* p Annot, FX_UINT nFlag)
193 { 182 {
194 » ASSERT(pAnnot != NULL); 183 ASSERT(pAnnot != NULL);
195 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 184 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
196 185
197 » if (!m_bNotifying) 186 if (!m_bNotifying)
198 » { 187 {
199 » » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 188 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
200 » » if (pWidget->GetAAction(CPDF_AAction::CursorExit)) 189 if (pWidget->GetAAction(CPDF_AAction::CursorExit))
201 » » { 190 {
202 » » » m_bNotifying = TRUE; 191 m_bNotifying = TRUE;
203 » » » pWidget->GetAppearanceAge(); 192 pWidget->GetAppearanceAge();
204 » » » int nValueAge = pWidget->GetValueAge(); 193 int nValueAge = pWidget->GetValueAge();
205 » » » pWidget->ClearAppModified(); 194 pWidget->ClearAppModified();
206 195
207 » » » ASSERT(pPageView != NULL); 196 ASSERT(pPageView != NULL);
208 197
209 198
210 199
211 » » » PDFSDK_FieldAction fa; 200 PDFSDK_FieldAction fa;
212 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); 201 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
213 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); 202 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
214 203
215 » » » pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageVi ew); 204 pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView);
216 » » » m_bNotifying = FALSE; 205 m_bNotifying = FALSE;
217 206
218 » » » //if (!IsValidAnnot(pPageView, pAnnot)) return; 207 //if (!IsValidAnnot(pPageView, pAnnot)) return;
219 208
220 » » » if (pWidget->IsAppModified()) 209 if (pWidget->IsAppModified())
221 » » » { 210 {
222 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller (pWidget, FALSE)) 211 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE) )
223 » » » » { 212 {
224 » » » » » pFormFiller->ResetPDFWindow(pPageView, n ValueAge == pWidget->GetValueAge()); 213 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget- >GetValueAge());
225 » » » » } 214 }
226 » » » } 215 }
227 » » } 216 }
228 » } 217 }
229 218
230 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 219 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
231 » { 220 {
232 » » pFormFiller->OnMouseExit(pPageView, pAnnot); 221 pFormFiller->OnMouseExit(pPageView, pAnnot);
233 » } 222 }
234 } 223 }
235 224
236 FX_BOOL»CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann ot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) 225 FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann ot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
237 { 226 {
238 » ASSERT(pAnnot != NULL); 227 ASSERT(pAnnot != NULL);
239 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 228 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
240 229
241 » if (!m_bNotifying) 230 if (!m_bNotifying)
242 » { 231 {
243 » » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 232 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
244 » » if (Annot_HitTest(pPageView, pAnnot, point) && pWidget->GetAActi on(CPDF_AAction::ButtonDown)) 233 if (Annot_HitTest(pPageView, pAnnot, point) && pWidget->GetAAction(CPDF_ AAction::ButtonDown))
245 » » { 234 {
246 » » » m_bNotifying = TRUE; 235 m_bNotifying = TRUE;
247 » » » pWidget->GetAppearanceAge(); 236 pWidget->GetAppearanceAge();
248 » » » int nValueAge = pWidget->GetValueAge(); 237 int nValueAge = pWidget->GetValueAge();
249 » » » pWidget->ClearAppModified(); 238 pWidget->ClearAppModified();
250 239
251 » » » ASSERT(pPageView != NULL); 240 ASSERT(pPageView != NULL);
252 241
253 242
254 243
255 » » » PDFSDK_FieldAction fa; 244 PDFSDK_FieldAction fa;
256 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags); 245 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags);
257 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlags); 246 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlags);
258 » » » pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageVi ew); 247 pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView);
259 » » » m_bNotifying = FALSE; 248 m_bNotifying = FALSE;
260 249
261 » » » if (!IsValidAnnot(pPageView, pAnnot)) return TRUE; 250 if (!IsValidAnnot(pPageView, pAnnot)) return TRUE;
262 251
263 » » » if (pWidget->IsAppModified()) 252 if (pWidget->IsAppModified())
264 » » » { 253 {
265 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller (pWidget, FALSE)) 254 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE) )
266 » » » » { 255 {
267 » » » » » pFormFiller->ResetPDFWindow(pPageView, n ValueAge == pWidget->GetValueAge()); 256 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget- >GetValueAge());
268 » » » » } 257 }
269 » » » } 258 }
270 » » } 259 }
271 » } 260 }
272 261
273 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 262 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
274 » { 263 {
275 » » return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, poi nt); 264 return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point);
276 » } 265 }
277 266
278 » return FALSE; 267 return FALSE;
279 } 268 }
280 269
281 FX_BOOL»CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot * pAnnot, FX_UINT nFlags, const CPDF_Point& point) 270 FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot * pAnnot, FX_UINT nFlags, const CPDF_Point& point)
282 { 271 {
283 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 272 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
284 » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 273 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
285 » CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); 274 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument();
286 275
287 » switch (pWidget->GetFieldType()) 276 switch (pWidget->GetFieldType())
288 » { 277 {
289 » case FIELDTYPE_PUSHBUTTON: 278 case FIELDTYPE_PUSHBUTTON:
290 » case FIELDTYPE_CHECKBOX: 279 case FIELDTYPE_CHECKBOX:
291 » case FIELDTYPE_RADIOBUTTON: 280 case FIELDTYPE_RADIOBUTTON:
292 » » if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)p oint.y)) 281 if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)point.y))
293 » » » pDocument->SetFocusAnnot(pAnnot); 282 pDocument->SetFocusAnnot(pAnnot);
294 » » break; 283 break;
295 » default: 284 default:
296 » » pDocument->SetFocusAnnot(pAnnot); 285 pDocument->SetFocusAnnot(pAnnot);
297 » » break; 286 break;
298 » } 287 }
299 288
300 » FX_BOOL bRet = FALSE; 289 FX_BOOL bRet = FALSE;
301 290
302 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 291 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
303 » { 292 {
304 » » bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point ); 293 bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point);
305 » } 294 }
306 295
307 » if (pDocument->GetFocusAnnot() == pAnnot) 296 if (pDocument->GetFocusAnnot() == pAnnot)
308 » { 297 {
309 » » FX_BOOL bExit = FALSE; 298 FX_BOOL bExit = FALSE;
310 » » FX_BOOL bReset = FALSE; 299 FX_BOOL bReset = FALSE;
311 » » OnButtonUp(pWidget, pPageView, bReset, bExit,nFlags); 300 OnButtonUp(pWidget, pPageView, bReset, bExit,nFlags);
312 » » if (bExit) return TRUE; 301 if (bExit) return TRUE;
313 302
314 » » OnClick(pWidget, pPageView, bReset, bExit, nFlags); 303 OnClick(pWidget, pPageView, bReset, bExit, nFlags);
315 » » if (bExit) return TRUE; 304 if (bExit) return TRUE;
316 » } 305 }
317 » return bRet; 306 return bRet;
318 } 307 }
319 308
320 void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa geView, FX_BOOL& bReset, FX_BOOL& bExit,FX_UINT nFlag) 309 void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa geView, FX_BOOL& bReset, FX_BOOL& bExit,FX_UINT nFlag)
321 { 310 {
322 » ASSERT(pWidget != NULL); 311 ASSERT(pWidget != NULL);
323 312
324 » if (!m_bNotifying) 313 if (!m_bNotifying)
325 » { 314 {
326 » » if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) 315 if (pWidget->GetAAction(CPDF_AAction::ButtonUp))
327 » » { 316 {
328 » » » m_bNotifying = TRUE; 317 m_bNotifying = TRUE;
329 » » » int nAge = pWidget->GetAppearanceAge(); 318 int nAge = pWidget->GetAppearanceAge();
330 » » » int nValueAge = pWidget->GetValueAge(); 319 int nValueAge = pWidget->GetValueAge();
331 320
332 » » » ASSERT(pPageView != NULL); 321 ASSERT(pPageView != NULL);
333 // » » » CReader_DocView* pDocView = pPageView->GetDocView(); 322 // CReader_DocView* pDocView = pPageView->GetDocView();
334 // » » » ASSERT(pDocView != NULL); 323 // ASSERT(pDocView != NULL);
335 324
336 325
337 326
338 » » » PDFSDK_FieldAction fa; 327 PDFSDK_FieldAction fa;
339 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); 328 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
340 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); 329 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
341 330
342 » » » pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView ); 331 pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView);
343 » » » m_bNotifying = FALSE; 332 m_bNotifying = FALSE;
344 333
345 » » » if (!IsValidAnnot(pPageView, pWidget)) 334 if (!IsValidAnnot(pPageView, pWidget))
346 » » » { 335 {
347 » » » » bExit = TRUE; 336 bExit = TRUE;
348 » » » » return; 337 return;
349 » » » } 338 }
350 339
351 » » » if (nAge != pWidget->GetAppearanceAge()) 340 if (nAge != pWidget->GetAppearanceAge())
352 » » » { 341 {
353 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller (pWidget, FALSE)) 342 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE) )
354 » » » » { 343 {
355 » » » » » pFormFiller->ResetPDFWindow(pPageView, n ValueAge == pWidget->GetValueAge()); 344 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget- >GetValueAge());
356 » » » » } 345 }
357 346
358 » » » » bReset = TRUE; 347 bReset = TRUE;
359 » » » } 348 }
360 » » } 349 }
361 » } 350 }
362 } 351 }
363 352
364 FX_BOOL»CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_A nnot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) 353 FX_BOOL CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_A nnot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
365 { 354 {
366 » ASSERT(pAnnot != NULL); 355 ASSERT(pAnnot != NULL);
367 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 356 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
368 357
369 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 358 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
370 » { 359 {
371 » » return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, p oint); 360 return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point);
372 » } 361 }
373 362
374 » return FALSE; 363 return FALSE;
375 } 364 }
376 365
377 FX_BOOL»CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot * pAnnot, FX_UINT nFlags, const CPDF_Point& point) 366 FX_BOOL CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot * pAnnot, FX_UINT nFlags, const CPDF_Point& point)
378 { 367 {
379 » ASSERT(pAnnot != NULL); 368 ASSERT(pAnnot != NULL);
380 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 369 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
381 370
382 » //change cursor 371 //change cursor
383 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) 372 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE))
384 » { 373 {
385 » » return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point ); 374 return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point);
386 » } 375 }
387 376
388 » return FALSE; 377 return FALSE;
389 } 378 }
390 379
391 FX_BOOL»CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Anno t* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point) 380 FX_BOOL CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Anno t* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point)
392 { 381 {
393 » ASSERT(pAnnot != NULL); 382 ASSERT(pAnnot != NULL);
394 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 383 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
395 384
396 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 385 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
397 » { 386 {
398 » » return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDel ta, point); 387 return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, poin t);
399 » } 388 }
400 389
401 » return FALSE; 390 return FALSE;
402 } 391 }
403 392
404 FX_BOOL»CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann ot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) 393 FX_BOOL CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann ot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
405 { 394 {
406 » ASSERT(pAnnot != NULL); 395 ASSERT(pAnnot != NULL);
407 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 396 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
408 397
409 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 398 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
410 » { 399 {
411 » » return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, poi nt); 400 return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point);
412 » } 401 }
413 402
414 » return FALSE; 403 return FALSE;
415 } 404 }
416 405
417 FX_BOOL»CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot * pAnnot, FX_UINT nFlags, const CPDF_Point& point) 406 FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot * pAnnot, FX_UINT nFlags, const CPDF_Point& point)
418 { 407 {
419 » ASSERT(pAnnot != NULL); 408 ASSERT(pAnnot != NULL);
420 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 409 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
421 410
422 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 411 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
423 » { 412 {
424 » » return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point ); 413 return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point);
425 » } 414 }
426 415
427 » return FALSE; 416 return FALSE;
428 } 417 }
429 418
430 FX_BOOL»CFFL_IFormFiller::OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_A nnot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) 419 FX_BOOL CFFL_IFormFiller::OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_A nnot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
431 { 420 {
432 » ASSERT(pAnnot != NULL); 421 ASSERT(pAnnot != NULL);
433 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 422 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
434 423
435 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 424 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
436 » { 425 {
437 » » return pFormFiller->OnRButtonDblClk(pPageView, pAnnot, nFlags, p oint); 426 return pFormFiller->OnRButtonDblClk(pPageView, pAnnot, nFlags, point);
438 » } 427 }
439 428
440 » return FALSE; 429 return FALSE;
441 } 430 }
442 431
443 FX_BOOL»CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_ UINT nFlags) 432 FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_ UINT nFlags)
444 { 433 {
445 » ASSERT(pAnnot != NULL); 434 ASSERT(pAnnot != NULL);
446 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 435 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
447 436
448 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 437 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
449 » { 438 {
450 » » return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); 439 return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags);
451 » } 440 }
452 441
453 » return FALSE; 442 return FALSE;
454 } 443 }
455 444
456 FX_BOOL»CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT n Flags) 445 FX_BOOL CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT n Flags)
457 { 446 {
458 » ASSERT(pAnnot != NULL); 447 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
459 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 448 if (nChar == FWL_VKEY_Tab)
460 449 return TRUE;
461 » if (nChar == FWL_VKEY_Tab) return TRUE; 450
462 451 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
463 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 452 return pFormFiller->OnChar(pAnnot, nChar, nFlags);
464 » { 453
465 » » return pFormFiller->OnChar(pAnnot, nChar, nFlags); 454 return FALSE;
466 » }
467
468 » return FALSE;
469 } 455 }
470 456
471 void CFFL_IFormFiller::OnDeSelected(CPDFSDK_Annot* pAnnot) 457 void CFFL_IFormFiller::OnDeSelected(CPDFSDK_Annot* pAnnot)
472 { 458 {
473 ASSERT(pAnnot != NULL); 459 ASSERT(pAnnot != NULL);
474 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 460 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
475 461
476 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 462 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
477 { 463 {
478 pFormFiller->OnDeSelected(pAnnot); 464 pFormFiller->OnDeSelected(pAnnot);
479 } 465 }
480 } 466 }
481 467
482 void CFFL_IFormFiller::OnSelected(CPDFSDK_Annot* pAnnot) 468 void CFFL_IFormFiller::OnSelected(CPDFSDK_Annot* pAnnot)
483 { 469 {
484 ASSERT(pAnnot != NULL); 470 ASSERT(pAnnot != NULL);
485 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 471 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
486 472
487 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 473 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
488 { 474 {
489 pFormFiller->OnSelected(pAnnot); 475 pFormFiller->OnSelected(pAnnot);
490 } 476 }
491 } 477 }
492 478
493 FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) 479 FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag)
494 { 480 {
495 » if(!pAnnot) return FALSE; 481 if (!pAnnot)
496 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 482 return FALSE;
497 483
498 » if (!m_bNotifying) 484 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
499 » {
500 » » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
501 » » if (pWidget->GetAAction(CPDF_AAction::GetFocus))
502 » » {
503 » » » m_bNotifying = TRUE;
504 » » » pWidget->GetAppearanceAge();
505 » » » int nValueAge = pWidget->GetValueAge();
506 » » » pWidget->ClearAppModified();
507 485
486 if (!m_bNotifying)
487 {
488 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
489 if (pWidget->GetAAction(CPDF_AAction::GetFocus))
490 {
491 m_bNotifying = TRUE;
492 pWidget->GetAppearanceAge();
508 493
509 » » » CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); 494 int nValueAge = pWidget->GetValueAge();
510 » » » ASSERT(pPageView != NULL); 495 pWidget->ClearAppModified();
511 496
512 » » » PDFSDK_FieldAction fa; 497 CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
513 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); 498 ASSERT(pPageView != NULL);
514 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
515 499
500 PDFSDK_FieldAction fa;
501 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
502 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
516 503
517 » » » CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TR UE); 504 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TRUE);
518 » » » if(!pFormFiller) return FALSE; 505 if(!pFormFiller) return FALSE;
519 » » » pFormFiller->GetActionData(pPageView, CPDF_AAction::GetF ocus, fa); 506 pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa);
507 pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView);
508 m_bNotifying = FALSE;
520 509
521 » » » pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView ); 510 if (pWidget->IsAppModified())
522 » » » m_bNotifying = FALSE; 511 {
512 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE) )
513 {
514 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget- >GetValueAge());
515 }
516 }
517 }
518 }
523 519
524 //» » » if (!IsValidAnnot(m_pApp, pDocument, pDocView, pPageView , pAnnot)) return FALSE; 520 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE))
521 return pFormFiller->OnSetFocus(pAnnot, nFlag);
525 522
526 » » » if (pWidget->IsAppModified()) 523 return TRUE;
527 » » » {
528 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller (pWidget, FALSE))
529 » » » » {
530 » » » » » pFormFiller->ResetPDFWindow(pPageView, n ValueAge == pWidget->GetValueAge());
531 » » » » }
532 » » » }
533 » » }
534 » }
535
536 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE))
537 » {
538 » » if (pFormFiller->OnSetFocus(pAnnot, nFlag))
539 » » {
540 » » » return TRUE;
541 » » }
542 » » else
543 » » » return FALSE;
544 » }
545
546 » return TRUE;
547 } 524 }
548 525
549 FX_BOOL»CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) 526 FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag)
550 { 527 {
551 » if(!pAnnot) return FALSE; 528 if(!pAnnot) return FALSE;
552 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 529 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
553 530
554 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 531 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
555 » { 532 {
556 » » if (pFormFiller->OnKillFocus(pAnnot, nFlag)) 533 if (pFormFiller->OnKillFocus(pAnnot, nFlag))
557 » » { 534 {
558 » » » if (!m_bNotifying) 535 if (!m_bNotifying)
559 » » » { 536 {
560 » » » » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnno t; 537 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
561 » » » » if (pWidget->GetAAction(CPDF_AAction::LoseFocus) ) 538 if (pWidget->GetAAction(CPDF_AAction::LoseFocus))
562 » » » » { 539 {
563 » » » » » m_bNotifying = TRUE; 540 m_bNotifying = TRUE;
564 » » » » » pWidget->ClearAppModified(); 541 pWidget->ClearAppModified();
565 542
566 » » » » » CPDFSDK_PageView* pPageView = pWidget->G etPageView(); 543 CPDFSDK_PageView* pPageView = pWidget->GetPageView();
567 » » » » » ASSERT(pPageView != NULL); 544 ASSERT(pPageView != NULL);
568 545
569 » » » » » PDFSDK_FieldAction fa; 546 PDFSDK_FieldAction fa;
570 » » » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown (nFlag); 547 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
571 » » » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(n Flag); 548 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
572 549
573 » » » » » pFormFiller->GetActionData(pPageView, CP DF_AAction::LoseFocus, fa); 550 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocu s, fa);
574 551
575 » » » » » pWidget->OnAAction(CPDF_AAction::LoseFoc us, fa, pPageView); 552 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView);
576 » » » » » m_bNotifying = FALSE; 553 m_bNotifying = FALSE;
577 554
578 » » » » } 555 }
579 » » » } 556 }
580 » » } 557 }
581 » » else 558 else
582 » » » return FALSE; 559 return FALSE;
583 » } 560 }
584 561
585 » return TRUE; 562 return TRUE;
586 } 563 }
587 564
588 FX_BOOL»CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) 565 FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget)
589 { 566 {
590 » return pWidget->IsVisible(); 567 return pWidget->IsVisible();
591 } 568 }
592 569
593 FX_BOOL»CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) 570 FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget)
594 { 571 {
595 » ASSERT(pWidget != NULL); 572 ASSERT(pWidget != NULL);
596 573
597 » int nFieldFlags = pWidget->GetFieldFlags(); 574 int nFieldFlags = pWidget->GetFieldFlags();
598 575
599 » return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; 576 return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY;
600 } 577 }
601 578
602 FX_BOOL»CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) 579 FX_BOOL CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget)
603 { 580 {
604 » ASSERT(pWidget != NULL); 581 ASSERT(pWidget != NULL);
605 582
606 » if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) 583 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON)
607 » » return TRUE; 584 return TRUE;
608 » else 585 else
Lei Zhang 2015/07/23 02:01:02 We missed this on master, FYI.
Tom Sepez 2015/07/23 16:17:41 Acknowledged.
609 » { 586 {
610 » » CPDF_Page* pPage = pWidget->GetPDFPage(); 587 CPDF_Page* pPage = pWidget->GetPDFPage();
611 » » ASSERT(pPage != NULL); 588 ASSERT(pPage != NULL);
612 589
613 » » CPDF_Document* pDocument = pPage->m_pDocument; 590 CPDF_Document* pDocument = pPage->m_pDocument;
614 » » ASSERT(pDocument != NULL); 591 ASSERT(pDocument != NULL);
615 592
616 » » FX_DWORD dwPermissions = pDocument->GetUserPermissions(); 593 FX_DWORD dwPermissions = pDocument->GetUserPermissions();
617 » » return (dwPermissions&FPDFPERM_FILL_FORM) || 594 return (dwPermissions&FPDFPERM_FILL_FORM) ||
618 » » » » (dwPermissions&FPDFPERM_ANNOT_FORM) || 595 (dwPermissions&FPDFPERM_ANNOT_FORM) ||
619 » » » (dwPermissions&FPDFPERM_MODIFY); 596 (dwPermissions&FPDFPERM_MODIFY);
620 » } 597 }
621 » return TRUE; 598 return TRUE;
622 } 599 }
623 600
624 CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL bRegister) 601 CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL bRegister)
625 { 602 {
626 auto it = m_Maps.find(pAnnot); 603 auto it = m_Maps.find(pAnnot);
627 if (it != m_Maps.end()) 604 if (it != m_Maps.end())
628 return it->second; 605 return it->second;
629 606
630 if (!bRegister) 607 if (!bRegister)
631 return nullptr; 608 return nullptr;
(...skipping 28 matching lines...) Expand all
660 637
661 if (!pFormFiller) 638 if (!pFormFiller)
662 return nullptr; 639 return nullptr;
663 640
664 m_Maps[pAnnot] = pFormFiller; 641 m_Maps[pAnnot] = pFormFiller;
665 return pFormFiller; 642 return pFormFiller;
666 } 643 }
667 644
668 void CFFL_IFormFiller::RemoveFormFiller(CPDFSDK_Annot* pAnnot) 645 void CFFL_IFormFiller::RemoveFormFiller(CPDFSDK_Annot* pAnnot)
669 { 646 {
670 » if ( pAnnot != NULL ) 647 if ( pAnnot != NULL )
671 » { 648 {
672 » » UnRegisterFormFiller( pAnnot ); 649 UnRegisterFormFiller( pAnnot );
673 » } 650 }
674 } 651 }
675 652
676 void CFFL_IFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot) 653 void CFFL_IFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot)
677 { 654 {
678 auto it = m_Maps.find(pAnnot); 655 auto it = m_Maps.find(pAnnot);
679 if (it == m_Maps.end()) 656 if (it == m_Maps.end())
680 return; 657 return;
681 658
682 delete it->second; 659 delete it->second;
683 m_Maps.erase(it); 660 m_Maps.erase(it);
684 } 661 }
685 662
686 void CFFL_IFormFiller::SetFocusAnnotTab(CPDFSDK_Annot* pWidget, FX_BOOL bSameFie ld, FX_BOOL bNext) 663 void CFFL_IFormFiller::SetFocusAnnotTab(CPDFSDK_Annot* pWidget, FX_BOOL bSameFie ld, FX_BOOL bNext)
687 { 664 {
688 665
689 } 666 }
690 667
691 void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX _FLOAT fPopupMax, int32_t & nRet, FX_FLOAT & fPopupRet) 668 void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX _FLOAT fPopupMax, int32_t & nRet, FX_FLOAT & fPopupRet)
692 { 669 {
693 » ASSERT(pPrivateData != NULL); 670 ASSERT(pPrivateData != NULL);
694 671
695 » CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; 672 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
696 673
697 674
698 675
699 676
700 » CPDF_Rect rcPageView(0,0,0,0); 677 CPDF_Rect rcPageView(0,0,0,0);
701 » rcPageView.right = pData->pWidget->GetPDFPage()->GetPageWidth(); 678 rcPageView.right = pData->pWidget->GetPDFPage()->GetPageWidth();
702 » rcPageView.bottom = pData->pWidget->GetPDFPage()->GetPageHeight(); 679 rcPageView.bottom = pData->pWidget->GetPDFPage()->GetPageHeight();
703 » rcPageView.Normalize(); 680 rcPageView.Normalize();
704 681
705 682
706 » ASSERT(pData->pWidget != NULL); 683 ASSERT(pData->pWidget != NULL);
707 » CPDF_Rect rcAnnot = pData->pWidget->GetRect(); 684 CPDF_Rect rcAnnot = pData->pWidget->GetRect();
708 685
709 » FX_FLOAT fTop = 0.0f; 686 FX_FLOAT fTop = 0.0f;
710 » FX_FLOAT fBottom = 0.0f; 687 FX_FLOAT fBottom = 0.0f;
711 688
712 » CPDFSDK_Widget * pWidget = (CPDFSDK_Widget*)pData->pWidget; 689 CPDFSDK_Widget * pWidget = (CPDFSDK_Widget*)pData->pWidget;
713 » switch (pWidget->GetRotate() / 90) 690 switch (pWidget->GetRotate() / 90)
714 » { 691 {
715 » default: 692 default:
716 » case 0: 693 case 0:
717 » » fTop = rcPageView.top - rcAnnot.top; 694 fTop = rcPageView.top - rcAnnot.top;
718 » » fBottom = rcAnnot.bottom - rcPageView.bottom; 695 fBottom = rcAnnot.bottom - rcPageView.bottom;
719 » » break; 696 break;
720 » case 1: 697 case 1:
721 » » fTop = rcAnnot.left - rcPageView.left; 698 fTop = rcAnnot.left - rcPageView.left;
722 » » fBottom = rcPageView.right - rcAnnot.right; 699 fBottom = rcPageView.right - rcAnnot.right;
723 » » break; 700 break;
724 » case 2: 701 case 2:
725 » » fTop = rcAnnot.bottom - rcPageView.bottom; 702 fTop = rcAnnot.bottom - rcPageView.bottom;
726 » » fBottom = rcPageView.top - rcAnnot.top; 703 fBottom = rcPageView.top - rcAnnot.top;
727 » » break; 704 break;
728 » case 3: 705 case 3:
729 » » fTop = rcPageView.right - rcAnnot.right; 706 fTop = rcPageView.right - rcAnnot.right;
730 » » fBottom = rcAnnot.left - rcPageView.left; 707 fBottom = rcAnnot.left - rcPageView.left;
731 » » break; 708 break;
732 » } 709 }
733 710
734 » FX_FLOAT fFactHeight = 0; 711 FX_FLOAT fFactHeight = 0;
735 » FX_BOOL bBottom = TRUE; 712 FX_BOOL bBottom = TRUE;
736 » FX_FLOAT fMaxListBoxHeight = 0; 713 FX_FLOAT fMaxListBoxHeight = 0;
737 » if (fPopupMax > FFL_MAXLISTBOXHEIGHT) 714 if (fPopupMax > FFL_MAXLISTBOXHEIGHT)
738 » { 715 {
739 » » if (fPopupMin > FFL_MAXLISTBOXHEIGHT) 716 if (fPopupMin > FFL_MAXLISTBOXHEIGHT)
740 » » { 717 {
741 » » » fMaxListBoxHeight = fPopupMin; 718 fMaxListBoxHeight = fPopupMin;
742 » » } 719 }
743 » » else 720 else
744 » » { 721 {
745 » » » fMaxListBoxHeight = FFL_MAXLISTBOXHEIGHT; 722 fMaxListBoxHeight = FFL_MAXLISTBOXHEIGHT;
746 » » } 723 }
747 » } 724 }
748 » else 725 else
749 » » fMaxListBoxHeight = fPopupMax; 726 fMaxListBoxHeight = fPopupMax;
750 727
751 » if (fBottom > fMaxListBoxHeight) 728 if (fBottom > fMaxListBoxHeight)
752 » { 729 {
753 » » fFactHeight = fMaxListBoxHeight; 730 fFactHeight = fMaxListBoxHeight;
754 » » bBottom = TRUE; 731 bBottom = TRUE;
755 » } 732 }
756 » else 733 else
757 » { 734 {
758 » » if (fTop > fMaxListBoxHeight) 735 if (fTop > fMaxListBoxHeight)
759 » » { 736 {
760 » » » fFactHeight = fMaxListBoxHeight; 737 fFactHeight = fMaxListBoxHeight;
761 » » » bBottom = FALSE; 738 bBottom = FALSE;
762 » » } 739 }
763 » » else 740 else
764 » » { 741 {
765 » » » if (fTop > fBottom) 742 if (fTop > fBottom)
766 » » » { 743 {
767 » » » » fFactHeight = fTop; 744 fFactHeight = fTop;
768 » » » » bBottom = FALSE; 745 bBottom = FALSE;
769 » » » } 746 }
770 » » » else 747 else
771 » » » { 748 {
772 » » » » fFactHeight = fBottom; 749 fFactHeight = fBottom;
773 » » » » bBottom = TRUE; 750 bBottom = TRUE;
774 » » » } 751 }
775 » » } 752 }
776 » } 753 }
777 754
778 » nRet = bBottom ? 0 : 1; 755 nRet = bBottom ? 0 : 1;
779 » fPopupRet = fFactHeight; 756 fPopupRet = fFactHeight;
780 } 757 }
781 758
782 void CFFL_IFormFiller::OnSetWindowRect(void* pPrivateData, const CPDF_Rect & rcW indow) 759 void CFFL_IFormFiller::OnSetWindowRect(void* pPrivateData, const CPDF_Rect & rcW indow)
783 { 760 {
784 ASSERT(pPrivateData != NULL); 761 ASSERT(pPrivateData != NULL);
785 762
786 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; 763 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
787 764
788 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, TRUE)) 765 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, TRUE))
789 { 766 {
(...skipping 22 matching lines...) Expand all
812 ASSERT(pData->pWidget != NULL); 789 ASSERT(pData->pWidget != NULL);
813 790
814 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); 791 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE);
815 ASSERT(pFormFiller != NULL); 792 ASSERT(pFormFiller != NULL);
816 793
817 pFormFiller->OnKeyStroke(bKeyDown); 794 pFormFiller->OnKeyStroke(bKeyDown);
818 } 795 }
819 796
820 void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, CPDFSDK_PageVi ew* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) 797 void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, CPDFSDK_PageVi ew* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag)
821 { 798 {
822 » if (!m_bNotifying) 799 if (!m_bNotifying)
823 » { 800 {
824 » » ASSERT(pWidget != NULL); 801 ASSERT(pWidget != NULL);
825 » » if (pWidget->GetAAction(CPDF_AAction::KeyStroke)) 802 if (pWidget->GetAAction(CPDF_AAction::KeyStroke))
826 » » { 803 {
827 » » » m_bNotifying = TRUE; 804 m_bNotifying = TRUE;
828 » » » pWidget->ClearAppModified(); 805 pWidget->ClearAppModified();
829 806
830 » » » ASSERT(pPageView != NULL); 807 ASSERT(pPageView != NULL);
831 // » » » CReader_DocView* pDocView = pPageView->GetDocView(); 808
832 // » » » ASSERT(pDocView != NULL); 809 PDFSDK_FieldAction fa;
833 810 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
834 811 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
835 812 fa.bWillCommit = TRUE;
836 » » » PDFSDK_FieldAction fa; 813 fa.bKeyDown = TRUE;
837 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); 814 fa.bRC = TRUE;
838 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); 815
839 » » » fa.bWillCommit = TRUE; 816 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE);
840 » » » fa.bKeyDown = TRUE; 817 ASSERT(pFormFiller != NULL);
841 » » » fa.bRC = TRUE; 818
842 819 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa);
843 » » » CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FA LSE); 820 pFormFiller->SaveState(pPageView);
844 » » » ASSERT(pFormFiller != NULL); 821
845 822 PDFSDK_FieldAction faOld = fa;
846 » » » pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyS troke, fa); 823 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView);
847 » » » pFormFiller->SaveState(pPageView); 824
848 825 bRC = fa.bRC;
849 » » » PDFSDK_FieldAction faOld = fa; 826 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidge t);
850 » » » pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageVie w); 827
851 828 m_bNotifying = FALSE;
852 » » » bRC = fa.bRC; 829 }
853 //» » » bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPage View, pWidget); 830 }
854
855 » » » m_bNotifying = FALSE;
856 » » }
857 » }
858 } 831 }
859 832
860 void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa geView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) 833 void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa geView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag)
861 { 834 {
862 » if (!m_bNotifying) 835 if (!m_bNotifying)
863 » { 836 {
864 » » ASSERT(pWidget != NULL); 837 ASSERT(pWidget != NULL);
865 » » if (pWidget->GetAAction(CPDF_AAction::Validate)) 838 if (pWidget->GetAAction(CPDF_AAction::Validate))
866 » » { 839 {
867 » » » m_bNotifying = TRUE; 840 m_bNotifying = TRUE;
868 » » » pWidget->ClearAppModified(); 841 pWidget->ClearAppModified();
869 842
870 » » » ASSERT(pPageView != NULL); 843 ASSERT(pPageView != NULL);
871 // » » » CReader_DocView* pDocView = pPageView->GetDocView(); 844 // CReader_DocView* pDocView = pPageView->GetDocView();
872 // » » » ASSERT(pDocView != NULL); 845 // ASSERT(pDocView != NULL);
873 846
874 847
875 848
876 » » » PDFSDK_FieldAction fa; 849 PDFSDK_FieldAction fa;
877 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); 850 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
878 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); 851 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
879 » » » fa.bKeyDown = TRUE; 852 fa.bKeyDown = TRUE;
880 » » » fa.bRC = TRUE; 853 fa.bRC = TRUE;
881 854
882 » » » CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FA LSE); 855 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE);
883 » » » ASSERT(pFormFiller != NULL); 856 ASSERT(pFormFiller != NULL);
884 857
885 » » » pFormFiller->GetActionData(pPageView, CPDF_AAction::Vali date, fa); 858 pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa);
886 » » » pFormFiller->SaveState(pPageView); 859 pFormFiller->SaveState(pPageView);
887 860
888 » » » PDFSDK_FieldAction faOld = fa; 861 PDFSDK_FieldAction faOld = fa;
889 » » » pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView ); 862 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView);
890 863
891 » » » bRC = fa.bRC; 864 bRC = fa.bRC;
892 //» » » bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPage View, pWidget); 865 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidge t);
893 866
894 » » » m_bNotifying = FALSE; 867 m_bNotifying = FALSE;
895 » » } 868 }
896 » } 869 }
897 } 870 }
898 871
899 void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pP ageView, FX_BOOL& bExit, FX_DWORD nFlag) 872 void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pP ageView, FX_BOOL& bExit, FX_DWORD nFlag)
900 { 873 {
901 » if (!m_bNotifying) 874 if (!m_bNotifying)
902 » { 875 {
903 » » ASSERT(pWidget != NULL); 876 ASSERT(pWidget != NULL);
904 » » ASSERT(pPageView != NULL); 877 ASSERT(pPageView != NULL);
905 // » » CReader_DocView* pDocView = pPageView->GetDocView(); 878 // CReader_DocView* pDocView = pPageView->GetDocView();
906 // » » ASSERT(pDocView != NULL); 879 // ASSERT(pDocView != NULL);
907 » » CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); 880 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
908 » » ASSERT(pDocument != NULL); 881 ASSERT(pDocument != NULL);
909 882
910 » » CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->G etInterForm(); 883 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF orm();
911 » » ASSERT(pInterForm != NULL); 884 ASSERT(pInterForm != NULL);
912 885
913 » » pInterForm->OnCalculate(pWidget->GetFormField()); 886 pInterForm->OnCalculate(pWidget->GetFormField());
914 887
915 //» » bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pW idget); 888 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidget);
916 889
917 » » m_bNotifying = FALSE; 890 m_bNotifying = FALSE;
918 » } 891 }
919 } 892 }
920 893
921 void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPage View, FX_BOOL& bExit, FX_DWORD nFlag) 894 void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPage View, FX_BOOL& bExit, FX_DWORD nFlag)
922 { 895 {
923 » if (!m_bNotifying) 896 if (!m_bNotifying)
924 » { 897 {
925 » » ASSERT(pWidget != NULL); 898 ASSERT(pWidget != NULL);
926 » » ASSERT(pPageView != NULL); 899 ASSERT(pPageView != NULL);
927 // » » CReader_DocView* pDocView = pPageView->GetDocView(); 900 // CReader_DocView* pDocView = pPageView->GetDocView();
928 // » » ASSERT(pDocView != NULL); 901 // ASSERT(pDocView != NULL);
929 » » CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); 902 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
930 » » ASSERT(pDocument != NULL); 903 ASSERT(pDocument != NULL);
931 904
932 » » CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->G etInterForm(); 905 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF orm();
933 » » ASSERT(pInterForm != NULL); 906 ASSERT(pInterForm != NULL);
934 907
935 » » FX_BOOL bFormated = FALSE; 908 FX_BOOL bFormated = FALSE;
936 » » CFX_WideString sValue = pInterForm->OnFormat(pWidget->GetFormFie ld(), bFormated); 909 CFX_WideString sValue = pInterForm->OnFormat(pWidget->GetFormField(), bF ormated);
937 910
938 //» » bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pW idget); 911 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidget);
939 912
940 » » if (bExit) return; 913 if (bExit) return;
941 914
942 » » if (bFormated) 915 if (bFormated)
943 » » { 916 {
944 » » » pInterForm->ResetFieldAppearance(pWidget->GetFormField() , sValue.c_str(), TRUE); 917 pInterForm->ResetFieldAppearance(pWidget->GetFormField(), sValue.c_s tr(), TRUE);
945 » » » pInterForm->UpdateField(pWidget->GetFormField()); 918 pInterForm->UpdateField(pWidget->GetFormField());
946 » » } 919 }
947 920
948 » » m_bNotifying = FALSE; 921 m_bNotifying = FALSE;
949 » } 922 }
950 } 923 }
951 924
952 void CFFL_IFormFiller::OnClick(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageV iew, FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag) 925 void CFFL_IFormFiller::OnClick(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageV iew, FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag)
953 { 926 {
954 » ASSERT(pWidget != NULL); 927 ASSERT(pWidget != NULL);
955 928
956 » if (!m_bNotifying) 929 if (!m_bNotifying)
957 » { 930 {
958 » » if (pWidget->HasXFAAAction(PDFSDK_XFA_Click)) 931 if (pWidget->HasXFAAAction(PDFSDK_XFA_Click))
959 » » { 932 {
960 » » » m_bNotifying = TRUE; 933 m_bNotifying = TRUE;
961 » » » int nAge = pWidget->GetAppearanceAge(); 934 int nAge = pWidget->GetAppearanceAge();
962 » » » int nValueAge = pWidget->GetValueAge(); 935 int nValueAge = pWidget->GetValueAge();
963 936
964 » » » PDFSDK_FieldAction fa; 937 PDFSDK_FieldAction fa;
965 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); 938 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
966 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); 939 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
967 940
968 » » » pWidget->OnXFAAAction(PDFSDK_XFA_Click, fa, pPageView); 941 pWidget->OnXFAAAction(PDFSDK_XFA_Click, fa, pPageView);
969 » » » m_bNotifying = FALSE; 942 m_bNotifying = FALSE;
970 943
971 » » » if (!IsValidAnnot(pPageView, pWidget)) 944 if (!IsValidAnnot(pPageView, pWidget))
972 » » » { 945 {
973 » » » » bExit = TRUE; 946 bExit = TRUE;
974 » » » » return; 947 return;
975 » » » } 948 }
976 949
977 » » » if (nAge != pWidget->GetAppearanceAge()) 950 if (nAge != pWidget->GetAppearanceAge())
978 » » » { 951 {
979 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller (pWidget, FALSE)) 952 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE) )
980 » » » » { 953 {
981 » » » » » pFormFiller->ResetPDFWindow(pPageView, n ValueAge == pWidget->GetValueAge()); 954 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget- >GetValueAge());
982 » » » » } 955 }
983 956
984 » » » » bReset = TRUE; 957 bReset = TRUE;
985 » » » } 958 }
986 » » } 959 }
987 » } 960 }
988 } 961 }
989 962
990 void CFFL_IFormFiller::OnFull(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageVi ew, FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag) 963 void CFFL_IFormFiller::OnFull(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageVi ew, FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag)
991 { 964 {
992 » ASSERT(pWidget != NULL); 965 ASSERT(pWidget != NULL);
993 966
994 » if (!m_bNotifying) 967 if (!m_bNotifying)
995 » { 968 {
996 » » if (pWidget->HasXFAAAction(PDFSDK_XFA_Full)) 969 if (pWidget->HasXFAAAction(PDFSDK_XFA_Full))
997 » » { 970 {
998 » » » m_bNotifying = TRUE; 971 m_bNotifying = TRUE;
999 » » » int nAge = pWidget->GetAppearanceAge(); 972 int nAge = pWidget->GetAppearanceAge();
1000 » » » int nValueAge = pWidget->GetValueAge(); 973 int nValueAge = pWidget->GetValueAge();
1001 974
1002 » » » PDFSDK_FieldAction fa; 975 PDFSDK_FieldAction fa;
1003 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); 976 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
1004 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); 977 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
1005 978
1006 » » » pWidget->OnXFAAAction(PDFSDK_XFA_Full, fa, pPageView); 979 pWidget->OnXFAAAction(PDFSDK_XFA_Full, fa, pPageView);
1007 » » » m_bNotifying = FALSE; 980 m_bNotifying = FALSE;
1008 981
1009 » » » if (!IsValidAnnot(pPageView, pWidget)) 982 if (!IsValidAnnot(pPageView, pWidget))
1010 » » » { 983 {
1011 » » » » bExit = TRUE; 984 bExit = TRUE;
1012 » » » » return; 985 return;
1013 » » » } 986 }
1014 987
1015 » » » if (nAge != pWidget->GetAppearanceAge()) 988 if (nAge != pWidget->GetAppearanceAge())
1016 » » » { 989 {
1017 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller (pWidget, FALSE)) 990 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE) )
1018 » » » » { 991 {
1019 » » » » » pFormFiller->ResetPDFWindow(pPageView, n ValueAge == pWidget->GetValueAge()); 992 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget- >GetValueAge());
1020 » » » » } 993 }
1021 994
1022 » » » » bReset = TRUE; 995 bReset = TRUE;
1023 » » » } 996 }
1024 » » } 997 }
1025 » } 998 }
1026 } 999 }
1027 1000
1028 void CFFL_IFormFiller::OnPopupPreOpen(void* pPrivateData, FX_BOOL& bExit, FX_DWO RD nFlag) 1001 void CFFL_IFormFiller::OnPopupPreOpen(void* pPrivateData, FX_BOOL& bExit, FX_DWO RD nFlag)
1029 { 1002 {
1030 ASSERT(pPrivateData != NULL); 1003 ASSERT(pPrivateData != NULL);
1031 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; 1004 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
1032 ASSERT(pData->pWidget != NULL); 1005 ASSERT(pData->pWidget != NULL);
1033 1006
1034 FX_BOOL bTempReset = FALSE; 1007 FX_BOOL bTempReset = FALSE;
1035 FX_BOOL bTempExit = FALSE; 1008 FX_BOOL bTempExit = FALSE;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 1102
1130 bReset = TRUE; 1103 bReset = TRUE;
1131 } 1104 }
1132 } 1105 }
1133 } 1106 }
1134 } 1107 }
1135 1108
1136 FX_BOOL CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Anno t* pAnnot) 1109 FX_BOOL CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Anno t* pAnnot)
1137 { 1110 {
1138 1111
1139 » ASSERT(pPageView != NULL); 1112 ASSERT(pPageView != NULL);
1140 » ASSERT(pAnnot != NULL); 1113 ASSERT(pAnnot != NULL);
1141 1114
1142 » if(pPageView) 1115 if(pPageView)
1143 » » return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot()); 1116 return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot());
1144 » else 1117 else
Lei Zhang 2015/07/23 02:01:03 Also missed on trunk.
Tom Sepez 2015/07/23 16:17:41 Acknowledged.
1145 » » return FALSE; 1118 return FALSE;
1146 } 1119 }
1147 1120
1148 void CFFL_IFormFiller::BeforeUndo(CPDFSDK_Document* pDocument) 1121 void CFFL_IFormFiller::BeforeUndo(CPDFSDK_Document* pDocument)
1149 { 1122 {
1150 1123
1151 } 1124 }
1152 1125
1153 void CFFL_IFormFiller::BeforeRedo(CPDFSDK_Document* pDocument) 1126 void CFFL_IFormFiller::BeforeRedo(CPDFSDK_Document* pDocument)
1154 { 1127 {
1155 BeforeUndo(pDocument); 1128 BeforeUndo(pDocument);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 ASSERT(pPrivateData != NULL); 1270 ASSERT(pPrivateData != NULL);
1298 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; 1271 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
1299 ASSERT(pData->pWidget != NULL); 1272 ASSERT(pData->pWidget != NULL);
1300 1273
1301 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); 1274 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE);
1302 ASSERT(pFormFiller != NULL); 1275 ASSERT(pFormFiller != NULL);
1303 1276
1304 if (!bEditOrList) 1277 if (!bEditOrList)
1305 pFormFiller->OnKeyStroke(bExit); 1278 pFormFiller->OnKeyStroke(bExit);
1306 } 1279 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698