[Libreoffice-commits] core.git: Branch 'distro/collabora/viewer' - 3 commits - android/experimental include/vcl sd/source
Jan Holesovsky
kendy at collabora.com
Wed Feb 4 15:45:39 PST 2015
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java | 16 +++++++---
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java | 9 ++++-
include/vcl/ITiledRenderable.hxx | 4 ++
sd/source/ui/inc/unomodel.hxx | 3 +
sd/source/ui/unoidl/unomodel.cxx | 5 +++
5 files changed, 31 insertions(+), 6 deletions(-)
New commits:
commit 3bccac71fb4f63305f5fd05b102ac287c235f8c9
Author: Jan Holesovsky <kendy at collabora.com>
Date: Wed Feb 4 23:31:01 2015 +0100
android: When loading fails, make sure we don't crash the next time.
Until now, when the loading failed, the next attempt to open a document
lead to a crash; fixed.
Change-Id: Ibb55b4799169e1521f076cf38380e429a50258a3
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
index fd88f1c..83cf5ec 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
@@ -28,6 +28,9 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation
}
private void tileRequest(ComposedTileLayer composedTileLayer, TileIdentifier tileId, boolean forceRedraw) {
+ if (mTileProvider == null)
+ return;
+
if (composedTileLayer.isStillValid(tileId)) {
CairoImage image = mTileProvider.createTile(tileId.x, tileId.y, tileId.size, tileId.zoom);
if (image != null) {
@@ -43,6 +46,9 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation
}
private void tileRerender(ComposedTileLayer composedTileLayer, SubTile tile) {
+ if (mTileProvider == null)
+ return;
+
if (composedTileLayer.isStillValid(tile.id) && !tile.markedForRemoval) {
mLayerClient.beginDrawing();
mTileProvider.rerenderTile(tile.getImage(), tile.id.x, tile.id.y, tile.id.size, tile.id.zoom);
@@ -90,7 +96,7 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation
LOKitShell.hideProgressSpinner();
}
- private boolean loadDocument(String filename) {
+ private void loadDocument(String filename) {
if (mApplication == null) {
mApplication = LibreOfficeMainActivity.mAppContext;
}
@@ -98,19 +104,21 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation
mLayerClient = mApplication.getLayerClient();
mTileProvider = TileProviderFactory.create(mLayerClient, filename);
- boolean isReady = mTileProvider.isReady();
- if (isReady) {
+
+ if (mTileProvider.isReady()) {
LOKitShell.showProgressSpinner();
mTileProvider.registerInvalidationCallback(this);
refresh();
LOKitShell.hideProgressSpinner();
+ } else {
+ closeDocument();
}
- return isReady;
}
public void closeDocument() {
if (mTileProvider != null) {
mTileProvider.close();
+ mTileProvider = null;
}
}
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
index c9e74c5..c39609d 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
@@ -75,6 +75,9 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback
postLoad();
mIsReady = true;
}
+ else {
+ mIsReady = false;
+ }
}
public void postLoad() {
@@ -149,7 +152,7 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback
} else {
ret = resetDocumentSize();
if (!ret) {
- error = "Document returned an invalid size or the document is empty!";
+ error = "Document returned an invalid size or the document is empty.";
}
}
commit 19c6379f2d4aa67d45e3c6235474e7e919b94f46
Author: Jan Holesovsky <kendy at collabora.com>
Date: Wed Feb 4 20:33:52 2015 +0100
android: Initialize for tiled rendering earlier.
We need to prepare the document ASAP, otherwise we will get zero size when eg.
presentation is switched to Notes view.
Change-Id: I0d3ccea18058052994d91868ec1346c5de25faff
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
index 3760891..c9e74c5 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
@@ -68,6 +68,9 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback
Log.i(LOGTAG, "====> mDocument = " + mDocument);
+ if (mDocument != null)
+ mDocument.initializeForRendering();
+
if (checkDocument()) {
postLoad();
mIsReady = true;
@@ -75,7 +78,6 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback
}
public void postLoad() {
- mDocument.initializeForRendering();
mDocument.setMessageCallback(this);
int parts = mDocument.getParts();
commit 79d97c069733ee8e7bc974f5d0e970e7f22eacd6
Author: Jan Holesovsky <kendy at collabora.com>
Date: Wed Feb 4 14:48:57 2015 +0100
android: In Impress, switch to the 'Normal' (slides) view.
Other modes are not fit for the tiled rendering, and crash the viewer.
Change-Id: I6fb17663203d9eb298bba2b9bd143fdd28ffb470
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 8711611..b231e98 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -84,6 +84,10 @@ public:
(void) ePartMode;
}
+ /**
+ * Setup various document properties that are needed for the document to
+ * be renderable via tiled rendering.
+ */
virtual void initializeForTiledRendering()
{
}
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index c7bf63b..e95e54d 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -240,6 +240,9 @@ public:
virtual OUString getPartName( int nPart ) SAL_OVERRIDE;
virtual void setPartMode( LibreOfficeKitPartMode ePartMode ) SAL_OVERRIDE;
+ /// @see ITiledRenderable::initializeForTiledRendering().
+ virtual void initializeForTiledRendering() SAL_OVERRIDE;
+
// XComponent
/** This dispose implementation releases the resources held by the
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index e92f328..431e4c6 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2347,6 +2347,11 @@ Size SdXImpressDocument::getDocumentSize()
return Size(convertMm100ToTwip(aSize.getWidth()), convertMm100ToTwip(aSize.getHeight()));
}
+void SdXImpressDocument::initializeForTiledRendering()
+{
+ // tiled rendering works only when we are in the 'Normal' view, switch to that
+ mpDocShell->GetViewShell()->GetViewFrame()->GetDispatcher()->Execute(SID_VIEWSHELL0, SfxCallMode::SYNCHRON | SfxCallMode::RECORD);
+}
uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable()
{
More information about the Libreoffice-commits
mailing list