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