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