Warning, file /graphics/okular/core/script/event_p.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2018 Intevation GmbH <intevation@intevation.de> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef OKULAR_SCRIPT_EVENT_P_H 0008 #define OKULAR_SCRIPT_EVENT_P_H 0009 0010 #include <QString> 0011 #include <QVariant> 0012 0013 #include <memory> 0014 0015 namespace Okular 0016 { 0017 class FormField; 0018 class Page; 0019 0020 /** 0021 * @short A JavaScript Event Object data container. 0022 * 0023 * Object to represet a JavaScript Event Object as described in the 0024 * Acrobat JavaScript Scripting Reference. 0025 * 0026 * The implementation is currently limited. To implement support 0027 * for a new event create the according data fields / getters 0028 * and setters and update the handling in js_event 0029 * accordingly. 0030 * 0031 * See Acrobat JavaScript Scripting Reference for the meaning 0032 * the fields and add getter / setter according for the 0033 * event you wish to implement. 0034 */ 0035 class Event 0036 { 0037 private: 0038 Event(); 0039 0040 public: 0041 enum EventType { 0042 UnknownEvent, /// < Unknown 0043 AppInit, /// < Not implemented. 0044 BatchExec, /// < Not implemented. 0045 BookmarkMouseUp, /// < Not implemented. 0046 ConsoleExec, /// < Not implemented. 0047 DocDidPrint, /// < Not implemented. 0048 DocDidSave, /// < Not implemented. 0049 DocOpen, /// < Not implemented. 0050 DocWillClose, /// < Not implemented. 0051 DocWillPrint, /// < Not implemented. 0052 DocWillSave, /// < Not implemented. 0053 ExternalExec, /// < Not implemented. 0054 FieldBlur, /// < Not implemented. 0055 FieldCalculate, /// < This event is defined in a field re-calculation. 0056 FieldFocus, /// < This event is defined when the field gains or loses focus. 0057 FieldFormat, /// < When a format action is executed 0058 FieldKeystroke, /// < Checks if the entered value is valid. 0059 FieldMouseDown, /// < Not implemented. 0060 FieldMouseEnter, /// < Not implemented. 0061 FieldMouseExit, /// < Not implemented. 0062 FieldMouseUp, /// < This event is the result of a mouse up on a field. 0063 /* Validates the field after every change is committed 0064 * (clicked outside or tabbed to another field). 0065 * The enter event is not handled 0066 */ 0067 FieldValidate, 0068 LinkMouseUp, /// < Not implemented. 0069 MenuExec, /// < Not implemented. 0070 PageOpen, /// < Not implemented. 0071 PageClose, /// < Not implemented. 0072 }; 0073 0074 explicit Event(EventType type); 0075 0076 /** One of the defined EventTypes */ 0077 EventType eventType() const; 0078 0079 QString name() const; 0080 0081 QString type() const; 0082 0083 QString targetName() const; 0084 void setTargetName(const QString &val); 0085 0086 Page *targetPage() const; 0087 void setTargetPage(Page *val); 0088 0089 FormField *source() const; 0090 void setSource(FormField *val); 0091 0092 Page *sourcePage() const; 0093 void setSourcePage(Page *val); 0094 0095 void *target() const; 0096 void setTarget(void *target); 0097 0098 QVariant value() const; 0099 void setValue(const QVariant &val); 0100 0101 bool returnCode() const; 0102 void setReturnCode(bool returnCode); 0103 0104 // Checks if the shift key was down when creating the event. 0105 bool shiftModifier() const; 0106 void setShiftModifier(bool shiftModifier); 0107 0108 bool willCommit() const; 0109 void setWillCommit(bool willCommit); 0110 0111 QString change() const; 0112 void setChange(const QString &change); 0113 0114 static std::shared_ptr<Event> createFormCalculateEvent(FormField *target, Page *targetPage, FormField *source = nullptr, Page *sourcePage = nullptr, const QString &targetName = QString()); 0115 static std::shared_ptr<Event> createFormatEvent(FormField *target, Page *targetPage, const QString &targetName = QString()); 0116 static std::shared_ptr<Event> createKeystrokeEvent(FormField *target, Page *targetPage); 0117 static std::shared_ptr<Event> createFormFocusEvent(FormField *target, Page *targetPage, const QString &targetName = QString()); 0118 static std::shared_ptr<Event> createFormValidateEvent(FormField *target, Page *targetPage, const QString &targetName = QString()); 0119 static std::shared_ptr<Event> createFieldMouseUpEvent(FormField *target, Page *targetPage); 0120 0121 private: 0122 class Private; 0123 std::shared_ptr<Private> d; 0124 Q_DISABLE_COPY(Event) 0125 }; 0126 0127 } // namespace Okular 0128 #endif // OKULAR_SCRIPT_EVENT_P_H