Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
cxfa_margin.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_margin.h"
8
9
#
include
"fxjs/xfa/cjx_node.h"
10
#
include
"xfa/fxfa/parser/cxfa_document.h"
11
12
namespace
{
13
14
const
CXFA_Node
::
PropertyData
kMarginPropertyData[] = {
15
{
XFA_Element
::Extras, 1, {}},
16
};
17
18
const
CXFA_Node
::
AttributeData
kMarginAttributeData[] = {
19
{
XFA_Attribute
::Id,
XFA_AttributeType
::
CData
,
nullptr
},
20
{
XFA_Attribute
::Use,
XFA_AttributeType
::
CData
,
nullptr
},
21
{
XFA_Attribute
::LeftInset,
XFA_AttributeType
::
Measure
, (
void
*)L"0in"},
22
{
XFA_Attribute
::BottomInset,
XFA_AttributeType
::
Measure
, (
void
*)L"0in"},
23
{
XFA_Attribute
::TopInset,
XFA_AttributeType
::
Measure
, (
void
*)L"0in"},
24
{
XFA_Attribute
::RightInset,
XFA_AttributeType
::
Measure
, (
void
*)L"0in"},
25
{
XFA_Attribute
::Usehref,
XFA_AttributeType
::
CData
,
nullptr
},
26
};
27
28
}
// namespace
29
30
CXFA_Margin::CXFA_Margin(CXFA_Document* doc,
XFA_PacketType
packet)
31
: CXFA_Node(doc,
32
packet,
33
{XFA_XDPPACKET::kTemplate, XFA_XDPPACKET::kForm},
34
XFA_ObjectType::Node,
35
XFA_Element::Margin,
36
kMarginPropertyData,
37
kMarginAttributeData,
38
cppgc::MakeGarbageCollected<CJX_Node>(
39
doc->GetHeap()->GetAllocationHandle(),
40
this
)) {}
41
42
CXFA_Margin::~
CXFA_Margin
() =
default
;
43
44
float
CXFA_Margin::
GetLeftInset
()
const
{
45
return
TryLeftInset
().value_or(0);
46
}
47
48
float
CXFA_Margin::
GetTopInset
()
const
{
49
return
TryTopInset
().value_or(0);
50
}
51
52
float
CXFA_Margin::
GetRightInset
()
const
{
53
return
TryRightInset
().value_or(0);
54
}
55
56
float
CXFA_Margin::
GetBottomInset
()
const
{
57
return
TryBottomInset
().value_or(0);
58
}
59
60
std
::optional<
float
> CXFA_Margin::
TryLeftInset
()
const
{
61
return
JSObject()->TryMeasureAsFloat(
XFA_Attribute
::LeftInset);
62
}
63
64
std
::optional<
float
> CXFA_Margin::
TryTopInset
()
const
{
65
return
JSObject()->TryMeasureAsFloat(
XFA_Attribute
::TopInset);
66
}
67
68
std
::optional<
float
> CXFA_Margin::
TryRightInset
()
const
{
69
return
JSObject()->TryMeasureAsFloat(
XFA_Attribute
::RightInset);
70
}
71
72
std
::optional<
float
> CXFA_Margin::
TryBottomInset
()
const
{
73
return
JSObject()->TryMeasureAsFloat(
XFA_Attribute
::BottomInset);
74
}
CXFA_Margin::GetBottomInset
float GetBottomInset() const
Definition
cxfa_margin.cpp:56
CXFA_Margin::TryTopInset
std::optional< float > TryTopInset() const
Definition
cxfa_margin.cpp:64
CXFA_Margin::~CXFA_Margin
~CXFA_Margin() override
CXFA_Margin::TryBottomInset
std::optional< float > TryBottomInset() const
Definition
cxfa_margin.cpp:72
CXFA_Margin::GetLeftInset
float GetLeftInset() const
Definition
cxfa_margin.cpp:44
CXFA_Margin::TryRightInset
std::optional< float > TryRightInset() const
Definition
cxfa_margin.cpp:68
CXFA_Margin::GetTopInset
float GetTopInset() const
Definition
cxfa_margin.cpp:48
CXFA_Margin::GetRightInset
float GetRightInset() const
Definition
cxfa_margin.cpp:52
CXFA_Margin::TryLeftInset
std::optional< float > TryLeftInset() const
Definition
cxfa_margin.cpp:60
CXFA_Node
Definition
cxfa_node.h:94
XFA_AttributeType
XFA_AttributeType
Definition
fxfa_basic.h:83
XFA_AttributeType::Measure
@ Measure
Definition
fxfa_basic.h:88
XFA_AttributeType::CData
@ CData
Definition
fxfa_basic.h:85
XFA_Attribute
XFA_Attribute
Definition
fxfa_basic.h:67
XFA_Element
XFA_Element
Definition
fxfa_basic.h:75
XFA_PacketType
XFA_PacketType
Definition
fxfa_basic.h:44
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
CXFA_Node::AttributeData
Definition
cxfa_node.h:110
CXFA_Node::PropertyData
Definition
cxfa_node.h:96
qtwebengine
src
3rdparty
chromium
third_party
pdfium
xfa
fxfa
parser
cxfa_margin.cpp
Generated on
for Qt by
1.18.0