summaryrefslogtreecommitdiffstats
path: root/android/experimental/LOAndroid2/app/src/main/java/org/libreoffice/LOEvent.java
blob: bf4f98b845da62245804388e4a5321b305a76f39 (plain)
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
package org.libreoffice;

import android.graphics.Rect;
import android.util.Log;

import org.mozilla.gecko.gfx.IntSize;
import org.mozilla.gecko.gfx.ViewportMetrics;

public class LOEvent {

    public static final int SIZE_CHANGED = 1;
    public static final int TILE_SIZE = 2;
    public static final int VIEWPORT = 3;
    public static final int DRAW = 4;

    private ViewportMetrics mViewportMetrics;

    public int mType;
    private String mTypeString;

    ViewportMetrics viewportMetrics;

    public LOEvent(int type, int width, int height, int widthPixels, int heightPixels, int tileWidth, int tileHeight) {
        mType = type;
        mTypeString = "Size Changed";
    }

    public LOEvent(int type, IntSize tileSize) {
        mType = type;
        mTypeString = "Tile size";
    }

    public LOEvent(int type, ViewportMetrics viewportMetrics) {
        mType = type;
        mTypeString = "Viewport";
        mViewportMetrics = viewportMetrics;
    }

    public LOEvent(int type, Rect rect) {
        mType = type;
        mTypeString = "Draw";
    }

    public static LOEvent draw(Rect rect) {
        return new LOEvent(DRAW, rect);
    }

    public static LOEvent sizeChanged(int width, int height, int widthPixels, int heightPixels, int tileWidth, int tileHeight) {
        return new LOEvent(SIZE_CHANGED, width, height, widthPixels, heightPixels, tileWidth, tileHeight);
    }

    public static LOEvent tileSize(IntSize tileSize) {
        return new LOEvent(TILE_SIZE, tileSize);
    }

    public static LOEvent viewport(ViewportMetrics viewportMetrics) {
        return new LOEvent(VIEWPORT, viewportMetrics);
    }

    public String getTypeString() {
        return mTypeString;
    }

    public ViewportMetrics getViewport() {
        return mViewportMetrics;
    }
}