OLD | NEW |
| (Empty) |
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/fxfa/app/xfa_ffdocview.h" | |
8 | |
9 #include "core/include/fxcrt/fx_ext.h" | |
10 #include "xfa/src/fxfa/app/xfa_ffapp.h" | |
11 #include "xfa/src/fxfa/app/xfa_ffbarcode.h" | |
12 #include "xfa/src/fxfa/app/xfa_ffcheckbutton.h" | |
13 #include "xfa/src/fxfa/app/xfa_ffchoicelist.h" | |
14 #include "xfa/src/fxfa/app/xfa_ffdoc.h" | |
15 #include "xfa/src/fxfa/app/xfa_ffdraw.h" | |
16 #include "xfa/src/fxfa/app/xfa_ffexclgroup.h" | |
17 #include "xfa/src/fxfa/app/xfa_fffield.h" | |
18 #include "xfa/src/fxfa/app/xfa_ffimage.h" | |
19 #include "xfa/src/fxfa/app/xfa_ffimageedit.h" | |
20 #include "xfa/src/fxfa/app/xfa_ffpageview.h" | |
21 #include "xfa/src/fxfa/app/xfa_ffpath.h" | |
22 #include "xfa/src/fxfa/app/xfa_ffpushbutton.h" | |
23 #include "xfa/src/fxfa/app/xfa_ffsignature.h" | |
24 #include "xfa/src/fxfa/app/xfa_ffsubform.h" | |
25 #include "xfa/src/fxfa/app/xfa_fftext.h" | |
26 #include "xfa/src/fxfa/app/xfa_fftextedit.h" | |
27 #include "xfa/src/fxfa/app/xfa_ffwidget.h" | |
28 #include "xfa/src/fxfa/app/xfa_ffwidgetacc.h" | |
29 #include "xfa/src/fxfa/app/xfa_ffwidgethandler.h" | |
30 #include "xfa/src/fxfa/app/xfa_fwladapter.h" | |
31 #include "xfa/src/fxfa/app/xfa_textlayout.h" | |
32 #include "xfa/src/fxfa/parser/xfa_script.h" | |
33 | |
34 extern const XFA_ATTRIBUTEENUM gs_EventActivity[] = { | |
35 XFA_ATTRIBUTEENUM_Click, XFA_ATTRIBUTEENUM_Change, | |
36 XFA_ATTRIBUTEENUM_DocClose, XFA_ATTRIBUTEENUM_DocReady, | |
37 XFA_ATTRIBUTEENUM_Enter, XFA_ATTRIBUTEENUM_Exit, | |
38 XFA_ATTRIBUTEENUM_Full, XFA_ATTRIBUTEENUM_IndexChange, | |
39 XFA_ATTRIBUTEENUM_Initialize, XFA_ATTRIBUTEENUM_MouseDown, | |
40 XFA_ATTRIBUTEENUM_MouseEnter, XFA_ATTRIBUTEENUM_MouseExit, | |
41 XFA_ATTRIBUTEENUM_MouseUp, XFA_ATTRIBUTEENUM_PostExecute, | |
42 XFA_ATTRIBUTEENUM_PostOpen, XFA_ATTRIBUTEENUM_PostPrint, | |
43 XFA_ATTRIBUTEENUM_PostSave, XFA_ATTRIBUTEENUM_PostSign, | |
44 XFA_ATTRIBUTEENUM_PostSubmit, XFA_ATTRIBUTEENUM_PreExecute, | |
45 XFA_ATTRIBUTEENUM_PreOpen, XFA_ATTRIBUTEENUM_PrePrint, | |
46 XFA_ATTRIBUTEENUM_PreSave, XFA_ATTRIBUTEENUM_PreSign, | |
47 XFA_ATTRIBUTEENUM_PreSubmit, XFA_ATTRIBUTEENUM_Ready, | |
48 XFA_ATTRIBUTEENUM_Unknown, | |
49 }; | |
50 CXFA_FFDocView::CXFA_FFDocView(CXFA_FFDoc* pDoc) | |
51 : m_bLayoutEvent(FALSE), | |
52 m_pListFocusWidget(nullptr), | |
53 m_bInLayoutStatus(FALSE), | |
54 m_pDoc(pDoc), | |
55 m_pWidgetHandler(nullptr), | |
56 m_pXFADocLayout(nullptr), | |
57 m_pFocusAcc(nullptr), | |
58 m_pFocusWidget(nullptr), | |
59 m_pOldFocusWidget(nullptr), | |
60 m_iStatus(XFA_DOCVIEW_LAYOUTSTATUS_None), | |
61 m_iLock(0) {} | |
62 CXFA_FFDocView::~CXFA_FFDocView() { | |
63 DestroyDocView(); | |
64 if (m_pWidgetHandler) { | |
65 delete m_pWidgetHandler; | |
66 } | |
67 m_pWidgetHandler = NULL; | |
68 } | |
69 void CXFA_FFDocView::InitLayout(CXFA_Node* pNode) { | |
70 RunBindItems(); | |
71 ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Initialize); | |
72 ExecEventActivityByDeepFirst(pNode, XFA_EVENT_IndexChange); | |
73 } | |
74 int32_t CXFA_FFDocView::StartLayout(int32_t iStartPage) { | |
75 m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Start; | |
76 m_pDoc->GetXFADoc()->DoProtoMerge(); | |
77 m_pDoc->GetXFADoc()->DoDataMerge(); | |
78 m_pXFADocLayout = GetXFALayout(); | |
79 int32_t iStatus = m_pXFADocLayout->StartLayout(); | |
80 if (iStatus < 0) { | |
81 return iStatus; | |
82 } | |
83 CXFA_Node* pRootItem = | |
84 ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)); | |
85 if (!pRootItem) { | |
86 return iStatus; | |
87 } | |
88 InitLayout(pRootItem); | |
89 InitCalculate(pRootItem); | |
90 InitValidate(pRootItem); | |
91 ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, TRUE); | |
92 m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Start; | |
93 return iStatus; | |
94 } | |
95 int32_t CXFA_FFDocView::DoLayout(IFX_Pause* pPause) { | |
96 int32_t iStatus = 100; | |
97 iStatus = m_pXFADocLayout->DoLayout(pPause); | |
98 if (iStatus != 100) { | |
99 return iStatus; | |
100 } | |
101 m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Doing; | |
102 return iStatus; | |
103 } | |
104 void CXFA_FFDocView::StopLayout() { | |
105 CXFA_Node* pRootItem = | |
106 ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)); | |
107 if (!pRootItem) { | |
108 return; | |
109 } | |
110 CXFA_Node* pSubformNode = pRootItem->GetChild(0, XFA_ELEMENT_Subform); | |
111 if (!pSubformNode) { | |
112 return; | |
113 } | |
114 CXFA_Node* pPageSetNode = | |
115 pSubformNode->GetFirstChildByClass(XFA_ELEMENT_PageSet); | |
116 if (!pPageSetNode) { | |
117 return; | |
118 } | |
119 RunCalculateWidgets(); | |
120 RunValidate(); | |
121 InitLayout(pPageSetNode); | |
122 InitCalculate(pPageSetNode); | |
123 InitValidate(pPageSetNode); | |
124 ExecEventActivityByDeepFirst(pPageSetNode, XFA_EVENT_Ready, TRUE); | |
125 ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready); | |
126 ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_DocReady); | |
127 RunCalculateWidgets(); | |
128 RunValidate(); | |
129 if (RunLayout()) { | |
130 ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready); | |
131 } | |
132 m_CalculateAccs.RemoveAll(); | |
133 if (m_pFocusAcc && !m_pFocusWidget) { | |
134 SetFocusWidgetAcc(m_pFocusAcc); | |
135 } | |
136 m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_End; | |
137 } | |
138 int32_t CXFA_FFDocView::GetLayoutStatus() { | |
139 return m_iStatus; | |
140 } | |
141 void CXFA_FFDocView::ShowNullTestMsg() { | |
142 int32_t iCount = m_arrNullTestMsg.GetSize(); | |
143 CXFA_FFApp* pApp = m_pDoc->GetApp(); | |
144 IXFA_AppProvider* pAppProvider = pApp->GetAppProvider(); | |
145 if (pAppProvider && iCount) { | |
146 int32_t iRemain = iCount > 7 ? iCount - 7 : 0; | |
147 iCount -= iRemain; | |
148 CFX_WideString wsMsg; | |
149 for (int32_t i = 0; i < iCount; i++) { | |
150 wsMsg += m_arrNullTestMsg[i] + FX_WSTRC(L"\n"); | |
151 } | |
152 if (iRemain > 0) { | |
153 CFX_WideString wsLimit; | |
154 pAppProvider->LoadString(XFA_IDS_ValidateLimit, wsLimit); | |
155 if (!wsLimit.IsEmpty()) { | |
156 CFX_WideString wsTemp; | |
157 wsTemp.Format((const FX_WCHAR*)wsLimit, iRemain); | |
158 wsMsg += FX_WSTRC(L"\n") + wsTemp; | |
159 } | |
160 } | |
161 CFX_WideString wsTitle; | |
162 pAppProvider->LoadString(XFA_IDS_AppName, wsTitle); | |
163 pAppProvider->MsgBox(wsMsg, wsTitle, XFA_MBICON_Status, XFA_MB_OK); | |
164 } | |
165 m_arrNullTestMsg.RemoveAll(); | |
166 } | |
167 void CXFA_FFDocView::UpdateDocView() { | |
168 if (IsUpdateLocked()) { | |
169 return; | |
170 } | |
171 LockUpdate(); | |
172 int32_t iNewAdds = m_NewAddedNodes.GetSize(); | |
173 for (int32_t i = 0; i < iNewAdds; i++) { | |
174 CXFA_Node* pNode = reinterpret_cast<CXFA_Node*>(m_NewAddedNodes[i]); | |
175 InitCalculate(pNode); | |
176 InitValidate(pNode); | |
177 ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Ready, TRUE); | |
178 } | |
179 m_NewAddedNodes.RemoveAll(); | |
180 RunSubformIndexChange(); | |
181 RunCalculateWidgets(); | |
182 RunValidate(); | |
183 ShowNullTestMsg(); | |
184 if (RunLayout() && m_bLayoutEvent) { | |
185 RunEventLayoutReady(); | |
186 } | |
187 m_bLayoutEvent = FALSE; | |
188 m_CalculateAccs.RemoveAll(); | |
189 RunInvalidate(); | |
190 UnlockUpdate(); | |
191 } | |
192 int32_t CXFA_FFDocView::CountPageViews() { | |
193 if (!m_pXFADocLayout) { | |
194 return 0; | |
195 } | |
196 return m_pXFADocLayout->CountPages(); | |
197 } | |
198 IXFA_PageView* CXFA_FFDocView::GetPageView(int32_t nIndex) { | |
199 if (!m_pXFADocLayout) { | |
200 return NULL; | |
201 } | |
202 return static_cast<CXFA_FFPageView*>(m_pXFADocLayout->GetPage(nIndex)); | |
203 } | |
204 IXFA_Widget* CXFA_FFDocView::GetWidgetByName(const CFX_WideStringC& wsName) { | |
205 return GetWidgetByName(wsName, NULL); | |
206 } | |
207 CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( | |
208 const CFX_WideStringC& wsName) { | |
209 return GetWidgetAccByName(wsName, NULL); | |
210 } | |
211 IXFA_DocLayout* CXFA_FFDocView::GetXFALayout() const { | |
212 return m_pDoc->GetXFADoc()->GetDocLayout(); | |
213 } | |
214 FX_BOOL CXFA_FFDocView::ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc) { | |
215 CXFA_Node* pNode = pWidgetAcc->GetNode(); | |
216 XFA_ELEMENT eType = pNode->GetClassID(); | |
217 if (eType != XFA_ELEMENT_Field && eType != XFA_ELEMENT_ExclGroup) { | |
218 return FALSE; | |
219 } | |
220 FX_BOOL bNotify = IsStaticNotify(); | |
221 pWidgetAcc->ResetData(); | |
222 pWidgetAcc->UpdateUIDisplay(); | |
223 if (bNotify) { | |
224 pWidgetAcc->NotifyEvent(XFA_WIDGETEVENT_PostContentChanged, NULL, NULL, | |
225 NULL); | |
226 } | |
227 if (CXFA_Validate validate = pWidgetAcc->GetValidate()) { | |
228 AddValidateWidget(pWidgetAcc); | |
229 validate.GetNode()->SetFlag(XFA_NODEFLAG_NeedsInitApp, TRUE, FALSE); | |
230 } | |
231 return TRUE; | |
232 } | |
233 void CXFA_FFDocView::ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc) { | |
234 m_bLayoutEvent = TRUE; | |
235 FX_BOOL bChanged = FALSE; | |
236 CXFA_Node* pFormNode = NULL; | |
237 if (pWidgetAcc) { | |
238 bChanged = ResetSingleWidgetAccData(pWidgetAcc); | |
239 pFormNode = pWidgetAcc->GetNode(); | |
240 } else { | |
241 pFormNode = GetRootSubform(); | |
242 } | |
243 if (!pFormNode) { | |
244 return; | |
245 } | |
246 if (pFormNode->GetClassID() != XFA_ELEMENT_Field && | |
247 pFormNode->GetClassID() != XFA_ELEMENT_ExclGroup) { | |
248 CXFA_WidgetAccIterator Iterator(this, pFormNode); | |
249 while (CXFA_WidgetAcc* pAcc = Iterator.MoveToNext()) { | |
250 bChanged |= ResetSingleWidgetAccData(pAcc); | |
251 if (pAcc->GetNode()->GetClassID() == XFA_ELEMENT_ExclGroup) { | |
252 Iterator.SkipTree(); | |
253 } | |
254 } | |
255 } | |
256 if (bChanged) { | |
257 m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); | |
258 } | |
259 } | |
260 int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam, | |
261 CXFA_WidgetAcc* pWidgetAcc) { | |
262 if (pParam == NULL) { | |
263 return XFA_EVENTERROR_Error; | |
264 } | |
265 if (pParam->m_eType == XFA_EVENT_Validate) { | |
266 CFX_WideString wsValidateStr = FX_WSTRC(L"preSubmit"); | |
267 CXFA_Node* pConfigItem = | |
268 ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Config)); | |
269 if (pConfigItem) { | |
270 CXFA_Node* pValidateNode = NULL; | |
271 CXFA_Node* pAcrobatNode = pConfigItem->GetChild(0, XFA_ELEMENT_Acrobat); | |
272 pValidateNode = | |
273 pAcrobatNode ? pAcrobatNode->GetChild(0, XFA_ELEMENT_Validate) : NULL; | |
274 if (!pValidateNode) { | |
275 CXFA_Node* pPresentNode = pConfigItem->GetChild(0, XFA_ELEMENT_Present); | |
276 pValidateNode = pPresentNode | |
277 ? pPresentNode->GetChild(0, XFA_ELEMENT_Validate) | |
278 : NULL; | |
279 } | |
280 if (pValidateNode) { | |
281 wsValidateStr = pValidateNode->GetContent(); | |
282 } | |
283 } | |
284 FX_BOOL bValidate = FALSE; | |
285 switch (pParam->m_iValidateActivities) { | |
286 case XFA_VALIDATE_preSubmit: | |
287 bValidate = wsValidateStr.Find(L"preSubmit") != -1; | |
288 break; | |
289 case XFA_VALIDATE_prePrint: | |
290 bValidate = wsValidateStr.Find(L"prePrint") != -1; | |
291 break; | |
292 case XFA_VALIDATE_preExecute: | |
293 bValidate = wsValidateStr.Find(L"preExecute") != -1; | |
294 break; | |
295 case XFA_VALIDATE_preSave: | |
296 bValidate = wsValidateStr.Find(L"preSave") != -1; | |
297 break; | |
298 } | |
299 if (!bValidate) { | |
300 return XFA_EVENTERROR_Sucess; | |
301 } | |
302 } | |
303 CXFA_Node* pNode = pWidgetAcc ? pWidgetAcc->GetNode() : NULL; | |
304 if (!pNode) { | |
305 CXFA_Node* pRootItem = | |
306 ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)); | |
307 if (!pRootItem) { | |
308 return XFA_EVENTERROR_Error; | |
309 } | |
310 pNode = pRootItem->GetChild(0, XFA_ELEMENT_Subform); | |
311 } | |
312 ExecEventActivityByDeepFirst(pNode, pParam->m_eType, pParam->m_bIsFormReady); | |
313 return XFA_EVENTERROR_Sucess; | |
314 } | |
315 IXFA_WidgetHandler* CXFA_FFDocView::GetWidgetHandler() { | |
316 if (!m_pWidgetHandler) { | |
317 m_pWidgetHandler = new CXFA_FFWidgetHandler(this); | |
318 } | |
319 return m_pWidgetHandler; | |
320 } | |
321 IXFA_WidgetIterator* CXFA_FFDocView::CreateWidgetIterator() { | |
322 CXFA_Node* pFormRoot = GetRootSubform(); | |
323 if (!pFormRoot) { | |
324 return NULL; | |
325 } | |
326 return new CXFA_FFDocWidgetIterator(this, pFormRoot); | |
327 } | |
328 IXFA_WidgetAccIterator* CXFA_FFDocView::CreateWidgetAccIterator( | |
329 XFA_WIDGETORDER eOrder) { | |
330 CXFA_Node* pFormRoot = GetRootSubform(); | |
331 if (!pFormRoot) { | |
332 return NULL; | |
333 } | |
334 return new CXFA_WidgetAccIterator(this, pFormRoot); | |
335 } | |
336 IXFA_Widget* CXFA_FFDocView::GetFocusWidget() { | |
337 return m_pFocusWidget; | |
338 } | |
339 void CXFA_FFDocView::KillFocus() { | |
340 if (m_pFocusWidget && | |
341 (m_pFocusWidget->GetStatus() & XFA_WIDGETSTATUS_Focused)) { | |
342 (m_pFocusWidget)->OnKillFocus(NULL); | |
343 } | |
344 m_pFocusAcc = NULL; | |
345 m_pFocusWidget = NULL; | |
346 m_pOldFocusWidget = NULL; | |
347 } | |
348 FX_BOOL CXFA_FFDocView::SetFocus(IXFA_Widget* hWidget) { | |
349 CXFA_FFWidget* pNewFocus = (CXFA_FFWidget*)hWidget; | |
350 if (m_pOldFocusWidget == pNewFocus) { | |
351 return FALSE; | |
352 } | |
353 CXFA_FFWidget* pOldFocus = m_pOldFocusWidget; | |
354 m_pOldFocusWidget = pNewFocus; | |
355 if (pOldFocus) { | |
356 if (m_pFocusWidget != m_pOldFocusWidget && | |
357 (pOldFocus->GetStatus() & XFA_WIDGETSTATUS_Focused)) { | |
358 m_pFocusWidget = pOldFocus; | |
359 pOldFocus->OnKillFocus(pNewFocus); | |
360 } else if ((pOldFocus->GetStatus() & XFA_WIDGETSTATUS_Visible)) { | |
361 if (!pOldFocus->IsLoaded()) { | |
362 pOldFocus->LoadWidget(); | |
363 } | |
364 pOldFocus->OnSetFocus(m_pFocusWidget); | |
365 m_pFocusWidget = pOldFocus; | |
366 pOldFocus->OnKillFocus(pNewFocus); | |
367 } | |
368 } | |
369 if (m_pFocusWidget == m_pOldFocusWidget) { | |
370 return FALSE; | |
371 } | |
372 pNewFocus = m_pOldFocusWidget; | |
373 if (m_pListFocusWidget && pNewFocus == m_pListFocusWidget) { | |
374 m_pFocusAcc = NULL; | |
375 m_pFocusWidget = NULL; | |
376 m_pListFocusWidget = NULL; | |
377 m_pOldFocusWidget = NULL; | |
378 return FALSE; | |
379 } | |
380 if (pNewFocus && (pNewFocus->GetStatus() & XFA_WIDGETSTATUS_Visible)) { | |
381 if (!pNewFocus->IsLoaded()) { | |
382 pNewFocus->LoadWidget(); | |
383 } | |
384 pNewFocus->OnSetFocus(m_pFocusWidget); | |
385 } | |
386 m_pFocusAcc = pNewFocus ? pNewFocus->GetDataAcc() : NULL; | |
387 m_pFocusWidget = pNewFocus; | |
388 m_pOldFocusWidget = m_pFocusWidget; | |
389 return TRUE; | |
390 } | |
391 CXFA_WidgetAcc* CXFA_FFDocView::GetFocusWidgetAcc() { | |
392 return m_pFocusAcc; | |
393 } | |
394 void CXFA_FFDocView::SetFocusWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) { | |
395 CXFA_FFWidget* pNewFocus = | |
396 pWidgetAcc ? pWidgetAcc->GetNextWidget(NULL) : NULL; | |
397 if (SetFocus(pNewFocus)) { | |
398 m_pFocusAcc = pWidgetAcc; | |
399 if (m_iStatus == XFA_DOCVIEW_LAYOUTSTATUS_End) { | |
400 m_pDoc->GetDocProvider()->SetFocusWidget(m_pDoc, m_pFocusWidget); | |
401 } | |
402 } | |
403 } | |
404 void CXFA_FFDocView::DeleteLayoutItem(CXFA_FFWidget* pWidget) { | |
405 if (m_pFocusAcc == pWidget->GetDataAcc()) { | |
406 m_pFocusAcc = NULL; | |
407 m_pFocusWidget = NULL; | |
408 m_pOldFocusWidget = NULL; | |
409 } | |
410 } | |
411 static int32_t XFA_ProcessEvent(CXFA_FFDocView* pDocView, | |
412 CXFA_WidgetAcc* pWidgetAcc, | |
413 CXFA_EventParam* pParam) { | |
414 if (!pParam || pParam->m_eType == XFA_EVENT_Unknown) { | |
415 return XFA_EVENTERROR_NotExist; | |
416 } | |
417 if (!pWidgetAcc || pWidgetAcc->GetClassID() == XFA_ELEMENT_Draw) { | |
418 return XFA_EVENTERROR_NotExist; | |
419 } | |
420 switch (pParam->m_eType) { | |
421 case XFA_EVENT_Calculate: | |
422 return pWidgetAcc->ProcessCalculate(); | |
423 case XFA_EVENT_Validate: | |
424 if (((CXFA_FFDoc*)pDocView->GetDoc()) | |
425 ->GetDocProvider() | |
426 ->IsValidationsEnabled(pDocView->GetDoc())) { | |
427 return pWidgetAcc->ProcessValidate(0x01); | |
428 } | |
429 return XFA_EVENTERROR_Disabled; | |
430 case XFA_EVENT_InitCalculate: { | |
431 CXFA_Calculate calc = pWidgetAcc->GetCalculate(); | |
432 if (!calc) { | |
433 return XFA_EVENTERROR_NotExist; | |
434 } | |
435 if (pWidgetAcc->GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) { | |
436 return XFA_EVENTERROR_Disabled; | |
437 } | |
438 CXFA_Script script = calc.GetScript(); | |
439 return pWidgetAcc->ExecuteScript(script, pParam); | |
440 } | |
441 default: | |
442 break; | |
443 } | |
444 int32_t iRet = | |
445 pWidgetAcc->ProcessEvent(gs_EventActivity[pParam->m_eType], pParam); | |
446 return iRet; | |
447 } | |
448 int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode, | |
449 XFA_EVENTTYPE eEventType, | |
450 FX_BOOL bIsFormReady, | |
451 FX_BOOL bRecursive, | |
452 CXFA_Node* pExclude) { | |
453 int32_t iRet = XFA_EVENTERROR_NotExist; | |
454 if (pFormNode == pExclude) { | |
455 return iRet; | |
456 } | |
457 XFA_ELEMENT elementType = pFormNode->GetClassID(); | |
458 if (elementType == XFA_ELEMENT_Field) { | |
459 if (eEventType == XFA_EVENT_IndexChange) { | |
460 return iRet; | |
461 } | |
462 CXFA_WidgetAcc* pWidgetAcc = (CXFA_WidgetAcc*)pFormNode->GetWidgetData(); | |
463 if (pWidgetAcc == NULL) { | |
464 return iRet; | |
465 } | |
466 CXFA_EventParam eParam; | |
467 eParam.m_eType = eEventType; | |
468 eParam.m_pTarget = pWidgetAcc; | |
469 eParam.m_bIsFormReady = bIsFormReady; | |
470 return XFA_ProcessEvent(this, pWidgetAcc, &eParam); | |
471 } | |
472 if (bRecursive) { | |
473 for (CXFA_Node* pNode = pFormNode->GetNodeItem( | |
474 XFA_NODEITEM_FirstChild, XFA_OBJECTTYPE_ContainerNode); | |
475 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling, | |
476 XFA_OBJECTTYPE_ContainerNode)) { | |
477 elementType = pNode->GetClassID(); | |
478 if (elementType != XFA_ELEMENT_Variables && | |
479 elementType != XFA_ELEMENT_Draw) { | |
480 iRet |= ExecEventActivityByDeepFirst(pNode, eEventType, bIsFormReady, | |
481 bRecursive, pExclude); | |
482 } | |
483 } | |
484 } | |
485 CXFA_WidgetAcc* pWidgetAcc = (CXFA_WidgetAcc*)pFormNode->GetWidgetData(); | |
486 if (pWidgetAcc == NULL) { | |
487 return iRet; | |
488 } | |
489 CXFA_EventParam eParam; | |
490 eParam.m_eType = eEventType; | |
491 eParam.m_pTarget = pWidgetAcc; | |
492 eParam.m_bIsFormReady = bIsFormReady; | |
493 iRet |= XFA_ProcessEvent(this, pWidgetAcc, &eParam); | |
494 return iRet; | |
495 } | |
496 CXFA_FFWidget* CXFA_FFDocView::GetWidgetByName(const CFX_WideStringC& wsName, | |
497 CXFA_FFWidget* pRefWidget) { | |
498 CXFA_WidgetAcc* pRefAcc = pRefWidget ? pRefWidget->GetDataAcc() : NULL; | |
499 if (CXFA_WidgetAcc* pAcc = GetWidgetAccByName(wsName, pRefAcc)) { | |
500 return pAcc->GetNextWidget(NULL); | |
501 } | |
502 return NULL; | |
503 } | |
504 CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( | |
505 const CFX_WideStringC& wsName, | |
506 CXFA_WidgetAcc* pRefWidgetAcc) { | |
507 CFX_WideString wsExpression; | |
508 FX_DWORD dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | | |
509 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; | |
510 IXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext(); | |
511 if (!pScriptContext) { | |
512 return NULL; | |
513 } | |
514 CXFA_Node* refNode = NULL; | |
515 if (pRefWidgetAcc) { | |
516 refNode = pRefWidgetAcc->GetNode(); | |
517 wsExpression = wsName; | |
518 } else { | |
519 wsExpression = L"$form." + wsName; | |
520 } | |
521 XFA_RESOLVENODE_RS resoveNodeRS; | |
522 int32_t iRet = pScriptContext->ResolveObjects(refNode, wsExpression, | |
523 resoveNodeRS, dwStyle); | |
524 if (iRet < 1) { | |
525 return NULL; | |
526 } | |
527 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { | |
528 CXFA_Node* pNode = resoveNodeRS.nodes[0]->AsNode(); | |
529 if (pNode) { | |
530 return (CXFA_WidgetAcc*)pNode->GetWidgetData(); | |
531 } | |
532 } | |
533 return NULL; | |
534 } | |
535 void CXFA_FFDocView::OnPageEvent(IXFA_LayoutPage* pSender, | |
536 XFA_PAGEEVENT eEvent, | |
537 int32_t iPageIndex) { | |
538 CXFA_FFPageView* pFFPageView = static_cast<CXFA_FFPageView*>(pSender); | |
539 if (eEvent == XFA_PAGEEVENT_PageRemoved) { | |
540 m_pDoc->GetDocProvider()->PageViewEvent(pFFPageView, | |
541 XFA_PAGEVIEWEVENT_PostRemoved); | |
542 return; | |
543 } | |
544 m_pDoc->GetDocProvider()->PageViewEvent(pFFPageView, | |
545 XFA_PAGEVIEWEVENT_PostAdded); | |
546 pFFPageView->LoadPageView(); | |
547 } | |
548 void CXFA_FFDocView::LockUpdate() { | |
549 m_iLock++; | |
550 } | |
551 void CXFA_FFDocView::UnlockUpdate() { | |
552 m_iLock--; | |
553 } | |
554 FX_BOOL CXFA_FFDocView::IsUpdateLocked() { | |
555 return m_iLock; | |
556 } | |
557 void CXFA_FFDocView::ClearInvalidateList() { | |
558 FX_POSITION ps = m_mapPageInvalidate.GetStartPosition(); | |
559 while (ps) { | |
560 void* pPageView = NULL; | |
561 CFX_RectF* pRect = NULL; | |
562 m_mapPageInvalidate.GetNextAssoc(ps, pPageView, (void*&)pRect); | |
563 delete pRect; | |
564 } | |
565 m_mapPageInvalidate.RemoveAll(); | |
566 } | |
567 void CXFA_FFDocView::AddInvalidateRect(CXFA_FFWidget* pWidget, | |
568 const CFX_RectF& rtInvalidate) { | |
569 AddInvalidateRect(pWidget->GetPageView(), rtInvalidate); | |
570 } | |
571 void CXFA_FFDocView::AddInvalidateRect(IXFA_PageView* pPageView, | |
572 const CFX_RectF& rtInvalidate) { | |
573 CFX_RectF* pRect = (CFX_RectF*)m_mapPageInvalidate.GetValueAt(pPageView); | |
574 if (!pRect) { | |
575 pRect = new CFX_RectF; | |
576 pRect->Set(rtInvalidate.left, rtInvalidate.top, rtInvalidate.width, | |
577 rtInvalidate.height); | |
578 m_mapPageInvalidate.SetAt(pPageView, pRect); | |
579 } else { | |
580 pRect->Union(rtInvalidate); | |
581 } | |
582 } | |
583 void CXFA_FFDocView::RunInvalidate() { | |
584 FX_POSITION ps = m_mapPageInvalidate.GetStartPosition(); | |
585 while (ps) { | |
586 IXFA_PageView* pPageView = NULL; | |
587 CFX_RectF* pRect = NULL; | |
588 m_mapPageInvalidate.GetNextAssoc(ps, (void*&)pPageView, (void*&)pRect); | |
589 m_pDoc->GetDocProvider()->InvalidateRect(pPageView, *pRect); | |
590 delete pRect; | |
591 } | |
592 m_mapPageInvalidate.RemoveAll(); | |
593 } | |
594 FX_BOOL CXFA_FFDocView::RunLayout() { | |
595 LockUpdate(); | |
596 m_bInLayoutStatus = TRUE; | |
597 if (!m_pXFADocLayout->IncrementLayout() && | |
598 m_pXFADocLayout->StartLayout() < 100) { | |
599 m_pXFADocLayout->DoLayout(); | |
600 UnlockUpdate(); | |
601 m_bInLayoutStatus = FALSE; | |
602 return TRUE; | |
603 } | |
604 m_bInLayoutStatus = FALSE; | |
605 UnlockUpdate(); | |
606 return FALSE; | |
607 } | |
608 void CXFA_FFDocView::RunSubformIndexChange() { | |
609 int32_t iSubforms = m_IndexChangedSubforms.GetSize(); | |
610 for (int32_t i = 0; i < iSubforms; i++) { | |
611 CXFA_Node* pSubformNode = | |
612 reinterpret_cast<CXFA_Node*>(m_IndexChangedSubforms[i]); | |
613 CXFA_WidgetAcc* pWidgetAcc = (CXFA_WidgetAcc*)pSubformNode->GetWidgetData(); | |
614 if (!pWidgetAcc) { | |
615 continue; | |
616 } | |
617 CXFA_EventParam eParam; | |
618 eParam.m_eType = XFA_EVENT_IndexChange; | |
619 eParam.m_pTarget = pWidgetAcc; | |
620 pWidgetAcc->ProcessEvent(XFA_ATTRIBUTEENUM_IndexChange, &eParam); | |
621 } | |
622 m_IndexChangedSubforms.RemoveAll(); | |
623 } | |
624 void CXFA_FFDocView::AddNewFormNode(CXFA_Node* pNode) { | |
625 m_NewAddedNodes.Add(pNode); | |
626 InitLayout(pNode); | |
627 } | |
628 void CXFA_FFDocView::AddIndexChangedSubform(CXFA_Node* pNode) { | |
629 FXSYS_assert(pNode->GetClassID() == XFA_ELEMENT_Subform); | |
630 m_IndexChangedSubforms.Add(pNode); | |
631 } | |
632 void CXFA_FFDocView::RunDocClose() { | |
633 CXFA_Node* pRootItem = | |
634 ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)); | |
635 if (!pRootItem) { | |
636 return; | |
637 } | |
638 ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_DocClose); | |
639 } | |
640 void CXFA_FFDocView::DestroyDocView() { | |
641 ClearInvalidateList(); | |
642 m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_None; | |
643 m_iLock = 0; | |
644 m_ValidateAccs.RemoveAll(); | |
645 m_bindItems.RemoveAll(); | |
646 m_CalculateAccs.RemoveAll(); | |
647 } | |
648 FX_BOOL CXFA_FFDocView::IsStaticNotify() { | |
649 return m_pDoc->GetDocType() == XFA_DOCTYPE_Static; | |
650 } | |
651 void CXFA_FFDocView::AddCalculateWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) { | |
652 int32_t iAccs = m_CalculateAccs.GetSize(); | |
653 CXFA_WidgetAcc* pCurrentAcc = | |
654 (iAccs < 1) ? (CXFA_WidgetAcc*)NULL | |
655 : (CXFA_WidgetAcc*)m_CalculateAccs[iAccs - 1]; | |
656 if (pCurrentAcc != pWidgetAcc) { | |
657 m_CalculateAccs.Add(pWidgetAcc); | |
658 } | |
659 } | |
660 void CXFA_FFDocView::AddCalculateNodeNotify(CXFA_Node* pNodeChange) { | |
661 CXFA_CalcData* pGlobalData = | |
662 (CXFA_CalcData*)pNodeChange->GetUserData(XFA_CalcData); | |
663 int32_t iCount = pGlobalData ? pGlobalData->m_Globals.GetSize() : 0; | |
664 for (int32_t i = 0; i < iCount; i++) { | |
665 CXFA_WidgetAcc* pResultAcc = (CXFA_WidgetAcc*)pGlobalData->m_Globals[i]; | |
666 if (pResultAcc->GetNode()->HasFlag(XFA_NODEFLAG_HasRemoved)) { | |
667 continue; | |
668 } | |
669 int32_t iAccs = m_CalculateAccs.GetSize(); | |
670 CXFA_WidgetAcc* pCurrentAcc = | |
671 (iAccs < 1) ? (CXFA_WidgetAcc*)NULL | |
672 : (CXFA_WidgetAcc*)m_CalculateAccs[iAccs - 1]; | |
673 if (pCurrentAcc != pResultAcc) { | |
674 m_CalculateAccs.Add(pResultAcc); | |
675 } | |
676 } | |
677 } | |
678 void CXFA_FFDocView::RunCalculateRecursive(int32_t& iIndex) { | |
679 while (iIndex < m_CalculateAccs.GetSize()) { | |
680 CXFA_WidgetAcc* pCurAcc = (CXFA_WidgetAcc*)m_CalculateAccs[iIndex]; | |
681 AddCalculateNodeNotify(pCurAcc->GetNode()); | |
682 int32_t iRefCount = | |
683 (int32_t)(uintptr_t)pCurAcc->GetNode()->GetUserData(XFA_CalcRefCount); | |
684 iRefCount++; | |
685 pCurAcc->GetNode()->SetUserData(XFA_CalcRefCount, | |
686 (void*)(uintptr_t)iRefCount); | |
687 if (iRefCount > 11) { | |
688 break; | |
689 } | |
690 if ((pCurAcc->ProcessCalculate()) == XFA_EVENTERROR_Sucess) { | |
691 AddValidateWidget(pCurAcc); | |
692 } | |
693 iIndex++; | |
694 RunCalculateRecursive(iIndex); | |
695 } | |
696 } | |
697 int32_t CXFA_FFDocView::RunCalculateWidgets() { | |
698 if (!m_pDoc->GetDocProvider()->IsCalculationsEnabled(m_pDoc)) { | |
699 return XFA_EVENTERROR_Disabled; | |
700 } | |
701 int32_t iCounts = m_CalculateAccs.GetSize(); | |
702 int32_t iIndex = 0; | |
703 if (iCounts > 0) { | |
704 RunCalculateRecursive(iIndex); | |
705 } | |
706 for (int32_t i = 0; i < m_CalculateAccs.GetSize(); i++) { | |
707 CXFA_WidgetAcc* pCurAcc = (CXFA_WidgetAcc*)m_CalculateAccs[i]; | |
708 pCurAcc->GetNode()->SetUserData(XFA_CalcRefCount, (void*)(uintptr_t)0); | |
709 } | |
710 m_CalculateAccs.RemoveAll(); | |
711 return XFA_EVENTERROR_Sucess; | |
712 } | |
713 void CXFA_FFDocView::AddValidateWidget(CXFA_WidgetAcc* pWidget) { | |
714 if (m_ValidateAccs.Find(pWidget) < 0) { | |
715 m_ValidateAccs.Add(pWidget); | |
716 } | |
717 } | |
718 FX_BOOL CXFA_FFDocView::InitCalculate(CXFA_Node* pNode) { | |
719 ExecEventActivityByDeepFirst(pNode, XFA_EVENT_InitCalculate); | |
720 return TRUE; | |
721 } | |
722 FX_BOOL CXFA_FFDocView::InitValidate(CXFA_Node* pNode) { | |
723 if (!m_pDoc->GetDocProvider()->IsValidationsEnabled(m_pDoc)) { | |
724 return FALSE; | |
725 } | |
726 ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Validate); | |
727 m_ValidateAccs.RemoveAll(); | |
728 return TRUE; | |
729 } | |
730 FX_BOOL CXFA_FFDocView::RunValidate() { | |
731 if (!m_pDoc->GetDocProvider()->IsValidationsEnabled(m_pDoc)) { | |
732 return FALSE; | |
733 } | |
734 int32_t iCounts = m_ValidateAccs.GetSize(); | |
735 for (int32_t i = 0; i < iCounts; i++) { | |
736 CXFA_WidgetAcc* pAcc = (CXFA_WidgetAcc*)m_ValidateAccs[i]; | |
737 if (pAcc->GetNode()->HasFlag(XFA_NODEFLAG_HasRemoved)) { | |
738 continue; | |
739 } | |
740 pAcc->ProcessValidate(); | |
741 } | |
742 m_ValidateAccs.RemoveAll(); | |
743 return TRUE; | |
744 } | |
745 FX_BOOL CXFA_FFDocView::RunEventLayoutReady() { | |
746 CXFA_Node* pRootItem = | |
747 ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)); | |
748 if (!pRootItem) { | |
749 return FALSE; | |
750 } | |
751 ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready); | |
752 RunLayout(); | |
753 return TRUE; | |
754 } | |
755 void CXFA_FFDocView::RunBindItems() { | |
756 int32_t iCount = m_bindItems.GetSize(); | |
757 for (int32_t i = 0; i < iCount; i++) { | |
758 if (reinterpret_cast<CXFA_Node*>(m_bindItems[i]) | |
759 ->HasFlag(XFA_NODEFLAG_HasRemoved)) { | |
760 continue; | |
761 } | |
762 CXFA_Node* pWidgetNode = reinterpret_cast<CXFA_Node*>(m_bindItems[i]) | |
763 ->GetNodeItem(XFA_NODEITEM_Parent); | |
764 CXFA_WidgetAcc* pAcc = (CXFA_WidgetAcc*)pWidgetNode->GetWidgetData(); | |
765 if (!pAcc) { | |
766 continue; | |
767 } | |
768 CXFA_BindItems binditems(reinterpret_cast<CXFA_Node*>(m_bindItems[i])); | |
769 IXFA_ScriptContext* pScriptContext = | |
770 pWidgetNode->GetDocument()->GetScriptContext(); | |
771 CFX_WideStringC wsRef; | |
772 binditems.GetRef(wsRef); | |
773 FX_DWORD dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | | |
774 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent | | |
775 XFA_RESOLVENODE_ALL; | |
776 XFA_RESOLVENODE_RS rs; | |
777 pScriptContext->ResolveObjects(pWidgetNode, wsRef, rs, dwStyle); | |
778 int32_t iCount = rs.nodes.GetSize(); | |
779 pAcc->DeleteItem(-1); | |
780 if (rs.dwFlags != XFA_RESOVENODE_RSTYPE_Nodes || iCount < 1) { | |
781 continue; | |
782 } | |
783 CFX_WideStringC wsValueRef, wsLabelRef; | |
784 binditems.GetValueRef(wsValueRef); | |
785 binditems.GetLabelRef(wsLabelRef); | |
786 const bool bUseValue = wsLabelRef.IsEmpty() || wsLabelRef == wsValueRef; | |
787 const bool bLabelUseContent = | |
788 wsLabelRef.IsEmpty() || wsLabelRef == FX_WSTRC(L"$"); | |
789 const bool bValueUseContent = | |
790 wsValueRef.IsEmpty() || wsValueRef == FX_WSTRC(L"$"); | |
791 CFX_WideString wsValue, wsLabel; | |
792 FX_DWORD uValueHash = FX_HashCode_String_GetW(CFX_WideString(wsValueRef), | |
793 wsValueRef.GetLength()); | |
794 for (int32_t i = 0; i < iCount; i++) { | |
795 CXFA_Object* refObj = rs.nodes[i]; | |
796 if (!refObj->IsNode()) { | |
797 continue; | |
798 } | |
799 CXFA_Node* refNode = refObj->AsNode(); | |
800 if (bValueUseContent) { | |
801 wsValue = refNode->GetContent(); | |
802 } else { | |
803 CXFA_Node* nodeValue = refNode->GetFirstChildByName(uValueHash); | |
804 if (nodeValue == NULL) { | |
805 wsValue = refNode->GetContent(); | |
806 } else { | |
807 wsValue = nodeValue->GetContent(); | |
808 } | |
809 } | |
810 if (!bUseValue) { | |
811 if (bLabelUseContent) { | |
812 wsLabel = refNode->GetContent(); | |
813 } else { | |
814 CXFA_Node* nodeLabel = refNode->GetFirstChildByName(wsLabelRef); | |
815 if (nodeLabel) | |
816 wsLabel = nodeLabel->GetContent(); | |
817 } | |
818 } else { | |
819 wsLabel = wsValue; | |
820 } | |
821 pAcc->InsertItem(wsLabel, wsValue); | |
822 } | |
823 } | |
824 m_bindItems.RemoveAll(); | |
825 } | |
826 void CXFA_FFDocView::SetChangeMark() { | |
827 if (m_iStatus < XFA_DOCVIEW_LAYOUTSTATUS_End) { | |
828 return; | |
829 } | |
830 m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); | |
831 } | |
832 CXFA_Node* CXFA_FFDocView::GetRootSubform() { | |
833 CXFA_Node* pFormPacketNode = | |
834 ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)); | |
835 if (!pFormPacketNode) { | |
836 return NULL; | |
837 } | |
838 return pFormPacketNode->GetFirstChildByClass(XFA_ELEMENT_Subform); | |
839 } | |
840 CXFA_FFDocWidgetIterator::CXFA_FFDocWidgetIterator(CXFA_FFDocView* pDocView, | |
841 CXFA_Node* pTravelRoot) | |
842 : m_ContentIterator(pTravelRoot) { | |
843 m_pDocView = pDocView; | |
844 m_pCurWidget = NULL; | |
845 } | |
846 CXFA_FFDocWidgetIterator::~CXFA_FFDocWidgetIterator() {} | |
847 void CXFA_FFDocWidgetIterator::Reset() { | |
848 m_ContentIterator.Reset(); | |
849 m_pCurWidget = NULL; | |
850 } | |
851 IXFA_Widget* CXFA_FFDocWidgetIterator::MoveToFirst() { | |
852 return NULL; | |
853 } | |
854 IXFA_Widget* CXFA_FFDocWidgetIterator::MoveToLast() { | |
855 return NULL; | |
856 } | |
857 IXFA_Widget* CXFA_FFDocWidgetIterator::MoveToNext() { | |
858 CXFA_Node* pItem = m_pCurWidget ? m_ContentIterator.MoveToNext() | |
859 : m_ContentIterator.GetCurrent(); | |
860 while (pItem) { | |
861 if (CXFA_WidgetAcc* pAcc = (CXFA_WidgetAcc*)pItem->GetWidgetData()) { | |
862 while ((m_pCurWidget = pAcc->GetNextWidget(NULL))) { | |
863 if (!m_pCurWidget->IsLoaded() && | |
864 (m_pCurWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) { | |
865 m_pCurWidget->LoadWidget(); | |
866 } | |
867 return m_pCurWidget; | |
868 } | |
869 } | |
870 pItem = m_ContentIterator.MoveToNext(); | |
871 } | |
872 return NULL; | |
873 } | |
874 IXFA_Widget* CXFA_FFDocWidgetIterator::MoveToPrevious() { | |
875 return NULL; | |
876 } | |
877 IXFA_Widget* CXFA_FFDocWidgetIterator::GetCurrentWidget() { | |
878 return NULL; | |
879 } | |
880 FX_BOOL CXFA_FFDocWidgetIterator::SetCurrentWidget(IXFA_Widget* hWidget) { | |
881 return FALSE; | |
882 } | |
883 IXFA_WidgetAccIterator* XFA_WidgetAccIterator_Create( | |
884 CXFA_WidgetAcc* pTravelRoot, | |
885 XFA_WIDGETORDER eOrder) { | |
886 if (!pTravelRoot) { | |
887 return NULL; | |
888 } | |
889 return new CXFA_WidgetAccIterator(pTravelRoot->GetDocView(), | |
890 pTravelRoot->GetNode()); | |
891 } | |
892 CXFA_WidgetAccIterator::CXFA_WidgetAccIterator(CXFA_FFDocView* pDocView, | |
893 CXFA_Node* pTravelRoot) | |
894 : m_ContentIterator(pTravelRoot) { | |
895 m_pDocView = pDocView; | |
896 m_pCurWidgetAcc = NULL; | |
897 } | |
898 CXFA_WidgetAccIterator::~CXFA_WidgetAccIterator() {} | |
899 void CXFA_WidgetAccIterator::Reset() { | |
900 m_pCurWidgetAcc = NULL; | |
901 m_ContentIterator.Reset(); | |
902 } | |
903 CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToFirst() { | |
904 return NULL; | |
905 } | |
906 CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToLast() { | |
907 return NULL; | |
908 } | |
909 CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToNext() { | |
910 CXFA_Node* pItem = m_pCurWidgetAcc ? m_ContentIterator.MoveToNext() | |
911 : m_ContentIterator.GetCurrent(); | |
912 while (pItem) { | |
913 if ((m_pCurWidgetAcc = (CXFA_WidgetAcc*)pItem->GetWidgetData())) { | |
914 return m_pCurWidgetAcc; | |
915 } | |
916 pItem = m_ContentIterator.MoveToNext(); | |
917 } | |
918 return NULL; | |
919 } | |
920 CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToPrevious() { | |
921 return NULL; | |
922 } | |
923 CXFA_WidgetAcc* CXFA_WidgetAccIterator::GetCurrentWidgetAcc() { | |
924 return NULL; | |
925 } | |
926 FX_BOOL CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) { | |
927 return FALSE; | |
928 } | |
929 void CXFA_WidgetAccIterator::SkipTree() { | |
930 m_ContentIterator.SkipChildrenAndMoveToNext(); | |
931 m_pCurWidgetAcc = NULL; | |
932 } | |
OLD | NEW |