[Libreoffice-commits] core.git: Branch 'distro/collabora/viewer' - 3 commits - android/Bootstrap android/experimental
Miklos Vajna
vmiklos at collabora.co.uk
Wed Feb 4 16:04:48 PST 2015
android/Bootstrap/Makefile.shared | 2
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java | 25 +++++--
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java | 5 +
android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java | 5 +
android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java | 35 ++++++++++
5 files changed, 65 insertions(+), 7 deletions(-)
New commits:
commit 5026658efd1e6deae22a89bff137b37cd3bce6bb
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Feb 4 17:45:00 2015 +0100
android: fix missing drawingML preset shapes
Change-Id: I7a22b9bcacd26b837c00bb09743ab2e176d60746
diff --git a/android/Bootstrap/Makefile.shared b/android/Bootstrap/Makefile.shared
index 77d2bcf..12b4774 100644
--- a/android/Bootstrap/Makefile.shared
+++ b/android/Bootstrap/Makefile.shared
@@ -138,6 +138,8 @@ copy-stuff:
rm -Rf assets/share # pre-clean it
mkdir -p assets/share/config
cp -R $(INSTDIR)/share/registry assets/share
+# Filter data is needed by e.g. the drawingML preset shape import.
+ cp -R $(INSTDIR)/share/filter assets/share
# Make sure the soffice.cfg directory is always created, it's not possible to hit any keys without it.
if ! test z$(DISABLE_UI) = zTRUE; then \
echo "Copying UI files into the apk"; \
commit d0e4a943b8762c3653de2b31a84635ab75f76cd5
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu Jan 29 19:03:07 2015 +0900
tdf#87098 don't adjust zoom/position for spreadsheets
Change-Id: Ieb908980a931b123e2c48fe3ecdc7830b48810ed
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
index 83cf5ec..afc9028 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
@@ -69,16 +69,27 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation
mViewportMetrics = mLayerClient.getViewportMetrics();
mLayerClient.setViewportMetrics(mViewportMetrics);
- if (mTileProvider.isTextDocument()) {
+ zoomAndRepositionTheDocument();
+
+ mLayerClient.forceRedraw();
+ }
+
+ private void zoomAndRepositionTheDocument() {
+ if (mTileProvider.isSpreadsheet()) {
+ // Don't do anything for spreadsheets - show at 100%
+ } else if (mTileProvider.isTextDocument()) {
+ // Always zoom text document to the beginning of the document and centered by width
float centerY = mViewportMetrics.getCssViewport().centerY();
- mLayerClient.zoomTo(new RectF (0, centerY, mTileProvider.getPageWidth(), centerY));
- } else if (mViewportMetrics.getViewport().width() < mViewportMetrics.getViewport().height()) {
- mLayerClient.zoomTo(mTileProvider.getPageWidth(), 0);
+ mLayerClient.zoomTo(new RectF(0, centerY, mTileProvider.getPageWidth(), centerY));
} else {
- mLayerClient.zoomTo(0, mTileProvider.getPageHeight());
+ // Other documents - always show the whole document on the screen,
+ // regardless of document shape and orientation.
+ if (mViewportMetrics.getViewport().width() < mViewportMetrics.getViewport().height()) {
+ mLayerClient.zoomTo(mTileProvider.getPageWidth(), 0);
+ } else {
+ mLayerClient.zoomTo(0, mTileProvider.getPageHeight());
+ }
}
-
- mLayerClient.forceRedraw();
}
/** Invalidate everything + handle the geometry change */
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
index c39609d..5f82763 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
@@ -273,6 +273,11 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback
return mDocument != null && mDocument.getDocumentType() == Document.DOCTYPE_TEXT;
}
+ @Override
+ public boolean isSpreadsheet() {
+ return mDocument != null && mDocument.getDocumentType() == Document.DOCTYPE_SPREADSHEET;
+ }
+
/**
* Register the tile invalidation callback.
*/
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java
index 15332a7..1f15870 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java
@@ -84,6 +84,11 @@ public class MockTileProvider implements TileProvider {
}
@Override
+ public boolean isSpreadsheet() {
+ return false;
+ }
+
+ @Override
public void registerInvalidationCallback(TileInvalidationCallback tileInvalidationCallback) {
}
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
index ed9682f..48bca1b 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
@@ -53,6 +53,11 @@ public interface TileProvider {
boolean isTextDocument();
/**
+ * Returns true if the current open document is a spreadsheet.
+ */
+ boolean isSpreadsheet();
+
+ /**
* Register a callback that is invoked when a tile invalidation is
* required.
*
commit 5fcd13c49f1a55ae9e6eb23d43bc326910ae0aa0
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Fri Jan 23 23:48:14 2015 +0900
android: add some comments to TileProvider interface
Change-Id: I1c6f7bccda2392235242f5c26af1437f1365f728
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
index da0d0f4..ed9682f 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
@@ -9,8 +9,14 @@ import org.mozilla.gecko.gfx.CairoImage;
import org.mozilla.gecko.gfx.IntSize;
public interface TileProvider {
+ /**
+ * Returns the page width in pixels.
+ */
int getPageWidth();
+ /**
+ * Returns the page height in pixels.
+ */
int getPageHeight();
boolean isReady();
@@ -22,18 +28,42 @@ public interface TileProvider {
*/
void rerenderTile(CairoImage image, float x, float y, IntSize tileSize, float zoom);
+ /**
+ * Change the document part to the one specified by the partIndex input parameter.
+ * @param partIndex - part index to change to
+ */
void changePart(int partIndex);
+ /**
+ * Get the current document part number.
+ * @return
+ */
int getCurrentPartNumber();
Bitmap thumbnail(int size);
+ /**
+ * Closes the document.
+ */
void close();
+ /**
+ * Returns true if the current open document is a text document.
+ */
boolean isTextDocument();
+ /**
+ * Register a callback that is invoked when a tile invalidation is
+ * required.
+ *
+ * @param tileInvalidationCallback - the tile invalidation callback
+ */
void registerInvalidationCallback(TileProvider.TileInvalidationCallback tileInvalidationCallback);
+ /**
+ * Trigger a key press.
+ * @param keyEvent - contains the
+ */
void keyPress(KeyEvent keyEvent);
/**
More information about the Libreoffice-commits
mailing list