Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cxfa_checkbutton.cpp
Go to the documentation of this file.
1// Copyright 2017 The PDFium Authors
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_checkbutton.h"
8
9#include "fxjs/xfa/cjx_node.h"
10#include "xfa/fxfa/parser/cxfa_document.h"
11
12namespace {
13
14const CXFA_Node::PropertyData kCheckButtonPropertyData[] = {
15 {XFA_Element::Margin, 1, {}},
16 {XFA_Element::Border, 1, {}},
17 {XFA_Element::Extras, 1, {}},
18};
19
20const CXFA_Node::AttributeData kCheckButtonAttributeData[] = {
23 {XFA_Attribute::AllowNeutral, XFA_AttributeType::Boolean, (void*)0},
25 (void*)XFA_AttributeValue::Default},
27 (void*)XFA_AttributeValue::Square},
28 {XFA_Attribute::Size, XFA_AttributeType::Measure, (void*)L"10pt"},
29 {XFA_Attribute::Usehref, XFA_AttributeType::CData, nullptr},
30};
31
32} // namespace
33
34// static
35CXFA_CheckButton* CXFA_CheckButton::FromNode(CXFA_Node* pNode) {
36 return pNode && pNode->GetElementType() == XFA_Element::CheckButton
37 ? static_cast<CXFA_CheckButton*>(pNode)
38 : nullptr;
39}
40
41CXFA_CheckButton::CXFA_CheckButton(CXFA_Document* doc, XFA_PacketType packet)
42 : CXFA_Node(doc,
43 packet,
44 {XFA_XDPPACKET::kTemplate, XFA_XDPPACKET::kForm},
45 XFA_ObjectType::Node,
46 XFA_Element::CheckButton,
47 kCheckButtonPropertyData,
48 kCheckButtonAttributeData,
49 cppgc::MakeGarbageCollected<CJX_Node>(
50 doc->GetHeap()->GetAllocationHandle(),
51 this)) {}
52
53CXFA_CheckButton::~CXFA_CheckButton() = default;
54
58
59bool CXFA_CheckButton::IsRound() {
60 return JSObject()->GetEnum(XFA_Attribute::Shape) == XFA_AttributeValue::Round;
61}
62
63XFA_AttributeValue CXFA_CheckButton::GetMark() {
64 return JSObject()->GetEnum(XFA_Attribute::Mark);
65}
66
67bool CXFA_CheckButton::IsAllowNeutral() {
68 return JSObject()->GetBoolean(XFA_Attribute::AllowNeutral);
69}
XFA_FFWidgetType GetDefaultFFWidgetType() const override
static CXFA_CheckButton * FromNode(CXFA_Node *pNode)
XFA_AttributeValue GetMark()
~CXFA_CheckButton() override
XFA_Element GetElementType() const
Definition cxfa_object.h:91
XFA_FFWidgetType
XFA_AttributeType
Definition fxfa_basic.h:83
XFA_Attribute
Definition fxfa_basic.h:67
XFA_Element
Definition fxfa_basic.h:75
XFA_AttributeValue
Definition fxfa_basic.h:60
XFA_PacketType
Definition fxfa_basic.h:44