summaryrefslogtreecommitdiff
path: root/android/Bootstrap/src/org/libreoffice/kit/Document.java
blob: 2670b9ebc65bf32ee51036be712d74d88bdf117b (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
/* -*- 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.kit;

import java.nio.ByteBuffer;

public class Document {

    private final long handle;

    private native void setPartNative(long handle, int part);
    private native int getNumberOfPartsNative(long handle);
    private native int getDocumentTypeNative(long handle);
    private native void paintTileNative(long handle, ByteBuffer buffer, int canvasWidth, int canvasHeight, int tilePositionX, int tilePositionY, int tileWidth, int tileHeight);
    private native long getDocumentHeightNative(long handle);
    private native long getDocumentWidthNative(long handle);

    public Document(long handle) {
        this.handle = handle;
    }

    public boolean saveAs(String url) {
        return false;
    }

    public int getDocumentType() {
        return getDocumentTypeNative(handle);
    }

    public int getNumberOfParts() {
        return getNumberOfPartsNative(handle);
    }

    public void setPart(int part) {
        setPartNative(handle, part);
    }

    void paintTile(ByteBuffer buffer, int canvasWidth, int canvasHeight, int tilePositionX, int tilePositionY, int tileWidth, int tileHeight) {
        paintTileNative(handle, buffer, canvasWidth, canvasHeight, tilePositionX, tilePositionY, tileWidth, tileHeight);
    }

    public long getDocumentWidth() {
        return getDocumentWidthNative(handle);
    }

    public long getDocumentHeight() {
        return getDocumentHeightNative(handle);
    }

}