Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: xfa/fxfa/parser/cxfa_widgetdata.cpp

Issue 1890563003: Simplify XFA event handling. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: address comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/include/xfa_ffdocview.h ('k') | xfa/fxfa/parser/xfa_document.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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/parser/cxfa_widgetdata.h" 7 #include "xfa/fxfa/parser/cxfa_widgetdata.h"
8 8
9 #include "core/fxcrt/include/fx_ext.h" 9 #include "core/fxcrt/include/fx_ext.h"
10 #include "xfa/fxbarcode/include/BC_Library.h" 10 #include "xfa/fxbarcode/include/BC_Library.h"
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 InsertListTextItem(pSaveItems, wsOldValue.AsStringC(), i); 920 InsertListTextItem(pSaveItems, wsOldValue.AsStringC(), i);
921 i++; 921 i++;
922 pListNode = pListNode->GetNodeItem(XFA_NODEITEM_NextSibling); 922 pListNode = pListNode->GetNodeItem(XFA_NODEITEM_NextSibling);
923 } 923 }
924 InsertListTextItem(pNode, wsLabel.AsStringC(), nIndex); 924 InsertListTextItem(pNode, wsLabel.AsStringC(), nIndex);
925 InsertListTextItem(pSaveItems, wsNewValue.AsStringC(), nIndex); 925 InsertListTextItem(pSaveItems, wsNewValue.AsStringC(), nIndex);
926 } 926 }
927 if (!bNotify) 927 if (!bNotify)
928 return; 928 return;
929 929
930 m_pNode->GetDocument()->GetNotify()->OnWidgetDataEvent( 930 m_pNode->GetDocument()->GetNotify()->OnWidgetListItemAdded(
931 this, XFA_WIDGETEVENT_ListItemAdded, (void*)wsLabel.c_str(), 931 this, wsLabel.c_str(), wsValue.c_str(), nIndex);
932 (void*)wsValue.c_str(), (void*)(uintptr_t)nIndex);
933 } 932 }
934 933
935 void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue, 934 void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue,
936 CFX_WideString& wsLabel) { 935 CFX_WideString& wsLabel) {
937 int32_t iCount = 0; 936 int32_t iCount = 0;
938 CXFA_NodeArray listitems; 937 CXFA_NodeArray listitems;
939 CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); 938 CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
940 for (; pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) { 939 for (; pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) {
941 if (pItems->GetClassID() != XFA_ELEMENT_Items) 940 if (pItems->GetClassID() != XFA_ELEMENT_Items)
942 continue; 941 continue;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 while (pNode) { 1045 while (pNode) {
1047 if (i == nIndex) { 1046 if (i == nIndex) {
1048 pItems->RemoveChild(pNode); 1047 pItems->RemoveChild(pNode);
1049 break; 1048 break;
1050 } 1049 }
1051 i++; 1050 i++;
1052 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling); 1051 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling);
1053 } 1052 }
1054 } 1053 }
1055 } 1054 }
1056 if (!bNotify) 1055 if (bNotify)
1057 return TRUE; 1056 m_pNode->GetDocument()->GetNotify()->OnWidgetListItemRemoved(this, nIndex);
1058
1059 m_pNode->GetDocument()->GetNotify()->OnWidgetDataEvent(
1060 this, XFA_WIDGETEVENT_ListItemRemoved, (void*)(uintptr_t)nIndex);
1061 return TRUE; 1057 return TRUE;
1062 } 1058 }
1063 1059
1064 int32_t CXFA_WidgetData::GetHorizontalScrollPolicy() { 1060 int32_t CXFA_WidgetData::GetHorizontalScrollPolicy() {
1065 CXFA_Node* pUIChild = GetUIChild(); 1061 CXFA_Node* pUIChild = GetUIChild();
1066 if (pUIChild) 1062 if (pUIChild)
1067 return pUIChild->GetEnum(XFA_ATTRIBUTE_HScrollPolicy); 1063 return pUIChild->GetEnum(XFA_ATTRIBUTE_HScrollPolicy);
1068 return XFA_ATTRIBUTEENUM_Auto; 1064 return XFA_ATTRIBUTEENUM_Auto;
1069 } 1065 }
1070 1066
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1788 } 1784 }
1789 } 1785 }
1790 } else if (wc == L'.') { 1786 } else if (wc == L'.') {
1791 iTread_ = 0; 1787 iTread_ = 0;
1792 iLead = -1; 1788 iLead = -1;
1793 } 1789 }
1794 wsRet += wc; 1790 wsRet += wc;
1795 } 1791 }
1796 return wsRet; 1792 return wsRet;
1797 } 1793 }
OLDNEW
« no previous file with comments | « xfa/fxfa/include/xfa_ffdocview.h ('k') | xfa/fxfa/parser/xfa_document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698