OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../../foxitlib.h" | 7 #include "../../../foxitlib.h" |
8 #include "../common/xfa_common.h" | 8 #include "../common/xfa_common.h" |
9 #include "xfa_fwladapter.h" | 9 #include "xfa_fwladapter.h" |
10 #include "xfa_ffdocview.h" | 10 #include "xfa_ffdocview.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 delete m_pWidgetHandler; | 79 delete m_pWidgetHandler; |
80 } | 80 } |
81 m_pWidgetHandler = NULL; | 81 m_pWidgetHandler = NULL; |
82 } | 82 } |
83 void CXFA_FFDocView::InitLayout(CXFA_Node* pNode) | 83 void CXFA_FFDocView::InitLayout(CXFA_Node* pNode) |
84 { | 84 { |
85 RunBindItems(); | 85 RunBindItems(); |
86 ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Initialize); | 86 ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Initialize); |
87 ExecEventActivityByDeepFirst(pNode, XFA_EVENT_IndexChange); | 87 ExecEventActivityByDeepFirst(pNode, XFA_EVENT_IndexChange); |
88 } | 88 } |
89 FX_INT32 CXFA_FFDocView::StartLayout(FX_INT32 iStartPage ) | 89 int32_t CXFA_FFDocView::StartLayout(int32_t iStartPage ) |
90 { | 90 { |
91 m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Start; | 91 m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Start; |
92 m_pDoc->GetXFADoc()->DoProtoMerge(); | 92 m_pDoc->GetXFADoc()->DoProtoMerge(); |
93 m_pDoc->GetXFADoc()->DoDataMerge(); | 93 m_pDoc->GetXFADoc()->DoDataMerge(); |
94 m_pXFADocLayout = GetXFALayout(); | 94 m_pXFADocLayout = GetXFALayout(); |
95 FX_INT32 iStatus = m_pXFADocLayout->StartLayout(); | 95 int32_t iStatus = m_pXFADocLayout->StartLayout(); |
96 if (iStatus < 0) { | 96 if (iStatus < 0) { |
97 return iStatus; | 97 return iStatus; |
98 } | 98 } |
99 CXFA_Node* pRootItem = (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFANode(XFA_HASHC
ODE_Form); | 99 CXFA_Node* pRootItem = (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFANode(XFA_HASHC
ODE_Form); |
100 if (!pRootItem) { | 100 if (!pRootItem) { |
101 return iStatus; | 101 return iStatus; |
102 } | 102 } |
103 InitLayout(pRootItem); | 103 InitLayout(pRootItem); |
104 InitCalculate(pRootItem); | 104 InitCalculate(pRootItem); |
105 InitValidate(pRootItem); | 105 InitValidate(pRootItem); |
106 ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, TRUE); | 106 ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, TRUE); |
107 m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Start; | 107 m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Start; |
108 return iStatus; | 108 return iStatus; |
109 } | 109 } |
110 FX_INT32 CXFA_FFDocView::DoLayout(IFX_Pause *pPause ) | 110 int32_t CXFA_FFDocView::DoLayout(IFX_Pause *pPause ) |
111 { | 111 { |
112 FX_INT32 iStatus = 100; | 112 int32_t iStatus = 100; |
113 iStatus = m_pXFADocLayout->DoLayout(pPause); | 113 iStatus = m_pXFADocLayout->DoLayout(pPause); |
114 if (iStatus != 100) { | 114 if (iStatus != 100) { |
115 return iStatus; | 115 return iStatus; |
116 } | 116 } |
117 m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Doing; | 117 m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Doing; |
118 return iStatus; | 118 return iStatus; |
119 } | 119 } |
120 void CXFA_FFDocView::StopLayout() | 120 void CXFA_FFDocView::StopLayout() |
121 { | 121 { |
122 CXFA_Node* pRootItem = (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFANode(XFA_HASHC
ODE_Form); | 122 CXFA_Node* pRootItem = (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFANode(XFA_HASHC
ODE_Form); |
(...skipping 20 matching lines...) Expand all Loading... |
143 RunValidate(); | 143 RunValidate(); |
144 if(RunLayout()) { | 144 if(RunLayout()) { |
145 ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready); | 145 ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready); |
146 } | 146 } |
147 m_CalculateAccs.RemoveAll(); | 147 m_CalculateAccs.RemoveAll(); |
148 if (m_pFocusAcc && !m_pFocusWidget) { | 148 if (m_pFocusAcc && !m_pFocusWidget) { |
149 SetFocusWidgetAcc(m_pFocusAcc); | 149 SetFocusWidgetAcc(m_pFocusAcc); |
150 } | 150 } |
151 m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_End; | 151 m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_End; |
152 } | 152 } |
153 FX_INT32 CXFA_FFDocView::GetLayoutStatus() | 153 int32_t CXFA_FFDocView::GetLayoutStatus() |
154 { | 154 { |
155 return m_iStatus; | 155 return m_iStatus; |
156 } | 156 } |
157 void CXFA_FFDocView::ShowNullTestMsg() | 157 void CXFA_FFDocView::ShowNullTestMsg() |
158 { | 158 { |
159 FX_INT32 iCount = m_arrNullTestMsg.GetSize(); | 159 int32_t iCount = m_arrNullTestMsg.GetSize(); |
160 CXFA_FFApp* pApp = m_pDoc->GetApp(); | 160 CXFA_FFApp* pApp = m_pDoc->GetApp(); |
161 IXFA_AppProvider* pAppProvider = pApp->GetAppProvider(); | 161 IXFA_AppProvider* pAppProvider = pApp->GetAppProvider(); |
162 if (pAppProvider && iCount) { | 162 if (pAppProvider && iCount) { |
163 FX_INT32 iRemain = iCount > 7 ? iCount - 7 : 0; | 163 int32_t iRemain = iCount > 7 ? iCount - 7 : 0; |
164 iCount -= iRemain; | 164 iCount -= iRemain; |
165 CFX_WideString wsMsg; | 165 CFX_WideString wsMsg; |
166 for (FX_INT32 i = 0; i < iCount; i++) { | 166 for (int32_t i = 0; i < iCount; i++) { |
167 wsMsg += m_arrNullTestMsg[i] + FX_WSTRC(L"\n"); | 167 wsMsg += m_arrNullTestMsg[i] + FX_WSTRC(L"\n"); |
168 } | 168 } |
169 if (iRemain > 0) { | 169 if (iRemain > 0) { |
170 CFX_WideString wsLimit; | 170 CFX_WideString wsLimit; |
171 pAppProvider->LoadString(XFA_IDS_ValidateLimit, wsLimit); | 171 pAppProvider->LoadString(XFA_IDS_ValidateLimit, wsLimit); |
172 if (!wsLimit.IsEmpty()) { | 172 if (!wsLimit.IsEmpty()) { |
173 CFX_WideString wsTemp; | 173 CFX_WideString wsTemp; |
174 wsTemp.Format((FX_LPCWSTR)wsLimit, iRemain); | 174 wsTemp.Format((FX_LPCWSTR)wsLimit, iRemain); |
175 wsMsg += FX_WSTRC(L"\n") + wsTemp; | 175 wsMsg += FX_WSTRC(L"\n") + wsTemp; |
176 } | 176 } |
177 } | 177 } |
178 CFX_WideString wsTitle; | 178 CFX_WideString wsTitle; |
179 pAppProvider->LoadString(XFA_IDS_AppName, wsTitle); | 179 pAppProvider->LoadString(XFA_IDS_AppName, wsTitle); |
180 pAppProvider->MsgBox(wsMsg, wsTitle, XFA_MBICON_Status, XFA_MB_OK); | 180 pAppProvider->MsgBox(wsMsg, wsTitle, XFA_MBICON_Status, XFA_MB_OK); |
181 } | 181 } |
182 m_arrNullTestMsg.RemoveAll(); | 182 m_arrNullTestMsg.RemoveAll(); |
183 } | 183 } |
184 void CXFA_FFDocView::UpdateDocView() | 184 void CXFA_FFDocView::UpdateDocView() |
185 { | 185 { |
186 if (IsUpdateLocked()) { | 186 if (IsUpdateLocked()) { |
187 return; | 187 return; |
188 } | 188 } |
189 LockUpdate(); | 189 LockUpdate(); |
190 FX_INT32 iNewAdds = m_NewAddedNodes.GetSize(); | 190 int32_t iNewAdds = m_NewAddedNodes.GetSize(); |
191 for (FX_INT32 i = 0; i < iNewAdds; i++) { | 191 for (int32_t i = 0; i < iNewAdds; i++) { |
192 CXFA_Node* pNode = (CXFA_Node*)m_NewAddedNodes[i]; | 192 CXFA_Node* pNode = (CXFA_Node*)m_NewAddedNodes[i]; |
193 InitCalculate(pNode); | 193 InitCalculate(pNode); |
194 InitValidate(pNode); | 194 InitValidate(pNode); |
195 ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Ready, TRUE); | 195 ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Ready, TRUE); |
196 } | 196 } |
197 m_NewAddedNodes.RemoveAll(); | 197 m_NewAddedNodes.RemoveAll(); |
198 this->RunSubformIndexChange(); | 198 this->RunSubformIndexChange(); |
199 this->RunCalculateWidgets(); | 199 this->RunCalculateWidgets(); |
200 this->RunValidate(); | 200 this->RunValidate(); |
201 ShowNullTestMsg(); | 201 ShowNullTestMsg(); |
202 m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Next; | 202 m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Next; |
203 if (RunLayout() && m_bLayoutEvent) { | 203 if (RunLayout() && m_bLayoutEvent) { |
204 RunEventLayoutReady(); | 204 RunEventLayoutReady(); |
205 } | 205 } |
206 m_bLayoutEvent = FALSE; | 206 m_bLayoutEvent = FALSE; |
207 m_CalculateAccs.RemoveAll(); | 207 m_CalculateAccs.RemoveAll(); |
208 this->RunInvalidate(); | 208 this->RunInvalidate(); |
209 UnlockUpdate(); | 209 UnlockUpdate(); |
210 } | 210 } |
211 FX_INT32 CXFA_FFDocView::CountPageViews() | 211 int32_t CXFA_FFDocView::CountPageViews() |
212 { | 212 { |
213 if (!m_pXFADocLayout) { | 213 if (!m_pXFADocLayout) { |
214 return 0; | 214 return 0; |
215 } | 215 } |
216 return m_pXFADocLayout->CountPages(); | 216 return m_pXFADocLayout->CountPages(); |
217 } | 217 } |
218 IXFA_PageView* CXFA_FFDocView::GetPageView(FX_INT32 nIndex) | 218 IXFA_PageView* CXFA_FFDocView::GetPageView(int32_t nIndex) |
219 { | 219 { |
220 if (!m_pXFADocLayout) { | 220 if (!m_pXFADocLayout) { |
221 return NULL; | 221 return NULL; |
222 } | 222 } |
223 return (CXFA_FFPageView*)m_pXFADocLayout->GetPage(nIndex); | 223 return (CXFA_FFPageView*)m_pXFADocLayout->GetPage(nIndex); |
224 } | 224 } |
225 IXFA_Widget* CXFA_FFDocView::GetWidgetByName(FX_WSTR wsName) | 225 IXFA_Widget* CXFA_FFDocView::GetWidgetByName(FX_WSTR wsName) |
226 { | 226 { |
227 return GetWidgetByName(wsName, NULL); | 227 return GetWidgetByName(wsName, NULL); |
228 } | 228 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 bChanged |= ResetSingleWidgetAccData(pAcc); | 273 bChanged |= ResetSingleWidgetAccData(pAcc); |
274 if (pAcc->GetNode()->GetClassID() == XFA_ELEMENT_ExclGroup) { | 274 if (pAcc->GetNode()->GetClassID() == XFA_ELEMENT_ExclGroup) { |
275 Iterator.SkipTree(); | 275 Iterator.SkipTree(); |
276 } | 276 } |
277 } | 277 } |
278 } | 278 } |
279 if (bChanged) { | 279 if (bChanged) { |
280 m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); | 280 m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); |
281 } | 281 } |
282 } | 282 } |
283 FX_INT32 CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam, CXFA_Widget
Acc* pWidgetAcc ) | 283 int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam, CXFA_WidgetA
cc* pWidgetAcc ) |
284 { | 284 { |
285 if (pParam == NULL) { | 285 if (pParam == NULL) { |
286 return XFA_EVENTERROR_Error; | 286 return XFA_EVENTERROR_Error; |
287 } | 287 } |
288 if (pParam->m_eType == XFA_EVENT_Validate) { | 288 if (pParam->m_eType == XFA_EVENT_Validate) { |
289 CFX_WideString wsValidateStr = FX_WSTRC(L"preSubmit"); | 289 CFX_WideString wsValidateStr = FX_WSTRC(L"preSubmit"); |
290 CXFA_Node* pConfigItem = (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFANode(XFA
_HASHCODE_Config); | 290 CXFA_Node* pConfigItem = (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFANode(XFA
_HASHCODE_Config); |
291 if (pConfigItem) { | 291 if (pConfigItem) { |
292 CXFA_Node* pValidateNode = NULL; | 292 CXFA_Node* pValidateNode = NULL; |
293 CXFA_Node* pAcrobatNode = pConfigItem->GetChild(0, XFA_ELEMENT_Acrob
at); | 293 CXFA_Node* pAcrobatNode = pConfigItem->GetChild(0, XFA_ELEMENT_Acrob
at); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 } | 424 } |
425 } | 425 } |
426 void CXFA_FFDocView::DeleteLayoutItem(CXFA_FFWidget* pWidget) | 426 void CXFA_FFDocView::DeleteLayoutItem(CXFA_FFWidget* pWidget) |
427 { | 427 { |
428 if (m_pFocusAcc == pWidget->GetDataAcc()) { | 428 if (m_pFocusAcc == pWidget->GetDataAcc()) { |
429 m_pFocusAcc = NULL; | 429 m_pFocusAcc = NULL; |
430 m_pFocusWidget = NULL; | 430 m_pFocusWidget = NULL; |
431 m_pOldFocusWidget = NULL; | 431 m_pOldFocusWidget = NULL; |
432 } | 432 } |
433 } | 433 } |
434 static FX_INT32 XFA_ProcessEvent(CXFA_FFDocView* pDocView, CXFA_WidgetAcc* pWidg
etAcc, CXFA_EventParam* pParam) | 434 static int32_t XFA_ProcessEvent(CXFA_FFDocView* pDocView, CXFA_WidgetAcc* pWidge
tAcc, CXFA_EventParam* pParam) |
435 { | 435 { |
436 if (!pParam || pParam->m_eType == XFA_EVENT_Unknown) { | 436 if (!pParam || pParam->m_eType == XFA_EVENT_Unknown) { |
437 return XFA_EVENTERROR_NotExist; | 437 return XFA_EVENTERROR_NotExist; |
438 } | 438 } |
439 if (!pWidgetAcc || pWidgetAcc->GetClassID() == XFA_ELEMENT_Draw) { | 439 if (!pWidgetAcc || pWidgetAcc->GetClassID() == XFA_ELEMENT_Draw) { |
440 return XFA_EVENTERROR_NotExist; | 440 return XFA_EVENTERROR_NotExist; |
441 } | 441 } |
442 switch (pParam->m_eType) { | 442 switch (pParam->m_eType) { |
443 case XFA_EVENT_Calculate: | 443 case XFA_EVENT_Calculate: |
444 return pWidgetAcc->ProcessCalculate(); | 444 return pWidgetAcc->ProcessCalculate(); |
445 case XFA_EVENT_Validate: | 445 case XFA_EVENT_Validate: |
446 if (((CXFA_FFDoc*)pDocView->GetDoc())->GetDocProvider()->IsValidatio
nsEnabled(pDocView->GetDoc())) { | 446 if (((CXFA_FFDoc*)pDocView->GetDoc())->GetDocProvider()->IsValidatio
nsEnabled(pDocView->GetDoc())) { |
447 return pWidgetAcc->ProcessValidate(0x01); | 447 return pWidgetAcc->ProcessValidate(0x01); |
448 } | 448 } |
449 return XFA_EVENTERROR_Disabled; | 449 return XFA_EVENTERROR_Disabled; |
450 case XFA_EVENT_InitCalculate: { | 450 case XFA_EVENT_InitCalculate: { |
451 CXFA_Calculate calc = pWidgetAcc->GetCalculate(); | 451 CXFA_Calculate calc = pWidgetAcc->GetCalculate(); |
452 if (!calc) { | 452 if (!calc) { |
453 return XFA_EVENTERROR_NotExist; | 453 return XFA_EVENTERROR_NotExist; |
454 } | 454 } |
455 if (pWidgetAcc->GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)
) { | 455 if (pWidgetAcc->GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)
) { |
456 return XFA_EVENTERROR_Disabled; | 456 return XFA_EVENTERROR_Disabled; |
457 } | 457 } |
458 CXFA_Script script = calc.GetScript(); | 458 CXFA_Script script = calc.GetScript(); |
459 return pWidgetAcc->ExecuteScript(script, pParam); | 459 return pWidgetAcc->ExecuteScript(script, pParam); |
460 } | 460 } |
461 default: | 461 default: |
462 break; | 462 break; |
463 } | 463 } |
464 FX_INT32 iRet = pWidgetAcc->ProcessEvent(gs_EventActivity[pParam->m_eType],
pParam); | 464 int32_t iRet = pWidgetAcc->ProcessEvent(gs_EventActivity[pParam->m_eType], p
Param); |
465 return iRet; | 465 return iRet; |
466 } | 466 } |
467 FX_INT32 CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode, XFA_
EVENTTYPE eEventType, FX_BOOL bIsFormReady, FX_BOOL bRecursive, CXFA_Node* pExcl
ude) | 467 int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode, XFA_E
VENTTYPE eEventType, FX_BOOL bIsFormReady, FX_BOOL bRecursive, CXFA_Node* pExclu
de) |
468 { | 468 { |
469 FX_INT32 iRet = XFA_EVENTERROR_NotExist; | 469 int32_t iRet = XFA_EVENTERROR_NotExist; |
470 if (pFormNode == pExclude) { | 470 if (pFormNode == pExclude) { |
471 return iRet; | 471 return iRet; |
472 } | 472 } |
473 XFA_ELEMENT elementType = pFormNode->GetClassID(); | 473 XFA_ELEMENT elementType = pFormNode->GetClassID(); |
474 if (elementType == XFA_ELEMENT_Field) { | 474 if (elementType == XFA_ELEMENT_Field) { |
475 if (eEventType == XFA_EVENT_IndexChange) { | 475 if (eEventType == XFA_EVENT_IndexChange) { |
476 return iRet; | 476 return iRet; |
477 } | 477 } |
478 CXFA_WidgetAcc* pWidgetAcc = (CXFA_WidgetAcc*)pFormNode->GetWidgetData()
; | 478 CXFA_WidgetAcc* pWidgetAcc = (CXFA_WidgetAcc*)pFormNode->GetWidgetData()
; |
479 if (pWidgetAcc == NULL) { | 479 if (pWidgetAcc == NULL) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 return NULL; | 521 return NULL; |
522 } | 522 } |
523 CXFA_Node* refNode = NULL; | 523 CXFA_Node* refNode = NULL; |
524 if(pRefWidgetAcc != NULL) { | 524 if(pRefWidgetAcc != NULL) { |
525 refNode = pRefWidgetAcc->GetNode(); | 525 refNode = pRefWidgetAcc->GetNode(); |
526 wsExpression = wsName; | 526 wsExpression = wsName; |
527 } else { | 527 } else { |
528 wsExpression = L"$form." + wsName; | 528 wsExpression = L"$form." + wsName; |
529 } | 529 } |
530 XFA_RESOLVENODE_RS resoveNodeRS; | 530 XFA_RESOLVENODE_RS resoveNodeRS; |
531 FX_INT32 iRet = pScriptContext->ResolveObjects(refNode, wsExpression, resove
NodeRS, dwStyle); | 531 int32_t iRet = pScriptContext->ResolveObjects(refNode, wsExpression, resoveN
odeRS, dwStyle); |
532 if (iRet < 1) { | 532 if (iRet < 1) { |
533 return NULL; | 533 return NULL; |
534 } | 534 } |
535 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { | 535 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { |
536 CXFA_Object* pNode = resoveNodeRS.nodes[0]; | 536 CXFA_Object* pNode = resoveNodeRS.nodes[0]; |
537 if(pNode->IsNode()) { | 537 if(pNode->IsNode()) { |
538 return (CXFA_WidgetAcc*)((CXFA_Node*)pNode)->GetWidgetData(); | 538 return (CXFA_WidgetAcc*)((CXFA_Node*)pNode)->GetWidgetData(); |
539 } | 539 } |
540 } | 540 } |
541 return NULL; | 541 return NULL; |
542 } | 542 } |
543 void CXFA_FFDocView::OnPageEvent(IXFA_LayoutPage *pSender, XFA_PAGEEVENT eEvent,
FX_INT32 iPageIndex) | 543 void CXFA_FFDocView::OnPageEvent(IXFA_LayoutPage *pSender, XFA_PAGEEVENT eEvent,
int32_t iPageIndex) |
544 { | 544 { |
545 FX_BOOL bNofify = m_iStatus >= XFA_DOCVIEW_LAYOUTSTATUS_End; | 545 FX_BOOL bNofify = m_iStatus >= XFA_DOCVIEW_LAYOUTSTATUS_End; |
546 if (eEvent == XFA_PAGEEVENT_PageRemoved) { | 546 if (eEvent == XFA_PAGEEVENT_PageRemoved) { |
547 if (bNofify) { | 547 if (bNofify) { |
548 m_pDoc->GetDocProvider()->PageViewEvent((CXFA_FFPageView*)pSender, X
FA_PAGEVIEWEVENT_PostRemoved); | 548 m_pDoc->GetDocProvider()->PageViewEvent((CXFA_FFPageView*)pSender, X
FA_PAGEVIEWEVENT_PostRemoved); |
549 } | 549 } |
550 } else if (eEvent == XFA_PAGEEVENT_PageAdded) { | 550 } else if (eEvent == XFA_PAGEEVENT_PageAdded) { |
551 if (bNofify) { | 551 if (bNofify) { |
552 m_pDoc->GetDocProvider()->PageViewEvent((CXFA_FFPageView*)pSender, X
FA_PAGEVIEWEVENT_PostAdded); | 552 m_pDoc->GetDocProvider()->PageViewEvent((CXFA_FFPageView*)pSender, X
FA_PAGEVIEWEVENT_PostAdded); |
553 ((CXFA_FFPageView*)pSender)->LoadPageView(); | 553 ((CXFA_FFPageView*)pSender)->LoadPageView(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 UnlockUpdate(); | 613 UnlockUpdate(); |
614 m_bInLayoutStatus = FALSE; | 614 m_bInLayoutStatus = FALSE; |
615 return TRUE; | 615 return TRUE; |
616 } | 616 } |
617 m_bInLayoutStatus = FALSE; | 617 m_bInLayoutStatus = FALSE; |
618 UnlockUpdate(); | 618 UnlockUpdate(); |
619 return FALSE; | 619 return FALSE; |
620 } | 620 } |
621 void CXFA_FFDocView::RunSubformIndexChange() | 621 void CXFA_FFDocView::RunSubformIndexChange() |
622 { | 622 { |
623 FX_INT32 iSubforms = m_IndexChangedSubforms.GetSize(); | 623 int32_t iSubforms = m_IndexChangedSubforms.GetSize(); |
624 for (FX_INT32 i = 0; i < iSubforms; i++) { | 624 for (int32_t i = 0; i < iSubforms; i++) { |
625 CXFA_Node* pSubformNode = (CXFA_Node*)m_IndexChangedSubforms[i]; | 625 CXFA_Node* pSubformNode = (CXFA_Node*)m_IndexChangedSubforms[i]; |
626 CXFA_WidgetAcc* pWidgetAcc = (CXFA_WidgetAcc*)pSubformNode->GetWidgetDat
a(); | 626 CXFA_WidgetAcc* pWidgetAcc = (CXFA_WidgetAcc*)pSubformNode->GetWidgetDat
a(); |
627 if (!pWidgetAcc) { | 627 if (!pWidgetAcc) { |
628 continue; | 628 continue; |
629 } | 629 } |
630 CXFA_EventParam eParam; | 630 CXFA_EventParam eParam; |
631 eParam.m_eType = XFA_EVENT_IndexChange; | 631 eParam.m_eType = XFA_EVENT_IndexChange; |
632 eParam.m_pTarget = pWidgetAcc; | 632 eParam.m_pTarget = pWidgetAcc; |
633 pWidgetAcc->ProcessEvent(XFA_ATTRIBUTEENUM_IndexChange, &eParam); | 633 pWidgetAcc->ProcessEvent(XFA_ATTRIBUTEENUM_IndexChange, &eParam); |
634 } | 634 } |
(...skipping 25 matching lines...) Expand all Loading... |
660 m_ValidateAccs.RemoveAll(); | 660 m_ValidateAccs.RemoveAll(); |
661 m_bindItems.RemoveAll(); | 661 m_bindItems.RemoveAll(); |
662 m_CalculateAccs.RemoveAll(); | 662 m_CalculateAccs.RemoveAll(); |
663 } | 663 } |
664 FX_BOOL CXFA_FFDocView::IsStaticNotify() | 664 FX_BOOL CXFA_FFDocView::IsStaticNotify() |
665 { | 665 { |
666 return m_pDoc->GetDocType() == XFA_DOCTYPE_Static; | 666 return m_pDoc->GetDocType() == XFA_DOCTYPE_Static; |
667 } | 667 } |
668 void CXFA_FFDocView::AddCalculateWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) | 668 void CXFA_FFDocView::AddCalculateWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) |
669 { | 669 { |
670 FX_INT32 iAccs = m_CalculateAccs.GetSize(); | 670 int32_t iAccs = m_CalculateAccs.GetSize(); |
671 CXFA_WidgetAcc* pCurrentAcc = (iAccs < 1) ? (CXFA_WidgetAcc*)NULL : (CXFA_Wi
dgetAcc*)m_CalculateAccs[iAccs - 1]; | 671 CXFA_WidgetAcc* pCurrentAcc = (iAccs < 1) ? (CXFA_WidgetAcc*)NULL : (CXFA_Wi
dgetAcc*)m_CalculateAccs[iAccs - 1]; |
672 if (pCurrentAcc != pWidgetAcc) { | 672 if (pCurrentAcc != pWidgetAcc) { |
673 m_CalculateAccs.Add(pWidgetAcc); | 673 m_CalculateAccs.Add(pWidgetAcc); |
674 } | 674 } |
675 } | 675 } |
676 void CXFA_FFDocView::AddCalculateNodeNotify(CXFA_Node* pNodeChange) | 676 void CXFA_FFDocView::AddCalculateNodeNotify(CXFA_Node* pNodeChange) |
677 { | 677 { |
678 CXFA_CalcData* pGlobalData = (CXFA_CalcData*)pNodeChange->GetUserData(XFA_Ca
lcData); | 678 CXFA_CalcData* pGlobalData = (CXFA_CalcData*)pNodeChange->GetUserData(XFA_Ca
lcData); |
679 FX_INT32 iCount = pGlobalData ? pGlobalData->m_Globals.GetSize() : 0; | 679 int32_t iCount = pGlobalData ? pGlobalData->m_Globals.GetSize() : 0; |
680 for (FX_INT32 i = 0; i < iCount; i++) { | 680 for (int32_t i = 0; i < iCount; i++) { |
681 CXFA_WidgetAcc* pResultAcc = (CXFA_WidgetAcc*)pGlobalData->m_Globals[i]; | 681 CXFA_WidgetAcc* pResultAcc = (CXFA_WidgetAcc*)pGlobalData->m_Globals[i]; |
682 if (pResultAcc->GetNode()->HasFlag(XFA_NODEFLAG_HasRemoved)) { | 682 if (pResultAcc->GetNode()->HasFlag(XFA_NODEFLAG_HasRemoved)) { |
683 continue; | 683 continue; |
684 } | 684 } |
685 FX_INT32 iAccs = m_CalculateAccs.GetSize(); | 685 int32_t iAccs = m_CalculateAccs.GetSize(); |
686 CXFA_WidgetAcc* pCurrentAcc = (iAccs < 1) ? (CXFA_WidgetAcc*)NULL : (CXF
A_WidgetAcc*)m_CalculateAccs[iAccs - 1]; | 686 CXFA_WidgetAcc* pCurrentAcc = (iAccs < 1) ? (CXFA_WidgetAcc*)NULL : (CXF
A_WidgetAcc*)m_CalculateAccs[iAccs - 1]; |
687 if (pCurrentAcc != pResultAcc) { | 687 if (pCurrentAcc != pResultAcc) { |
688 m_CalculateAccs.Add(pResultAcc); | 688 m_CalculateAccs.Add(pResultAcc); |
689 } | 689 } |
690 } | 690 } |
691 } | 691 } |
692 void CXFA_FFDocView::RunCalculateRecursive(FX_INT32& iIndex) | 692 void CXFA_FFDocView::RunCalculateRecursive(int32_t& iIndex) |
693 { | 693 { |
694 while (iIndex < m_CalculateAccs.GetSize()) { | 694 while (iIndex < m_CalculateAccs.GetSize()) { |
695 CXFA_WidgetAcc* pCurAcc = (CXFA_WidgetAcc*)m_CalculateAccs[iIndex]; | 695 CXFA_WidgetAcc* pCurAcc = (CXFA_WidgetAcc*)m_CalculateAccs[iIndex]; |
696 AddCalculateNodeNotify(pCurAcc->GetNode()); | 696 AddCalculateNodeNotify(pCurAcc->GetNode()); |
697 FX_INT32 iRefCount = (FX_INT32)(FX_UINTPTR)pCurAcc->GetNode()->GetUserDa
ta(XFA_CalcRefCount); | 697 int32_t iRefCount = (int32_t)(uintptr_t)pCurAcc->GetNode()->GetUserData(
XFA_CalcRefCount); |
698 iRefCount++; | 698 iRefCount++; |
699 pCurAcc->GetNode()->SetUserData(XFA_CalcRefCount, (FX_LPVOID)(FX_UINTPTR
)iRefCount); | 699 pCurAcc->GetNode()->SetUserData(XFA_CalcRefCount, (FX_LPVOID)(uintptr_t)
iRefCount); |
700 if (iRefCount > 11) { | 700 if (iRefCount > 11) { |
701 break; | 701 break; |
702 } | 702 } |
703 if ((pCurAcc->ProcessCalculate()) == XFA_EVENTERROR_Sucess) { | 703 if ((pCurAcc->ProcessCalculate()) == XFA_EVENTERROR_Sucess) { |
704 AddValidateWidget(pCurAcc); | 704 AddValidateWidget(pCurAcc); |
705 } | 705 } |
706 iIndex++; | 706 iIndex++; |
707 RunCalculateRecursive(iIndex); | 707 RunCalculateRecursive(iIndex); |
708 } | 708 } |
709 } | 709 } |
710 FX_INT32 CXFA_FFDocView::RunCalculateWidgets() | 710 int32_t CXFA_FFDocView::RunCalculateWidgets() |
711 { | 711 { |
712 if (!m_pDoc->GetDocProvider()->IsCalculationsEnabled(m_pDoc)) { | 712 if (!m_pDoc->GetDocProvider()->IsCalculationsEnabled(m_pDoc)) { |
713 return XFA_EVENTERROR_Disabled; | 713 return XFA_EVENTERROR_Disabled; |
714 } | 714 } |
715 FX_INT32 iCounts = m_CalculateAccs.GetSize(); | 715 int32_t iCounts = m_CalculateAccs.GetSize(); |
716 FX_INT32 iIndex = 0; | 716 int32_t iIndex = 0; |
717 if (iCounts > 0) { | 717 if (iCounts > 0) { |
718 RunCalculateRecursive(iIndex); | 718 RunCalculateRecursive(iIndex); |
719 } | 719 } |
720 for (FX_INT32 i = 0; i < m_CalculateAccs.GetSize(); i++) { | 720 for (int32_t i = 0; i < m_CalculateAccs.GetSize(); i++) { |
721 CXFA_WidgetAcc* pCurAcc = (CXFA_WidgetAcc*)m_CalculateAccs[i]; | 721 CXFA_WidgetAcc* pCurAcc = (CXFA_WidgetAcc*)m_CalculateAccs[i]; |
722 pCurAcc->GetNode()->SetUserData(XFA_CalcRefCount, (FX_LPVOID)(FX_UINTPTR
)0); | 722 pCurAcc->GetNode()->SetUserData(XFA_CalcRefCount, (FX_LPVOID)(uintptr_t)
0); |
723 } | 723 } |
724 m_CalculateAccs.RemoveAll(); | 724 m_CalculateAccs.RemoveAll(); |
725 return XFA_EVENTERROR_Sucess; | 725 return XFA_EVENTERROR_Sucess; |
726 } | 726 } |
727 void CXFA_FFDocView::AddValidateWidget(CXFA_WidgetAcc* pWidget) | 727 void CXFA_FFDocView::AddValidateWidget(CXFA_WidgetAcc* pWidget) |
728 { | 728 { |
729 if (m_ValidateAccs.Find(pWidget) < 0) { | 729 if (m_ValidateAccs.Find(pWidget) < 0) { |
730 m_ValidateAccs.Add(pWidget); | 730 m_ValidateAccs.Add(pWidget); |
731 } | 731 } |
732 } | 732 } |
733 FX_BOOL CXFA_FFDocView::InitCalculate(CXFA_Node* pNode) | 733 FX_BOOL CXFA_FFDocView::InitCalculate(CXFA_Node* pNode) |
734 { | 734 { |
735 ExecEventActivityByDeepFirst(pNode, XFA_EVENT_InitCalculate); | 735 ExecEventActivityByDeepFirst(pNode, XFA_EVENT_InitCalculate); |
736 return TRUE; | 736 return TRUE; |
737 } | 737 } |
738 FX_BOOL CXFA_FFDocView::InitValidate(CXFA_Node* pNode) | 738 FX_BOOL CXFA_FFDocView::InitValidate(CXFA_Node* pNode) |
739 { | 739 { |
740 if (!m_pDoc->GetDocProvider()->IsValidationsEnabled(m_pDoc)) { | 740 if (!m_pDoc->GetDocProvider()->IsValidationsEnabled(m_pDoc)) { |
741 return FALSE; | 741 return FALSE; |
742 } | 742 } |
743 ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Validate); | 743 ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Validate); |
744 m_ValidateAccs.RemoveAll(); | 744 m_ValidateAccs.RemoveAll(); |
745 return TRUE; | 745 return TRUE; |
746 } | 746 } |
747 FX_BOOL CXFA_FFDocView::RunValidate() | 747 FX_BOOL CXFA_FFDocView::RunValidate() |
748 { | 748 { |
749 if (!m_pDoc->GetDocProvider()->IsValidationsEnabled(m_pDoc)) { | 749 if (!m_pDoc->GetDocProvider()->IsValidationsEnabled(m_pDoc)) { |
750 return FALSE; | 750 return FALSE; |
751 } | 751 } |
752 FX_INT32 iCounts = m_ValidateAccs.GetSize(); | 752 int32_t iCounts = m_ValidateAccs.GetSize(); |
753 for (FX_INT32 i = 0; i < iCounts; i++) { | 753 for (int32_t i = 0; i < iCounts; i++) { |
754 CXFA_WidgetAcc* pAcc = (CXFA_WidgetAcc*)m_ValidateAccs[i]; | 754 CXFA_WidgetAcc* pAcc = (CXFA_WidgetAcc*)m_ValidateAccs[i]; |
755 if (pAcc->GetNode()->HasFlag(XFA_NODEFLAG_HasRemoved)) { | 755 if (pAcc->GetNode()->HasFlag(XFA_NODEFLAG_HasRemoved)) { |
756 continue; | 756 continue; |
757 } | 757 } |
758 pAcc->ProcessValidate(); | 758 pAcc->ProcessValidate(); |
759 } | 759 } |
760 m_ValidateAccs.RemoveAll(); | 760 m_ValidateAccs.RemoveAll(); |
761 return TRUE; | 761 return TRUE; |
762 } | 762 } |
763 FX_BOOL CXFA_FFDocView::RunEventLayoutReady() | 763 FX_BOOL CXFA_FFDocView::RunEventLayoutReady() |
764 { | 764 { |
765 CXFA_Node* pRootItem = (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFANode(XFA_HASHC
ODE_Form); | 765 CXFA_Node* pRootItem = (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFANode(XFA_HASHC
ODE_Form); |
766 if (!pRootItem) { | 766 if (!pRootItem) { |
767 return FALSE; | 767 return FALSE; |
768 } | 768 } |
769 ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready); | 769 ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready); |
770 RunLayout(); | 770 RunLayout(); |
771 return TRUE; | 771 return TRUE; |
772 } | 772 } |
773 void CXFA_FFDocView::RunBindItems() | 773 void CXFA_FFDocView::RunBindItems() |
774 { | 774 { |
775 FX_INT32 iCount = m_bindItems.GetSize(); | 775 int32_t iCount = m_bindItems.GetSize(); |
776 for (FX_INT32 i = 0; i < iCount; i++) { | 776 for (int32_t i = 0; i < iCount; i++) { |
777 if (((CXFA_Node*)m_bindItems[i])->HasFlag(XFA_NODEFLAG_HasRemoved)) { | 777 if (((CXFA_Node*)m_bindItems[i])->HasFlag(XFA_NODEFLAG_HasRemoved)) { |
778 continue; | 778 continue; |
779 } | 779 } |
780 CXFA_Node* pWidgetNode = ((CXFA_Node*)m_bindItems[i])->GetNodeItem(XFA_N
ODEITEM_Parent); | 780 CXFA_Node* pWidgetNode = ((CXFA_Node*)m_bindItems[i])->GetNodeItem(XFA_N
ODEITEM_Parent); |
781 CXFA_WidgetAcc* pAcc = (CXFA_WidgetAcc*)pWidgetNode->GetWidgetData(); | 781 CXFA_WidgetAcc* pAcc = (CXFA_WidgetAcc*)pWidgetNode->GetWidgetData(); |
782 if (!pAcc) { | 782 if (!pAcc) { |
783 continue; | 783 continue; |
784 } | 784 } |
785 CXFA_BindItems binditems((CXFA_Node*)m_bindItems[i]); | 785 CXFA_BindItems binditems((CXFA_Node*)m_bindItems[i]); |
786 IXFA_ScriptContext* pScriptContext = pWidgetNode->GetDocument()->GetScri
ptContext(); | 786 IXFA_ScriptContext* pScriptContext = pWidgetNode->GetDocument()->GetScri
ptContext(); |
787 CFX_WideStringC wsRef; | 787 CFX_WideStringC wsRef; |
788 binditems.GetRef(wsRef); | 788 binditems.GetRef(wsRef); |
789 FX_DWORD dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties
| XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_ALL; | 789 FX_DWORD dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties
| XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_ALL; |
790 XFA_RESOLVENODE_RS rs; | 790 XFA_RESOLVENODE_RS rs; |
791 pScriptContext->ResolveObjects(pWidgetNode, wsRef, rs, dwStyle); | 791 pScriptContext->ResolveObjects(pWidgetNode, wsRef, rs, dwStyle); |
792 FX_INT32 iCount = rs.nodes.GetSize(); | 792 int32_t iCount = rs.nodes.GetSize(); |
793 pAcc->DeleteItem(-1); | 793 pAcc->DeleteItem(-1); |
794 if (rs.dwFlags != XFA_RESOVENODE_RSTYPE_Nodes || iCount < 1) { | 794 if (rs.dwFlags != XFA_RESOVENODE_RSTYPE_Nodes || iCount < 1) { |
795 continue; | 795 continue; |
796 } | 796 } |
797 CFX_WideStringC wsValueRef, wsLabelRef; | 797 CFX_WideStringC wsValueRef, wsLabelRef; |
798 binditems.GetValueRef(wsValueRef); | 798 binditems.GetValueRef(wsValueRef); |
799 binditems.GetLabelRef(wsLabelRef); | 799 binditems.GetLabelRef(wsLabelRef); |
800 FX_BOOL bUseValue = wsLabelRef.IsEmpty() || wsLabelRef == wsValueRef; | 800 FX_BOOL bUseValue = wsLabelRef.IsEmpty() || wsLabelRef == wsValueRef; |
801 FX_BOOL bLabelUseContent = wsLabelRef.IsEmpty() || wsLabelRef == FX_WSTR
C(L"$"); | 801 FX_BOOL bLabelUseContent = wsLabelRef.IsEmpty() || wsLabelRef == FX_WSTR
C(L"$"); |
802 FX_BOOL bValueUseContent = wsValueRef.IsEmpty() || wsValueRef == FX_WSTR
C(L"$"); | 802 FX_BOOL bValueUseContent = wsValueRef.IsEmpty() || wsValueRef == FX_WSTR
C(L"$"); |
803 CFX_WideString wsValue, wsLabel; | 803 CFX_WideString wsValue, wsLabel; |
804 FX_DWORD uValueHash = FX_HashCode_String_GetW(CFX_WideString(wsValueRef)
, wsValueRef.GetLength()); | 804 FX_DWORD uValueHash = FX_HashCode_String_GetW(CFX_WideString(wsValueRef)
, wsValueRef.GetLength()); |
805 FX_DWORD uLableHash = FX_HashCode_String_GetW(CFX_WideString(wsLabelRef)
, wsLabelRef.GetLength()); | 805 FX_DWORD uLableHash = FX_HashCode_String_GetW(CFX_WideString(wsLabelRef)
, wsLabelRef.GetLength()); |
806 for (FX_INT32 i = 0; i < iCount; i++) { | 806 for (int32_t i = 0; i < iCount; i++) { |
807 CXFA_Object* refObj = rs.nodes[i]; | 807 CXFA_Object* refObj = rs.nodes[i]; |
808 if(!refObj->IsNode()) { | 808 if(!refObj->IsNode()) { |
809 continue; | 809 continue; |
810 } | 810 } |
811 CXFA_Node* refNode = (CXFA_Node*)refObj; | 811 CXFA_Node* refNode = (CXFA_Node*)refObj; |
812 if (bValueUseContent) { | 812 if (bValueUseContent) { |
813 wsValue = refNode->GetContent(); | 813 wsValue = refNode->GetContent(); |
814 } else { | 814 } else { |
815 CXFA_Node* nodeValue = refNode->GetFirstChildByName(uValueHash); | 815 CXFA_Node* nodeValue = refNode->GetFirstChildByName(uValueHash); |
816 if (nodeValue == NULL) { | 816 if (nodeValue == NULL) { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 } | 951 } |
952 FX_BOOL CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) | 952 FX_BOOL CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) |
953 { | 953 { |
954 return FALSE; | 954 return FALSE; |
955 } | 955 } |
956 void CXFA_WidgetAccIterator::SkipTree() | 956 void CXFA_WidgetAccIterator::SkipTree() |
957 { | 957 { |
958 m_ContentIterator.SkipChildrenAndMoveToNext(); | 958 m_ContentIterator.SkipChildrenAndMoveToNext(); |
959 m_pCurWidgetAcc = NULL; | 959 m_pCurWidgetAcc = NULL; |
960 } | 960 } |
OLD | NEW |