diff options
Diffstat (limited to 'android')
3 files changed, 23 insertions, 10 deletions
diff --git a/android/source/src/java/org/libreoffice/LOKitThread.java b/android/source/src/java/org/libreoffice/LOKitThread.java index 03b7070e783a..e80e5af6c990 100644 --- a/android/source/src/java/org/libreoffice/LOKitThread.java +++ b/android/source/src/java/org/libreoffice/LOKitThread.java @@ -265,15 +265,7 @@ class LOKitThread extends Thread { refresh(); LOKitShell.hideProgressSpinner(mContext); - if (fileType.matches(LibreOfficeUIActivity.NEW_WRITER_STRING_KEY)) - mTileProvider.saveDocumentAs(filePath, "odt"); - else if (fileType.matches(LibreOfficeUIActivity.NEW_CALC_STRING_KEY)) - mTileProvider.saveDocumentAs(filePath, "ods"); - else if (fileType.matches(LibreOfficeUIActivity.NEW_IMPRESS_STRING_KEY)) - mTileProvider.saveDocumentAs(filePath, "odp"); - else - mTileProvider.saveDocumentAs(filePath, "odg"); - + mTileProvider.saveDocumentAs(filePath); } else { closeDocument(); } diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java b/android/source/src/java/org/libreoffice/LOKitTileProvider.java index 0e2649337322..a887118c6aaa 100644 --- a/android/source/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/source/src/java/org/libreoffice/LOKitTileProvider.java @@ -356,6 +356,21 @@ class LOKitTileProvider implements TileProvider { LOKitShell.hideProgressSpinner(mContext); } + @Override + public void saveDocumentAs(final String filePath) { + final int docType = mDocument.getDocumentType(); + if (docType == Document.DOCTYPE_TEXT) + saveDocumentAs(filePath, "odt"); + else if (docType == Document.DOCTYPE_SPREADSHEET) + saveDocumentAs(filePath, "ods"); + else if (docType == Document.DOCTYPE_PRESENTATION) + saveDocumentAs(filePath, "odp"); + else if (docType == Document.DOCTYPE_DRAWING) + saveDocumentAs(filePath, "odg"); + else + Log.w(LOGTAG, "Cannot determine file format from document. Not saving."); + } + public void exportToPDF(boolean print){ String dir = Environment.getExternalStorageDirectory().getAbsolutePath()+"/Documents"; File docDir = new File(dir); diff --git a/android/source/src/java/org/libreoffice/TileProvider.java b/android/source/src/java/org/libreoffice/TileProvider.java index dabf30b834f7..a848b4ae98d0 100644 --- a/android/source/src/java/org/libreoffice/TileProvider.java +++ b/android/source/src/java/org/libreoffice/TileProvider.java @@ -22,11 +22,17 @@ import org.mozilla.gecko.gfx.IntSize; public interface TileProvider { /** - * Save the current document. + * Save the current document under the given path. */ void saveDocumentAs(String filePath, String format); /** + * Saves the current document under the given path, + * using the default file format. + */ + void saveDocumentAs(String filePath); + + /** * Returns the page width in pixels. */ int getPageWidth(); |