LibreOffice Module android (master) 1
InvalidationHandler.java
Go to the documentation of this file.
1package org.libreoffice;
2
3import android.content.Intent;
4import android.graphics.PointF;
5import android.graphics.RectF;
6import android.net.Uri;
7import android.util.Log;
8import android.widget.EditText;
9import android.widget.Toast;
10
11import org.json.JSONArray;
12import org.json.JSONException;
13import org.json.JSONObject;
15import org.libreoffice.kit.Document;
16import org.libreoffice.kit.Office;
19
20import java.util.ArrayList;
21import java.util.Collections;
22import java.util.List;
23
27public class InvalidationHandler implements Document.MessageCallback, Office.MessageCallback {
28 private static final String LOGTAG = InvalidationHandler.class.getSimpleName();
32 private boolean mKeyEvent = false;
34
35 private int currentTotalPageNumber = 0; // total page number of the current document
36
38 mContext = context;
42 }
43
50 @Override
51 public void messageRetrieved(int messageID, String payload) {
53 // enable handling of hyperlinks and search result even in the Viewer
54 if (messageID != Document.CALLBACK_INVALIDATE_TILES
55 && messageID != Document.CALLBACK_DOCUMENT_PASSWORD
56 && messageID != Document.CALLBACK_HYPERLINK_CLICKED
57 && messageID != Document.CALLBACK_SEARCH_RESULT_SELECTION
58 && messageID != Document.CALLBACK_SC_FOLLOW_JUMP
59 && messageID != Document.CALLBACK_TEXT_SELECTION
60 && messageID != Document.CALLBACK_TEXT_SELECTION_START
61 && messageID != Document.CALLBACK_TEXT_SELECTION_END)
62 return;
63 }
64 switch (messageID) {
65 case Document.CALLBACK_INVALIDATE_TILES:
66 invalidateTiles(payload);
67 break;
68 case Document.CALLBACK_UNO_COMMAND_RESULT:
69 unoCommandResult(payload);
70 break;
71 case Document.CALLBACK_INVALIDATE_VISIBLE_CURSOR:
72 invalidateCursor(payload);
73 break;
74 case Document.CALLBACK_TEXT_SELECTION:
75 textSelection(payload);
76 break;
77 case Document.CALLBACK_TEXT_SELECTION_START:
78 textSelectionStart(payload);
79 break;
80 case Document.CALLBACK_TEXT_SELECTION_END:
81 textSelectionEnd(payload);
82 break;
83 case Document.CALLBACK_CURSOR_VISIBLE:
84 cursorVisibility(payload);
85 break;
86 case Document.CALLBACK_GRAPHIC_SELECTION:
87 graphicSelection(payload);
88 break;
89 case Document.CALLBACK_HYPERLINK_CLICKED:
90 if (!payload.startsWith("http://") && !payload.startsWith("https://")) {
91 payload = "http://" + payload;
92 }
93 Intent urlIntent = new Intent(Intent.ACTION_VIEW);
94 urlIntent.setData(Uri.parse(payload));
95 mContext.startActivity(urlIntent);
96 break;
97 case Document.CALLBACK_STATE_CHANGED:
98 stateChanged(payload);
99 break;
100 case Document.CALLBACK_SEARCH_RESULT_SELECTION:
101 searchResultSelection(payload);
102 // when doing a search, CALLBACK_SEARCH_RESULT_SELECTION is called in addition
103 // to the CALLBACK_TEXT_SELECTION{,_START,_END} callbacks and the handling of
104 // the previous 3 makes the cursor shown in addition to the selection rectangle,
105 // so hide the cursor again to just show the selection rectangle for the search result
110 break;
111 case Document.CALLBACK_SEARCH_NOT_FOUND:
112 Log.d(LOGTAG, "LOK_CALLBACK: Search not found.");
113 // this callback is never caught. Hope someone fix this.
114 break;
115 case Document.CALLBACK_CELL_CURSOR:
116 invalidateCellCursor(payload);
117 break;
118 case Document.CALLBACK_SC_FOLLOW_JUMP:
119 jumpToCell(payload);
120 break;
121 case Document.CALLBACK_INVALIDATE_HEADER:
123 break;
124 case Document.CALLBACK_CELL_ADDRESS:
125 cellAddress(payload);
126 break;
127 case Document.CALLBACK_CELL_FORMULA:
128 cellFormula(payload);
129 break;
130 case Document.CALLBACK_DOCUMENT_PASSWORD:
132 break;
133 case Document.CALLBACK_DOCUMENT_SIZE_CHANGED:
134 pageSizeChanged(payload);
135 default:
136
137 Log.d(LOGTAG, "LOK_CALLBACK uncaught: " + messageID + " : " + payload);
138 }
139 }
140
141 private void unoCommandResult(String payload) {
142 try {
143 JSONObject payloadObject = new JSONObject(payload);
144 if (payloadObject.getString("commandName").equals(".uno:Save")) {
145 if (payloadObject.getString("success").equals("true")) {
147 }
148 }else if(payloadObject.getString("commandName").equals(".uno:Name") ||
149 payloadObject.getString("commandName").equals(".uno:RenamePage")){
150 //success returns false even though its true for some reason,
151 LOKitShell.getMainHandler().post(new Runnable() {
152 @Override
153 public void run() {
154 mContext.getTileProvider().resetParts();
155 mContext.getDocumentPartViewListAdapter().notifyDataSetChanged();
157 Toast.makeText(mContext, mContext.getString(R.string.part_name_changed), Toast.LENGTH_SHORT).show();
158 }
159 });
160 } else if(payloadObject.getString("commandName").equals(".uno:Remove") ||
161 payloadObject.getString("commandName").equals(".uno:DeletePage") ) {
162 LOKitShell.getMainHandler().post(new Runnable() {
163 @Override
164 public void run() {
165 mContext.getTileProvider().resetParts();
166 mContext.getDocumentPartViewListAdapter().notifyDataSetChanged();
168 Toast.makeText(mContext, mContext.getString(R.string.part_deleted), Toast.LENGTH_SHORT).show();
169 }
170 });
171 }
172 }catch(JSONException e){
173 e.printStackTrace();
174 }
175 }
176
177 private void cellFormula(final String payload) {
178 LOKitShell.getMainHandler().post(new Runnable() {
179 @Override
180 public void run() {
181 ((EditText)mContext.findViewById(R.id.calc_formula)).setText(payload);
182 }
183 });
184 }
185
186 private void cellAddress(final String payload) {
187 LOKitShell.getMainHandler().post(new Runnable() {
188 @Override
189 public void run() {
190 ((EditText)mContext.findViewById(R.id.calc_address)).setText(payload);
191 }
192 });
193 }
194
195 private void invalidateHeader() {
197 }
198
199 private void documentPassword() {
202 synchronized (this) {
203 try {
204 this.wait();
205 } catch (InterruptedException e) {
206 e.printStackTrace();
207 }
208 }
210 }
211
212 private void invalidateCellCursor(String payload) {
213 RectF cellCursorRect = convertPayloadToRectangle(payload);
214
215 if (cellCursorRect != null) {
216 mDocumentOverlay.showCellSelection(cellCursorRect);
218 }
219 }
220
221 private void jumpToCell(String payload) {
222 RectF cellCursorRect = convertPayloadCellToRectangle(payload);
223
224 if (cellCursorRect != null) {
226 }
227 }
228
234 private void searchResultSelection(String payload) {
235 RectF selectionRectangle = null;
236 try {
237 JSONObject collectiveResult = new JSONObject(payload);
238 JSONArray searchResult = collectiveResult.getJSONArray("searchResultSelection");
239 if (searchResult.length() == 1) {
240 String rectangle = searchResult.getJSONObject(0).getString("rectangles");
241 selectionRectangle = convertPayloadToRectangle(rectangle);
242 }
243 } catch (JSONException e) {
244 e.printStackTrace();
245 }
246 if (selectionRectangle != null) {
247 moveViewportToMakeSelectionVisible(selectionRectangle);
248 }
249 }
250
261 public void moveViewportToMakeSelectionVisible(RectF selectionRectangle) {
262 RectF moveToRect = mLayerClient.getViewportMetrics().getCssViewport();
263 if (moveToRect.contains(selectionRectangle)) {
264 return;
265 }
266
267 float newLeft = moveToRect.left;
268 float newTop = moveToRect.top;
269
270 // if selection rectangle is wider or taller than current viewport, we need to zoom out
272 float widthRatio = 1f;
273 float heightRatio = 1f;
274 if (moveToRect.width() < selectionRectangle.width()) {
275 widthRatio = selectionRectangle.width() / moveToRect.width() / 0.85f; // 0.85f gives some margin (must < 0.9)
276 }
277 if (moveToRect.height() < selectionRectangle.height()) {
278 heightRatio = selectionRectangle.height() / moveToRect.height() / 0.45f; // 0.45f gives some margin (must < 0.5)
279 }
280 float newZoom = widthRatio > heightRatio ? oldZoom/widthRatio : oldZoom/heightRatio;
281
282 // if selection is out of viewport we need to adjust accordingly
283 if (selectionRectangle.right < moveToRect.left || selectionRectangle.left < moveToRect.left) {
284 newLeft = selectionRectangle.left - (moveToRect.width() * 0.1f) * oldZoom / newZoom; // 0.1f gives left margin
285 } else if (selectionRectangle.right > moveToRect.right || selectionRectangle.left > moveToRect.right) {
286 newLeft = selectionRectangle.right - (moveToRect.width() * 0.9f) * oldZoom / newZoom; // 0.9f gives right margin
287 }
288
289 if (selectionRectangle.top < moveToRect.top || selectionRectangle.bottom < moveToRect.top) {
290 newTop = selectionRectangle.top - (moveToRect.height() * 0.1f) * oldZoom / newZoom; // 0.1f gives top margin
291 } else if (selectionRectangle.bottom > moveToRect.bottom || selectionRectangle.top > moveToRect.bottom){
292 newTop = selectionRectangle.bottom - (moveToRect.height() * 0.5f) * oldZoom / newZoom; // 0.5 f gives bottom margin
293 }
294
295 LOKitShell.moveViewportTo(mContext, new PointF(newLeft, newTop), newZoom);
296 }
297
298 private void pageSizeChanged(String payload){
299 if(mContext.getTileProvider().isTextDocument()){
300 String[] bounds = payload.split(",");
301 int pageWidth = Integer.parseInt(bounds[0]);
302 int pageHeight = Integer.parseInt(bounds[1].trim());
303 LOKitShell.sendEvent(new LOEvent(LOEvent.PAGE_SIZE_CHANGED, pageWidth, pageHeight));
304 }
305 }
306
307 private void stateChanged(String payload) {
308 String[] parts = payload.split("=");
309 if (parts.length < 2) {
310 Log.e(LOGTAG, "LOK_CALLBACK_STATE_CHANGED unexpected payload: " + payload);
311 return;
312 }
313 final String value = parts[1];
314 boolean pressed = Boolean.parseBoolean(value);
315 if (!mContext.getTileProvider().isReady()) {
316 Log.w(LOGTAG, "tile provider not ready, ignoring payload "+payload);
317 return;
318 }
319 if (parts[0].equals(".uno:Bold")) {
320 mContext.getFormattingController().onToggleStateChanged(Document.BOLD, pressed);
321 } else if (parts[0].equals(".uno:Italic")) {
322 mContext.getFormattingController().onToggleStateChanged(Document.ITALIC, pressed);
323 } else if (parts[0].equals(".uno:Underline")) {
324 mContext.getFormattingController().onToggleStateChanged(Document.UNDERLINE, pressed);
325 } else if (parts[0].equals(".uno:Strikeout")) {
326 mContext.getFormattingController().onToggleStateChanged(Document.STRIKEOUT, pressed);
327 } else if (parts[0].equals(".uno:CharFontName")) {
329 } else if (parts[0].equals(".uno:FontHeight")) {
331 } else if (parts[0].equals(".uno:LeftPara")) {
332 mContext.getFormattingController().onToggleStateChanged(Document.ALIGN_LEFT, pressed);
333 } else if (parts[0].equals(".uno:CenterPara")) {
334 mContext.getFormattingController().onToggleStateChanged(Document.ALIGN_CENTER, pressed);
335 } else if (parts[0].equals(".uno:RightPara")) {
336 mContext.getFormattingController().onToggleStateChanged(Document.ALIGN_RIGHT, pressed);
337 } else if (parts[0].equals(".uno:JustifyPara")) {
338 mContext.getFormattingController().onToggleStateChanged(Document.ALIGN_JUSTIFY, pressed);
339 } else if (parts[0].equals(".uno:DefaultBullet")) {
340 mContext.getFormattingController().onToggleStateChanged(Document.BULLET_LIST, pressed);
341 } else if (parts[0].equals(".uno:DefaultNumbering")) {
342 mContext.getFormattingController().onToggleStateChanged(Document.NUMBERED_LIST, pressed);
343 } else if (parts[0].equals(".uno:Color")) {
344 mContext.getFontController().colorPaletteListener.updateColorPickerPosition(Integer.parseInt(value));
345 } else if (mContext.getTileProvider().isTextDocument() && (parts[0].equals(".uno:BackColor") || parts[0].equals(".uno:CharBackColor"))) {
346 mContext.getFontController().backColorPaletteListener.updateColorPickerPosition(Integer.parseInt(value));
347 } else if (mContext.getTileProvider().isPresentation() && parts[0].equals(".uno:CharBackColor")) {
348 mContext.getFontController().backColorPaletteListener.updateColorPickerPosition(Integer.parseInt(value));
349 } else if (mContext.getTileProvider().isSpreadsheet() && parts[0].equals(".uno:BackgroundColor")) {
350 mContext.getFontController().backColorPaletteListener.updateColorPickerPosition(Integer.parseInt(value));
351 } else if (parts[0].equals(".uno:StatePageNumber")) {
352 // get the total page number and compare to the current value and update accordingly
353 String[] splitStrings = parts[1].split(" ");
354 int totalPageNumber = Integer.valueOf(splitStrings[splitStrings.length - 1]);
355 if (totalPageNumber != currentTotalPageNumber) {
356 currentTotalPageNumber = totalPageNumber;
357 // update part page rectangles stored in DocumentOverlayView object
359 }
360 } else {
361 Log.d(LOGTAG, "LOK_CALLBACK_STATE_CHANGED type uncatched: " + payload);
362 }
363 }
364
371 public RectF convertPayloadToRectangle(String payload) {
372 String payloadWithoutWhitespace = payload.replaceAll("\\s", ""); // remove all whitespace from the string
373
374 if (payloadWithoutWhitespace.isEmpty() || payloadWithoutWhitespace.equals("EMPTY")) {
375 return null;
376 }
377
378 String[] coordinates = payloadWithoutWhitespace.split(",");
379
380 if (coordinates.length != 4) {
381 return null;
382 }
383 return convertPayloadToRectangle(coordinates);
384 }
385
392 public RectF convertPayloadCellToRectangle(String payload) {
393 String payloadWithoutWhitespace = payload.replaceAll("\\s", ""); // remove all whitespace from the string
394
395 if (payloadWithoutWhitespace.isEmpty() || payloadWithoutWhitespace.equals("EMPTY")) {
396 return null;
397 }
398
399 String[] coordinates = payloadWithoutWhitespace.split(",");
400
401 if (coordinates.length != 6 ) {
402 return null;
403 }
404 return convertPayloadToRectangle(coordinates);
405 }
406
413 public RectF convertPayloadToRectangle(String[] coordinates) {
414 if (coordinates.length < 4 ) {
415 return null;
416 }
417
418 int x = Integer.decode(coordinates[0]);
419 int y = Integer.decode(coordinates[1]);
420 int width = Integer.decode(coordinates[2]);
421 int height = Integer.decode(coordinates[3]);
422
423 float dpi = LOKitShell.getDpi(mContext);
424
425 return new RectF(
426 LOKitTileProvider.twipToPixel(x, dpi),
427 LOKitTileProvider.twipToPixel(y, dpi),
428 LOKitTileProvider.twipToPixel(x + width, dpi),
429 LOKitTileProvider.twipToPixel(y + height, dpi)
430 );
431 }
432
439 public List<RectF> convertPayloadToRectangles(String payload) {
440 List<RectF> rectangles = new ArrayList<RectF>();
441 String[] rectangleArray = payload.split(";");
442
443 for (String coordinates : rectangleArray) {
444 RectF rectangle = convertPayloadToRectangle(coordinates);
445 if (rectangle != null) {
446 rectangles.add(rectangle);
447 }
448
449 }
450
451 return rectangles;
452 }
453
459 private void invalidateTiles(String payload) {
460 RectF rectangle = convertPayloadToRectangle(payload);
461 if (rectangle != null) {
463 }
464 }
465
471 private synchronized void invalidateCursor(String payload) {
472 RectF cursorRectangle = convertPayloadToRectangle(payload);
473 if (cursorRectangle != null) {
474 mDocumentOverlay.positionCursor(cursorRectangle);
476
479 }
480
481 if (mKeyEvent) {
482 moveViewportToMakeCursorVisible(cursorRectangle);
483 mKeyEvent = false;
484 }
485 }
486 }
487
495 public void moveViewportToMakeCursorVisible(RectF cursorRectangle) {
496 RectF moveToRect = mLayerClient.getViewportMetrics().getCssViewport();
497 if (moveToRect.contains(cursorRectangle)) {
498 return;
499 }
500
501 float newLeft = moveToRect.left;
502 float newTop = moveToRect.top;
503
504 if (cursorRectangle.right < moveToRect.left || cursorRectangle.left < moveToRect.left) {
505 newLeft = cursorRectangle.left - (moveToRect.width() * 0.1f);
506 } else if (cursorRectangle.right > moveToRect.right || cursorRectangle.left > moveToRect.right) {
507 newLeft = cursorRectangle.right - (moveToRect.width() * 0.9f);
508 }
509
510 if (cursorRectangle.top < moveToRect.top || cursorRectangle.bottom < moveToRect.top) {
511 newTop = cursorRectangle.top - (moveToRect.height() * 0.1f);
512 } else if (cursorRectangle.bottom > moveToRect.bottom || cursorRectangle.top > moveToRect.bottom) {
513 newTop = cursorRectangle.bottom - (moveToRect.height() / 2.0f);
514 }
515
516 LOKitShell.moveViewportTo(mContext, new PointF(newLeft, newTop), null);
517 }
518
524 private synchronized void textSelectionStart(String payload) {
525 RectF selectionRect = convertPayloadToRectangle(payload);
526 if (selectionRect != null) {
528 }
529 }
530
536 private synchronized void textSelectionEnd(String payload) {
537 RectF selectionRect = convertPayloadToRectangle(payload);
538 if (selectionRect != null) {
540 }
541 }
542
548 private synchronized void textSelection(String payload) {
549 if (payload.isEmpty() || payload.equals("EMPTY")) {
552 }
553 mDocumentOverlay.changeSelections(Collections.<RectF>emptyList());
554 if (mContext.getTileProvider().isSpreadsheet()) {
556 }
557 mContext.getToolbarController().showHideClipboardCutAndCopy(false);
558 } else {
559 List<RectF> rectangles = convertPayloadToRectangles(payload);
562 }
565 if (mContext.getTileProvider().isSpreadsheet()) {
566 mDocumentOverlay.showHeaderSelection(rectangles.get(0));
567 }
568 String selectedText = mContext.getTileProvider().getTextSelection("");
569 mContext.getToolbarController().showClipboardActions(selectedText);
570 }
571 }
572
578 private synchronized void cursorVisibility(String payload) {
579 if (payload.equals("true")) {
583 }
584 } else if (payload.equals("false")) {
587 }
588 }
589
595 private void graphicSelection(String payload) {
596 if (payload.isEmpty() || payload.equals("EMPTY")) {
599 }
600 } else {
601 RectF rectangle = convertPayloadToRectangle(payload);
605 }
607 }
608 }
609
615 public synchronized void changeStateTo(OverlayState next) {
616 changeState(mState, next);
617 }
618
625 private synchronized void changeState(OverlayState previous, OverlayState next) {
626 mState = next;
627 handleGeneralChangeState(previous, next);
628 switch (next) {
629 case CURSOR:
630 handleCursorState(previous);
631 break;
632 case SELECTION:
633 handleSelectionState(previous);
634 break;
635 case GRAPHIC_SELECTION:
637 break;
638 case TRANSITION:
639 handleTransitionState(previous);
640 break;
641 case NONE:
642 handleNoneState(previous);
643 break;
644 }
645 }
646
651 if (previous == OverlayState.NONE &&
653 mContext.getToolbarController().switchToEditMode();
654 } else if (next == OverlayState.NONE &&
656 mContext.getToolbarController().switchToViewMode();
657 }
658 }
659
663 private void handleNoneState(OverlayState previous) {
664 if (previous == OverlayState.NONE) {
665 return;
666 }
667
668 // Just hide everything
676 }
677
681 private void handleSelectionState(OverlayState previous) {
685 }
686
690 private void handleCursorState(OverlayState previous) {
692 if (previous == OverlayState.TRANSITION) {
695 }
696 }
697
701 private void handleTransitionState(OverlayState previous) {
702 switch (previous) {
703 case SELECTION:
707 break;
708 case CURSOR:
710 break;
711 case GRAPHIC_SELECTION:
713 break;
714 }
715 }
716
723 }
724
729 return mState;
730 }
731
735 public void keyEvent() {
736 mKeyEvent = true;
737 }
738
742 public enum OverlayState {
766}
767
768/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void selectFont(final String fontName)
void selectFontSize(final String fontSize)
Parses (interprets) and handles invalidation messages from LibreOffice.
synchronized void changeStateTo(OverlayState next)
Trigger a transition to a new overlay state.
void moveViewportToMakeSelectionVisible(RectF selectionRectangle)
Move the viewport to show the selection.
void handleGraphicSelectionState(OverlayState previous)
Handle a transition to OverlayState.GRAPHIC_SELECTION state.
void handleCursorState(OverlayState previous)
Handle a transition to OverlayState.CURSOR state.
synchronized void textSelection(String payload)
Handles the text selection message.
void searchResultSelection(String payload)
Handles the search result selection message, which is a JSONObject.
OverlayState getCurrentState()
The current state the overlay is in.
void cellAddress(final String payload)
synchronized void invalidateCursor(String payload)
Handles the cursor invalidation message.
void handleNoneState(OverlayState previous)
Handle a transition to OverlayState.NONE state.
void handleTransitionState(OverlayState previous)
Handle a transition to OverlayState.TRANSITION state.
List< RectF > convertPayloadToRectangles(String payload)
Parses the payload text with more rectangles (separated by ';') and converts to a list of rectangles.
InvalidationHandler(LibreOfficeMainActivity context)
synchronized void changeState(OverlayState previous, OverlayState next)
Executes a transition from old overlay state to a new overlay state.
void graphicSelection(String payload)
Handles the graphic selection change message.
final LibreOfficeMainActivity mContext
void messageRetrieved(int messageID, String payload)
Processes callback message.
void cellFormula(final String payload)
RectF convertPayloadCellToRectangle(String payload)
Parses the payload text with rectangle coordinates and converts to rectangle in pixel coordinates.
synchronized void cursorVisibility(String payload)
Handles the cursor visibility message.
void keyEvent()
A key event happened (i.e.
void handleSelectionState(OverlayState previous)
Handle a transition to OverlayState.SELECTION state.
void moveViewportToMakeCursorVisible(RectF cursorRectangle)
Move the viewport to show the cursor.
RectF convertPayloadToRectangle(String[] coordinates)
Converts rectangle coordinates to rectangle in pixel coordinates.
synchronized void textSelectionEnd(String payload)
Handles the text selection end message.
void handleGeneralChangeState(OverlayState previous, OverlayState next)
Handle a general transition - executed for all transitions.
RectF convertPayloadToRectangle(String payload)
Parses the payload text with rectangle coordinates and converts to rectangle in pixel coordinates.
synchronized void textSelectionStart(String payload)
Handles the text selection start message.
void invalidateTiles(String payload)
Handles the tile invalidation message.
Events and data that is queued and processed by LOKitThread.
Definition: LOEvent.java:21
static final int PAGE_SIZE_CHANGED
Definition: LOEvent.java:42
static final int UPDATE_PART_PAGE_RECT
Definition: LOEvent.java:38
static final int UPDATE_CALC_HEADERS
Definition: LOEvent.java:40
Common static LOKit functions, functions to send events.
Definition: LOKitShell.java:26
static boolean isEditingEnabled()
Definition: LOKitShell.java:63
static void sendTileInvalidationRequest(RectF rect)
Send tile invalidation to LOKitThread.
static void sendEvent(LOEvent event)
Make sure LOKitThread is running and send event to it.
Definition: LOKitShell.java:72
static float getDpi(Context context)
Definition: LOKitShell.java:27
static Handler getMainHandler()
Definition: LOKitShell.java:36
static void moveViewportTo(final LibreOfficeMainActivity context, final PointF position, final Float zoom)
Move the viewport to the desired point (top-left), and change the zoom level.
Main activity of the LibreOffice App.
DocumentPartViewListAdapter getDocumentPartViewListAdapter()
void hideSoftKeyboard()
Hides software keyboard on UI thread.
Selection handle is a common class for "start", "middle" and "end" types of selection handles.
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.
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 showSelections()
Show selections on the overlay.
void showCursor()
Show the cursor at the defined cursor position on the overlay.
void positionCursor(final RectF position)
Position the cursor to the input position on the overlay.
void hideGraphicSelection()
Hide the graphic selection.
void showGraphicSelection()
Show the graphic selection on the overlay.
void hideCursor()
Hide the cursor at the defined cursor position on the overlay.
ImmutableViewportMetrics getViewportMetrics()
Implementation of PanZoomTarget.
Any value
float y
float x
GRAPHIC_SELECTION
State where we operate the graphic selection.
SELECTION
State where we operate the text selection.
TRANSITION
In-between state where we need to transition to a new overlay state.
CURSOR
State where we operate with the cursor.
def rectangle(l)
def run(arg=None, arg2=-1)
NONE
std::basic_string_view< charT, traits > trim(std::basic_string_view< charT, traits > str)
const sal_uInt8 R