diff options
author | Mert Tümer <merttumer7@gmail.com> | 2018-01-08 12:07:44 +0300 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-03-14 00:43:12 +0100 |
commit | 7105ad16e7e7bfde4193dc174568ebb8a293cc87 (patch) | |
tree | 769353914bed986a2fda99aab9e4448454d6254c | |
parent | 31e939c9f4b29fb2b2e63eb096450cf3da35d67f (diff) |
[Pardus] tdf#107026 render the new page without reopen the document
This patch is sponsored by ULAKBIM/Pardus project.
Signed-off-by: Mert Tümer <merttumer7@gmail.com>
Change-Id: I91c902bfd1acc5cc70ad30f16e0719e7a325702b
Reviewed-on: https://gerrit.libreoffice.org/47636
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
5 files changed, 38 insertions, 0 deletions
diff --git a/android/source/src/java/org/libreoffice/InvalidationHandler.java b/android/source/src/java/org/libreoffice/InvalidationHandler.java index 6c582550ff81..eb22f6c8f3d3 100644 --- a/android/source/src/java/org/libreoffice/InvalidationHandler.java +++ b/android/source/src/java/org/libreoffice/InvalidationHandler.java @@ -113,6 +113,8 @@ public class InvalidationHandler implements Document.MessageCallback, Office.Mes case Document.CALLBACK_DOCUMENT_PASSWORD: documentPassword(); break; + case Document.CALLBACK_DOCUMENT_SIZE_CHANGED: + pageSizeChanged(payload); default: Log.d(LOGTAG, "LOK_CALLBACK uncaught: " + messageID + " : " + payload); } @@ -231,6 +233,13 @@ public class InvalidationHandler implements Document.MessageCallback, Office.Mes LOKitShell.moveViewportTo(mContext, new PointF(newLeft, newTop), newZoom); } + private void pageSizeChanged(String payload){ + String[] bounds = payload.split(","); + int pageWidth = Integer.parseInt(bounds[0]); + int pageHeight = Integer.parseInt(bounds[1].trim()); + LOKitShell.sendEvent(new LOEvent(LOEvent.PAGE_SIZE_CHANGED, pageWidth, pageHeight)); + } + private void stateChanged(String payload) { String[] parts = payload.split("="); if (parts.length < 2) { diff --git a/android/source/src/java/org/libreoffice/LOEvent.java b/android/source/src/java/org/libreoffice/LOEvent.java index 4d081e61c0f2..979d8ba29ed7 100644 --- a/android/source/src/java/org/libreoffice/LOEvent.java +++ b/android/source/src/java/org/libreoffice/LOEvent.java @@ -40,6 +40,7 @@ public class LOEvent implements Comparable<LOEvent> { public static final int UPDATE_ZOOM_CONSTRAINTS = 19; public static final int UPDATE_CALC_HEADERS = 20; public static final int REFRESH = 21; + public static final int PAGE_SIZE_CHANGED = 22; public final int mType; public int mPriority = 0; @@ -57,6 +58,8 @@ public class LOEvent implements Comparable<LOEvent> { public RectF mInvalidationRect; public SelectionHandle.HandleType mHandleType; public String mValue; + public int mPageWidth; + public int mPageHeight; public LOEvent(int type) { mType = type; @@ -139,6 +142,12 @@ public class LOEvent implements Comparable<LOEvent> { mDocumentCoordinate = documentCoordinate; } + public LOEvent(int type, int pageWidth, int pageHeight){ + mType = type; + mPageWidth = pageWidth; + mPageHeight = pageHeight; + } + public String getTypeString() { if (mTypeString == null) { return "Event type: " + mType; diff --git a/android/source/src/java/org/libreoffice/LOKitThread.java b/android/source/src/java/org/libreoffice/LOKitThread.java index c4146fcb6b29..63f49dc6253f 100644 --- a/android/source/src/java/org/libreoffice/LOKitThread.java +++ b/android/source/src/java/org/libreoffice/LOKitThread.java @@ -175,6 +175,11 @@ class LOKitThread extends Thread { mContext.getDocumentOverlay().setPartPageRectangles(partPageRectangles); } + private void updatePageSize(int pageWidth, int pageHeight){ + mTileProvider.setDocumentSize(pageWidth, pageHeight); + redraw(); + } + private void updateZoomConstraints() { if (mTileProvider == null) return; mLayerClient = mContext.getLayerClient(); @@ -364,6 +369,9 @@ class LOKitThread extends Thread { case LOEvent.REFRESH: refresh(); break; + case LOEvent.PAGE_SIZE_CHANGED: + updatePageSize(event.mPageWidth, event.mPageHeight); + break; } } diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java b/android/source/src/java/org/libreoffice/LOKitTileProvider.java index 24456ebf9cb1..4a8720cb9d01 100644 --- a/android/source/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/source/src/java/org/libreoffice/LOKitTileProvider.java @@ -367,6 +367,12 @@ class LOKitTileProvider implements TileProvider { return true; } + @Override + public void setDocumentSize(int pageWidth, int pageHeight){ + mWidthTwip = pageWidth; + mHeightTwip = pageHeight; + } + /** * @see TileProvider#getPageWidth() */ diff --git a/android/source/src/java/org/libreoffice/TileProvider.java b/android/source/src/java/org/libreoffice/TileProvider.java index 609fb62c708a..10d578337680 100644 --- a/android/source/src/java/org/libreoffice/TileProvider.java +++ b/android/source/src/java/org/libreoffice/TileProvider.java @@ -13,6 +13,7 @@ import android.graphics.Bitmap; import android.graphics.PointF; import android.view.KeyEvent; +import org.libreoffice.kit.Document; import org.mozilla.gecko.gfx.CairoImage; import org.mozilla.gecko.gfx.IntSize; @@ -162,6 +163,11 @@ public interface TileProvider { * Send a request to change end the change of graphic selection.. */ void setGraphicSelectionEnd(PointF documentCoordinate); + + /** + * Set the new page size of the document when changed + */ + void setDocumentSize(int pageWidth, int pageHeight); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |