diff options
Diffstat (limited to 'android')
5 files changed, 21 insertions, 13 deletions
diff --git a/android/Bootstrap/src/org/libreoffice/kit/Document.java b/android/Bootstrap/src/org/libreoffice/kit/Document.java index 4cc4ba345c04..dcc315faca4c 100644 --- a/android/Bootstrap/src/org/libreoffice/kit/Document.java +++ b/android/Bootstrap/src/org/libreoffice/kit/Document.java @@ -143,6 +143,8 @@ public class Document { private native int getDocumentTypeNative(); + public native void setClientZoom(int nTilePixelWidth, int nTilePixelHeight, int nTileTwipWidth, int nTileTwipHeight); + private native void saveAs(String url, String format, String options); private native void paintTileNative(ByteBuffer buffer, int canvasWidth, int canvasHeight, int tilePositionX, int tilePositionY, int tileWidth, int tileHeight); diff --git a/android/source/src/java/org/libreoffice/LOKitThread.java b/android/source/src/java/org/libreoffice/LOKitThread.java index a8f4d303293c..978056dab1d7 100644 --- a/android/source/src/java/org/libreoffice/LOKitThread.java +++ b/android/source/src/java/org/libreoffice/LOKitThread.java @@ -299,17 +299,18 @@ public class LOKitThread extends Thread { // to handle hyperlinks, enable single tap even in the Viewer boolean editing = LOKitShell.isEditingEnabled(); + float zoomFactor = mViewportMetrics.getZoomFactor(); if (touchType.equals("LongPress") && editing) { mInvalidationHandler.changeStateTo(InvalidationHandler.OverlayState.TRANSITION); - mTileProvider.mouseButtonDown(documentCoordinate, 1); - mTileProvider.mouseButtonUp(documentCoordinate, 1); - mTileProvider.mouseButtonDown(documentCoordinate, 2); - mTileProvider.mouseButtonUp(documentCoordinate, 2); + mTileProvider.mouseButtonDown(documentCoordinate, 1, zoomFactor); + mTileProvider.mouseButtonUp(documentCoordinate, 1, zoomFactor); + mTileProvider.mouseButtonDown(documentCoordinate, 2, zoomFactor); + mTileProvider.mouseButtonUp(documentCoordinate, 2, zoomFactor); } else if (touchType.equals("SingleTap")) { mInvalidationHandler.changeStateTo(InvalidationHandler.OverlayState.TRANSITION); - mTileProvider.mouseButtonDown(documentCoordinate, 1); - mTileProvider.mouseButtonUp(documentCoordinate, 1); + mTileProvider.mouseButtonDown(documentCoordinate, 1, zoomFactor); + mTileProvider.mouseButtonUp(documentCoordinate, 1, zoomFactor); } else if (touchType.equals("GraphicSelectionStart") && editing) { mTileProvider.setGraphicSelectionStart(documentCoordinate); } else if (touchType.equals("GraphicSelectionEnd") && editing) { diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java b/android/source/src/java/org/libreoffice/LOKitTileProvider.java index f859b7a1bc62..b70e8524ecc3 100644 --- a/android/source/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/source/src/java/org/libreoffice/LOKitTileProvider.java @@ -397,10 +397,11 @@ public class LOKitTileProvider implements TileProvider { } } - private void mouseButton(int type, PointF inDocument, int numberOfClicks) { + private void mouseButton(int type, PointF inDocument, int numberOfClicks, float zoomFactor) { int x = (int) pixelToTwip(inDocument.x, mDPI); int y = (int) pixelToTwip(inDocument.y, mDPI); + mDocument.setClientZoom(TILE_SIZE, TILE_SIZE, (int) (mTileWidth / zoomFactor), (int) (mTileHeight / zoomFactor)); mDocument.postMouseEvent(type, x, y, numberOfClicks, Document.MOUSE_BUTTON_LEFT, Document.KEYBOARD_MODIFIER_NONE); } @@ -408,16 +409,16 @@ public class LOKitTileProvider implements TileProvider { * @see TileProvider#mouseButtonDown(android.graphics.PointF, int) */ @Override - public void mouseButtonDown(PointF documentCoordinate, int numberOfClicks) { - mouseButton(Document.MOUSE_EVENT_BUTTON_DOWN, documentCoordinate, numberOfClicks); + public void mouseButtonDown(PointF documentCoordinate, int numberOfClicks, float zoomFactor) { + mouseButton(Document.MOUSE_EVENT_BUTTON_DOWN, documentCoordinate, numberOfClicks, zoomFactor); } /** * @see TileProvider#mouseButtonUp(android.graphics.PointF, int) */ @Override - public void mouseButtonUp(PointF documentCoordinate, int numberOfClicks) { - mouseButton(Document.MOUSE_EVENT_BUTTON_UP, documentCoordinate, numberOfClicks); + public void mouseButtonUp(PointF documentCoordinate, int numberOfClicks, float zoomFactor) { + mouseButton(Document.MOUSE_EVENT_BUTTON_UP, documentCoordinate, numberOfClicks, zoomFactor); } @Override diff --git a/android/source/src/java/org/libreoffice/TileProvider.java b/android/source/src/java/org/libreoffice/TileProvider.java index 3104172ef5cf..0ab5a1f641c9 100644 --- a/android/source/src/java/org/libreoffice/TileProvider.java +++ b/android/source/src/java/org/libreoffice/TileProvider.java @@ -88,7 +88,7 @@ public interface TileProvider { * @param documentCoordinate - coordinate relative to the document where the mouse button should be triggered * @param numberOfClicks - number of clicks (1 - single click, 2 - double click) */ - void mouseButtonDown(PointF documentCoordinate, int numberOfClicks); + void mouseButtonDown(PointF documentCoordinate, int numberOfClicks, float zoomFactor); /** @@ -107,7 +107,7 @@ public interface TileProvider { * @param documentCoordinate - coordinate relative to the document where the mouse button should be triggered * @param numberOfClicks - number of clicks (1 - single click, 2 - double click) */ - void mouseButtonUp(PointF documentCoordinate, int numberOfClicks); + void mouseButtonUp(PointF documentCoordinate, int numberOfClicks, float zoomFactor); /** * Post a UNO command to LOK. diff --git a/android/source/src/java/org/mozilla/gecko/gfx/ImmutableViewportMetrics.java b/android/source/src/java/org/mozilla/gecko/gfx/ImmutableViewportMetrics.java index 35b417593acf..f90580fbee8c 100644 --- a/android/source/src/java/org/mozilla/gecko/gfx/ImmutableViewportMetrics.java +++ b/android/source/src/java/org/mozilla/gecko/gfx/ImmutableViewportMetrics.java @@ -106,6 +106,10 @@ public class ImmutableViewportMetrics { return new RectF(cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom); } + public float getZoomFactor() { + return zoomFactor; + } + /* * Returns the viewport metrics that represent a linear transition between "this" and "to" at * time "t", which is on the scale [0, 1). This function interpolates all values stored in |