LibreOffice Module android (master) 1
DocumentOverlay.java
Go to the documentation of this file.
1/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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 */
9package org.libreoffice.overlay;
10
11import android.graphics.RectF;
12import android.util.Log;
13
16import org.libreoffice.R;
21
22import java.util.List;
23
29public class DocumentOverlay {
30 private static final String LOGTAG = DocumentOverlay.class.getSimpleName();
31
34
35 private final long hidePageNumberRectDelayInMilliseconds = 500;
36
41 private class DocumentOverlayLayer extends Layer {
42 private float mViewLeft;
43 private float mViewTop;
44 private float mViewZoom;
45
49 @Override
50 public void draw(final RenderContext context) {
51 if (FloatUtils.fuzzyEquals(mViewLeft, context.viewport.left)
54 return;
55 }
56
57 mViewLeft = context.viewport.left;
58 mViewTop = context.viewport.top;
59 mViewZoom = context.zoomFactor;
60
61 LOKitShell.getMainHandler().post(new Runnable() {
62 public void run() {
64 }
65 });
66 }
67 }
68
70 mDocumentOverlayView = context.findViewById(R.id.text_cursor_view);
72 if (mDocumentOverlayView == null) {
73 Log.e(LOGTAG, "Failed to initialize TextCursorLayer - CursorView is null");
74 }
77 }
78
79 public void setPartPageRectangles(List<RectF> rectangles) {
81 }
82
86 public void showCursor() {
87 LOKitShell.getMainHandler().post(new Runnable() {
88 public void run() {
90 }
91 });
92 }
93
97 public void hideCursor() {
98 LOKitShell.getMainHandler().post(new Runnable() {
99 public void run() {
101 }
102 });
103 }
104
108 public void showPageNumberRect() {
109 LOKitShell.getMainHandler().post(new Runnable() {
110 public void run() {
112 }
113 });
114 }
115
119 public void hidePageNumberRect() {
120 LOKitShell.getMainHandler().postDelayed(new Runnable() {
121 public void run() {
123 }
125 }
126
130 public void positionCursor(final RectF position) {
131 LOKitShell.getMainHandler().post(new Runnable() {
132 public void run() {
134 }
135 });
136 }
137
141 public void showSelections() {
142 LOKitShell.getMainHandler().post(new Runnable() {
143 public void run() {
145 }
146 });
147 }
148
152 public void hideSelections() {
153 LOKitShell.getMainHandler().post(new Runnable() {
154 public void run() {
156 }
157 });
158 }
159
163 public void changeSelections(final List<RectF> selections) {
164 LOKitShell.getMainHandler().post(new Runnable() {
165 public void run() {
167 }
168 });
169 }
170
174 public void showGraphicSelection() {
175 LOKitShell.getMainHandler().post(new Runnable() {
176 public void run() {
178 }
179 });
180 }
181
185 public void hideGraphicSelection() {
186 LOKitShell.getMainHandler().post(new Runnable() {
187 public void run() {
189 }
190 });
191 }
192
196 public void changeGraphicSelection(final RectF rectangle) {
197 LOKitShell.getMainHandler().post(new Runnable() {
198 public void run() {
200 }
201 });
202 }
203
207 public void showHandle(final SelectionHandle.HandleType type) {
208 LOKitShell.getMainHandler().post(new Runnable() {
209 public void run() {
211 }
212 });
213 }
214
218 public void hideHandle(final SelectionHandle.HandleType type) {
219 LOKitShell.getMainHandler().post(new Runnable() {
220 public void run() {
222 }
223 });
224 }
225
229 public void positionHandle(final SelectionHandle.HandleType type, final RectF rectangle) {
230 LOKitShell.getMainHandler().post(new Runnable() {
231 public void run() {
233 }
234 });
235 }
236
239 }
240
241 public void setCalcHeadersController(CalcHeadersController calcHeadersController) {
242 mDocumentOverlayView.setCalcHeadersController(calcHeadersController);
243 }
244
245 public void showCellSelection(final RectF cellCursorRect) {
246 LOKitShell.getMainHandler().post(new Runnable() {
247 public void run() {
249 }
250 });
251 }
252
253 public void showHeaderSelection(final RectF cellCursorRect) {
254 LOKitShell.getMainHandler().post(new Runnable() {
255 public void run() {
257 }
258 });
259 }
260
261 public void showAdjustLengthLine(final boolean isRow, final CalcHeadersView view) {
262 LOKitShell.getMainHandler().post(new Runnable() {
263 @Override
264 public void run() {
266 }
267 });
268 }
269}
270
271/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Common static LOKit functions, functions to send events.
Definition: LOKitShell.java:26
static Handler getMainHandler()
Definition: LOKitShell.java:36
Main activity of the LibreOffice App.
Selection handle is a common class for "start", "middle" and "end" types of selection handles.
Document overlay view is responsible for showing the client drawn overlay elements like cursor,...
void showGraphicSelection()
Show the graphic selection on the view.
void setCalcHeadersController(CalcHeadersController calcHeadersController)
void showPageNumberRect()
Calculate and show page number according to current viewport position.
void changeSelections(List< RectF > selectionRects)
Change the text selection rectangles.
void hideHandle(SelectionHandle.HandleType type)
Hide the handle.
void showHandle(SelectionHandle.HandleType type)
Show the handle.
void changeCursorPosition(RectF position)
Change the cursor position.
void hideGraphicSelection()
Hide the graphic selection.
void showAdjustLengthLine(boolean isRow, final CalcHeadersView view)
void initialize(LayerView layerView)
Initialize the selection and cursor view.
void setPartPageRectangles(List< RectF > rectangles)
Set part page rectangles and initialize a page number rectangle object (canvas element).
void hideSelections()
Hide text selection rectangles.
void showSelections()
Show text selection rectangles.
void changeGraphicSelection(RectF rectangle)
Change the graphic selection rectangle.
void showCursor()
Show the cursor on the view.
void repositionWithViewport(float x, float y, float zoom)
void positionHandle(SelectionHandle.HandleType type, RectF position)
Change the handle document position.
void hidePageNumberRect()
Hide page number rectangle canvas element.
DocumentOverlayLayer responsibility is to get the changes to the viewport and report them to Document...
The DocumentOverlay is an overlay over the document.
void changeGraphicSelection(final RectF rectangle)
Change the graphic selection rectangle to the input rectangle.
void changeSelections(final List< RectF > selections)
Change the list of selections.
void positionHandle(final SelectionHandle.HandleType type, final RectF rectangle)
Position the handle (of input type) position to the input rectangle.
void hideHandle(final SelectionHandle.HandleType type)
Hide the handle (of input type).
void hideSelections()
Hide selections on the overlay.
final DocumentOverlayLayer mDocumentOverlayLayer
void showHeaderSelection(final RectF cellCursorRect)
void showCellSelection(final RectF cellCursorRect)
void showHandle(final SelectionHandle.HandleType type)
Show the handle (of input type) on the overlay.
void showAdjustLengthLine(final boolean isRow, final CalcHeadersView view)
void showSelections()
Show selections on the overlay.
void showCursor()
Show the cursor at the defined cursor position on the overlay.
void showPageNumberRect()
Show the page number rectangle on the overlay.
void setCalcHeadersController(CalcHeadersController calcHeadersController)
void positionCursor(final RectF position)
Position the cursor to the input position on the overlay.
void hideGraphicSelection()
Hide the graphic selection.
void hidePageNumberRect()
Hide the page number rectangle on the overlay.
final DocumentOverlayView mDocumentOverlayView
void showGraphicSelection()
Show the graphic selection on the overlay.
void hideCursor()
Hide the cursor at the defined cursor position on the overlay.
DocumentOverlay(LibreOfficeMainActivity context, LayerView layerView)
void setPartPageRectangles(List< RectF > rectangles)
A view rendered by the layer compositor.
Definition: LayerView.java:41
static boolean fuzzyEquals(float a, float b)
Definition: FloatUtils.java:13
def position(n=-1)
def rectangle(l)
def run(arg=None, arg2=-1)
ResultType type
const sal_uInt8 R