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
cpdf_aaction.cpp
Go to the documentation of this file.
1// Copyright 2016 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 "core/fpdfdoc/cpdf_aaction.h"
8
9#include <array>
10#include <iterator>
11#include <utility>
12
13#include "core/fpdfapi/parser/cpdf_dictionary.h"
14
15namespace {
16
17// |kAATypes| should have one less element than enum AActionType due to
18// |kDocumentOpen|, which is an artificial type.
19constexpr const std::array<const char*, CPDF_AAction::kNumberOfActions - 1>
20 kAATypes = {{
21 "E", // kCursorEnter
22 "X", // kCursorExit
23 "D", // kButtonDown
24 "U", // kButtonUp
25 "Fo", // kGetFocus
26 "Bl", // kLoseFocus
27 "PO", // kPageOpen
28 "PC", // kPageClose
29 "PV", // kPageVisible
30 "PI", // kPageInvisible
31 "O", // kOpenPage
32 "C", // kClosePage
33 "K", // kKeyStroke
34 "F", // kFormat
35 "V", // kValidate
36 "C", // kCalculate
37 "WC", // kCloseDocument
38 "WS", // kSaveDocument
39 "DS", // kDocumentSaved
40 "WP", // kPrintDocument
41 "DP", // kDocumentPrinted
42 }};
43
44} // namespace
45
48
49CPDF_AAction::CPDF_AAction(const CPDF_AAction& that) = default;
50
51CPDF_AAction::~CPDF_AAction() = default;
52
54 return m_pDict && m_pDict->KeyExist(kAATypes[eType]);
55}
56
58 return CPDF_Action(m_pDict ? m_pDict->GetDictFor(kAATypes[eType]) : nullptr);
59}
60
61// static
63 switch (type) {
64 case kButtonUp:
65 case kButtonDown:
66 case kKeyStroke:
67 return true;
68 default:
69 return false;
70 }
71}
bool ActionExist(AActionType eType) const
CPDF_AAction(const CPDF_AAction &that)
CPDF_AAction(RetainPtr< const CPDF_Dictionary > pDict)
CPDF_Action GetAction(AActionType eType) const
static bool IsUserInput(AActionType type)
std::map< ByteString, RetainPtr< CPDF_Object >, std::less<> > DictMap