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_dataexporter.cpp
Go to the documentation of this file.
1
// Copyright 2014 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_dataexporter.h"
8
9
#
include
"core/fxcrt/check.h"
10
#
include
"core/fxcrt/fx_codepage.h"
11
#
include
"core/fxcrt/xml/cfx_xmlelement.h"
12
#
include
"core/fxcrt/xml/cfx_xmlnode.h"
13
#
include
"xfa/fxfa/parser/cxfa_document.h"
14
#
include
"xfa/fxfa/parser/cxfa_node.h"
15
#
include
"xfa/fxfa/parser/xfa_utils.h"
16
17
CXFA_DataExporter
::
CXFA_DataExporter
() =
default
;
18
19
CXFA_DataExporter
::~
CXFA_DataExporter
() =
default
;
20
21
bool
CXFA_DataExporter
::
Export
(
const
RetainPtr
<
IFX_SeekableStream
>& pStream,
22
CXFA_Node
* pNode) {
23
DCHECK
(pStream);
24
25
if
(pNode
->
IsModelNode
()) {
26
switch
(pNode
->
GetPacketType
(
)
) {
27
case
XFA_PacketType
::Xdp: {
28
pStream->WriteString(
29
"<xdp:xdp xmlns:xdp=\"http://ns.adobe.com/xdp/\">"
);
30
for
(
CXFA_Node
* pChild = pNode->GetFirstChild(); pChild;
31
pChild = pChild->GetNextSibling()) {
32
Export
(
pStream
,
pChild
)
;
33
}
34
pStream->WriteString(
"</xdp:xdp>\n"
);
35
break
;
36
}
37
case
XFA_PacketType
::Datasets: {
38
CFX_XMLElement* pElement =
ToXMLElement
(
pNode
->
GetXMLMappingNode
(
)
)
;
39
if
(!pElement)
40
return
false
;
41
42
CXFA_Node
* pDataNode = pNode->GetFirstChild();
43
DCHECK
(pDataNode);
44
XFA_DataExporter_DealWithDataGroupNode
(
pDataNode
)
;
45
pElement
->
Save
(pStream);
46
break
;
47
}
48
case
XFA_PacketType
::Form:
49
XFA_DataExporter_RegenerateFormFile
(
pNode
,
pStream
,
false
)
;
50
break
;
51
case
XFA_PacketType
::Template:
52
default
: {
53
CFX_XMLElement* pElement =
ToXMLElement
(
pNode
->
GetXMLMappingNode
(
)
)
;
54
if
(!pElement)
55
return
false
;
56
57
pElement
->
Save
(pStream);
58
break
;
59
}
60
}
61
return
true
;
62
}
63
64
CXFA_Node
* pDataNode = pNode->GetParent();
65
CXFA_Node
* pExportNode = pNode;
66
for
(
CXFA_Node
* pChildNode = pDataNode->GetFirstChild(); pChildNode;
67
pChildNode = pChildNode->GetNextSibling()) {
68
if
(pChildNode != pNode) {
69
pExportNode = pDataNode;
70
break
;
71
}
72
}
73
CFX_XMLElement* pElement =
ToXMLElement
(
pExportNode
->
GetXMLMappingNode
(
)
)
;
74
if
(!pElement)
75
return
false
;
76
77
XFA_DataExporter_DealWithDataGroupNode
(
pExportNode
)
;
78
pElement
->
SetAttribute
(
L"xmlns:xfa"
,
79
L"http://www.xfa.org/schema/xfa-data/1.0/"
)
;
80
pElement
->
Save
(pStream);
81
pElement
->
RemoveAttribute
(
L"xmlns:xfa"
)
;
82
return
true
;
83
}
ToXMLElement
CFX_XMLElement * ToXMLElement(CFX_XMLNode *pNode)
Definition
cfx_xmlelement.h:53
DCHECK
#define DCHECK
Definition
check.h:33
CFX_XMLElement::Save
void Save(const RetainPtr< IFX_RetainableWriteStream > &pXMLStream) override
Definition
cfx_xmlelement.cpp:80
CFX_XMLElement::SetAttribute
void SetAttribute(const WideString &name, const WideString &value)
Definition
cfx_xmlelement.cpp:137
CFX_XMLElement::RemoveAttribute
void RemoveAttribute(const WideString &name)
Definition
cfx_xmlelement.cpp:142
CXFA_DataExporter
Definition
cxfa_dataexporter.h:15
CXFA_DataExporter::CXFA_DataExporter
CXFA_DataExporter()
CXFA_DataExporter::Export
bool Export(const RetainPtr< IFX_SeekableStream > &pWrite, CXFA_Node *pNode)
Definition
cxfa_dataexporter.cpp:21
CXFA_DataExporter::~CXFA_DataExporter
~CXFA_DataExporter()
CXFA_Node
Definition
cxfa_node.h:94
CXFA_Node::GetXMLMappingNode
CFX_XMLNode * GetXMLMappingNode() const
Definition
cxfa_node.h:185
CXFA_Node::GetPacketType
XFA_PacketType GetPacketType() const
Definition
cxfa_node.h:147
CXFA_Object::IsModelNode
bool IsModelNode() const
Definition
cxfa_object.h:72
IFX_SeekableStream
Definition
fx_stream.h:64
fxcrt::RetainPtr
Definition
retain_ptr.h:28
XFA_PacketType
XFA_PacketType
Definition
fxfa_basic.h:44
XFA_DataExporter_DealWithDataGroupNode
void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node *pDataNode)
Definition
xfa_utils.cpp:422
XFA_DataExporter_RegenerateFormFile
void XFA_DataExporter_RegenerateFormFile(CXFA_Node *pNode, const RetainPtr< IFX_SeekableStream > &pStream, bool bSaveXML)
Definition
xfa_utils.cpp:444
qtwebengine
src
3rdparty
chromium
third_party
pdfium
xfa
fxfa
parser
cxfa_dataexporter.cpp
Generated on
for Qt by
1.18.0