Kaydet (Commit) 7105ad16 authored tarafından Mert Tümer's avatar Mert Tümer Kaydeden (comit) Thorsten Behrens

[Pardus] tdf#107026 render the new page without reopen the document

This patch is sponsored by ULAKBIM/Pardus project.
Signed-off-by: 's avatarMert Tümer <merttumer7@gmail.com>

Change-Id: I91c902bfd1acc5cc70ad30f16e0719e7a325702b
Reviewed-on: https://gerrit.libreoffice.org/47636Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 31e939c9
......@@ -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) {
......
......@@ -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;
......
......@@ -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;
}
}
......
......@@ -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()
*/
......
......@@ -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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment