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_image.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_image.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
::
AttributeData
kImageAttributeData[] = {
15
{
XFA_Attribute
::Id,
XFA_AttributeType
::
CData
,
nullptr
},
16
{
XFA_Attribute
::Name,
XFA_AttributeType
::
CData
,
nullptr
},
17
{
XFA_Attribute
::Use,
XFA_AttributeType
::
CData
,
nullptr
},
18
{
XFA_Attribute
::ContentType,
XFA_AttributeType
::
CData
,
nullptr
},
19
{
XFA_Attribute
::TransferEncoding,
XFA_AttributeType
::
Enum
,
20
(
void
*)
XFA_AttributeValue
::Base64},
21
{
XFA_Attribute
::Usehref,
XFA_AttributeType
::
CData
,
nullptr
},
22
{
XFA_Attribute
::Aspect,
XFA_AttributeType
::
Enum
,
23
(
void
*)
XFA_AttributeValue
::Fit},
24
{
XFA_Attribute
::Href,
XFA_AttributeType
::
CData
,
nullptr
},
25
};
26
27
}
// namespace
28
29
// static
30
CXFA_Image* CXFA_Image::
FromNode
(
CXFA_Node
* pNode) {
31
return
pNode && pNode->GetElementType() == XFA_Element::Image
32
?
static_cast
<CXFA_Image*>(pNode)
33
:
nullptr
;
34
}
35
36
CXFA_Image::CXFA_Image(CXFA_Document* doc,
XFA_PacketType
packet)
37
: CXFA_Node(doc,
38
packet,
39
{XFA_XDPPACKET::kTemplate, XFA_XDPPACKET::kForm},
40
XFA_ObjectType::ContentNode,
41
XFA_Element::Image,
42
{},
43
kImageAttributeData,
44
cppgc::MakeGarbageCollected<CJX_Node>(
45
doc->GetHeap()->GetAllocationHandle(),
46
this
)) {}
47
48
CXFA_Image::~
CXFA_Image
() =
default
;
49
50
XFA_AttributeValue
CXFA_Image::
GetAspect
() {
51
return
JSObject()->GetEnum(
XFA_Attribute
::Aspect);
52
}
53
54
WideString
CXFA_Image::
GetContentType
() {
55
return
JSObject()->TryCData(
XFA_Attribute
::ContentType,
true
).value_or(L"");
56
}
57
58
WideString
CXFA_Image::
GetHref
() {
59
return
JSObject()->TryCData(
XFA_Attribute
::Href,
true
).value_or(L"");
60
}
61
62
XFA_AttributeValue
CXFA_Image::
GetTransferEncoding
() {
63
return
static_cast
<
XFA_AttributeValue
>(
64
JSObject()->GetEnum(
XFA_Attribute
::TransferEncoding));
65
}
66
67
WideString
CXFA_Image::
GetContent
() {
68
return
JSObject()->TryContent(
false
,
true
).value_or(L"");
69
}
70
71
void
CXFA_Image::
SetContentType
(
const
WideString
& wsContentType) {
72
JSObject()->SetCData(
XFA_Attribute
::ContentType, wsContentType);
73
}
74
75
void
CXFA_Image::
SetHref
(
const
WideString
& wsHref) {
76
JSObject()->SetCData(
XFA_Attribute
::Href, wsHref);
77
}
78
79
void
CXFA_Image::
SetTransferEncoding
(
XFA_AttributeValue
iTransferEncoding) {
80
JSObject()->SetEnum(
XFA_Attribute
::TransferEncoding, iTransferEncoding,
81
false
);
82
}
CXFA_Image::GetContent
WideString GetContent()
Definition
cxfa_image.cpp:67
CXFA_Image::SetTransferEncoding
void SetTransferEncoding(XFA_AttributeValue iTransferEncoding)
Definition
cxfa_image.cpp:79
CXFA_Image::FromNode
static CXFA_Image * FromNode(CXFA_Node *pNode)
Definition
cxfa_image.cpp:30
CXFA_Image::SetContentType
void SetContentType(const WideString &wsContentType)
Definition
cxfa_image.cpp:71
CXFA_Image::SetHref
void SetHref(const WideString &wsHref)
Definition
cxfa_image.cpp:75
CXFA_Image::GetContentType
WideString GetContentType()
Definition
cxfa_image.cpp:54
CXFA_Image::GetTransferEncoding
XFA_AttributeValue GetTransferEncoding()
Definition
cxfa_image.cpp:62
CXFA_Image::GetHref
WideString GetHref()
Definition
cxfa_image.cpp:58
CXFA_Image::GetAspect
XFA_AttributeValue GetAspect()
Definition
cxfa_image.cpp:50
CXFA_Image::~CXFA_Image
~CXFA_Image() override
CXFA_Node
Definition
cxfa_node.h:94
XFA_AttributeType
XFA_AttributeType
Definition
fxfa_basic.h:83
XFA_AttributeType::Enum
@ Enum
Definition
fxfa_basic.h:84
XFA_AttributeType::CData
@ CData
Definition
fxfa_basic.h:85
XFA_Attribute
XFA_Attribute
Definition
fxfa_basic.h:67
XFA_AttributeValue
XFA_AttributeValue
Definition
fxfa_basic.h:60
XFA_PacketType
XFA_PacketType
Definition
fxfa_basic.h:44
CXFA_Node::AttributeData
Definition
cxfa_node.h:110
WideString
fxcrt::WideString WideString
Definition
widestring.h:207
qtwebengine
src
3rdparty
chromium
third_party
pdfium
xfa
fxfa
parser
cxfa_image.cpp
Generated on
for Qt by
1.18.0