cid#1607171 Data race condition
[LibreOffice.git] / android / source / src / java / org / libreoffice / TileProvider.java
blobc979a9883c1312c74fdfa7350bfd2a56fd38a0a0
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;
12 import android.graphics.Bitmap;
13 import android.graphics.PointF;
14 import android.view.KeyEvent;
16 import org.mozilla.gecko.gfx.CairoImage;
17 import org.mozilla.gecko.gfx.IntSize;
19 /**
20 * Provides the tiles and other document information.
22 public interface TileProvider {
24 /**
25 * Save the current document under the given path.
26 * @param takeOwnership Whether to take ownership of the new file,
27 * i.e. whether the current document is changed to the
28 * newly saved document (takeOwnership = true),
29 * as compared to just saving a copy of the current document
30 * or exporting to a different file format.
31 * Must be 'false' when using this method for export to e.g. PNG or PDF.
32 * @return Whether saving was successful.
34 boolean saveDocumentAs(String filePath, String format, boolean takeOwnership);
36 /**
37 * Saves the current document under the given path,
38 * using the default file format.
39 * @param takeOwnership (s. documentation for
40 * 'saveDocumentAs(String filePath, String format, boolean takeOwnership)')
42 boolean saveDocumentAs(String filePath, boolean takeOwnership);
44 /**
45 * Returns the page width in pixels.
47 int getPageWidth();
49 /**
50 * Returns the page height in pixels.
52 int getPageHeight();
54 boolean isReady();
56 CairoImage createTile(float x, float y, IntSize tileSize, float zoom);
58 /**
59 * Rerender and overwrite tile's image buffer directly
61 void rerenderTile(CairoImage image, float x, float y, IntSize tileSize, float zoom);
63 /**
64 * Change the document part to the one specified by the partIndex input parameter.
66 * @param partIndex - part index to change to
68 void changePart(int partIndex);
70 /**
71 * Get the current document part number.
73 * @return
75 int getCurrentPartNumber();
77 /**
78 * Get the total number of parts.
80 int getPartsCount();
82 Bitmap thumbnail(int size);
84 /**
85 * Closes the document.
87 void close();
89 /**
90 * Returns true if the current open document is a drawing.
92 boolean isDrawing();
94 /**
95 * Returns true if the current open document is a text document.
97 boolean isTextDocument();
99 /**
100 * Returns true if the current open document is a spreadsheet.
102 boolean isSpreadsheet();
105 * Returns true if the current open document is a presentation
107 boolean isPresentation();
110 * Trigger a key event.
112 * @param keyEvent - contains information about key event
114 void sendKeyEvent(KeyEvent keyEvent);
117 * Trigger a mouse button down event.
119 * @param documentCoordinate - coordinate relative to the document where the mouse button should be triggered
120 * @param numberOfClicks - number of clicks (1 - single click, 2 - double click)
122 void mouseButtonDown(PointF documentCoordinate, int numberOfClicks, float zoomFactor);
126 * Trigger a swipe left event.
128 void onSwipeLeft();
131 * Trigger a swipe left event.
133 void onSwipeRight();
136 * Trigger a mouse button up event.
138 * @param documentCoordinate - coordinate relative to the document where the mouse button should be triggered
139 * @param numberOfClicks - number of clicks (1 - single click, 2 - double click)
141 void mouseButtonUp(PointF documentCoordinate, int numberOfClicks, float zoomFactor);
144 * Post a UNO command to LOK.
146 * @param command - the .uno: command, like ".uno:Bold"
148 void postUnoCommand(String command, String arguments);
151 * This is the actual reference to the function in LOK, used for getting notified when uno:save event finishes
152 * @param command
153 * @param arguments
154 * @param notifyWhenFinished
156 void postUnoCommand(String command, String arguments, boolean notifyWhenFinished);
159 * Send text selection start coordinate.
160 * @param documentCoordinate
162 void setTextSelectionStart(PointF documentCoordinate);
165 * Send text selection end coordinate.
166 * @param documentCoordinate
168 void setTextSelectionEnd(PointF documentCoordinate);
171 * get selected text
172 * @param mimeType
174 String getTextSelection(String mimeType);
177 * copy
178 * @param mimeType
179 * @param data
180 * @return
182 boolean paste(String mimeType, String data);
184 * Send text selection reset coordinate.
185 * @param documentCoordinate
187 void setTextSelectionReset(PointF documentCoordinate);
190 * Send a request to change start the change of graphic selection.
192 void setGraphicSelectionStart(PointF documentCoordinate);
195 * Send a request to change end the change of graphic selection...
197 void setGraphicSelectionEnd(PointF documentCoordinate);
200 * Set the new page size of the document when changed
202 void setDocumentSize(int pageWidth, int pageHeight);
205 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */