android/experimental/LOAndroid3/AndroidManifest.xml.in | 9 + android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java | 54 +++++++++- libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 4 libreofficekit/source/gtk/lokdocview.c | 3 sd/source/ui/view/outlview.cxx | 7 - sw/source/core/txtnode/txtedt.cxx | 19 ++- sw/source/core/unocore/unoparagraph.cxx | 6 - writerperfect/source/common/WPXSvInputStream.cxx | 2 8 files changed, 88 insertions(+), 16 deletions(-)
New commits: commit e8c199c0a5c11dbe6375adb97e68160c0775b8a1 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Thu Feb 5 19:05:05 2015 +0900 android: copy document to temp file when using content scheme We get the data from Intent, which has data identified by an uri. An uri can use many schemes but we support file (loading directly from a file) or content (used by GMail App). When loading from content, the document is available through a stream and has to be stored into a temporary file locally first, and then that file is should be used as input for loading the document. Change-Id: Ia4ffa8ff02b9737b91a41c03c2eb335d28fe1d61 diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java index 1b20328..7fa45f5 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java @@ -2,6 +2,7 @@ package org.libreoffice; import android.app.Activity; import android.app.AlertDialog; +import android.content.ContentResolver; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; @@ -24,6 +25,13 @@ import org.mozilla.gecko.ZoomConstraints; import org.mozilla.gecko.gfx.GeckoLayerClient; import org.mozilla.gecko.gfx.LayerView; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import java.util.ArrayList; import java.util.List; @@ -45,6 +53,7 @@ public class LibreOfficeMainActivity extends LOAbout { private List<DocumentPartView> mDocumentPartView = new ArrayList<DocumentPartView>(); private DocumentPartViewListAdapter mDocumentPartViewListAdapter; private String mInputFile; + private File mTempFile = null; public LibreOfficeMainActivity() { super(/*newActivity=*/false); @@ -96,7 +105,15 @@ public class LibreOfficeMainActivity extends LOAbout { LayoutInflater.from(this).setFactory(ViewFactory.getInstance()); if (getIntent().getData() != null) { - mInputFile = getIntent().getData().getPath(); + if (getIntent().getData().getScheme().equals(ContentResolver.SCHEME_CONTENT)) { + if (copyFileToTemp() && mTempFile != null) { + mInputFile = mTempFile.getPath(); + } else { + // TODO: can't open the file + } + } else if (getIntent().getData().getScheme().equals(ContentResolver.SCHEME_FILE)) { + mInputFile = getIntent().getData().getPath(); + } } else { mInputFile = DEFAULT_DOC_PATH; } @@ -131,6 +148,35 @@ public class LibreOfficeMainActivity extends LOAbout { mLayerClient.notifyReady(); } + private boolean copyFileToTemp() { + ContentResolver contentResolver = getContentResolver(); + InputStream inputStream = null; + try { + inputStream = contentResolver.openInputStream(getIntent().getData()); + mTempFile = File.createTempFile("LibreOffice", null, this.getCacheDir()); + + OutputStream outputStream = new FileOutputStream(mTempFile); + byte[] buffer = new byte[4096]; + int len = 0; + while ((len = inputStream.read(buffer)) != -1) { + outputStream.write(buffer, 0, len); + } + inputStream.close(); + outputStream.close(); + return true; + } catch (FileNotFoundException e) { + } catch (IOException e) { + } finally { + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + } + } + } + return false; + } + @Override protected void onResume() { super.onResume(); @@ -162,6 +208,12 @@ public class LibreOfficeMainActivity extends LOAbout { Log.i(LOGTAG, "onDestroy.."); mLayerClient.destroy(); super.onDestroy(); + + if (isFinishing()) { // Not an orientation change + if (mTempFile != null) { + mTempFile.delete(); + } + } } public LOKitThread getLOKitThread() { commit f255cadc61c1b41e113b519066082258fef97ec9 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Thu Feb 5 19:03:06 2015 +0900 android: allow only "file" and "content" URI scheme Content scheme is used by GMail App for example. Change-Id: I3583d38c42b9ad96209f0cd178ea6957a7aec86c diff --git a/android/experimental/LOAndroid3/AndroidManifest.xml.in b/android/experimental/LOAndroid3/AndroidManifest.xml.in index 3a17f62..244c6db 100644 --- a/android/experimental/LOAndroid3/AndroidManifest.xml.in +++ b/android/experimental/LOAndroid3/AndroidManifest.xml.in @@ -16,7 +16,9 @@ android:icon="@drawable/main" android:label="@string/app_name" android:hardwareAccelerated="true" - android:theme="@style/AppTheme"> + android:theme="@style/AppTheme" + android:largeHeap="false"> + <!-- Viewer Activity --> <activity android:name=".LibreOfficeMainActivity" @@ -28,6 +30,9 @@ <action android:name="android.intent.action.PICK" /> <category android:name="android.intent.category.DEFAULT" /> + <data android:scheme="file"/> + <data android:scheme="content"/> + <!-- Please keep this in sync with FileUtilities.java. --> <!-- ODF --> @@ -83,6 +88,7 @@ </intent-filter> </activity> + <!-- Document Browser Activity --> <activity android:name=".ui.LibreOfficeUIActivity" android:label="@string/app_name"> @@ -91,6 +97,7 @@ <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> + </application> </manifest> commit 42ed2a60ef61f02d9e65a56693823df0ab54e8f8 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon Jan 26 11:40:33 2015 +0100 gtktiledviewer: fix for missing g_info() Change-Id: I04a91065526b49bacb72c7d4865440efc3b3f7d0 diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx index 66c56e7..a12303d 100644 --- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx @@ -21,6 +21,10 @@ #include <com/sun/star/awt/Key.hpp> +#ifndef g_info +#define g_info(...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, __VA_ARGS__) +#endif + static int help() { fprintf( stderr, "Usage: gtktiledviewer <absolute-path-to-libreoffice-install> <path-to-document>\n" ); commit 6da0d486621638cc352872d9b0d3ab4277663796 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon Jan 26 10:57:10 2015 +0100 fix for missing g_info Change-Id: Ibfab6d3aadb126fc357fd2d15485dcde8ceefa94 diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c index bb2444c..7264563 100644 --- a/libreofficekit/source/gtk/lokdocview.c +++ b/libreofficekit/source/gtk/lokdocview.c @@ -19,6 +19,9 @@ #ifndef G_SOURCE_REMOVE #define G_SOURCE_REMOVE FALSE #endif +#ifndef g_info +#define g_info(...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, __VA_ARGS__) +#endif static void lok_docview_class_init( LOKDocViewClass* pClass ); static void lok_docview_init( LOKDocView* pDocView ); commit 959d0b0d10581a9cf37b30b5617bd9062e75af0d Author: Michael Stahl <mst...@redhat.com> Date: Wed Jan 21 14:36:42 2015 +0100 writerperfect: convert assert on invalid input to SAL_WARN lp502369-3.doc contains several StgEntry that are invalid and have type 0 (STG_EMPTY). Not sure if sot Storage::FillInfoList() should filter these out. Change-Id: I493cbb346723a3be4f8bc93de1030e68c1216b50 diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx index 8233820..764b1b9 100644 --- a/writerperfect/source/common/WPXSvInputStream.cxx +++ b/writerperfect/source/common/WPXSvInputStream.cxx @@ -236,7 +236,7 @@ void OLEStorageImpl::traverse(const SotStorageRef &rStorage, const rtl::OUString } else { - assert(false); + SAL_WARN("writerperfect", "OLEStorageImpl::traverse: invalid storage entry, neither stream nor file"); } } } commit 62e6490f0aeeacd069fdab6831ff389c7bb95f2e Author: Michael Stahl <mst...@redhat.com> Date: Wed Jan 21 11:12:34 2015 +0100 sw: fix bogus assert in SwTxtNode::RstTxtAttr() The assert for case 3 is wrong and fires when importing ooo44732-2.doc but there is also a bug here where a hint could be skipped. Change-Id: I028d2d5df9e80cf0001d9bc11aa7fabcd01e83bb diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index a04fdff..9a8b88e 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -529,6 +529,7 @@ void SwTxtNode::RstTxtAttr( } else // Case: 3 { + bChanged = true; m_pSwpHints->NoteInHistory( pHt ); // UGLY: this may temporarily destroy the sorting! pHt->GetStart() = nEnd; @@ -539,13 +540,19 @@ void SwTxtNode::RstTxtAttr( SwTxtAttr* pNew = MakeTxtAttr( *GetDoc(), *pStyleHandle, nAttrStart, nEnd ); InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST ); - } - - // this case appears to rely on InsertHint not re-sorting - // and pNew being inserted behind pHt - assert(pHt == m_pSwpHints->GetTextHint(i)); - bChanged = true; + // skip the ++i because InsertHint will re-sort + // so now an unrelated hint (previous i+1) may be at i! + // (but pHt and pNew can only move to indexes >= i) +#if OSL_DEBUG_LEVEL > 0 + for (size_t j = 0; j < i; ++j) + { + assert(m_pSwpHints->GetTextHint(j) != pHt); + assert(m_pSwpHints->GetTextHint(j) != pNew); + } +#endif + continue; + } } } } commit 4f3314dad7f6431bc2714451139ac7ad9d7cdd1d Author: Caolán McNamara <caol...@redhat.com> Date: Tue Jan 20 17:43:46 2015 +0000 fix SwIndexReg::~SwIndexReg assert in fdo68332-2.docx SwParaSelection sets a mark on the cursor, but there is no need to do that. DelFullPara will delete the SwTxtNode anyway. Change-Id: I99b8dd637bd4d2b49a555e147514a2def19fa0bf Reviewed-on: https://gerrit.libreoffice.org/14054 Reviewed-by: Michael Stahl <mst...@redhat.com> Tested-by: Michael Stahl <mst...@redhat.com> diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index 10f1b3c..aa7bc1a 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -1279,11 +1279,7 @@ void SAL_CALL SwXParagraph::dispose() throw (uno::RuntimeException, std::excepti if (pTxtNode) { SwCursor aCursor( SwPosition( *pTxtNode ), 0, false ); - // select paragraph - { - SwParaSelection aParaSel( aCursor ); - pTxtNode->GetDoc()->getIDocumentContentOperations().DelFullPara(aCursor); - } + pTxtNode->GetDoc()->getIDocumentContentOperations().DelFullPara(aCursor); lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this)); m_pImpl->m_EventListeners.disposeAndClear(ev); } commit 3325a97fe3cea6734cc8a52692827787de63ecee Author: Caolán McNamara <caol...@redhat.com> Date: Tue Jan 20 15:14:58 2015 +0000 Related: ooo#34420-1.sxi concealed divide by zero on this and about 30 other documents where the NaN result is cast back to a long, giving rise to an assert in vcl/source/outdev/map.cxx:391 of long int ImplLogicToPixel(long int, long int, long int, long int, long int): Assertion `std::abs(n) < std::numeric_limits<long>::max() / nMapNum / nDPI' failed. Change-Id: Ia87e4ee6bbf0f10b7eba513e9a5ba3c42440d181 diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index c7e1508..4840296 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -1723,8 +1723,11 @@ IMPL_LINK(OutlineView, PaintingFirstLineHdl, PaintFirstLineInfo*, pInfo) Size aOutSize( 2000, nBulletHeight ); const float fImageHeight = ((float)aOutSize.Height() * (float)4) / (float)7; - const float fImageRatio = (float)aImageSize.Height() / (float)aImageSize.Width(); - aImageSize.Width() = (long)( fImageRatio * fImageHeight ); + if (aImageSize.Width() != 0) + { + const float fImageRatio = (float)aImageSize.Height() / (float)aImageSize.Width(); + aImageSize.Width() = (long)( fImageRatio * fImageHeight ); + } aImageSize.Height() = (long)( fImageHeight ); Point aImagePos( pInfo->mrStartPos );
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits