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_barcode.h"
8
9 #include "fxjs/xfa/cjx_barcode.h"
10 #include "third_party/base/ptr_util.h"
11
12 namespace {
13
14 const CXFA_Node::AttributeData kAttributeData[] = {
15 {XFA_Attribute::Id, XFA_AttributeType::CData, nullptr},
16 {XFA_Attribute::DataRowCount, XFA_AttributeType::CData, nullptr},
17 {XFA_Attribute::Use, XFA_AttributeType::CData, nullptr},
18 {XFA_Attribute::DataPrep, XFA_AttributeType::Enum,
19 (void*)XFA_AttributeEnum::None},
20 {XFA_Attribute::Type, XFA_AttributeType::CData, (void*)nullptr},
21 {XFA_Attribute::TextLocation, XFA_AttributeType::Enum,
22 (void*)XFA_AttributeEnum::Below},
23 {XFA_Attribute::ModuleWidth, XFA_AttributeType::Measure, (void*)L"0.25mm"},
24 {XFA_Attribute::PrintCheckDigit, XFA_AttributeType::Boolean, (void*)0},
25 {XFA_Attribute::ModuleHeight, XFA_AttributeType::Measure, (void*)L"5mm"},
26 {XFA_Attribute::StartChar, XFA_AttributeType::CData, nullptr},
27 {XFA_Attribute::Truncate, XFA_AttributeType::Boolean, (void*)0},
28 {XFA_Attribute::WideNarrowRatio, XFA_AttributeType::CData, (void*)L"3:1"},
29 {XFA_Attribute::ErrorCorrectionLevel, XFA_AttributeType::CData, nullptr},
30 {XFA_Attribute::UpsMode, XFA_AttributeType::Enum,
31 (void*)XFA_AttributeEnum::UsCarrier},
32 {XFA_Attribute::Checksum, XFA_AttributeType::Enum,
33 (void*)XFA_AttributeEnum::None},
34 {XFA_Attribute::CharEncoding, XFA_AttributeType::CData, (void*)L"UTF-8"},
35 {XFA_Attribute::Usehref, XFA_AttributeType::CData, nullptr},
36 {XFA_Attribute::DataColumnCount, XFA_AttributeType::CData, nullptr},
37 {XFA_Attribute::RowColumnRatio, XFA_AttributeType::CData, nullptr},
38 {XFA_Attribute::DataLength, XFA_AttributeType::CData, nullptr},
39 {XFA_Attribute::EndChar, XFA_AttributeType::CData, nullptr},
40 {XFA_Attribute::Unknown, XFA_AttributeType::Integer, nullptr}};
41
42 constexpr wchar_t kName[] = L"barcode";
43
44 } // namespace
45
CXFA_Barcode(CXFA_Document * doc,XFA_PacketType packet)46 CXFA_Barcode::CXFA_Barcode(CXFA_Document* doc, XFA_PacketType packet)
47 : CXFA_Node(doc,
48 packet,
49 (XFA_XDPPACKET_Template | XFA_XDPPACKET_Form),
50 XFA_ObjectType::Node,
51 XFA_Element::Barcode,
52 nullptr,
53 kAttributeData,
54 kName,
55 pdfium::MakeUnique<CJX_Barcode>(this)) {}
56
~CXFA_Barcode()57 CXFA_Barcode::~CXFA_Barcode() {}
58