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_value.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_value.h"
8
9
#
include
"fxjs/xfa/cjx_node.h"
10
#
include
"fxjs/xfa/cjx_object.h"
11
#
include
"xfa/fxfa/parser/cxfa_arc.h"
12
#
include
"xfa/fxfa/parser/cxfa_document.h"
13
#
include
"xfa/fxfa/parser/cxfa_exdata.h"
14
#
include
"xfa/fxfa/parser/cxfa_image.h"
15
#
include
"xfa/fxfa/parser/cxfa_line.h"
16
#
include
"xfa/fxfa/parser/cxfa_rectangle.h"
17
18
namespace
{
19
20
constexpr
CXFA_Node
::
PropertyData
kValuePropertyData[] = {
21
{
XFA_Element
::Arc, 1,
XFA_PropertyFlag
::
kOneOf
},
22
{
XFA_Element
::Text, 1,
XFA_PropertyFlag
::
kOneOf
},
23
{
XFA_Element
::Time, 1,
XFA_PropertyFlag
::
kOneOf
},
24
{
XFA_Element
::DateTime, 1,
XFA_PropertyFlag
::
kOneOf
},
25
{
XFA_Element
::Image, 1,
XFA_PropertyFlag
::
kOneOf
},
26
{
XFA_Element
::Decimal, 1,
XFA_PropertyFlag
::
kOneOf
},
27
{
XFA_Element
::Boolean, 1,
XFA_PropertyFlag
::
kOneOf
},
28
{
XFA_Element
::Integer, 1,
XFA_PropertyFlag
::
kOneOf
},
29
{
XFA_Element
::ExData, 1,
XFA_PropertyFlag
::
kOneOf
},
30
{
XFA_Element
::Rectangle, 1,
XFA_PropertyFlag
::
kOneOf
},
31
{
XFA_Element
::Date, 1,
XFA_PropertyFlag
::
kOneOf
},
32
{
XFA_Element
::Float, 1,
XFA_PropertyFlag
::
kOneOf
},
33
{
XFA_Element
::Line, 1,
XFA_PropertyFlag
::
kOneOf
},
34
};
35
36
constexpr
CXFA_Node
::
AttributeData
kValueAttributeData[] = {
37
{
XFA_Attribute
::Id,
XFA_AttributeType
::
CData
,
nullptr
},
38
{
XFA_Attribute
::Use,
XFA_AttributeType
::
CData
,
nullptr
},
39
{
XFA_Attribute
::Relevant,
XFA_AttributeType
::
CData
,
nullptr
},
40
{
XFA_Attribute
::Usehref,
XFA_AttributeType
::
CData
,
nullptr
},
41
{
XFA_Attribute
::Override,
XFA_AttributeType
::
Boolean
, (
void
*)0},
42
};
43
44
}
// namespace
45
46
CXFA_Value::CXFA_Value(CXFA_Document* doc,
XFA_PacketType
packet)
47
: CXFA_Node(doc,
48
packet,
49
{XFA_XDPPACKET::kTemplate, XFA_XDPPACKET::kForm},
50
XFA_ObjectType::Node,
51
XFA_Element::Value,
52
kValuePropertyData,
53
kValueAttributeData,
54
cppgc::MakeGarbageCollected<CJX_Node>(
55
doc->GetHeap()->GetAllocationHandle(),
56
this
)) {}
57
58
CXFA_Value::~
CXFA_Value
() =
default
;
59
60
XFA_Element
CXFA_Value::
GetChildValueClassID
()
const
{
61
CXFA_Node
* pNode = GetFirstChild();
62
return
pNode ? pNode
->
GetElementType
() :
XFA_Element
::
Unknown
;
63
}
64
65
WideString CXFA_Value::
GetChildValueContent
()
const
{
66
CXFA_Node
* pNode = GetFirstChild();
67
return
pNode
68
? pNode->JSObject()->TryContent(
false
,
true
).value_or(WideString
(
)
)
69
: WideString
(
)
;
70
}
71
72
CXFA_Arc* CXFA_Value::
GetArcIfExists
()
const
{
73
return
CXFA_Arc
::
FromNode
(
GetFirstChild()
)
;
74
}
75
76
CXFA_Line* CXFA_Value::
GetLineIfExists
()
const
{
77
return
CXFA_Line
::
FromNode
(
GetFirstChild()
)
;
78
}
79
80
CXFA_Rectangle
* CXFA_Value::
GetRectangleIfExists
()
const
{
81
return
CXFA_Rectangle
::
FromNode
(
GetFirstChild()
)
;
82
}
83
84
CXFA_Text* CXFA_Value::
GetTextIfExists
()
const
{
85
return
CXFA_Text
::
FromNode
(
GetFirstChild()
)
;
86
}
87
88
CXFA_ExData* CXFA_Value::
GetExDataIfExists
()
const
{
89
return
CXFA_ExData
::
FromNode
(
GetFirstChild()
)
;
90
}
91
92
CXFA_Image* CXFA_Value::
GetImageIfExists
()
const
{
93
return
CXFA_Image
::
FromNode
(
GetFirstChild()
)
;
94
}
CXFA_Arc::FromNode
static CXFA_Arc * FromNode(CXFA_Node *pNode)
Definition
cxfa_arc.cpp:33
CXFA_ExData::FromNode
static CXFA_ExData * FromNode(CXFA_Node *pNode)
Definition
cxfa_exdata.cpp:30
CXFA_Image::FromNode
static CXFA_Image * FromNode(CXFA_Node *pNode)
Definition
cxfa_image.cpp:30
CXFA_Line::FromNode
static CXFA_Line * FromNode(CXFA_Node *pNode)
Definition
cxfa_line.cpp:33
CXFA_Node
Definition
cxfa_node.h:93
CXFA_Object::GetElementType
XFA_Element GetElementType() const
Definition
cxfa_object.h:91
CXFA_Rectangle
Definition
cxfa_rectangle.h:15
CXFA_Rectangle::FromNode
static CXFA_Rectangle * FromNode(CXFA_Node *pNode)
Definition
cxfa_rectangle.cpp:40
CXFA_Text::FromNode
static CXFA_Text * FromNode(CXFA_Node *pNode)
Definition
cxfa_text.cpp:26
CXFA_Value::~CXFA_Value
~CXFA_Value() override
CXFA_Value::GetExDataIfExists
CXFA_ExData * GetExDataIfExists() const
Definition
cxfa_value.cpp:88
CXFA_Value::GetTextIfExists
CXFA_Text * GetTextIfExists() const
Definition
cxfa_value.cpp:84
CXFA_Value::GetChildValueContent
WideString GetChildValueContent() const
Definition
cxfa_value.cpp:65
CXFA_Value::GetImageIfExists
CXFA_Image * GetImageIfExists() const
Definition
cxfa_value.cpp:92
CXFA_Value::GetChildValueClassID
XFA_Element GetChildValueClassID() const
Definition
cxfa_value.cpp:60
CXFA_Value::GetArcIfExists
CXFA_Arc * GetArcIfExists() const
Definition
cxfa_value.cpp:72
CXFA_Value::GetLineIfExists
CXFA_Line * GetLineIfExists() const
Definition
cxfa_value.cpp:76
CXFA_Value::GetRectangleIfExists
CXFA_Rectangle * GetRectangleIfExists() const
Definition
cxfa_value.cpp:80
fxcrt::WideString::WideString
WideString()
XFA_PropertyFlag
XFA_PropertyFlag
Definition
cxfa_node.h:88
XFA_PropertyFlag::kOneOf
@ kOneOf
XFA_AttributeType
XFA_AttributeType
Definition
fxfa_basic.h:83
XFA_AttributeType::Boolean
@ Boolean
XFA_AttributeType::CData
@ CData
XFA_Attribute
XFA_Attribute
Definition
fxfa_basic.h:67
XFA_Element
XFA_Element
Definition
fxfa_basic.h:75
XFA_Element::Unknown
@ Unknown
XFA_PacketType
XFA_PacketType
Definition
fxfa_basic.h:44
CXFA_Node::AttributeData
Definition
cxfa_node.h:109
CXFA_Node::PropertyData
Definition
cxfa_node.h:95
qtwebengine
src
3rdparty
chromium
third_party
pdfium
xfa
fxfa
parser
cxfa_value.cpp
Generated on Sat Sep 21 2024 01:05:11 for Qt by
1.12.0