1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.libreoffice;
import android.graphics.PointF;
import android.graphics.RectF;
import android.view.KeyEvent;
import org.libreoffice.canvas.SelectionHandle;
import org.mozilla.gecko.gfx.ComposedTileLayer;
/**
* Events and data that is queued and processed by LOKitThread.
*/
public class LOEvent implements Comparable<LOEvent> {
public static final int SIZE_CHANGED = 1;
public static final int CHANGE_PART = 2;
public static final int LOAD = 3;
public static final int CLOSE = 4;
public static final int TILE_REEVALUATION_REQUEST = 5;
public static final int THUMBNAIL = 6;
public static final int TILE_INVALIDATION = 7;
public static final int TOUCH = 8;
public static final int KEY_EVENT = 9;
public static final int CHANGE_HANDLE_POSITION = 10;
public static final int SWIPE_RIGHT = 11;
public static final int SWIPE_LEFT = 12;
public static final int NAVIGATION_CLICK = 13;
public static final int UNO_COMMAND = 14;
public static final int RESUME = 15;
public static final int LOAD_NEW = 16;
public static final int SAVE_AS = 17;
public static final int UPDATE_PART_PAGE_RECT = 18;
public static final int UPDATE_ZOOM_CONSTRAINTS = 19;
public static final int UPDATE_CALC_HEADERS = 20;
public static final int REFRESH = 21;
public final int mType;
public int mPriority = 0;
private String mTypeString;
public ThumbnailCreator.ThumbnailCreationTask mTask;
public int mPartIndex;
public String mString;
public String filePath;
public String fileType;
public ComposedTileLayer mComposedTileLayer;
public String mTouchType;
public PointF mDocumentCoordinate;
public KeyEvent mKeyEvent;
public RectF mInvalidationRect;
public SelectionHandle.HandleType mHandleType;
public String mValue;
public LOEvent(int type) {
mType = type;
}
public LOEvent(int type, ComposedTileLayer composedTileLayer) {
mType = type;
mTypeString = "Tile Reevaluation";
mComposedTileLayer = composedTileLayer;
}
public LOEvent(int type, String someString) {
mType = type;
mTypeString = "String";
mString = someString;
mValue = null;
}
public LOEvent(int type, String key, String value) {
mType = type;
mTypeString = "key / value";
mString = key;
mValue = value;
}
public LOEvent(int type, String key, int value) {
mType = type;
mTypeString = "Resume partIndex";
mString = key;
mPartIndex = value;
}
public LOEvent(String filePath, int type) {
mType = type;
mTypeString = "Load";
this.filePath = filePath;
}
public LOEvent(String filePath, String fileType, int type) {
mType = type;
mTypeString = "Load New/Save As";
this.filePath = filePath;
this.fileType = fileType;
}
public LOEvent(int type, int partIndex) {
mType = type;
mPartIndex = partIndex;
mTypeString = "Change part";
}
public LOEvent(int type, ThumbnailCreator.ThumbnailCreationTask task) {
mType = type;
mTask = task;
mTypeString = "Thumbnail";
}
public LOEvent(int type, String touchType, PointF documentTouchCoordinate) {
mType = type;
mTypeString = "Touch";
mTouchType = touchType;
mDocumentCoordinate = documentTouchCoordinate;
}
public LOEvent(int type, KeyEvent keyEvent) {
mType = type;
mTypeString = "Key Event";
mKeyEvent = keyEvent;
}
public LOEvent(int type, RectF rect) {
mType = type;
mTypeString = "Tile Invalidation";
mInvalidationRect = rect;
}
public LOEvent(int type, SelectionHandle.HandleType handleType, PointF documentCoordinate) {
mType = type;
mHandleType = handleType;
mDocumentCoordinate = documentCoordinate;
}
public String getTypeString() {
if (mTypeString == null) {
return "Event type: " + mType;
}
return mTypeString;
}
@Override
public int compareTo(LOEvent another) {
return mPriority - another.mPriority;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|