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 "fxjse/include/cfxjse_value.h" | 9 #include "fxjse/include/cfxjse_value.h" |
10 #include "xfa/fxfa/app/xfa_ffbarcode.h" | 10 #include "xfa/fxfa/app/xfa_ffbarcode.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 void CXFA_FFNotify::OnWidgetListItemAdded(CXFA_WidgetData* pSender, | 51 void CXFA_FFNotify::OnWidgetListItemAdded(CXFA_WidgetData* pSender, |
52 const FX_WCHAR* pLabel, | 52 const FX_WCHAR* pLabel, |
53 const FX_WCHAR* pValue, | 53 const FX_WCHAR* pValue, |
54 int32_t iIndex) { | 54 int32_t iIndex) { |
55 CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pSender); | 55 CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pSender); |
56 if (pWidgetAcc->GetUIType() != XFA_Element::ChoiceList) | 56 if (pWidgetAcc->GetUIType() != XFA_Element::ChoiceList) |
57 return; | 57 return; |
58 | 58 |
59 CXFA_FFWidget* pWidget = nullptr; | 59 CXFA_FFWidget* pWidget = nullptr; |
60 while ((pWidget = pWidgetAcc->GetNextWidget(pWidget)) != nullptr) { | 60 while ((pWidget = pWidgetAcc->GetNextWidget(pWidget))) { |
61 if (pWidget->IsLoaded()) { | 61 if (pWidget->IsLoaded()) { |
62 if (pWidgetAcc->IsListBox()) { | 62 if (pWidgetAcc->IsListBox()) { |
63 static_cast<CXFA_FFListBox*>(pWidget)->InsertItem(pLabel, iIndex); | 63 static_cast<CXFA_FFListBox*>(pWidget)->InsertItem(pLabel, iIndex); |
64 } else { | 64 } else { |
65 static_cast<CXFA_FFComboBox*>(pWidget)->InsertItem(pLabel, iIndex); | 65 static_cast<CXFA_FFComboBox*>(pWidget)->InsertItem(pLabel, iIndex); |
66 } | 66 } |
67 } | 67 } |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 void CXFA_FFNotify::OnWidgetListItemRemoved(CXFA_WidgetData* pSender, | 71 void CXFA_FFNotify::OnWidgetListItemRemoved(CXFA_WidgetData* pSender, |
72 int32_t iIndex) { | 72 int32_t iIndex) { |
73 CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pSender); | 73 CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pSender); |
74 if (pWidgetAcc->GetUIType() != XFA_Element::ChoiceList) | 74 if (pWidgetAcc->GetUIType() != XFA_Element::ChoiceList) |
75 return; | 75 return; |
76 | 76 |
77 CXFA_FFWidget* pWidget = nullptr; | 77 CXFA_FFWidget* pWidget = nullptr; |
78 while ((pWidget = pWidgetAcc->GetNextWidget(pWidget)) != nullptr) { | 78 while ((pWidget = pWidgetAcc->GetNextWidget(pWidget))) { |
79 if (pWidget->IsLoaded()) { | 79 if (pWidget->IsLoaded()) { |
80 if (pWidgetAcc->IsListBox()) { | 80 if (pWidgetAcc->IsListBox()) { |
81 static_cast<CXFA_FFListBox*>(pWidget)->DeleteItem(iIndex); | 81 static_cast<CXFA_FFListBox*>(pWidget)->DeleteItem(iIndex); |
82 } else { | 82 } else { |
83 static_cast<CXFA_FFComboBox*>(pWidget)->DeleteItem(iIndex); | 83 static_cast<CXFA_FFComboBox*>(pWidget)->DeleteItem(iIndex); |
84 } | 84 } |
85 } | 85 } |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 XFA_EVENTTYPE eEventType, | 214 XFA_EVENTTYPE eEventType, |
215 FX_BOOL bIsFormReady, | 215 FX_BOOL bIsFormReady, |
216 FX_BOOL bRecursive, | 216 FX_BOOL bRecursive, |
217 CXFA_WidgetAcc* pExclude) { | 217 CXFA_WidgetAcc* pExclude) { |
218 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 218 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
219 if (!pDocView) { | 219 if (!pDocView) { |
220 return XFA_EVENTERROR_NotExist; | 220 return XFA_EVENTERROR_NotExist; |
221 } | 221 } |
222 return pDocView->ExecEventActivityByDeepFirst( | 222 return pDocView->ExecEventActivityByDeepFirst( |
223 pFormNode, eEventType, bIsFormReady, bRecursive, | 223 pFormNode, eEventType, bIsFormReady, bRecursive, |
224 pExclude ? pExclude->GetNode() : NULL); | 224 pExclude ? pExclude->GetNode() : nullptr); |
225 } | 225 } |
226 void CXFA_FFNotify::AddCalcValidate(CXFA_Node* pNode) { | 226 void CXFA_FFNotify::AddCalcValidate(CXFA_Node* pNode) { |
227 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 227 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
228 if (!pDocView) { | 228 if (!pDocView) { |
229 return; | 229 return; |
230 } | 230 } |
231 CXFA_WidgetAcc* pWidgetAcc = | 231 CXFA_WidgetAcc* pWidgetAcc = |
232 static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()); | 232 static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()); |
233 if (!pWidgetAcc) { | 233 if (!pWidgetAcc) { |
234 return; | 234 return; |
235 } | 235 } |
236 pDocView->AddCalculateWidgetAcc(pWidgetAcc); | 236 pDocView->AddCalculateWidgetAcc(pWidgetAcc); |
237 pDocView->AddValidateWidget(pWidgetAcc); | 237 pDocView->AddValidateWidget(pWidgetAcc); |
238 } | 238 } |
239 CXFA_FFDoc* CXFA_FFNotify::GetHDOC() { | 239 CXFA_FFDoc* CXFA_FFNotify::GetHDOC() { |
240 return m_pDoc; | 240 return m_pDoc; |
241 } | 241 } |
242 IXFA_DocProvider* CXFA_FFNotify::GetDocProvider() { | 242 IXFA_DocProvider* CXFA_FFNotify::GetDocProvider() { |
243 return m_pDoc->GetDocProvider(); | 243 return m_pDoc->GetDocProvider(); |
244 } | 244 } |
245 IXFA_AppProvider* CXFA_FFNotify::GetAppProvider() { | 245 IXFA_AppProvider* CXFA_FFNotify::GetAppProvider() { |
246 return m_pDoc->GetApp()->GetAppProvider(); | 246 return m_pDoc->GetApp()->GetAppProvider(); |
247 } | 247 } |
248 CXFA_FFWidgetHandler* CXFA_FFNotify::GetWidgetHandler() { | 248 CXFA_FFWidgetHandler* CXFA_FFNotify::GetWidgetHandler() { |
249 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 249 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
250 return pDocView ? pDocView->GetWidgetHandler() : NULL; | 250 return pDocView ? pDocView->GetWidgetHandler() : nullptr; |
251 } | 251 } |
252 CXFA_FFWidget* CXFA_FFNotify::GetHWidget(CXFA_LayoutItem* pLayoutItem) { | 252 CXFA_FFWidget* CXFA_FFNotify::GetHWidget(CXFA_LayoutItem* pLayoutItem) { |
253 return XFA_GetWidgetFromLayoutItem(pLayoutItem); | 253 return XFA_GetWidgetFromLayoutItem(pLayoutItem); |
254 } | 254 } |
255 void CXFA_FFNotify::OpenDropDownList(CXFA_FFWidget* hWidget) { | 255 void CXFA_FFNotify::OpenDropDownList(CXFA_FFWidget* hWidget) { |
256 if (hWidget->GetDataAcc()->GetUIType() != XFA_Element::ChoiceList) { | 256 if (hWidget->GetDataAcc()->GetUIType() != XFA_Element::ChoiceList) { |
257 return; | 257 return; |
258 } | 258 } |
259 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 259 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
260 pDocView->LockUpdate(); | 260 pDocView->LockUpdate(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 void CXFA_FFNotify::RunSubformIndexChange(CXFA_Node* pSubformNode) { | 292 void CXFA_FFNotify::RunSubformIndexChange(CXFA_Node* pSubformNode) { |
293 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 293 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
294 if (!pDocView) { | 294 if (!pDocView) { |
295 return; | 295 return; |
296 } | 296 } |
297 pDocView->AddIndexChangedSubform(pSubformNode); | 297 pDocView->AddIndexChangedSubform(pSubformNode); |
298 } | 298 } |
299 CXFA_Node* CXFA_FFNotify::GetFocusWidgetNode() { | 299 CXFA_Node* CXFA_FFNotify::GetFocusWidgetNode() { |
300 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 300 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
301 if (!pDocView) { | 301 if (!pDocView) { |
302 return NULL; | 302 return nullptr; |
303 } | 303 } |
304 CXFA_WidgetAcc* pAcc = pDocView->GetFocusWidgetAcc(); | 304 CXFA_WidgetAcc* pAcc = pDocView->GetFocusWidgetAcc(); |
305 return pAcc ? pAcc->GetNode() : NULL; | 305 return pAcc ? pAcc->GetNode() : nullptr; |
306 } | 306 } |
307 void CXFA_FFNotify::SetFocusWidgetNode(CXFA_Node* pNode) { | 307 void CXFA_FFNotify::SetFocusWidgetNode(CXFA_Node* pNode) { |
308 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 308 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
309 if (!pDocView) { | 309 if (!pDocView) { |
310 return; | 310 return; |
311 } | 311 } |
312 CXFA_WidgetAcc* pAcc = | 312 CXFA_WidgetAcc* pAcc = |
313 pNode ? static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()) : nullptr; | 313 pNode ? static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()) : nullptr; |
314 pDocView->SetFocusWidgetAcc(pAcc); | 314 pDocView->SetFocusWidgetAcc(pAcc); |
315 } | 315 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 353 |
354 if (pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End) | 354 if (pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End) |
355 return; | 355 return; |
356 | 356 |
357 CXFA_WidgetAcc* pWidgetAcc = | 357 CXFA_WidgetAcc* pWidgetAcc = |
358 static_cast<CXFA_WidgetAcc*>(pSender->GetWidgetData()); | 358 static_cast<CXFA_WidgetAcc*>(pSender->GetWidgetData()); |
359 if (!pWidgetAcc) | 359 if (!pWidgetAcc) |
360 return; | 360 return; |
361 | 361 |
362 CXFA_FFWidget* pWidget = nullptr; | 362 CXFA_FFWidget* pWidget = nullptr; |
363 while ((pWidget = pWidgetAcc->GetNextWidget(pWidget)) != nullptr) { | 363 while ((pWidget = pWidgetAcc->GetNextWidget(pWidget))) { |
364 if (pWidget->IsLoaded()) | 364 if (pWidget->IsLoaded()) |
365 pWidget->AddInvalidateRect(); | 365 pWidget->AddInvalidateRect(); |
366 } | 366 } |
367 } | 367 } |
368 | 368 |
369 void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender, | 369 void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender, |
370 XFA_ATTRIBUTE eAttr, | 370 XFA_ATTRIBUTE eAttr, |
371 CXFA_Node* pParentNode, | 371 CXFA_Node* pParentNode, |
372 CXFA_Node* pWidgetNode) { | 372 CXFA_Node* pWidgetNode) { |
373 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 373 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 pDocView->AddCalculateWidgetAcc(pWidgetAcc); | 415 pDocView->AddCalculateWidgetAcc(pWidgetAcc); |
416 pDocView->AddValidateWidget(pWidgetAcc); | 416 pDocView->AddValidateWidget(pWidgetAcc); |
417 } else if (pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent) | 417 } else if (pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent) |
418 ->GetElementType() == XFA_Element::ExclGroup) { | 418 ->GetElementType() == XFA_Element::ExclGroup) { |
419 pWidgetAcc->UpdateUIDisplay(); | 419 pWidgetAcc->UpdateUIDisplay(); |
420 } | 420 } |
421 return; | 421 return; |
422 } | 422 } |
423 } | 423 } |
424 CXFA_FFWidget* pWidget = nullptr; | 424 CXFA_FFWidget* pWidget = nullptr; |
425 while ((pWidget = pWidgetAcc->GetNextWidget(pWidget)) != nullptr) { | 425 while ((pWidget = pWidgetAcc->GetNextWidget(pWidget))) { |
426 if (!pWidget->IsLoaded()) | 426 if (!pWidget->IsLoaded()) |
427 continue; | 427 continue; |
428 | 428 |
429 if (bUpdateProperty) | 429 if (bUpdateProperty) |
430 pWidget->UpdateWidgetProperty(); | 430 pWidget->UpdateWidgetProperty(); |
431 pWidget->PerformLayout(); | 431 pWidget->PerformLayout(); |
432 pWidget->AddInvalidateRect(); | 432 pWidget->AddInvalidateRect(); |
433 } | 433 } |
434 } | 434 } |
435 | 435 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 return; | 505 return; |
506 | 506 |
507 CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pSender); | 507 CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pSender); |
508 if (!pWidget) | 508 if (!pWidget) |
509 return; | 509 return; |
510 | 510 |
511 pDocView->DeleteLayoutItem(pWidget); | 511 pDocView->DeleteLayoutItem(pWidget); |
512 m_pDoc->GetDocProvider()->WidgetPreRemove(pWidget, pWidget->GetDataAcc()); | 512 m_pDoc->GetDocProvider()->WidgetPreRemove(pWidget, pWidget->GetDataAcc()); |
513 pWidget->AddInvalidateRect(nullptr); | 513 pWidget->AddInvalidateRect(nullptr); |
514 } | 514 } |
OLD | NEW |