1 // Copyright 2017 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #include "xfa/fxfa/parser/cxfa_ui.h" 8 9 #include "fxjs/xfa/cjx_ui.h" 10 #include "third_party/base/ptr_util.h" 11 12 namespace { 13 14 const CXFA_Node::PropertyData kPropertyData[] = { 15 {XFA_Element::CheckButton, 1, XFA_PROPERTYFLAG_OneOf}, 16 {XFA_Element::ChoiceList, 1, XFA_PROPERTYFLAG_OneOf}, 17 {XFA_Element::DefaultUi, 1, XFA_PROPERTYFLAG_OneOf}, 18 {XFA_Element::Barcode, 1, XFA_PROPERTYFLAG_OneOf}, 19 {XFA_Element::Button, 1, XFA_PROPERTYFLAG_OneOf}, 20 {XFA_Element::DateTimeEdit, 1, XFA_PROPERTYFLAG_OneOf}, 21 {XFA_Element::Picture, 1, 0}, 22 {XFA_Element::ImageEdit, 1, XFA_PROPERTYFLAG_OneOf}, 23 {XFA_Element::PasswordEdit, 1, XFA_PROPERTYFLAG_OneOf}, 24 {XFA_Element::NumericEdit, 1, XFA_PROPERTYFLAG_OneOf}, 25 {XFA_Element::Signature, 1, XFA_PROPERTYFLAG_OneOf}, 26 {XFA_Element::TextEdit, 1, XFA_PROPERTYFLAG_OneOf}, 27 {XFA_Element::ExObject, 1, XFA_PROPERTYFLAG_OneOf}, 28 {XFA_Element::Extras, 1, 0}, 29 {XFA_Element::Unknown, 0, 0}}; 30 const CXFA_Node::AttributeData kAttributeData[] = { 31 {XFA_Attribute::Id, XFA_AttributeType::CData, nullptr}, 32 {XFA_Attribute::Use, XFA_AttributeType::CData, nullptr}, 33 {XFA_Attribute::Usehref, XFA_AttributeType::CData, nullptr}, 34 {XFA_Attribute::Unknown, XFA_AttributeType::Integer, nullptr}}; 35 36 constexpr wchar_t kName[] = L"ui"; 37 38 } // namespace 39 40 CXFA_Ui::CXFA_Ui(CXFA_Document* doc, XFA_PacketType packet) 41 : CXFA_Node(doc, 42 packet, 43 (XFA_XDPPACKET_Template | XFA_XDPPACKET_Form), 44 XFA_ObjectType::Node, 45 XFA_Element::Ui, 46 kPropertyData, 47 kAttributeData, 48 kName, 49 pdfium::MakeUnique<CJX_Ui>(this)) {} 50 51 CXFA_Ui::~CXFA_Ui() {} 52