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_ffdocview.h" | 7 #include "xfa/include/fxfa/xfa_ffdocview.h" |
8 | 8 |
9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
10 #include "xfa/fxfa/app/xfa_ffapp.h" | |
11 #include "xfa/fxfa/app/xfa_ffbarcode.h" | 10 #include "xfa/fxfa/app/xfa_ffbarcode.h" |
12 #include "xfa/fxfa/app/xfa_ffcheckbutton.h" | 11 #include "xfa/fxfa/app/xfa_ffcheckbutton.h" |
13 #include "xfa/fxfa/app/xfa_ffchoicelist.h" | 12 #include "xfa/fxfa/app/xfa_ffchoicelist.h" |
14 #include "xfa/fxfa/app/xfa_ffdoc.h" | |
15 #include "xfa/fxfa/app/xfa_ffdraw.h" | 13 #include "xfa/fxfa/app/xfa_ffdraw.h" |
16 #include "xfa/fxfa/app/xfa_ffexclgroup.h" | 14 #include "xfa/fxfa/app/xfa_ffexclgroup.h" |
17 #include "xfa/fxfa/app/xfa_fffield.h" | 15 #include "xfa/fxfa/app/xfa_fffield.h" |
18 #include "xfa/fxfa/app/xfa_ffimage.h" | 16 #include "xfa/fxfa/app/xfa_ffimage.h" |
19 #include "xfa/fxfa/app/xfa_ffimageedit.h" | 17 #include "xfa/fxfa/app/xfa_ffimageedit.h" |
20 #include "xfa/fxfa/app/xfa_ffpageview.h" | |
21 #include "xfa/fxfa/app/xfa_ffpath.h" | 18 #include "xfa/fxfa/app/xfa_ffpath.h" |
22 #include "xfa/fxfa/app/xfa_ffpushbutton.h" | 19 #include "xfa/fxfa/app/xfa_ffpushbutton.h" |
23 #include "xfa/fxfa/app/xfa_ffsignature.h" | 20 #include "xfa/fxfa/app/xfa_ffsignature.h" |
24 #include "xfa/fxfa/app/xfa_ffsubform.h" | 21 #include "xfa/fxfa/app/xfa_ffsubform.h" |
25 #include "xfa/fxfa/app/xfa_fftext.h" | 22 #include "xfa/fxfa/app/xfa_fftext.h" |
26 #include "xfa/fxfa/app/xfa_fftextedit.h" | 23 #include "xfa/fxfa/app/xfa_fftextedit.h" |
27 #include "xfa/fxfa/app/xfa_ffwidget.h" | 24 #include "xfa/fxfa/app/xfa_ffwidget.h" |
28 #include "xfa/fxfa/app/xfa_ffwidgetacc.h" | 25 #include "xfa/fxfa/app/xfa_ffwidgetacc.h" |
29 #include "xfa/fxfa/app/xfa_ffwidgethandler.h" | |
30 #include "xfa/fxfa/app/xfa_fwladapter.h" | 26 #include "xfa/fxfa/app/xfa_fwladapter.h" |
31 #include "xfa/fxfa/app/xfa_textlayout.h" | 27 #include "xfa/fxfa/app/xfa_textlayout.h" |
| 28 #include "xfa/fxfa/parser/xfa_document_layout_imp.h" |
32 #include "xfa/fxfa/parser/xfa_script.h" | 29 #include "xfa/fxfa/parser/xfa_script.h" |
| 30 #include "xfa/fxfa/parser/xfa_script_imp.h" |
| 31 #include "xfa/include/fxfa/xfa_ffapp.h" |
| 32 #include "xfa/include/fxfa/xfa_ffdoc.h" |
| 33 #include "xfa/include/fxfa/xfa_ffpageview.h" |
| 34 #include "xfa/include/fxfa/xfa_ffwidgethandler.h" |
33 | 35 |
34 extern const XFA_ATTRIBUTEENUM gs_EventActivity[] = { | 36 extern const XFA_ATTRIBUTEENUM gs_EventActivity[] = { |
35 XFA_ATTRIBUTEENUM_Click, XFA_ATTRIBUTEENUM_Change, | 37 XFA_ATTRIBUTEENUM_Click, XFA_ATTRIBUTEENUM_Change, |
36 XFA_ATTRIBUTEENUM_DocClose, XFA_ATTRIBUTEENUM_DocReady, | 38 XFA_ATTRIBUTEENUM_DocClose, XFA_ATTRIBUTEENUM_DocReady, |
37 XFA_ATTRIBUTEENUM_Enter, XFA_ATTRIBUTEENUM_Exit, | 39 XFA_ATTRIBUTEENUM_Enter, XFA_ATTRIBUTEENUM_Exit, |
38 XFA_ATTRIBUTEENUM_Full, XFA_ATTRIBUTEENUM_IndexChange, | 40 XFA_ATTRIBUTEENUM_Full, XFA_ATTRIBUTEENUM_IndexChange, |
39 XFA_ATTRIBUTEENUM_Initialize, XFA_ATTRIBUTEENUM_MouseDown, | 41 XFA_ATTRIBUTEENUM_Initialize, XFA_ATTRIBUTEENUM_MouseDown, |
40 XFA_ATTRIBUTEENUM_MouseEnter, XFA_ATTRIBUTEENUM_MouseExit, | 42 XFA_ATTRIBUTEENUM_MouseEnter, XFA_ATTRIBUTEENUM_MouseExit, |
41 XFA_ATTRIBUTEENUM_MouseUp, XFA_ATTRIBUTEENUM_PostExecute, | 43 XFA_ATTRIBUTEENUM_MouseUp, XFA_ATTRIBUTEENUM_PostExecute, |
42 XFA_ATTRIBUTEENUM_PostOpen, XFA_ATTRIBUTEENUM_PostPrint, | 44 XFA_ATTRIBUTEENUM_PostOpen, XFA_ATTRIBUTEENUM_PostPrint, |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 m_CalculateAccs.RemoveAll(); | 190 m_CalculateAccs.RemoveAll(); |
189 RunInvalidate(); | 191 RunInvalidate(); |
190 UnlockUpdate(); | 192 UnlockUpdate(); |
191 } | 193 } |
192 int32_t CXFA_FFDocView::CountPageViews() { | 194 int32_t CXFA_FFDocView::CountPageViews() { |
193 if (!m_pXFADocLayout) { | 195 if (!m_pXFADocLayout) { |
194 return 0; | 196 return 0; |
195 } | 197 } |
196 return m_pXFADocLayout->CountPages(); | 198 return m_pXFADocLayout->CountPages(); |
197 } | 199 } |
198 IXFA_PageView* CXFA_FFDocView::GetPageView(int32_t nIndex) { | 200 CXFA_FFPageView* CXFA_FFDocView::GetPageView(int32_t nIndex) { |
199 if (!m_pXFADocLayout) { | 201 if (!m_pXFADocLayout) { |
200 return NULL; | 202 return NULL; |
201 } | 203 } |
202 return static_cast<CXFA_FFPageView*>(m_pXFADocLayout->GetPage(nIndex)); | 204 return static_cast<CXFA_FFPageView*>(m_pXFADocLayout->GetPage(nIndex)); |
203 } | 205 } |
204 IXFA_Widget* CXFA_FFDocView::GetWidgetByName(const CFX_WideStringC& wsName) { | 206 |
205 return GetWidgetByName(wsName, NULL); | 207 CXFA_LayoutProcessor* CXFA_FFDocView::GetXFALayout() const { |
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(); | 208 return m_pDoc->GetXFADoc()->GetDocLayout(); |
213 } | 209 } |
214 FX_BOOL CXFA_FFDocView::ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc) { | 210 FX_BOOL CXFA_FFDocView::ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc) { |
215 CXFA_Node* pNode = pWidgetAcc->GetNode(); | 211 CXFA_Node* pNode = pWidgetAcc->GetNode(); |
216 XFA_ELEMENT eType = pNode->GetClassID(); | 212 XFA_ELEMENT eType = pNode->GetClassID(); |
217 if (eType != XFA_ELEMENT_Field && eType != XFA_ELEMENT_ExclGroup) { | 213 if (eType != XFA_ELEMENT_Field && eType != XFA_ELEMENT_ExclGroup) { |
218 return FALSE; | 214 return FALSE; |
219 } | 215 } |
220 FX_BOOL bNotify = IsStaticNotify(); | 216 FX_BOOL bNotify = IsStaticNotify(); |
221 pWidgetAcc->ResetData(); | 217 pWidgetAcc->ResetData(); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 CXFA_Node* pRootItem = | 301 CXFA_Node* pRootItem = |
306 ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)); | 302 ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)); |
307 if (!pRootItem) { | 303 if (!pRootItem) { |
308 return XFA_EVENTERROR_Error; | 304 return XFA_EVENTERROR_Error; |
309 } | 305 } |
310 pNode = pRootItem->GetChild(0, XFA_ELEMENT_Subform); | 306 pNode = pRootItem->GetChild(0, XFA_ELEMENT_Subform); |
311 } | 307 } |
312 ExecEventActivityByDeepFirst(pNode, pParam->m_eType, pParam->m_bIsFormReady); | 308 ExecEventActivityByDeepFirst(pNode, pParam->m_eType, pParam->m_bIsFormReady); |
313 return XFA_EVENTERROR_Success; | 309 return XFA_EVENTERROR_Success; |
314 } | 310 } |
315 IXFA_WidgetHandler* CXFA_FFDocView::GetWidgetHandler() { | 311 CXFA_FFWidgetHandler* CXFA_FFDocView::GetWidgetHandler() { |
316 if (!m_pWidgetHandler) { | 312 if (!m_pWidgetHandler) { |
317 m_pWidgetHandler = new CXFA_FFWidgetHandler(this); | 313 m_pWidgetHandler = new CXFA_FFWidgetHandler(this); |
318 } | 314 } |
319 return m_pWidgetHandler; | 315 return m_pWidgetHandler; |
320 } | 316 } |
321 IXFA_WidgetIterator* CXFA_FFDocView::CreateWidgetIterator() { | 317 IXFA_WidgetIterator* CXFA_FFDocView::CreateWidgetIterator() { |
322 CXFA_Node* pFormRoot = GetRootSubform(); | 318 CXFA_Node* pFormRoot = GetRootSubform(); |
323 if (!pFormRoot) { | 319 if (!pFormRoot) { |
324 return NULL; | 320 return NULL; |
325 } | 321 } |
326 return new CXFA_FFDocWidgetIterator(this, pFormRoot); | 322 return new CXFA_FFDocWidgetIterator(this, pFormRoot); |
327 } | 323 } |
328 IXFA_WidgetAccIterator* CXFA_FFDocView::CreateWidgetAccIterator( | 324 CXFA_WidgetAccIterator* CXFA_FFDocView::CreateWidgetAccIterator( |
329 XFA_WIDGETORDER eOrder) { | 325 XFA_WIDGETORDER eOrder) { |
330 CXFA_Node* pFormRoot = GetRootSubform(); | 326 CXFA_Node* pFormRoot = GetRootSubform(); |
331 if (!pFormRoot) { | 327 if (!pFormRoot) { |
332 return NULL; | 328 return NULL; |
333 } | 329 } |
334 return new CXFA_WidgetAccIterator(this, pFormRoot); | 330 return new CXFA_WidgetAccIterator(this, pFormRoot); |
335 } | 331 } |
336 IXFA_Widget* CXFA_FFDocView::GetFocusWidget() { | 332 CXFA_FFWidget* CXFA_FFDocView::GetFocusWidget() { |
337 return m_pFocusWidget; | 333 return m_pFocusWidget; |
338 } | 334 } |
339 void CXFA_FFDocView::KillFocus() { | 335 void CXFA_FFDocView::KillFocus() { |
340 if (m_pFocusWidget && | 336 if (m_pFocusWidget && |
341 (m_pFocusWidget->GetStatus() & XFA_WIDGETSTATUS_Focused)) { | 337 (m_pFocusWidget->GetStatus() & XFA_WIDGETSTATUS_Focused)) { |
342 (m_pFocusWidget)->OnKillFocus(NULL); | 338 (m_pFocusWidget)->OnKillFocus(NULL); |
343 } | 339 } |
344 m_pFocusAcc = NULL; | 340 m_pFocusAcc = NULL; |
345 m_pFocusWidget = NULL; | 341 m_pFocusWidget = NULL; |
346 m_pOldFocusWidget = NULL; | 342 m_pOldFocusWidget = NULL; |
347 } | 343 } |
348 FX_BOOL CXFA_FFDocView::SetFocus(IXFA_Widget* hWidget) { | 344 FX_BOOL CXFA_FFDocView::SetFocus(CXFA_FFWidget* hWidget) { |
349 CXFA_FFWidget* pNewFocus = (CXFA_FFWidget*)hWidget; | 345 CXFA_FFWidget* pNewFocus = hWidget; |
350 if (m_pOldFocusWidget == pNewFocus) { | 346 if (m_pOldFocusWidget == pNewFocus) { |
351 return FALSE; | 347 return FALSE; |
352 } | 348 } |
353 CXFA_FFWidget* pOldFocus = m_pOldFocusWidget; | 349 CXFA_FFWidget* pOldFocus = m_pOldFocusWidget; |
354 m_pOldFocusWidget = pNewFocus; | 350 m_pOldFocusWidget = pNewFocus; |
355 if (pOldFocus) { | 351 if (pOldFocus) { |
356 if (m_pFocusWidget != m_pOldFocusWidget && | 352 if (m_pFocusWidget != m_pOldFocusWidget && |
357 (pOldFocus->GetStatus() & XFA_WIDGETSTATUS_Focused)) { | 353 (pOldFocus->GetStatus() & XFA_WIDGETSTATUS_Focused)) { |
358 m_pFocusWidget = pOldFocus; | 354 m_pFocusWidget = pOldFocus; |
359 pOldFocus->OnKillFocus(pNewFocus); | 355 pOldFocus->OnKillFocus(pNewFocus); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 return pAcc->GetNextWidget(NULL); | 496 return pAcc->GetNextWidget(NULL); |
501 } | 497 } |
502 return NULL; | 498 return NULL; |
503 } | 499 } |
504 CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( | 500 CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( |
505 const CFX_WideStringC& wsName, | 501 const CFX_WideStringC& wsName, |
506 CXFA_WidgetAcc* pRefWidgetAcc) { | 502 CXFA_WidgetAcc* pRefWidgetAcc) { |
507 CFX_WideString wsExpression; | 503 CFX_WideString wsExpression; |
508 uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | | 504 uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | |
509 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; | 505 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; |
510 IXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext(); | 506 CXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext(); |
511 if (!pScriptContext) { | 507 if (!pScriptContext) { |
512 return NULL; | 508 return NULL; |
513 } | 509 } |
514 CXFA_Node* refNode = NULL; | 510 CXFA_Node* refNode = NULL; |
515 if (pRefWidgetAcc) { | 511 if (pRefWidgetAcc) { |
516 refNode = pRefWidgetAcc->GetNode(); | 512 refNode = pRefWidgetAcc->GetNode(); |
517 wsExpression = wsName; | 513 wsExpression = wsName; |
518 } else { | 514 } else { |
519 wsExpression = L"$form." + wsName; | 515 wsExpression = L"$form." + wsName; |
520 } | 516 } |
521 XFA_RESOLVENODE_RS resoveNodeRS; | 517 XFA_RESOLVENODE_RS resoveNodeRS; |
522 int32_t iRet = pScriptContext->ResolveObjects(refNode, wsExpression, | 518 int32_t iRet = pScriptContext->ResolveObjects(refNode, wsExpression, |
523 resoveNodeRS, dwStyle); | 519 resoveNodeRS, dwStyle); |
524 if (iRet < 1) { | 520 if (iRet < 1) { |
525 return NULL; | 521 return NULL; |
526 } | 522 } |
527 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { | 523 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { |
528 CXFA_Node* pNode = resoveNodeRS.nodes[0]->AsNode(); | 524 CXFA_Node* pNode = resoveNodeRS.nodes[0]->AsNode(); |
529 if (pNode) { | 525 if (pNode) { |
530 return (CXFA_WidgetAcc*)pNode->GetWidgetData(); | 526 return (CXFA_WidgetAcc*)pNode->GetWidgetData(); |
531 } | 527 } |
532 } | 528 } |
533 return NULL; | 529 return NULL; |
534 } | 530 } |
535 void CXFA_FFDocView::OnPageEvent(IXFA_LayoutPage* pSender, | 531 void CXFA_FFDocView::OnPageEvent(CXFA_ContainerLayoutItem* pSender, |
536 XFA_PAGEEVENT eEvent, | 532 XFA_PAGEEVENT eEvent, |
537 int32_t iPageIndex) { | 533 int32_t iPageIndex) { |
538 CXFA_FFPageView* pFFPageView = static_cast<CXFA_FFPageView*>(pSender); | 534 CXFA_FFPageView* pFFPageView = static_cast<CXFA_FFPageView*>(pSender); |
539 if (eEvent == XFA_PAGEEVENT_PageRemoved) { | 535 if (eEvent == XFA_PAGEEVENT_PageRemoved) { |
540 m_pDoc->GetDocProvider()->PageViewEvent(pFFPageView, | 536 m_pDoc->GetDocProvider()->PageViewEvent(pFFPageView, |
541 XFA_PAGEVIEWEVENT_PostRemoved); | 537 XFA_PAGEVIEWEVENT_PostRemoved); |
542 return; | 538 return; |
543 } | 539 } |
544 m_pDoc->GetDocProvider()->PageViewEvent(pFFPageView, | 540 m_pDoc->GetDocProvider()->PageViewEvent(pFFPageView, |
545 XFA_PAGEVIEWEVENT_PostAdded); | 541 XFA_PAGEVIEWEVENT_PostAdded); |
(...skipping 15 matching lines...) Expand all Loading... |
561 CFX_RectF* pRect = NULL; | 557 CFX_RectF* pRect = NULL; |
562 m_mapPageInvalidate.GetNextAssoc(ps, pPageView, (void*&)pRect); | 558 m_mapPageInvalidate.GetNextAssoc(ps, pPageView, (void*&)pRect); |
563 delete pRect; | 559 delete pRect; |
564 } | 560 } |
565 m_mapPageInvalidate.RemoveAll(); | 561 m_mapPageInvalidate.RemoveAll(); |
566 } | 562 } |
567 void CXFA_FFDocView::AddInvalidateRect(CXFA_FFWidget* pWidget, | 563 void CXFA_FFDocView::AddInvalidateRect(CXFA_FFWidget* pWidget, |
568 const CFX_RectF& rtInvalidate) { | 564 const CFX_RectF& rtInvalidate) { |
569 AddInvalidateRect(pWidget->GetPageView(), rtInvalidate); | 565 AddInvalidateRect(pWidget->GetPageView(), rtInvalidate); |
570 } | 566 } |
571 void CXFA_FFDocView::AddInvalidateRect(IXFA_PageView* pPageView, | 567 void CXFA_FFDocView::AddInvalidateRect(CXFA_FFPageView* pPageView, |
572 const CFX_RectF& rtInvalidate) { | 568 const CFX_RectF& rtInvalidate) { |
573 CFX_RectF* pRect = (CFX_RectF*)m_mapPageInvalidate.GetValueAt(pPageView); | 569 CFX_RectF* pRect = (CFX_RectF*)m_mapPageInvalidate.GetValueAt(pPageView); |
574 if (!pRect) { | 570 if (!pRect) { |
575 pRect = new CFX_RectF; | 571 pRect = new CFX_RectF; |
576 pRect->Set(rtInvalidate.left, rtInvalidate.top, rtInvalidate.width, | 572 pRect->Set(rtInvalidate.left, rtInvalidate.top, rtInvalidate.width, |
577 rtInvalidate.height); | 573 rtInvalidate.height); |
578 m_mapPageInvalidate.SetAt(pPageView, pRect); | 574 m_mapPageInvalidate.SetAt(pPageView, pRect); |
579 } else { | 575 } else { |
580 pRect->Union(rtInvalidate); | 576 pRect->Union(rtInvalidate); |
581 } | 577 } |
582 } | 578 } |
583 void CXFA_FFDocView::RunInvalidate() { | 579 void CXFA_FFDocView::RunInvalidate() { |
584 FX_POSITION ps = m_mapPageInvalidate.GetStartPosition(); | 580 FX_POSITION ps = m_mapPageInvalidate.GetStartPosition(); |
585 while (ps) { | 581 while (ps) { |
586 IXFA_PageView* pPageView = NULL; | 582 CXFA_FFPageView* pPageView = NULL; |
587 CFX_RectF* pRect = NULL; | 583 CFX_RectF* pRect = NULL; |
588 m_mapPageInvalidate.GetNextAssoc(ps, (void*&)pPageView, (void*&)pRect); | 584 m_mapPageInvalidate.GetNextAssoc(ps, (void*&)pPageView, (void*&)pRect); |
589 m_pDoc->GetDocProvider()->InvalidateRect(pPageView, *pRect); | 585 m_pDoc->GetDocProvider()->InvalidateRect(pPageView, *pRect); |
590 delete pRect; | 586 delete pRect; |
591 } | 587 } |
592 m_mapPageInvalidate.RemoveAll(); | 588 m_mapPageInvalidate.RemoveAll(); |
593 } | 589 } |
594 FX_BOOL CXFA_FFDocView::RunLayout() { | 590 FX_BOOL CXFA_FFDocView::RunLayout() { |
595 LockUpdate(); | 591 LockUpdate(); |
596 m_bInLayoutStatus = TRUE; | 592 m_bInLayoutStatus = TRUE; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 ->HasFlag(XFA_NODEFLAG_HasRemoved)) { | 759 ->HasFlag(XFA_NODEFLAG_HasRemoved)) { |
764 continue; | 760 continue; |
765 } | 761 } |
766 CXFA_Node* pWidgetNode = reinterpret_cast<CXFA_Node*>(m_bindItems[i]) | 762 CXFA_Node* pWidgetNode = reinterpret_cast<CXFA_Node*>(m_bindItems[i]) |
767 ->GetNodeItem(XFA_NODEITEM_Parent); | 763 ->GetNodeItem(XFA_NODEITEM_Parent); |
768 CXFA_WidgetAcc* pAcc = (CXFA_WidgetAcc*)pWidgetNode->GetWidgetData(); | 764 CXFA_WidgetAcc* pAcc = (CXFA_WidgetAcc*)pWidgetNode->GetWidgetData(); |
769 if (!pAcc) { | 765 if (!pAcc) { |
770 continue; | 766 continue; |
771 } | 767 } |
772 CXFA_BindItems binditems(reinterpret_cast<CXFA_Node*>(m_bindItems[i])); | 768 CXFA_BindItems binditems(reinterpret_cast<CXFA_Node*>(m_bindItems[i])); |
773 IXFA_ScriptContext* pScriptContext = | 769 CXFA_ScriptContext* pScriptContext = |
774 pWidgetNode->GetDocument()->GetScriptContext(); | 770 pWidgetNode->GetDocument()->GetScriptContext(); |
775 CFX_WideStringC wsRef; | 771 CFX_WideStringC wsRef; |
776 binditems.GetRef(wsRef); | 772 binditems.GetRef(wsRef); |
777 uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | | 773 uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | |
778 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent | | 774 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent | |
779 XFA_RESOLVENODE_ALL; | 775 XFA_RESOLVENODE_ALL; |
780 XFA_RESOLVENODE_RS rs; | 776 XFA_RESOLVENODE_RS rs; |
781 pScriptContext->ResolveObjects(pWidgetNode, wsRef, rs, dwStyle); | 777 pScriptContext->ResolveObjects(pWidgetNode, wsRef, rs, dwStyle); |
782 int32_t iCount = rs.nodes.GetSize(); | 778 int32_t iCount = rs.nodes.GetSize(); |
783 pAcc->DeleteItem(-1); | 779 pAcc->DeleteItem(-1); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 CXFA_Node* pTravelRoot) | 841 CXFA_Node* pTravelRoot) |
846 : m_ContentIterator(pTravelRoot) { | 842 : m_ContentIterator(pTravelRoot) { |
847 m_pDocView = pDocView; | 843 m_pDocView = pDocView; |
848 m_pCurWidget = NULL; | 844 m_pCurWidget = NULL; |
849 } | 845 } |
850 CXFA_FFDocWidgetIterator::~CXFA_FFDocWidgetIterator() {} | 846 CXFA_FFDocWidgetIterator::~CXFA_FFDocWidgetIterator() {} |
851 void CXFA_FFDocWidgetIterator::Reset() { | 847 void CXFA_FFDocWidgetIterator::Reset() { |
852 m_ContentIterator.Reset(); | 848 m_ContentIterator.Reset(); |
853 m_pCurWidget = NULL; | 849 m_pCurWidget = NULL; |
854 } | 850 } |
855 IXFA_Widget* CXFA_FFDocWidgetIterator::MoveToFirst() { | 851 CXFA_FFWidget* CXFA_FFDocWidgetIterator::MoveToFirst() { |
856 return NULL; | 852 return NULL; |
857 } | 853 } |
858 IXFA_Widget* CXFA_FFDocWidgetIterator::MoveToLast() { | 854 CXFA_FFWidget* CXFA_FFDocWidgetIterator::MoveToLast() { |
859 return NULL; | 855 return NULL; |
860 } | 856 } |
861 IXFA_Widget* CXFA_FFDocWidgetIterator::MoveToNext() { | 857 CXFA_FFWidget* CXFA_FFDocWidgetIterator::MoveToNext() { |
862 CXFA_Node* pItem = m_pCurWidget ? m_ContentIterator.MoveToNext() | 858 CXFA_Node* pItem = m_pCurWidget ? m_ContentIterator.MoveToNext() |
863 : m_ContentIterator.GetCurrent(); | 859 : m_ContentIterator.GetCurrent(); |
864 while (pItem) { | 860 while (pItem) { |
865 if (CXFA_WidgetAcc* pAcc = (CXFA_WidgetAcc*)pItem->GetWidgetData()) { | 861 if (CXFA_WidgetAcc* pAcc = (CXFA_WidgetAcc*)pItem->GetWidgetData()) { |
866 while ((m_pCurWidget = pAcc->GetNextWidget(NULL))) { | 862 while ((m_pCurWidget = pAcc->GetNextWidget(NULL))) { |
867 if (!m_pCurWidget->IsLoaded() && | 863 if (!m_pCurWidget->IsLoaded() && |
868 (m_pCurWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) { | 864 (m_pCurWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) { |
869 m_pCurWidget->LoadWidget(); | 865 m_pCurWidget->LoadWidget(); |
870 } | 866 } |
871 return m_pCurWidget; | 867 return m_pCurWidget; |
872 } | 868 } |
873 } | 869 } |
874 pItem = m_ContentIterator.MoveToNext(); | 870 pItem = m_ContentIterator.MoveToNext(); |
875 } | 871 } |
876 return NULL; | 872 return NULL; |
877 } | 873 } |
878 IXFA_Widget* CXFA_FFDocWidgetIterator::MoveToPrevious() { | 874 CXFA_FFWidget* CXFA_FFDocWidgetIterator::MoveToPrevious() { |
879 return NULL; | 875 return NULL; |
880 } | 876 } |
881 IXFA_Widget* CXFA_FFDocWidgetIterator::GetCurrentWidget() { | 877 CXFA_FFWidget* CXFA_FFDocWidgetIterator::GetCurrentWidget() { |
882 return NULL; | 878 return NULL; |
883 } | 879 } |
884 FX_BOOL CXFA_FFDocWidgetIterator::SetCurrentWidget(IXFA_Widget* hWidget) { | 880 FX_BOOL CXFA_FFDocWidgetIterator::SetCurrentWidget(CXFA_FFWidget* hWidget) { |
885 return FALSE; | 881 return FALSE; |
886 } | 882 } |
887 IXFA_WidgetAccIterator* XFA_WidgetAccIterator_Create( | 883 |
888 CXFA_WidgetAcc* pTravelRoot, | |
889 XFA_WIDGETORDER eOrder) { | |
890 if (!pTravelRoot) { | |
891 return NULL; | |
892 } | |
893 return new CXFA_WidgetAccIterator(pTravelRoot->GetDocView(), | |
894 pTravelRoot->GetNode()); | |
895 } | |
896 CXFA_WidgetAccIterator::CXFA_WidgetAccIterator(CXFA_FFDocView* pDocView, | 884 CXFA_WidgetAccIterator::CXFA_WidgetAccIterator(CXFA_FFDocView* pDocView, |
897 CXFA_Node* pTravelRoot) | 885 CXFA_Node* pTravelRoot) |
898 : m_ContentIterator(pTravelRoot) { | 886 : m_ContentIterator(pTravelRoot) { |
899 m_pDocView = pDocView; | 887 m_pDocView = pDocView; |
900 m_pCurWidgetAcc = NULL; | 888 m_pCurWidgetAcc = NULL; |
901 } | 889 } |
902 CXFA_WidgetAccIterator::~CXFA_WidgetAccIterator() {} | 890 CXFA_WidgetAccIterator::~CXFA_WidgetAccIterator() {} |
903 void CXFA_WidgetAccIterator::Reset() { | 891 void CXFA_WidgetAccIterator::Reset() { |
904 m_pCurWidgetAcc = NULL; | 892 m_pCurWidgetAcc = NULL; |
905 m_ContentIterator.Reset(); | 893 m_ContentIterator.Reset(); |
(...skipping 21 matching lines...) Expand all Loading... |
927 CXFA_WidgetAcc* CXFA_WidgetAccIterator::GetCurrentWidgetAcc() { | 915 CXFA_WidgetAcc* CXFA_WidgetAccIterator::GetCurrentWidgetAcc() { |
928 return NULL; | 916 return NULL; |
929 } | 917 } |
930 FX_BOOL CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) { | 918 FX_BOOL CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) { |
931 return FALSE; | 919 return FALSE; |
932 } | 920 } |
933 void CXFA_WidgetAccIterator::SkipTree() { | 921 void CXFA_WidgetAccIterator::SkipTree() { |
934 m_ContentIterator.SkipChildrenAndMoveToNext(); | 922 m_ContentIterator.SkipChildrenAndMoveToNext(); |
935 m_pCurWidgetAcc = NULL; | 923 m_pCurWidgetAcc = NULL; |
936 } | 924 } |
OLD | NEW |