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/include/xfa_ffdocview.h" | 7 #include "xfa/fxfa/include/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_ffbarcode.h" | 10 #include "xfa/fxfa/app/xfa_ffbarcode.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 } | 302 } |
303 ExecEventActivityByDeepFirst(pNode, pParam->m_eType, pParam->m_bIsFormReady); | 303 ExecEventActivityByDeepFirst(pNode, pParam->m_eType, pParam->m_bIsFormReady); |
304 return XFA_EVENTERROR_Success; | 304 return XFA_EVENTERROR_Success; |
305 } | 305 } |
306 CXFA_FFWidgetHandler* CXFA_FFDocView::GetWidgetHandler() { | 306 CXFA_FFWidgetHandler* CXFA_FFDocView::GetWidgetHandler() { |
307 if (!m_pWidgetHandler) { | 307 if (!m_pWidgetHandler) { |
308 m_pWidgetHandler = new CXFA_FFWidgetHandler(this); | 308 m_pWidgetHandler = new CXFA_FFWidgetHandler(this); |
309 } | 309 } |
310 return m_pWidgetHandler; | 310 return m_pWidgetHandler; |
311 } | 311 } |
312 IXFA_WidgetIterator* CXFA_FFDocView::CreateWidgetIterator() { | 312 |
313 CXFA_Node* pFormRoot = GetRootSubform(); | |
314 if (!pFormRoot) { | |
315 return NULL; | |
316 } | |
317 return new CXFA_FFDocWidgetIterator(this, pFormRoot); | |
318 } | |
319 CXFA_WidgetAccIterator* CXFA_FFDocView::CreateWidgetAccIterator( | 313 CXFA_WidgetAccIterator* CXFA_FFDocView::CreateWidgetAccIterator( |
320 XFA_WIDGETORDER eOrder) { | 314 XFA_WIDGETORDER eOrder) { |
321 CXFA_Node* pFormRoot = GetRootSubform(); | 315 CXFA_Node* pFormRoot = GetRootSubform(); |
322 if (!pFormRoot) { | 316 if (!pFormRoot) { |
323 return NULL; | 317 return NULL; |
324 } | 318 } |
325 return new CXFA_WidgetAccIterator(this, pFormRoot); | 319 return new CXFA_WidgetAccIterator(this, pFormRoot); |
326 } | 320 } |
327 CXFA_FFWidget* CXFA_FFDocView::GetFocusWidget() { | 321 CXFA_FFWidget* CXFA_FFDocView::GetFocusWidget() { |
328 return m_pFocusWidget; | 322 return m_pFocusWidget; |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); | 796 m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc); |
803 } | 797 } |
804 CXFA_Node* CXFA_FFDocView::GetRootSubform() { | 798 CXFA_Node* CXFA_FFDocView::GetRootSubform() { |
805 CXFA_Node* pFormPacketNode = | 799 CXFA_Node* pFormPacketNode = |
806 ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)); | 800 ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)); |
807 if (!pFormPacketNode) { | 801 if (!pFormPacketNode) { |
808 return NULL; | 802 return NULL; |
809 } | 803 } |
810 return pFormPacketNode->GetFirstChildByClass(XFA_ELEMENT_Subform); | 804 return pFormPacketNode->GetFirstChildByClass(XFA_ELEMENT_Subform); |
811 } | 805 } |
812 CXFA_FFDocWidgetIterator::CXFA_FFDocWidgetIterator(CXFA_FFDocView* pDocView, | |
813 CXFA_Node* pTravelRoot) | |
814 : m_ContentIterator(pTravelRoot) { | |
815 m_pDocView = pDocView; | |
816 m_pCurWidget = NULL; | |
817 } | |
818 CXFA_FFDocWidgetIterator::~CXFA_FFDocWidgetIterator() {} | |
819 void CXFA_FFDocWidgetIterator::Reset() { | |
820 m_ContentIterator.Reset(); | |
821 m_pCurWidget = NULL; | |
822 } | |
823 CXFA_FFWidget* CXFA_FFDocWidgetIterator::MoveToFirst() { | |
824 return NULL; | |
825 } | |
826 CXFA_FFWidget* CXFA_FFDocWidgetIterator::MoveToLast() { | |
827 return NULL; | |
828 } | |
829 CXFA_FFWidget* CXFA_FFDocWidgetIterator::MoveToNext() { | |
830 CXFA_Node* pItem = m_pCurWidget ? m_ContentIterator.MoveToNext() | |
831 : m_ContentIterator.GetCurrent(); | |
832 while (pItem) { | |
833 if (CXFA_WidgetAcc* pAcc = (CXFA_WidgetAcc*)pItem->GetWidgetData()) { | |
834 while ((m_pCurWidget = pAcc->GetNextWidget(NULL))) { | |
835 if (!m_pCurWidget->IsLoaded() && | |
836 (m_pCurWidget->GetStatus() & XFA_WidgetStatus_Visible)) { | |
837 m_pCurWidget->LoadWidget(); | |
838 } | |
839 return m_pCurWidget; | |
840 } | |
841 } | |
842 pItem = m_ContentIterator.MoveToNext(); | |
843 } | |
844 return NULL; | |
845 } | |
846 CXFA_FFWidget* CXFA_FFDocWidgetIterator::MoveToPrevious() { | |
847 return NULL; | |
848 } | |
849 CXFA_FFWidget* CXFA_FFDocWidgetIterator::GetCurrentWidget() { | |
850 return NULL; | |
851 } | |
852 FX_BOOL CXFA_FFDocWidgetIterator::SetCurrentWidget(CXFA_FFWidget* hWidget) { | |
853 return FALSE; | |
854 } | |
855 | 806 |
856 CXFA_WidgetAccIterator::CXFA_WidgetAccIterator(CXFA_FFDocView* pDocView, | 807 CXFA_WidgetAccIterator::CXFA_WidgetAccIterator(CXFA_FFDocView* pDocView, |
857 CXFA_Node* pTravelRoot) | 808 CXFA_Node* pTravelRoot) |
858 : m_ContentIterator(pTravelRoot) { | 809 : m_ContentIterator(pTravelRoot) { |
859 m_pDocView = pDocView; | 810 m_pDocView = pDocView; |
860 m_pCurWidgetAcc = NULL; | 811 m_pCurWidgetAcc = NULL; |
861 } | 812 } |
862 CXFA_WidgetAccIterator::~CXFA_WidgetAccIterator() {} | 813 CXFA_WidgetAccIterator::~CXFA_WidgetAccIterator() {} |
863 void CXFA_WidgetAccIterator::Reset() { | 814 void CXFA_WidgetAccIterator::Reset() { |
864 m_pCurWidgetAcc = NULL; | 815 m_pCurWidgetAcc = NULL; |
(...skipping 22 matching lines...) Expand all Loading... |
887 CXFA_WidgetAcc* CXFA_WidgetAccIterator::GetCurrentWidgetAcc() { | 838 CXFA_WidgetAcc* CXFA_WidgetAccIterator::GetCurrentWidgetAcc() { |
888 return NULL; | 839 return NULL; |
889 } | 840 } |
890 FX_BOOL CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) { | 841 FX_BOOL CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) { |
891 return FALSE; | 842 return FALSE; |
892 } | 843 } |
893 void CXFA_WidgetAccIterator::SkipTree() { | 844 void CXFA_WidgetAccIterator::SkipTree() { |
894 m_ContentIterator.SkipChildrenAndMoveToNext(); | 845 m_ContentIterator.SkipChildrenAndMoveToNext(); |
895 m_pCurWidgetAcc = NULL; | 846 m_pCurWidgetAcc = NULL; |
896 } | 847 } |
OLD | NEW |