7#include "core/fpdfdoc/cpdf_metadata.h"
12#include "core/fpdfapi/parser/cpdf_stream.h"
13#include "core/fpdfapi/parser/cpdf_stream_acc.h"
14#include "core/fxcrt/cfx_read_only_span_stream.h"
15#include "core/fxcrt/fx_codepage.h"
16#include "core/fxcrt/xml/cfx_xmldocument.h"
17#include "core/fxcrt/xml/cfx_xmlelement.h"
18#include "core/fxcrt/xml/cfx_xmlparser.h"
19#include "third_party/base/check.h"
23constexpr int kMaxMetaDataDepth = 128;
25bool CheckForSharedFormInternal(
int depth,
26 CFX_XMLElement* element,
27 std::vector<UnsupportedFeature>* unsupported) {
28 if (depth >= kMaxMetaDataDepth) {
34 if (attr
.EqualsASCII(
"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/")) {
35 for (
const auto* child = element->GetFirstChild(); child;
36 child = child->GetNextSibling()) {
40 const auto* child_elem =
static_cast<
const CFX_XMLElement*>(child);
41 if (!child_elem->GetName().EqualsASCII(
"adhocwf:workflowType"))
44 switch (child_elem->GetTextData().GetInteger()) {
49 unsupported->push_back(
53 unsupported->push_back(
62 for (
auto* child = element->GetFirstChild(); child;
63 child = child->GetNextSibling()) {
64 CFX_XMLElement* xml_element = ToXMLElement(child);
66 !CheckForSharedFormInternal(depth + 1, xml_element, unsupported)) {
83 auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(stream_);
84 pAcc->LoadAllDataFiltered();
86 auto stream = pdfium::MakeRetain<CFX_ReadOnlySpanStream>(pAcc->GetSpan());
87 CFX_XMLParser parser(stream);
88 std::unique_ptr<CFX_XMLDocument> doc = parser.Parse();
92 std::vector<UnsupportedFeature> unsupported;
93 CheckForSharedFormInternal(0, doc->GetRoot(), &unsupported);
WideString GetAttribute(const WideString &name) const
static WideString FromASCII(ByteStringView str)
bool EqualsASCII(ByteStringView that) const