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 "xfa/fxfa/app/xfa_ffnotify.h" | 7 #include "xfa/fxfa/app/xfa_ffnotify.h" |
8 | 8 |
9 #include "xfa/fxfa/app/xfa_ffbarcode.h" | 9 #include "xfa/fxfa/app/xfa_ffbarcode.h" |
10 #include "xfa/fxfa/app/xfa_ffcheckbutton.h" | 10 #include "xfa/fxfa/app/xfa_ffcheckbutton.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 static void XFA_FFDeleteWidgetAcc(void* pData) { | 33 static void XFA_FFDeleteWidgetAcc(void* pData) { |
34 delete static_cast<CXFA_WidgetAcc*>(pData); | 34 delete static_cast<CXFA_WidgetAcc*>(pData); |
35 } | 35 } |
36 | 36 |
37 static XFA_MAPDATABLOCKCALLBACKINFO gs_XFADeleteWidgetAcc = { | 37 static XFA_MAPDATABLOCKCALLBACKINFO gs_XFADeleteWidgetAcc = { |
38 XFA_FFDeleteWidgetAcc, nullptr}; | 38 XFA_FFDeleteWidgetAcc, nullptr}; |
39 | 39 |
40 CXFA_FFNotify::CXFA_FFNotify(CXFA_FFDoc* pDoc) : m_pDoc(pDoc) {} | 40 CXFA_FFNotify::CXFA_FFNotify(CXFA_FFDoc* pDoc) : m_pDoc(pDoc) {} |
41 CXFA_FFNotify::~CXFA_FFNotify() {} | 41 CXFA_FFNotify::~CXFA_FFNotify() {} |
| 42 |
42 void CXFA_FFNotify::OnPageEvent(CXFA_ContainerLayoutItem* pSender, | 43 void CXFA_FFNotify::OnPageEvent(CXFA_ContainerLayoutItem* pSender, |
43 XFA_PAGEEVENT eEvent, | 44 uint32_t dwEvent) { |
44 void* pParam) { | |
45 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pSender->GetLayout()); | 45 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pSender->GetLayout()); |
46 if (!pDocView) { | 46 if (pDocView) |
47 return; | 47 pDocView->OnPageEvent(pSender, dwEvent); |
48 } | |
49 pDocView->OnPageEvent(pSender, eEvent, (int32_t)(uintptr_t)pParam); | |
50 } | 48 } |
51 void CXFA_FFNotify::OnNodeEvent(CXFA_Node* pSender, | 49 |
52 XFA_NODEEVENT eEvent, | |
53 void* pParam, | |
54 void* pParam2, | |
55 void* pParam3, | |
56 void* pParam4) { | |
57 switch (eEvent) { | |
58 case XFA_NODEEVENT_Ready: | |
59 OnNodeReady(pSender); | |
60 break; | |
61 case XFA_NODEEVENT_ValueChanging: | |
62 OnValueChanging(pSender, pParam, pParam2); | |
63 break; | |
64 case XFA_NODEEVENT_ValueChanged: | |
65 OnValueChanged(pSender, pParam, pParam2, pParam3, pParam4); | |
66 break; | |
67 case XFA_NODEEVENT_ChildAdded: | |
68 OnChildAdded(pSender, pParam, pParam2); | |
69 break; | |
70 case XFA_NODEEVENT_ChildRemoved: | |
71 OnChildRemoved(pSender, pParam, pParam2); | |
72 break; | |
73 } | |
74 } | |
75 void CXFA_FFNotify::OnWidgetDataEvent(CXFA_WidgetData* pSender, | 50 void CXFA_FFNotify::OnWidgetDataEvent(CXFA_WidgetData* pSender, |
76 uint32_t dwEvent, | 51 uint32_t dwEvent, |
77 void* pParam, | 52 void* pParam, |
78 void* pAdditional, | 53 void* pAdditional, |
79 void* pAdditional2) { | 54 void* pAdditional2) { |
80 CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pSender); | 55 CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pSender); |
81 switch (dwEvent) { | 56 switch (dwEvent) { |
82 case XFA_WIDGETEVENT_ListItemAdded: { | 57 case XFA_WIDGETEVENT_ListItemAdded: { |
83 if (pWidgetAcc->GetUIType() != XFA_ELEMENT_ChoiceList) { | 58 if (pWidgetAcc->GetUIType() != XFA_ELEMENT_ChoiceList) { |
84 return; | 59 return; |
85 } | 60 } |
86 FX_BOOL bStaticNotify = pWidgetAcc->GetDocView()->IsStaticNotify(); | 61 FX_BOOL bStaticNotify = pWidgetAcc->GetDocView()->IsStaticNotify(); |
87 CXFA_FFWidget* pWidget = pWidgetAcc->GetNextWidget(NULL); | 62 CXFA_FFWidget* pWidget = pWidgetAcc->GetNextWidget(NULL); |
88 if (!pWidget) { | 63 if (!pWidget) { |
89 if (bStaticNotify) { | 64 if (bStaticNotify) { |
90 pWidgetAcc->GetDoc()->GetDocProvider()->WidgetEvent( | 65 pWidgetAcc->GetDoc()->GetDocProvider()->WidgetEvent( |
91 pWidget, pWidgetAcc, XFA_WIDGETEVENT_ListItemAdded, pParam, | 66 pWidget, pWidgetAcc, XFA_WIDGETEVENT_ListItemAdded); |
92 pAdditional); | |
93 } | 67 } |
94 return; | 68 return; |
95 } | 69 } |
96 while (pWidget) { | 70 while (pWidget) { |
97 if (pWidget->IsLoaded()) { | 71 if (pWidget->IsLoaded()) { |
98 if (pWidgetAcc->IsListBox()) { | 72 if (pWidgetAcc->IsListBox()) { |
99 static_cast<CXFA_FFListBox*>(pWidget) | 73 static_cast<CXFA_FFListBox*>(pWidget) |
100 ->InsertItem((const CFX_WideStringC&)(const FX_WCHAR*)pParam, | 74 ->InsertItem((const CFX_WideStringC&)(const FX_WCHAR*)pParam, |
101 (int32_t)(uintptr_t)pAdditional2); | 75 (int32_t)(uintptr_t)pAdditional2); |
102 } else { | 76 } else { |
103 static_cast<CXFA_FFComboBox*>(pWidget) | 77 static_cast<CXFA_FFComboBox*>(pWidget) |
104 ->InsertItem((const CFX_WideStringC&)(const FX_WCHAR*)pParam, | 78 ->InsertItem((const CFX_WideStringC&)(const FX_WCHAR*)pParam, |
105 (int32_t)(uintptr_t)pAdditional2); | 79 (int32_t)(uintptr_t)pAdditional2); |
106 } | 80 } |
107 } | 81 } |
108 if (bStaticNotify) { | 82 if (bStaticNotify) { |
109 pWidgetAcc->GetDoc()->GetDocProvider()->WidgetEvent( | 83 pWidgetAcc->GetDoc()->GetDocProvider()->WidgetEvent( |
110 pWidget, pWidgetAcc, XFA_WIDGETEVENT_ListItemAdded, pParam, | 84 pWidget, pWidgetAcc, XFA_WIDGETEVENT_ListItemAdded); |
111 pAdditional); | |
112 } | 85 } |
113 pWidget = pWidgetAcc->GetNextWidget(pWidget); | 86 pWidget = pWidgetAcc->GetNextWidget(pWidget); |
114 } | 87 } |
115 } break; | 88 } break; |
116 case XFA_WIDGETEVENT_ListItemRemoved: { | 89 case XFA_WIDGETEVENT_ListItemRemoved: { |
117 if (pWidgetAcc->GetUIType() != XFA_ELEMENT_ChoiceList) { | 90 if (pWidgetAcc->GetUIType() != XFA_ELEMENT_ChoiceList) { |
118 return; | 91 return; |
119 } | 92 } |
120 FX_BOOL bStaticNotify = pWidgetAcc->GetDocView()->IsStaticNotify(); | 93 FX_BOOL bStaticNotify = pWidgetAcc->GetDocView()->IsStaticNotify(); |
121 CXFA_FFWidget* pWidget = pWidgetAcc->GetNextWidget(NULL); | 94 CXFA_FFWidget* pWidget = pWidgetAcc->GetNextWidget(NULL); |
122 if (!pWidget) { | 95 if (!pWidget) { |
123 if (bStaticNotify) { | 96 if (bStaticNotify) { |
124 pWidgetAcc->GetDoc()->GetDocProvider()->WidgetEvent( | 97 pWidgetAcc->GetDoc()->GetDocProvider()->WidgetEvent( |
125 pWidget, pWidgetAcc, XFA_WIDGETEVENT_ListItemRemoved, pParam, | 98 pWidget, pWidgetAcc, XFA_WIDGETEVENT_ListItemRemoved); |
126 pAdditional); | |
127 } | 99 } |
128 return; | 100 return; |
129 } | 101 } |
130 while (pWidget) { | 102 while (pWidget) { |
131 if (pWidget->IsLoaded()) { | 103 if (pWidget->IsLoaded()) { |
132 if (pWidgetAcc->IsListBox()) { | 104 if (pWidgetAcc->IsListBox()) { |
133 static_cast<CXFA_FFListBox*>(pWidget) | 105 static_cast<CXFA_FFListBox*>(pWidget) |
134 ->DeleteItem((int32_t)(uintptr_t)pParam); | 106 ->DeleteItem((int32_t)(uintptr_t)pParam); |
135 } else { | 107 } else { |
136 static_cast<CXFA_FFComboBox*>(pWidget) | 108 static_cast<CXFA_FFComboBox*>(pWidget) |
137 ->DeleteItem((int32_t)(uintptr_t)pParam); | 109 ->DeleteItem((int32_t)(uintptr_t)pParam); |
138 } | 110 } |
139 } | 111 } |
140 if (bStaticNotify) { | 112 if (bStaticNotify) { |
141 pWidgetAcc->GetDoc()->GetDocProvider()->WidgetEvent( | 113 pWidgetAcc->GetDoc()->GetDocProvider()->WidgetEvent( |
142 pWidget, pWidgetAcc, XFA_WIDGETEVENT_ListItemRemoved, pParam, | 114 pWidget, pWidgetAcc, XFA_WIDGETEVENT_ListItemRemoved); |
143 pAdditional); | |
144 } | 115 } |
145 pWidget = pWidgetAcc->GetNextWidget(pWidget); | 116 pWidget = pWidgetAcc->GetNextWidget(pWidget); |
146 } | 117 } |
147 } break; | 118 } break; |
148 } | 119 } |
149 } | 120 } |
150 CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) { | 121 CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) { |
151 CXFA_LayoutProcessor* pLayout = m_pDoc->GetXFADoc()->GetDocLayout(); | 122 CXFA_LayoutProcessor* pLayout = m_pDoc->GetXFADoc()->GetDocLayout(); |
152 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout); | 123 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout); |
153 XFA_ELEMENT eType = pNode->GetClassID(); | 124 XFA_ELEMENT eType = pNode->GetClassID(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 default: | 197 default: |
227 pWidget = NULL; | 198 pWidget = NULL; |
228 break; | 199 break; |
229 } | 200 } |
230 if (!pWidget) { | 201 if (!pWidget) { |
231 return NULL; | 202 return NULL; |
232 } | 203 } |
233 pWidget->SetDocView(pDocView); | 204 pWidget->SetDocView(pDocView); |
234 return pWidget; | 205 return pWidget; |
235 } | 206 } |
236 void CXFA_FFNotify::OnLayoutEvent(CXFA_LayoutProcessor* pLayout, | 207 |
237 CXFA_LayoutItem* pSender, | |
238 XFA_LAYOUTEVENT eEvent, | |
239 void* pParam, | |
240 void* pParam2) { | |
241 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout); | |
242 if (!pDocView || !XFA_GetWidgetFromLayoutItem(pSender)) { | |
243 return; | |
244 } | |
245 switch (eEvent) { | |
246 case XFA_LAYOUTEVENT_ItemAdded: | |
247 OnLayoutItemAdd(pDocView, pLayout, pSender, pParam, pParam2); | |
248 break; | |
249 case XFA_LAYOUTEVENT_ItemRemoving: | |
250 OnLayoutItemRemoving(pDocView, pLayout, pSender, pParam, pParam2); | |
251 break; | |
252 case XFA_LAYOUTEVENT_RectChanged: | |
253 OnLayoutItemRectChanged(pDocView, pLayout, pSender, pParam, pParam2); | |
254 break; | |
255 case XFA_LAYOUTEVENT_StatusChanged: | |
256 OnLayoutItemStatustChanged(pDocView, pLayout, pSender, pParam, pParam2); | |
257 break; | |
258 } | |
259 } | |
260 void CXFA_FFNotify::StartFieldDrawLayout(CXFA_Node* pItem, | 208 void CXFA_FFNotify::StartFieldDrawLayout(CXFA_Node* pItem, |
261 FX_FLOAT& fCalcWidth, | 209 FX_FLOAT& fCalcWidth, |
262 FX_FLOAT& fCalcHeight) { | 210 FX_FLOAT& fCalcHeight) { |
263 CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pItem->GetWidgetData()); | 211 CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pItem->GetWidgetData()); |
264 if (!pAcc) { | 212 if (!pAcc) { |
265 return; | 213 return; |
266 } | 214 } |
267 pAcc->StartWidgetLayout(fCalcWidth, fCalcHeight); | 215 pAcc->StartWidgetLayout(fCalcWidth, fCalcHeight); |
268 } | 216 } |
269 FX_BOOL CXFA_FFNotify::FindSplitPos(CXFA_Node* pItem, | 217 FX_BOOL CXFA_FFNotify::FindSplitPos(CXFA_Node* pItem, |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 } | 341 } |
394 void CXFA_FFNotify::SetFocusWidgetNode(CXFA_Node* pNode) { | 342 void CXFA_FFNotify::SetFocusWidgetNode(CXFA_Node* pNode) { |
395 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 343 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
396 if (!pDocView) { | 344 if (!pDocView) { |
397 return; | 345 return; |
398 } | 346 } |
399 CXFA_WidgetAcc* pAcc = | 347 CXFA_WidgetAcc* pAcc = |
400 pNode ? static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()) : nullptr; | 348 pNode ? static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()) : nullptr; |
401 pDocView->SetFocusWidgetAcc(pAcc); | 349 pDocView->SetFocusWidgetAcc(pAcc); |
402 } | 350 } |
| 351 |
403 void CXFA_FFNotify::OnNodeReady(CXFA_Node* pNode) { | 352 void CXFA_FFNotify::OnNodeReady(CXFA_Node* pNode) { |
404 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 353 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
405 if (!pDocView) { | 354 if (!pDocView) { |
406 return; | 355 return; |
407 } | 356 } |
408 XFA_ELEMENT iType = pNode->GetClassID(); | 357 XFA_ELEMENT iType = pNode->GetClassID(); |
409 if (XFA_IsCreateWidget(iType)) { | 358 if (XFA_IsCreateWidget(iType)) { |
410 CXFA_WidgetAcc* pAcc = new CXFA_WidgetAcc(pDocView, pNode); | 359 CXFA_WidgetAcc* pAcc = new CXFA_WidgetAcc(pDocView, pNode); |
411 pNode->SetObject(XFA_ATTRIBUTE_WidgetData, pAcc, &gs_XFADeleteWidgetAcc); | 360 pNode->SetObject(XFA_ATTRIBUTE_WidgetData, pAcc, &gs_XFADeleteWidgetAcc); |
412 return; | 361 return; |
413 } | 362 } |
414 switch (iType) { | 363 switch (iType) { |
415 case XFA_ELEMENT_BindItems: | 364 case XFA_ELEMENT_BindItems: |
416 pDocView->m_bindItems.Add(pNode); | 365 pDocView->m_bindItems.Add(pNode); |
417 break; | 366 break; |
418 case XFA_ELEMENT_Validate: { | 367 case XFA_ELEMENT_Validate: { |
419 pNode->SetFlag(XFA_NODEFLAG_NeedsInitApp, TRUE, FALSE); | 368 pNode->SetFlag(XFA_NODEFLAG_NeedsInitApp, TRUE, FALSE); |
420 } break; | 369 } break; |
421 default: | 370 default: |
422 break; | 371 break; |
423 } | 372 } |
424 } | 373 } |
425 void CXFA_FFNotify::OnValueChanging(CXFA_Node* pSender, | 374 |
426 void* pParam, | 375 void CXFA_FFNotify::OnValueChanging(CXFA_Node* pSender, XFA_ATTRIBUTE eAttr) { |
427 void* pParam2) { | |
428 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 376 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
429 if (!pDocView) { | 377 if (!pDocView) { |
430 return; | 378 return; |
431 } | 379 } |
432 if (pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End) { | 380 if (pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End) { |
433 return; | 381 return; |
434 } | 382 } |
435 uint32_t dwPacket = pSender->GetPacketID(); | 383 uint32_t dwPacket = pSender->GetPacketID(); |
436 if (dwPacket & XFA_XDPPACKET_Datasets) { | 384 if (dwPacket & XFA_XDPPACKET_Datasets) { |
437 } else if (pSender->IsFormContainer()) { | 385 } else if (pSender->IsFormContainer()) { |
438 XFA_ATTRIBUTE eAttr = (XFA_ATTRIBUTE)(uintptr_t)pParam; | |
439 if (eAttr == XFA_ATTRIBUTE_Presence) { | 386 if (eAttr == XFA_ATTRIBUTE_Presence) { |
440 CXFA_WidgetAcc* pWidgetAcc = | 387 CXFA_WidgetAcc* pWidgetAcc = |
441 static_cast<CXFA_WidgetAcc*>(pSender->GetWidgetData()); | 388 static_cast<CXFA_WidgetAcc*>(pSender->GetWidgetData()); |
442 if (!pWidgetAcc) { | 389 if (!pWidgetAcc) { |
443 return; | 390 return; |
444 } | 391 } |
445 CXFA_FFWidget* pWidget = NULL; | 392 CXFA_FFWidget* pWidget = NULL; |
446 while ((pWidget = pWidgetAcc->GetNextWidget(pWidget))) { | 393 while ((pWidget = pWidgetAcc->GetNextWidget(pWidget))) { |
447 if (pWidget->IsLoaded()) { | 394 if (pWidget->IsLoaded()) { |
448 pWidget->AddInvalidateRect(); | 395 pWidget->AddInvalidateRect(); |
449 } | 396 } |
450 } | 397 } |
451 } | 398 } |
452 } | 399 } |
453 } | 400 } |
| 401 |
454 void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender, | 402 void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender, |
455 void* pParam, | 403 XFA_ATTRIBUTE eAttr, |
456 void* pParam2, | 404 CXFA_Node* pParentNode, |
457 void* pParam3, | 405 CXFA_Node* pWidgetNode) { |
458 void* pParam4) { | |
459 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 406 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
460 if (!pDocView) { | 407 if (!pDocView) { |
461 return; | 408 return; |
462 } | 409 } |
463 uint32_t dwPacket = pSender->GetPacketID(); | 410 uint32_t dwPacket = pSender->GetPacketID(); |
464 XFA_ATTRIBUTE eAttr = (XFA_ATTRIBUTE)(uintptr_t)pParam; | |
465 if (dwPacket & XFA_XDPPACKET_Form) { | 411 if (dwPacket & XFA_XDPPACKET_Form) { |
466 CXFA_Node* pParentNode = static_cast<CXFA_Node*>(pParam3); | |
467 CXFA_Node* pWidgetNode = static_cast<CXFA_Node*>(pParam4); | |
468 XFA_ELEMENT ePType = pParentNode->GetClassID(); | 412 XFA_ELEMENT ePType = pParentNode->GetClassID(); |
469 FX_BOOL bIsContainerNode = pParentNode->IsContainerNode(); | 413 FX_BOOL bIsContainerNode = pParentNode->IsContainerNode(); |
470 CXFA_WidgetAcc* pWidgetAcc = | 414 CXFA_WidgetAcc* pWidgetAcc = |
471 static_cast<CXFA_WidgetAcc*>(pWidgetNode->GetWidgetData()); | 415 static_cast<CXFA_WidgetAcc*>(pWidgetNode->GetWidgetData()); |
472 if (!pWidgetAcc) { | 416 if (!pWidgetAcc) { |
473 return; | 417 return; |
474 } | 418 } |
475 FX_BOOL bUpdateProperty = FALSE; | 419 FX_BOOL bUpdateProperty = FALSE; |
476 pDocView->SetChangeMark(); | 420 pDocView->SetChangeMark(); |
477 switch (ePType) { | 421 switch (ePType) { |
478 case XFA_ELEMENT_Caption: { | 422 case XFA_ELEMENT_Caption: { |
479 CXFA_TextLayout* pCapOut = pWidgetAcc->GetCaptionTextLayout(); | 423 CXFA_TextLayout* pCapOut = pWidgetAcc->GetCaptionTextLayout(); |
480 if (!pCapOut) { | 424 if (!pCapOut) { |
481 return; | 425 return; |
482 } | 426 } |
483 pCapOut->Unload(); | 427 pCapOut->Unload(); |
484 } break; | 428 } break; |
485 case XFA_ELEMENT_Ui: | 429 case XFA_ELEMENT_Ui: |
486 case XFA_ELEMENT_Para: | 430 case XFA_ELEMENT_Para: |
487 bUpdateProperty = TRUE; | 431 bUpdateProperty = TRUE; |
488 break; | 432 break; |
489 case XFA_ELEMENT_Font: | 433 case XFA_ELEMENT_Font: |
490 case XFA_ELEMENT_Margin: | 434 case XFA_ELEMENT_Margin: |
491 case XFA_ELEMENT_Value: | 435 case XFA_ELEMENT_Value: |
492 case XFA_ELEMENT_Items: | 436 case XFA_ELEMENT_Items: |
493 break; | 437 break; |
494 default: | 438 default: |
495 break; | 439 break; |
496 } | 440 } |
497 if (bIsContainerNode && eAttr == XFA_ATTRIBUTE_Access) { | 441 if (bIsContainerNode && eAttr == XFA_ATTRIBUTE_Access) |
498 bUpdateProperty = TRUE; | 442 bUpdateProperty = TRUE; |
499 FX_BOOL bNotify = pDocView->IsStaticNotify(); | 443 |
500 if (bNotify) { | |
501 pWidgetAcc->NotifyEvent(XFA_WIDGETEVENT_AccessChanged, NULL, pParam2, | |
502 NULL); | |
503 } | |
504 } | |
505 if (eAttr == XFA_ATTRIBUTE_Value) { | 444 if (eAttr == XFA_ATTRIBUTE_Value) { |
506 pDocView->AddCalculateNodeNotify(pSender); | 445 pDocView->AddCalculateNodeNotify(pSender); |
507 if (ePType == XFA_ELEMENT_Value || bIsContainerNode) { | 446 if (ePType == XFA_ELEMENT_Value || bIsContainerNode) { |
508 FX_BOOL bNotify = pDocView->IsStaticNotify(); | |
509 if (bIsContainerNode) { | 447 if (bIsContainerNode) { |
510 pWidgetAcc->UpdateUIDisplay(); | 448 pWidgetAcc->UpdateUIDisplay(); |
511 pDocView->AddCalculateWidgetAcc(pWidgetAcc); | 449 pDocView->AddCalculateWidgetAcc(pWidgetAcc); |
512 pDocView->AddValidateWidget(pWidgetAcc); | 450 pDocView->AddValidateWidget(pWidgetAcc); |
513 } else if (pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent) | 451 } else if (pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent) |
514 ->GetClassID() == XFA_ELEMENT_ExclGroup) { | 452 ->GetClassID() == XFA_ELEMENT_ExclGroup) { |
515 pWidgetAcc->UpdateUIDisplay(); | 453 pWidgetAcc->UpdateUIDisplay(); |
516 } | 454 } |
517 if (bNotify) { | |
518 pWidgetAcc->NotifyEvent(XFA_WIDGETEVENT_PostContentChanged, NULL, | |
519 NULL, NULL); | |
520 } | |
521 return; | 455 return; |
522 } | 456 } |
523 } | 457 } |
524 CXFA_FFWidget* pWidget = NULL; | 458 CXFA_FFWidget* pWidget = NULL; |
525 while ((pWidget = pWidgetAcc->GetNextWidget(pWidget))) { | 459 while ((pWidget = pWidgetAcc->GetNextWidget(pWidget))) { |
526 if (!pWidget->IsLoaded()) { | 460 if (!pWidget->IsLoaded()) { |
527 continue; | 461 continue; |
528 } | 462 } |
529 if (bUpdateProperty) { | 463 if (bUpdateProperty) { |
530 pWidget->UpdateWidgetProperty(); | 464 pWidget->UpdateWidgetProperty(); |
531 } | 465 } |
532 pWidget->PerformLayout(); | 466 pWidget->PerformLayout(); |
533 pWidget->AddInvalidateRect(); | 467 pWidget->AddInvalidateRect(); |
534 } | 468 } |
535 } else { | 469 } else { |
536 if (eAttr == XFA_ATTRIBUTE_Value) { | 470 if (eAttr == XFA_ATTRIBUTE_Value) { |
537 pDocView->AddCalculateNodeNotify(pSender); | 471 pDocView->AddCalculateNodeNotify(pSender); |
538 } | 472 } |
539 } | 473 } |
540 } | 474 } |
541 void CXFA_FFNotify::OnChildAdded(CXFA_Node* pSender, | 475 |
542 void* pParam, | 476 void CXFA_FFNotify::OnChildAdded(CXFA_Node* pSender) { |
543 void* pParam2) { | |
544 if (!pSender->IsFormContainer()) { | 477 if (!pSender->IsFormContainer()) { |
545 return; | 478 return; |
546 } | 479 } |
547 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 480 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
548 if (!pDocView) { | 481 if (!pDocView) { |
549 return; | 482 return; |
550 } | 483 } |
551 FX_BOOL bLayoutReady = | 484 FX_BOOL bLayoutReady = |
552 !(pDocView->m_bInLayoutStatus) && | 485 !(pDocView->m_bInLayoutStatus) && |
553 (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End); | 486 (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End); |
554 if (bLayoutReady) { | 487 if (bLayoutReady) { |
555 m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); | 488 m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); |
556 } | 489 } |
557 } | 490 } |
558 void CXFA_FFNotify::OnChildRemoved(CXFA_Node* pSender, | 491 |
559 void* pParam, | 492 void CXFA_FFNotify::OnChildRemoved() { |
560 void* pParam2) { | |
561 if (CXFA_FFDocView* pDocView = m_pDoc->GetDocView()) { | 493 if (CXFA_FFDocView* pDocView = m_pDoc->GetDocView()) { |
562 FX_BOOL bLayoutReady = | 494 FX_BOOL bLayoutReady = |
563 !(pDocView->m_bInLayoutStatus) && | 495 !(pDocView->m_bInLayoutStatus) && |
564 (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End); | 496 (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End); |
565 if (bLayoutReady) { | 497 if (bLayoutReady) { |
566 m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); | 498 m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); |
567 } | 499 } |
568 } | 500 } |
569 } | 501 } |
570 void CXFA_FFNotify::OnLayoutItemAdd(CXFA_FFDocView* pDocView, | 502 |
571 CXFA_LayoutProcessor* pLayout, | 503 void CXFA_FFNotify::OnLayoutItemAdd(CXFA_LayoutProcessor* pLayout, |
572 CXFA_LayoutItem* pSender, | 504 CXFA_LayoutItem* pSender, |
573 void* pParam, | 505 int32_t iPageIdx, |
574 void* pParam2) { | 506 uint32_t dwStatus) { |
575 CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender); | 507 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout); |
576 int32_t iPageIdx = (int32_t)(uintptr_t)pParam; | 508 if (!pDocView) |
| 509 return; |
| 510 |
| 511 CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pSender); |
| 512 if (!pWidget) |
| 513 return; |
| 514 |
577 CXFA_FFPageView* pNewPageView = pDocView->GetPageView(iPageIdx); | 515 CXFA_FFPageView* pNewPageView = pDocView->GetPageView(iPageIdx); |
578 uint32_t dwStatus = (uint32_t)(uintptr_t)pParam2; | |
579 uint32_t dwFilter = XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable | | 516 uint32_t dwFilter = XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable | |
580 XFA_WIDGETSTATUS_Printable; | 517 XFA_WIDGETSTATUS_Printable; |
581 pWidget->ModifyStatus(dwStatus, dwFilter); | 518 pWidget->ModifyStatus(dwStatus, dwFilter); |
582 CXFA_FFPageView* pPrePageView = pWidget->GetPageView(); | 519 CXFA_FFPageView* pPrePageView = pWidget->GetPageView(); |
583 if (pPrePageView != pNewPageView || | 520 if (pPrePageView != pNewPageView || |
584 (dwStatus & (XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable)) == | 521 (dwStatus & (XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable)) == |
585 (XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable)) { | 522 (XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable)) { |
586 pWidget->SetPageView(pNewPageView); | 523 pWidget->SetPageView(pNewPageView); |
587 m_pDoc->GetDocProvider()->WidgetEvent(pWidget, pWidget->GetDataAcc(), | 524 m_pDoc->GetDocProvider()->WidgetEvent(pWidget, pWidget->GetDataAcc(), |
588 XFA_WIDGETEVENT_PostAdded, | 525 XFA_WIDGETEVENT_PostAdded); |
589 pNewPageView, pPrePageView); | |
590 } | 526 } |
591 if (pDocView->GetLayoutStatus() != XFA_DOCVIEW_LAYOUTSTATUS_End || | 527 if (pDocView->GetLayoutStatus() != XFA_DOCVIEW_LAYOUTSTATUS_End || |
592 !(dwStatus & XFA_WIDGETSTATUS_Visible)) { | 528 !(dwStatus & XFA_WIDGETSTATUS_Visible)) { |
593 return; | 529 return; |
594 } | 530 } |
595 if (pWidget->IsLoaded()) { | 531 if (pWidget->IsLoaded()) { |
596 CFX_RectF rtOld; | 532 CFX_RectF rtOld; |
597 pWidget->GetWidgetRect(rtOld); | 533 pWidget->GetWidgetRect(rtOld); |
598 if (rtOld != pWidget->ReCacheWidgetRect()) | 534 if (rtOld != pWidget->ReCacheWidgetRect()) |
599 pWidget->PerformLayout(); | 535 pWidget->PerformLayout(); |
600 } else { | 536 } else { |
601 pWidget->LoadWidget(); | 537 pWidget->LoadWidget(); |
602 } | 538 } |
603 pWidget->AddInvalidateRect(nullptr); | 539 pWidget->AddInvalidateRect(nullptr); |
604 } | 540 } |
605 void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_FFDocView* pDocView, | 541 |
606 CXFA_LayoutProcessor* pLayout, | 542 void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_LayoutProcessor* pLayout, |
607 CXFA_LayoutItem* pSender, | 543 CXFA_LayoutItem* pSender) { |
608 void* pParam, | 544 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout); |
609 void* pParam2) { | 545 if (!pDocView) |
610 CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender); | 546 return; |
| 547 |
| 548 CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pSender); |
| 549 if (!pWidget) |
| 550 return; |
| 551 |
611 pDocView->DeleteLayoutItem(pWidget); | 552 pDocView->DeleteLayoutItem(pWidget); |
612 m_pDoc->GetDocProvider()->WidgetEvent(pWidget, pWidget->GetDataAcc(), | 553 m_pDoc->GetDocProvider()->WidgetEvent(pWidget, pWidget->GetDataAcc(), |
613 XFA_WIDGETEVENT_PreRemoved, nullptr, | 554 XFA_WIDGETEVENT_PreRemoved); |
614 pWidget->GetPageView()); | |
615 pWidget->AddInvalidateRect(nullptr); | 555 pWidget->AddInvalidateRect(nullptr); |
616 } | 556 } |
617 void CXFA_FFNotify::OnLayoutItemRectChanged(CXFA_FFDocView* pDocView, | |
618 CXFA_LayoutProcessor* pLayout, | |
619 CXFA_LayoutItem* pSender, | |
620 void* pParam, | |
621 void* pParam2) {} | |
622 void CXFA_FFNotify::OnLayoutItemStatustChanged(CXFA_FFDocView* pDocView, | |
623 CXFA_LayoutProcessor* pLayout, | |
624 CXFA_LayoutItem* pSender, | |
625 void* pParam, | |
626 void* pParam2) { | |
627 CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender); | |
628 if (!pWidget) { | |
629 return; | |
630 } | |
631 uint32_t dwStatus = (uint32_t)(uintptr_t)pParam; | |
632 if (dwStatus == 0) { | |
633 CXFA_LayoutItem* pPreItem = pSender->GetPrev(); | |
634 if (pPreItem) { | |
635 CXFA_FFWidget* pPreWidget = static_cast<CXFA_FFWidget*>(pPreItem); | |
636 if (pPreWidget) { | |
637 dwStatus = pPreWidget->GetStatus(); | |
638 } | |
639 } | |
640 } | |
641 uint32_t dwOldStatus = pWidget->GetStatus(); | |
642 uint32_t dwFilter = XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable | | |
643 XFA_WIDGETSTATUS_Printable; | |
644 if ((dwOldStatus & dwFilter) == dwStatus) { | |
645 return; | |
646 } | |
647 pWidget->ModifyStatus(dwStatus, dwFilter); | |
648 } | |
OLD | NEW |