1 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
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
;
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
;
63 public int mPageWidth
;
64 public int mPageHeight
;
65 public boolean mNotify
;
67 public LOEvent(int type
) {
71 public LOEvent(int type
, ComposedTileLayer composedTileLayer
) {
73 mTypeString
= "Tile Reevaluation";
74 mComposedTileLayer
= composedTileLayer
;
77 public LOEvent(int type
, String someString
) {
79 mTypeString
= "String";
84 public LOEvent(int type
, String someString
, boolean notify
) {
86 mTypeString
= "String";
92 public LOEvent(int type
, String someString
, String value
, boolean notify
) {
94 mTypeString
= "String";
100 public LOEvent(int type
, String key
, String value
) {
102 mTypeString
= "key / value";
107 public LOEvent(String filePath
, int type
) {
109 mTypeString
= "Load";
110 this.filePath
= filePath
;
113 public LOEvent(String filePath
, String fileType
, int type
) {
115 mTypeString
= "Load New/Save As";
116 this.filePath
= filePath
;
117 this.fileType
= fileType
;
120 public LOEvent(int type
, int partIndex
) {
122 mPartIndex
= partIndex
;
123 mTypeString
= "Change part";
126 public LOEvent(int type
, ThumbnailCreator
.ThumbnailCreationTask task
) {
129 mTypeString
= "Thumbnail";
132 public LOEvent(int type
, String touchType
, PointF documentTouchCoordinate
) {
134 mTypeString
= "Touch";
135 mTouchType
= touchType
;
136 mDocumentCoordinate
= documentTouchCoordinate
;
139 public LOEvent(int type
, KeyEvent keyEvent
) {
141 mTypeString
= "Key Event";
142 mKeyEvent
= keyEvent
;
145 public LOEvent(int type
, RectF rect
) {
147 mTypeString
= "Tile Invalidation";
148 mInvalidationRect
= rect
;
151 public LOEvent(int type
, SelectionHandle
.HandleType handleType
, PointF documentCoordinate
) {
153 mHandleType
= handleType
;
154 mDocumentCoordinate
= documentCoordinate
;
157 public LOEvent(int type
, int pageWidth
, int pageHeight
){
159 mPageWidth
= pageWidth
;
160 mPageHeight
= pageHeight
;
163 public String
getTypeString() {
164 if (mTypeString
== null) {
165 return "Event type: " + mType
;
171 public int compareTo(LOEvent another
) {
172 return mPriority
- another
.mPriority
;
177 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */