Rebased ref, commits from common ancestor: commit 77debb673e61340dfc3ddc63b6d72731c091c210 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Feb 20 16:21:06 2015 +0100
Extract LibreOfficeKitEnums.h from LibreOfficeKit.h This massively reduces the rebuild time in case only a new enumeration value is added to one of the enums. Change-Id: I4e58adf36fcd29da1672a5e5091bd3f6744f148d diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index a144b51..3acb7bf 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -18,6 +18,7 @@ #define LOK_USE_UNSTABLE_API #include <LibreOfficeKit/LibreOfficeKit.h> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <tools/errinf.hxx> #include <osl/file.hxx> @@ -182,12 +183,12 @@ extern "C" static void doc_destroy(LibreOfficeKitDocument* pThis); static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* pUrl, const char* pFormat, const char* pFilterOptions); -static LibreOfficeKitDocumentType doc_getDocumentType(LibreOfficeKitDocument* pThis); +static int doc_getDocumentType(LibreOfficeKitDocument* pThis); static int doc_getParts(LibreOfficeKitDocument* pThis); static int doc_getPart(LibreOfficeKitDocument* pThis); static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart); static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart); -static void doc_setPartMode(LibreOfficeKitDocument* pThis, LibreOfficeKitPartMode ePartMode); +static void doc_setPartMode(LibreOfficeKitDocument* pThis, int nPartMode); void doc_paintTile(LibreOfficeKitDocument* pThis, unsigned char* pBuffer, const int nCanvasWidth, const int nCanvasHeight, @@ -450,7 +451,7 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha return false; } -static LibreOfficeKitDocumentType doc_getDocumentType (LibreOfficeKitDocument* pThis) +static int doc_getDocumentType (LibreOfficeKitDocument* pThis) { LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis); @@ -541,7 +542,7 @@ static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart) } static void doc_setPartMode(LibreOfficeKitDocument* pThis, - LibreOfficeKitPartMode ePartMode) + int nPartMode) { ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -554,7 +555,7 @@ static void doc_setPartMode(LibreOfficeKitDocument* pThis, int nCurrentPart = pDoc->getPart(); - pDoc->setPartMode(ePartMode); + pDoc->setPartMode(nPartMode); // We need to make sure the internal state is updated, just changing the mode // might not update the relevant shells (i.e. impress will keep rendering the diff --git a/desktop/source/lib/lokandroid.cxx b/desktop/source/lib/lokandroid.cxx index 9ea1842..a4f7297 100644 --- a/desktop/source/lib/lokandroid.cxx +++ b/desktop/source/lib/lokandroid.cxx @@ -209,7 +209,7 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_setPart { LibreOfficeKitDocument* pDocument = getHandle<LibreOfficeKitDocument>(pEnv, aObject); - pDocument->pClass->setPartMode(pDocument, (LibreOfficeKitPartMode) nPartMode); + pDocument->pClass->setPartMode(pDocument, nPartMode); } extern "C" SAL_JNI_EXPORT jint JNICALL Java_org_libreoffice_kit_Document_getDocumentTypeNative diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index c7dac9a..f8a62b2 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -31,103 +31,6 @@ typedef struct _LibreOfficeKitDocumentClass LibreOfficeKitDocumentClass; #define LIBREOFFICEKIT_HAS(pKit,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitClass,member,(pKit)->pClass->nSize) #ifdef LOK_USE_UNSTABLE_API -typedef enum -{ - LOK_DOCTYPE_TEXT, - LOK_DOCTYPE_SPREADSHEET, - LOK_DOCTYPE_PRESENTATION, - LOK_DOCTYPE_DRAWING, - LOK_DOCTYPE_OTHER -} -LibreOfficeKitDocumentType; - -typedef enum -{ - LOK_PARTMODE_DEFAULT, - LOK_PARTMODE_SLIDE, - LOK_PARTMODE_NOTES, - LOK_PARTMODE_SLIDENOTES, - LOK_PARTMODE_EMBEDDEDOBJ -} -LibreOfficeKitPartMode; - -typedef enum -{ - /** - * Any tiles which are over the rectangle described in the payload are no - * longer valid. - * - * Rectangle format: "width, height, x, y", where all numbers are document - * coordinates, in twips. - */ - LOK_CALLBACK_INVALIDATE_TILES, - /** - * The size and/or the position of the visible cursor changed. - * - * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES. - */ - LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, - /** - * The list of rectangles representing the current text selection changed. - * - * List format is "rectangle1[; rectangle2[; ...]]" (without quotes and - * brackets), where rectangleN has the same format as - * LOK_CALLBACK_INVALIDATE_TILES. When there is no selection, an empty - * string is provided. - */ - LOK_CALLBACK_TEXT_SELECTION, - /** - * The size and/or the position of the cursor rectangle at the text - * selection start changed. - * - * If this callback is emitted, it's always followed by a - * LOK_CALLBACK_TEXT_SELECTION one. Rectangle format is the same as - * LOK_CALLBACK_INVALIDATE_TILES. - */ - LOK_CALLBACK_TEXT_SELECTION_START, - /** - * The size and/or the position of the cursor rectangle at the text - * selection end changed. - * - * If this callback is emitted, it's always followed by a - * LOK_CALLBACK_TEXT_SELECTION one. Rectangle format is the same as - * LOK_CALLBACK_INVALIDATE_TILES. - */ - LOK_CALLBACK_TEXT_SELECTION_END -} -LibreOfficeKitCallbackType; - -typedef enum -{ - /// A key on the keyboard is pressed. - LOK_KEYEVENT_KEYINPUT, - /// A key on the keyboard is released. - LOK_KEYEVENT_KEYUP -} -LibreOfficeKitKeyEventType; - -typedef enum -{ - /// A pressed gesture has started. - LOK_MOUSEEVENT_MOUSEBUTTONDOWN, - /// A pressed gesture has finished. - LOK_MOUSEEVENT_MOUSEBUTTONUP, - /// A change has happened during a press gesture. - LOK_MOUSEEVENT_MOUSEMOVE -} -LibreOfficeKitMouseEventType; - -typedef enum -{ - /// The start of selection is to be adjusted. - LOK_SETTEXTSELECTION_START, - /// The end of selection is to be adjusted. - LOK_SETTEXTSELECTION_END, - /// Both the start and the end of selection is to be adjusted. - LOK_SETTEXTSELECTION_RESET -} -LibreOfficeKitSetTextSelectionType; - typedef void (*LibreOfficeKitCallback)(int nType, const char* pPayload, void* pData); #endif // LOK_USE_UNSTABLE_API @@ -168,7 +71,11 @@ struct _LibreOfficeKitDocumentClass const char* pFormat, const char* pFilterOptions); #ifdef LOK_USE_UNSTABLE_API - LibreOfficeKitDocumentType (*getDocumentType) (LibreOfficeKitDocument* pThis); + /** Get document type. + * + * @returns an element of the LibreOfficeKitDocumentType enum. + */ + int (*getDocumentType) (LibreOfficeKitDocument* pThis); /** Get number of part that the document contains. * Part refers to either indivual sheets in a Spreadsheet, @@ -185,8 +92,12 @@ struct _LibreOfficeKitDocumentClass char* (*getPartName) (LibreOfficeKitDocument* pThis, int nPart); + /** Sets mode of the current part. + * + * @param nMode - element from the LibreOfficeKitPartMode enum. + */ void (*setPartMode) (LibreOfficeKitDocument* pThis, - LibreOfficeKitPartMode eMode); + int nMode); void (*paintTile) (LibreOfficeKitDocument* pThis, unsigned char* pBuffer, diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index 8f19582..f8d6e19 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -44,7 +44,7 @@ public: inline LibreOfficeKitDocument *get() { return mpDoc; } #ifdef LOK_USE_UNSTABLE_API - inline LibreOfficeKitDocumentType getDocumentType() + inline int getDocumentType() { return mpDoc->pClass->getDocumentType(mpDoc); } diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h new file mode 100644 index 0000000..a8aca2f --- /dev/null +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -0,0 +1,124 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITENUMS_H +#define INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITENUMS_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifdef LOK_USE_UNSTABLE_API +typedef enum +{ + LOK_DOCTYPE_TEXT, + LOK_DOCTYPE_SPREADSHEET, + LOK_DOCTYPE_PRESENTATION, + LOK_DOCTYPE_DRAWING, + LOK_DOCTYPE_OTHER +} +LibreOfficeKitDocumentType; + +typedef enum +{ + LOK_PARTMODE_DEFAULT, + LOK_PARTMODE_SLIDE, + LOK_PARTMODE_NOTES, + LOK_PARTMODE_SLIDENOTES, + LOK_PARTMODE_EMBEDDEDOBJ +} +LibreOfficeKitPartMode; + +typedef enum +{ + /** + * Any tiles which are over the rectangle described in the payload are no + * longer valid. + * + * Rectangle format: "width, height, x, y", where all numbers are document + * coordinates, in twips. + */ + LOK_CALLBACK_INVALIDATE_TILES, + /** + * The size and/or the position of the visible cursor changed. + * + * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES. + */ + LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, + /** + * The list of rectangles representing the current text selection changed. + * + * List format is "rectangle1[; rectangle2[; ...]]" (without quotes and + * brackets), where rectangleN has the same format as + * LOK_CALLBACK_INVALIDATE_TILES. When there is no selection, an empty + * string is provided. + */ + LOK_CALLBACK_TEXT_SELECTION, + /** + * The size and/or the position of the cursor rectangle at the text + * selection start changed. + * + * If this callback is emitted, it's always followed by a + * LOK_CALLBACK_TEXT_SELECTION one. Rectangle format is the same as + * LOK_CALLBACK_INVALIDATE_TILES. + */ + LOK_CALLBACK_TEXT_SELECTION_START, + /** + * The size and/or the position of the cursor rectangle at the text + * selection end changed. + * + * If this callback is emitted, it's always followed by a + * LOK_CALLBACK_TEXT_SELECTION one. Rectangle format is the same as + * LOK_CALLBACK_INVALIDATE_TILES. + */ + LOK_CALLBACK_TEXT_SELECTION_END +} +LibreOfficeKitCallbackType; + +typedef enum +{ + /// A key on the keyboard is pressed. + LOK_KEYEVENT_KEYINPUT, + /// A key on the keyboard is released. + LOK_KEYEVENT_KEYUP +} +LibreOfficeKitKeyEventType; + +typedef enum +{ + /// A pressed gesture has started. + LOK_MOUSEEVENT_MOUSEBUTTONDOWN, + /// A pressed gesture has finished. + LOK_MOUSEEVENT_MOUSEBUTTONUP, + /// A change has happened during a press gesture. + LOK_MOUSEEVENT_MOUSEMOVE +} +LibreOfficeKitMouseEventType; + +typedef enum +{ + /// The start of selection is to be adjusted. + LOK_SETTEXTSELECTION_START, + /// The end of selection is to be adjusted. + LOK_SETTEXTSELECTION_END, + /// Both the start and the end of selection is to be adjusted. + LOK_SETTEXTSELECTION_RESET +} +LibreOfficeKitSetTextSelectionType; + +#endif // LOK_USE_UNSTABLE_API + +#ifdef __cplusplus +} +#endif + +#endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITENUMS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h index c1a1731..d6d720e 100644 --- a/include/LibreOfficeKit/LibreOfficeKitGtk.h +++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h @@ -100,7 +100,7 @@ void lok_docview_set_part (LOKDocView* pDocView, char* lok_docview_get_part_name (LOKDocView* pDocView, int nPart); void lok_docview_set_partmode (LOKDocView* pDocView, - LibreOfficeKitPartMode ePartMode); + int nPartMode); /// Sets if the viewer is actually an editor or not. void lok_docview_set_edit (LOKDocView* pDocView, gboolean bEdit); diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index d5b3e80..ee903ad 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -79,9 +79,10 @@ public: return OUString(""); } - virtual void setPartMode(LibreOfficeKitPartMode ePartMode) + /// @see lok::Document::setPartMode(). + virtual void setPartMode(int nPartMode) { - (void) ePartMode; + (void) nPartMode; } /** diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx index fbaa97f..65bfb7d 100644 --- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx @@ -17,6 +17,7 @@ #include <LibreOfficeKit/LibreOfficeKitGtk.h> #include <LibreOfficeKit/LibreOfficeKitInit.h> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> #include "../lokdocview_quad/lokdocview_quad.h" #include <com/sun/star/awt/Key.hpp> diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c index 132b2d4..31d9430 100644 --- a/libreofficekit/source/gtk/lokdocview.c +++ b/libreofficekit/source/gtk/lokdocview.c @@ -13,7 +13,7 @@ #define LOK_USE_UNSTABLE_API #include <LibreOfficeKit/LibreOfficeKit.h> - +#include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <LibreOfficeKit/LibreOfficeKitGtk.h> #if !GLIB_CHECK_VERSION(2,32,0) @@ -713,9 +713,9 @@ SAL_DLLPUBLIC_EXPORT char* lok_docview_get_part_name( LOKDocView* pDocView, int } SAL_DLLPUBLIC_EXPORT void lok_docview_set_partmode( LOKDocView* pDocView, - LibreOfficeKitPartMode ePartMode ) + int nPartMode ) { - pDocView->pDocument->pClass->setPartMode( pDocView->pDocument, ePartMode ); + pDocView->pDocument->pClass->setPartMode( pDocView->pDocument, nPartMode ); renderDocument(pDocView, NULL); } diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index fbeb73a..768e4f6 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -238,7 +238,7 @@ public: virtual int getPart() SAL_OVERRIDE; virtual int getParts() SAL_OVERRIDE; virtual OUString getPartName( int nPart ) SAL_OVERRIDE; - virtual void setPartMode( LibreOfficeKitPartMode ePartMode ) SAL_OVERRIDE; + virtual void setPartMode( int nPartMode ) SAL_OVERRIDE; /// @see vcl::ITiledRenderable::initializeForTiledRendering(). virtual void initializeForTiledRendering() SAL_OVERRIDE; diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 6f5edb3..ff9115a 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -41,6 +41,7 @@ #include <sfx2/bindings.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <editeng/UnoForbiddenCharsTable.hxx> #include <svx/svdoutl.hxx> @@ -2302,14 +2303,14 @@ OUString SdXImpressDocument::getPartName( int nPart ) return pPage->GetName(); } -void SdXImpressDocument::setPartMode( LibreOfficeKitPartMode ePartMode ) +void SdXImpressDocument::setPartMode( int nPartMode ) { DrawViewShell* pViewSh = GetViewShell(); if (!pViewSh) return; PageKind aPageKind( PK_STANDARD ); - switch ( ePartMode ) + switch ( nPartMode ) { case LOK_PARTMODE_EMBEDDEDOBJ: // This will probably be handled higher up, i.e. diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index 60d51e6..1c5bdd7 100644 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -40,6 +40,7 @@ #include <vcl/svapp.hxx> #include <vcl/settings.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> namespace sd { diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index cf68b8d..74b5ee6 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -54,6 +54,7 @@ #include <boost/scoped_ptr.hpp> #include <touch/touch.h> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <paintfrm.hxx> // Here static members are defined. They will get changed on alteration of the diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index c8565d4..751a7e1 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -68,6 +68,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <touch/touch-impl.h> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <editeng/acorrcfg.hxx> #include <SwSmartTagMgr.hxx> diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 88320e8..0f0cbeb 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -28,6 +28,8 @@ #include <sfx2/printer.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <toolkit/awt/vclxdevice.hxx> +#define LOK_USE_UNSTABLE_API +#include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <cmdid.h> #include <swtypes.hxx> #include <wdocsh.hxx> commit 916d40e047ae7a46ce8da05776c66a4e8630c809 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Feb 20 16:12:25 2015 +0100 README.Android: document how to get pretty-printers work Change-Id: I0e421aaa38934f6fb2dd8992261ebcde80896e12 diff --git a/README.Android b/README.Android index 8e9702e..4094ef2 100644 --- a/README.Android +++ b/README.Android @@ -25,23 +25,19 @@ In order to have proper acceleration, you need the 32-bit libGL.so: ant debug install adb logcat - And if all goes well - you should have some nice unit test output to -enjoy. After a while of this loop you might find that you have lost a lot of -space on your emulator's or device's /data volume. If using the emulator, you -can do: + And if all goes well - you should have some nice debug output to enjoy +when you start the app. After a while of this loop you might find that you have +lost a lot of space on your emulator's or device's /data volume. If using the +emulator, you can do: adb shell stop; adb shell start but on a (non-rooted) device you probably just need to reboot it. On the other hand, this phenomenon might not happen on actual devices. - and continue onwards & upwards. - * What about using a real device? - That works fine, too. You won't be able to use the "adb shell -stop" and "adb shell start" commands to do anything, as far as I -know. But don't seem to be necessary on a real device anyway? + That works fine, too. * Debugging @@ -50,6 +46,10 @@ know. But don't seem to be necessary on a real device anyway? like --enable-selective-debuginfo="sw/" or so, in order to fit into the memory during linking. + Building with all symbols is also possible but the linking is currently +slow (around 10 to 15 minutes) and you need lots of memory (around 16GB + some +swap). + You also want to avoid --with-android-package-name (or when you use that, you must set it to "org.libreoffice"), otherwise ndk-gdb will complain that @@ -62,12 +62,12 @@ ERROR: Could not extract package's data directory. Are you sure that cd android/experimental/LOAndroid3 <android-ndk-r10d>/ndk-gdb --adb=<android-sdk-linux>/platform-tools/adb --start - It seems that the "have to start the app before gdb can connect to it" -and the "pending breakpoints do not work" problems are now resolved with the -current NDK. + Pretty printers aren't loaded automatically due to the single shared + object, but you can still load them manually. E.g. to have a pretty-printer for + rtl::OString, you need: -Building with all symbols is also possible but the linking is slow (around 10 -to 15 minutes) and you need lots of memory (around 16GB + some swap). + (gdb) python sys.path.insert(0, "/master/solenv/gdb") + (gdb) source /master/instdir/program/libuno_sal.so.3-gdb.py * Common Errors / Gotchas commit 9b00d3944eb9c83bc5a0b098b70fb9767dc614d2 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Feb 20 16:05:34 2015 +0100 README.Android: document requirements for an all-symbol build Change-Id: I945b9833dee3a47cf23760b3f22917731a879e12 diff --git a/README.Android b/README.Android index cfb0203..8e9702e 100644 --- a/README.Android +++ b/README.Android @@ -66,6 +66,9 @@ ERROR: Could not extract package's data directory. Are you sure that and the "pending breakpoints do not work" problems are now resolved with the current NDK. +Building with all symbols is also possible but the linking is slow (around 10 +to 15 minutes) and you need lots of memory (around 16GB + some swap). + * Common Errors / Gotchas lo_dlneeds: Could not read ELF header of /data/data/org.libreoffice...libfoo.so commit a247d077a506cb017aba005eb5c3335b745ec5f7 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Feb 20 16:04:11 2015 +0100 README.Android: document how to install the self-built .apk Change-Id: I3539f406d0c425902efec0bee4c3701df8048593 diff --git a/README.Android b/README.Android index 19f54f9..cfb0203 100644 --- a/README.Android +++ b/README.Android @@ -21,10 +21,9 @@ In order to have proper acceleration, you need the 32-bit libGL.so: Then: - make cmd cmd=bash - cd android/qa/sc - make clean all install - make run ; adb shell logcat + cd android/experimental/LOAndroid3 + ant debug install + adb logcat And if all goes well - you should have some nice unit test output to enjoy. After a while of this loop you might find that you have lost a lot of commit 49137ed241805db08b58bb1011d239ff85033258 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Feb 20 15:52:23 2015 +0100 android: install gdb printers Commit f44f94b95b435ee0ec71c73133daeb88cd2539b1 (fix gdb pretty printers for --enable-mergelibs, 2013-09-10) doesn't really say why this was wanted, probably just to be on the safe side. Enabling them allows at least manually loading them. Change-Id: I22eeca67e4077e06efba8b3edfd6eb84159b9c47 diff --git a/Makefile.in b/Makefile.in index c1e7af1..b4c1ecf 100644 --- a/Makefile.in +++ b/Makefile.in @@ -239,7 +239,7 @@ bootstrap: compilerplugins # with some translations like "build"->"all" for historic reasons # build: bootstrap fetch $(if $(CROSS_COMPILING),cross-toolset) -ifneq ($(filter-out WNT MACOSX IOS ANDROID,$(OS)),) +ifneq ($(filter-out WNT MACOSX IOS,$(OS)),) mkdir -p $(INSTDIR) $(SRCDIR)/solenv/bin/install-gdb-printers -a $(INSTDIR) -c endif commit ab44ada1471873997de3ae0349b258088b2ba71b Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Feb 20 14:51:06 2015 +0100 sd::ViewShell -> SdrModel for LOK callback One one hand, this fixes missing invalidations after typing characters in editeng on Android. Previously it was assumed that there is only one sd::ViewShell for one Impress document, but that's obviously not true. On the other hand, this will be handy when later svx code wants to invoke the LOK callback as well, when it was stored in sd, that wasn't possible. Change-Id: Id467be01ad008aecaaabdd85b2a6b29a14f1eb86 diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index a8a185a..375ad58 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -37,6 +37,7 @@ #include <svx/xtable.hxx> #include <svx/pageitem.hxx> #include <vcl/field.hxx> +#include <vcl/ITiledRenderable.hxx> class OutputDevice; #include <svx/svdtypes.hxx> @@ -171,6 +172,8 @@ protected: OutputDevice* pRefOutDev; // ReferenceDevice for the EditEngine /// Set if we are doing tiled rendering. bool mbTiledRendering; + LibreOfficeKitCallback mpLibreOfficeKitCallback; + void* mpLibreOfficeKitData; sal_uIntPtr nProgressAkt; // for the sal_uIntPtr nProgressMax; // ProgressBar- sal_uIntPtr nProgressOfs; // -Handler @@ -338,6 +341,10 @@ public: void setTiledRendering(bool bTiledRendering); /// Are we doing tiled rendering? bool isTiledRendering() const; + /// The actual implementation of the vcl::ITiledRenderable::registerCallback() API. + void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData); + /// Invokes the registered callback, if there are any. + void libreOfficeKitCallback(int nType, const char* pPayload) const; // If a new MapMode is set on the RefDevice (or similar) void RefDeviceChanged(); // not yet implemented // default font heigth in logical units diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index e5f082c..b4bd333 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -23,7 +23,6 @@ #include <rtl/ref.hxx> #include <vcl/field.hxx> -#include <vcl/ITiledRenderable.hxx> #include <sfx2/viewsh.hxx> #include <vcl/prntypes.hxx> #include <svtools/transfer.hxx> @@ -444,11 +443,6 @@ public: SdPage* pPage, const sal_Int32 nInsertPosition = -1); - /// The actual implementation of the vcl::ITiledRenderable::registerCallback() API for Impress. - void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData); - /// Invokes the registered callback, if there are any. - void libreOfficeKitCallback(int nType, const char* pPayload) const; - class Implementation; protected: @@ -582,9 +576,6 @@ private: /** Create the rulers. */ void SetupRulers (void); - - LibreOfficeKitCallback mpLibreOfficeKitCallback; - void* mpLibreOfficeKitData; }; SdrView* ViewShell::GetDrawView (void) const diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 267a983..6f5edb3 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2358,7 +2358,7 @@ void SdXImpressDocument::initializeForTiledRendering() void SdXImpressDocument::registerCallback(LibreOfficeKitCallback pCallback, void* pData) { SolarMutexGuard aGuard; - mpDocShell->GetViewShell()->registerLibreOfficeKitCallback(pCallback, pData); + mpDoc->registerLibreOfficeKitCallback(pCallback, pData); } uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable() diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index a94d8ee..60d51e6 100644 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -992,7 +992,7 @@ void Window::LogicInvalidate(const ::vcl::Region* pRegion) sRectangle = "EMPTY"; else sRectangle = pRegion->GetBoundRect().toString(); - mpViewShell->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); + mpViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); } } // end of namespace sd diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 77b024ea..0581a7c 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -137,8 +137,6 @@ ViewShell::ViewShell( SfxViewFrame*, vcl::Window* pParentWindow, ViewShellBase& : SfxShell(&rViewShellBase) , mbCenterAllowed(bAllowCenter) , mpParentWindow(pParentWindow) -, mpLibreOfficeKitCallback(0) -, mpLibreOfficeKitData(0) { construct(); } @@ -1450,18 +1448,6 @@ void ViewShell::NotifyAccUpdate( ) GetViewShellBase().GetDrawController().NotifyAccUpdate(); } -void ViewShell::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData) -{ - mpLibreOfficeKitCallback = pCallback; - mpLibreOfficeKitData = pData; -} - -void ViewShell::libreOfficeKitCallback(int nType, const char* pPayload) const -{ - if (mpLibreOfficeKitCallback) - mpLibreOfficeKitCallback(nType, pPayload, mpLibreOfficeKitData); -} - } // end of namespace sd //===== ViewShellObjectBarFactory ============================================= diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index c444fa5..66f004e 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -125,6 +125,8 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe pHitTestOutliner=NULL; pRefOutDev=NULL; mbTiledRendering = false; + mpLibreOfficeKitCallback = 0; + mpLibreOfficeKitData = 0; nProgressAkt=0; nProgressMax=0; nProgressOfs=0; @@ -806,6 +808,18 @@ bool SdrModel::isTiledRendering() const return mbTiledRendering; } +void SdrModel::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData) +{ + mpLibreOfficeKitCallback = pCallback; + mpLibreOfficeKitData = pData; +} + +void SdrModel::libreOfficeKitCallback(int nType, const char* pPayload) const +{ + if (mpLibreOfficeKitCallback) + mpLibreOfficeKitCallback(nType, pPayload, mpLibreOfficeKitData); +} + void SdrModel::ImpReformatAllTextObjects() { if( isLocked() ) commit 532e77cd3886b985f6e61363f563cbaa6c1b4b6d Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Fri Feb 20 14:56:29 2015 +0900 android: support selection invalidation, show selection handles Change-Id: I82909e6426d4e9fd5dc7b9c9e6e1b21259cf9a57 diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index eb7cb40..1fd1388 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -398,6 +398,18 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback case Document.CALLBACK_INVALIDATE_VISIBLE_CURSOR: invalidateCursor(payload); break; + case Document.CALLBACK_INVALIDATE_TEXT_SELECTION: + Log.i(LOGTAG, "Selection: " + payload); + invalidateSelection(payload); + break; + case Document.CALLBACK_INVALIDATE_TEXT_SELECTION_START: + Log.i(LOGTAG, "Selection start: " + payload); + invalidateSelectionStart(payload); + break; + case Document.CALLBACK_INVALIDATE_TEXT_SELECTION_END: + Log.i(LOGTAG, "Selection end: " + payload); + invalidateSelectionEnd(payload); + break; } } @@ -421,6 +433,44 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback LOKitShell.sendTileInvalidationRequest(rect); } } + + private void invalidateSelectionStart(String payload) { + RectF rect = convertCallbackMessageStringToRectF(payload); + if (rect != null) { + RectF underSelection = new RectF(rect.centerX(), rect.bottom, rect.centerX(), rect.bottom); + TextSelection textSelection = LibreOfficeMainActivity.mAppContext.getTextSelection(); + textSelection.positionHandle(TextSelectionHandle.HandleType.START, underSelection); + textSelection.showHandle(TextSelectionHandle.HandleType.START); + + textSelection.hideHandle(TextSelectionHandle.HandleType.MIDDLE); + + TextCursorLayer textCursorLayer = LibreOfficeMainActivity.mAppContext.getTextCursorLayer(); + textCursorLayer.hideCursor(); + } + } + + private void invalidateSelectionEnd(String payload) { + RectF rect = convertCallbackMessageStringToRectF(payload); + if (rect != null) { + RectF underSelection = new RectF(rect.centerX(), rect.bottom, rect.centerX(), rect.bottom); + TextSelection textSelection = LibreOfficeMainActivity.mAppContext.getTextSelection(); + textSelection.positionHandle(TextSelectionHandle.HandleType.END, underSelection); + textSelection.showHandle(TextSelectionHandle.HandleType.END); + + textSelection.hideHandle(TextSelectionHandle.HandleType.MIDDLE); + + TextCursorLayer textCursorLayer = LibreOfficeMainActivity.mAppContext.getTextCursorLayer(); + textCursorLayer.hideCursor(); + } + } + + private void invalidateSelection(String payload) { + if (payload.isEmpty()) { + TextSelection textSelection = LibreOfficeMainActivity.mAppContext.getTextSelection(); + textSelection.hideHandle(TextSelectionHandle.HandleType.START); + textSelection.hideHandle(TextSelectionHandle.HandleType.END); + } + } } // vim:set shiftwidth=4 softtabstop=4 expandtab: commit 4d6eb40f9b433f2f95c5025e1fb26be9039612c5 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Fri Feb 20 14:54:35 2015 +0900 android: fix LOGTAG in DisplayPortCalculator Change-Id: I7895cc8fe70ecf69183ed9261bad4b74af023c8d diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/DisplayPortCalculator.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/DisplayPortCalculator.java index 789d5b6..f860cd9 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/DisplayPortCalculator.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/DisplayPortCalculator.java @@ -17,7 +17,7 @@ import org.mozilla.gecko.util.FloatUtils; import java.util.Map; final class DisplayPortCalculator { - private static final String LOGTAG = "GeckoDisplayPortCalculator"; + private static final String LOGTAG = DisplayPortCalculator.class.getSimpleName(); private static final PointF ZERO_VELOCITY = new PointF(0, 0); // Keep this in sync with the TILEDLAYERBUFFER_TILE_SIZE defined in gfx/layers/TiledLayerBuffer.h commit d103037d0f8ab10f98e59c40c37e14df4830f123 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Fri Feb 20 14:51:40 2015 +0900 android: no need for TileInvalidationCallback We can just handle the tile invalidation messaged directly in LOKitTileProvider where we just send a tile invalidation event to LOKitThread. This is needed as we aren't in the correct thread. Change-Id: I62995f2f9abfa7496e0793549b8e02ff47b1ed65 diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java index 1e3036c..2037e9d 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java @@ -4,6 +4,7 @@ package org.libreoffice; import android.app.ActivityManager; import android.content.Context; import android.graphics.PointF; +import android.graphics.RectF; import android.os.Handler; import android.util.DisplayMetrics; import android.view.KeyEvent; @@ -119,4 +120,8 @@ public class LOKitShell { public static void sendTileReevaluationRequest(ComposedTileLayer composedTileLayer) { LOKitShell.sendEvent(new LOEvent(LOEvent.TILE_REEVALUATION_REQUEST, composedTileLayer)); } + + public static void sendTileInvalidationRequest(RectF rect) { + LOKitShell.sendEvent(new LOEvent(LOEvent.TILE_INVALIDATION, rect)); + } } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java index 8ae5749..9ec76be 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java @@ -17,7 +17,7 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.LinkedBlockingQueue; -public class LOKitThread extends Thread implements TileProvider.TileInvalidationCallback { +public class LOKitThread extends Thread { private static final String LOGTAG = LOKitThread.class.getSimpleName(); private LinkedBlockingQueue<LOEvent> mEventQueue = new LinkedBlockingQueue<LOEvent>(); @@ -154,7 +154,6 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation if (mTileProvider.isReady()) { LOKitShell.showProgressSpinner(); - mTileProvider.registerInvalidationCallback(this); refresh(); LOKitShell.hideProgressSpinner(); } else { @@ -246,11 +245,6 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation public void clearQueue() { mEventQueue.clear(); } - - @Override - public void invalidate(RectF rect) { - queueEvent(new LOEvent(LOEvent.TILE_INVALIDATION, rect)); - } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index d8753de..eb7cb40 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -32,7 +32,6 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback private Office mOffice; private Document mDocument; private boolean mIsReady = false; - private TileInvalidationCallback tileInvalidationCallback = null; private float mDPI; private float mWidthTwip; @@ -279,14 +278,6 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback } /** - * Register the tile invalidation callback. - */ - @Override - public void registerInvalidationCallback(TileInvalidationCallback tileInvalidationCallback) { - this.tileInvalidationCallback = tileInvalidationCallback; - } - - /** * Returns the Unicode character generated by this event or 0. */ private int getCharCode(KeyEvent keyEvent) { @@ -425,12 +416,9 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback } private void invalidateTiles(String payload) { - if (tileInvalidationCallback == null) { - return; - } RectF rect = convertCallbackMessageStringToRectF(payload); if (rect != null) { - tileInvalidationCallback.invalidate(rect); + LOKitShell.sendTileInvalidationRequest(rect); } } } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java index e6fbcd2..fe934a1 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java @@ -90,10 +90,6 @@ public class MockTileProvider implements TileProvider { } @Override - public void registerInvalidationCallback(TileInvalidationCallback tileInvalidationCallback) { - } - - @Override public void sendKeyEvent(KeyEvent keyEvent) { } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java index 92dbb3d..ea868bd 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java @@ -61,14 +61,6 @@ public interface TileProvider { boolean isSpreadsheet(); /** - * 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 event. * * @param keyEvent - contains information about key event @@ -90,16 +82,4 @@ public interface TileProvider { * @param numberOfClicks - number of clicks (1 - single click, 2 - double click) */ void mouseButtonUp(PointF documentCoordinate, int numberOfClicks); - - /** - * Callback to retrieve invalidation calls - */ - public interface TileInvalidationCallback { - /** - * Invoked when a region is invalidated. - * - * @param rect area in pixels which was invalidated and needs to be redrawn - */ - void invalidate(RectF rect); - } } commit b3fd1d5e5670c79e61c3ba19a04aa0cf0d429212 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Thu Feb 19 18:36:17 2015 +0100 Use SdrModel::isTiledRendering() It turns out that in case the is-tiled-rendering flag is part of the sdr model, then that's enough for all the places where so far used a flag on the output device for this purpose, so change the two users of that method to use SdrModel::isTiledRendering(), and clean up the now unused one. Change-Id: Ife6d3d7e093c04b707497d9588942b38bcd8742d diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index b35a82e..a144b51 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -607,7 +607,6 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, aDevice.SetOutputSizePixelScaleOffsetAndBuffer( Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(), aBuffer, true ); - aDevice.setTiledRendering(true); pDoc->paintTile(aDevice, nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 80178b3..ec1063b 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -275,8 +275,6 @@ private: ImplOutDevData* mpOutDevData; std::vector< VCLXGraphics* >* mpUnoGraphicsList; vcl::PDFWriterImpl* mpPDFWriter; - /// Set if we are doing the tiled rendering. - bool mbTiledRendering; vcl::ExtOutDevData* mpExtOutDevData; // TEMP TEMP TEMP @@ -478,11 +476,6 @@ public: void SetExtOutDevData( vcl::ExtOutDevData* pExtOutDevData ) { mpExtOutDevData = pExtOutDevData; } vcl::ExtOutDevData* GetExtOutDevData() const { return mpExtOutDevData; } - /// Set if we are doing tiled rendering. - void setTiledRendering(bool bTiledRendering); - /// Are we doing tiled rendering? - bool isTiledRendering() const; - ///@} diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index b7331da..5fdc177 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -308,7 +308,7 @@ void SdrObjEditView::TextEditDrawing(SdrPaintWindow& rPaintWindow) const { OutlinerView* pOLV = pActiveOutliner->GetView(i); - if(pOLV->GetWindow() == &rPaintWindow.GetOutputDevice() || rPaintWindow.GetOutputDevice().isTiledRendering()) + if(pOLV->GetWindow() == &rPaintWindow.GetOutputDevice() || GetModel()->isTiledRendering()) { ImpPaintOutlinerView(*pOLV, aCheckRect, rPaintWindow.GetTargetOutputDevice()); return; diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index a3c294d..346f74c 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -736,7 +736,7 @@ void SdrPaintView::DoCompleteRedraw(SdrPaintWindow& rPaintWindow, const vcl::Reg void SdrPaintView::EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer) { std::unique_ptr<SdrPaintWindow> pPaintWindow; - if (rPaintWindow.GetOutputDevice().isTiledRendering() && rPaintWindow.getTemporaryTarget()) + if (GetModel()->isTiledRendering() && rPaintWindow.getTemporaryTarget()) { // Tiled rendering, we must paint the TextEdit to the output device. pPaintWindow.reset(&rPaintWindow); diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index 85a222c..0305c94 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -99,7 +99,6 @@ OutputDevice::OutputDevice() : mpOutDevStateStack = new OutDevStateStack; mpPDFWriter = NULL; mpAlphaVDev = NULL; - mbTiledRendering = false; mpExtOutDevData = NULL; mnOutOffX = 0; mnOutOffY = 0; @@ -398,16 +397,6 @@ bool OutputDevice::SupportsOperation( OutDevSupportType eType ) const return bHasSupport; } -void OutputDevice::setTiledRendering(bool bTiledRendering) -{ - mbTiledRendering = bTiledRendering; -} - -bool OutputDevice::isTiledRendering() const -{ - return mbTiledRendering; -} - // Direct OutputDevice drawing public functions void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize, commit 40e3569a08d89fc6cf91cfc3a88d1049f25533c9 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Thu Feb 19 14:38:53 2015 +0100 ImpEditEngine::UpdateViews: need to go via Invalidate() for tiled rendering This makes typed characters appear as you type it (and not only after the editing of the shape text is finished) in Impress. Change-Id: Id47efe8223ddfdbad36f436366c9c8c8e0cb45f4 diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index cc3db19..cfd4fc5 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -572,6 +572,16 @@ Color EditView::GetBackgroundColor() const return pImpEditView->GetBackgroundColor(); } +void EditView::setTiledRendering(bool bTiledRendering) +{ + pImpEditView->setTiledRendering(bTiledRendering); +} + +bool EditView::isTiledRendering() +{ + return pImpEditView->isTiledRendering(); +} + void EditView::SetControlWord( sal_uInt32 nWord ) { pImpEditView->nControl = nWord; diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 4ec83bb..ed543cb 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -75,6 +75,7 @@ ImpEditView::ImpEditView( EditView* pView, EditEngine* pEng, vcl::Window* pWindo pOutWin = pWindow; pPointer = NULL; pBackgroundColor = NULL; + mbTiledRendering = false; nScrollDiffX = 0; nExtraCursorFlags = 0; nCursorBidiLevel = CURSOR_BIDILEVEL_DONTKNOW; @@ -112,6 +113,16 @@ void ImpEditView::SetBackgroundColor( const Color& rColor ) pBackgroundColor = new Color( rColor ); } +void ImpEditView::setTiledRendering(bool bTiledRendering) +{ + mbTiledRendering = bTiledRendering; +} + +bool ImpEditView::isTiledRendering() const +{ + return mbTiledRendering; +} + void ImpEditView::SetEditSelection( const EditSelection& rEditSelection ) { // set state before notification diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 78128ab..0bcaa38 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -215,6 +215,7 @@ private: EditView* pEditView; vcl::Cursor* pCursor; Color* pBackgroundColor; + bool mbTiledRendering; EditEngine* pEditEngine; vcl::Window* pOutWin; Pointer* pPointer; @@ -363,6 +364,9 @@ public: const Color& GetBackgroundColor() const { return ( pBackgroundColor ? *pBackgroundColor : pOutWin->GetBackground().GetColor() ); } + void setTiledRendering(bool bTiledRendering); + bool isTiledRendering() const; + bool IsWrongSpelledWord( const EditPaM& rPaM, bool bMarkIfWrong ); OUString SpellIgnoreOrAddWord( bool bAdd ); diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index d98efb5..6c3dd12 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -290,7 +290,8 @@ void ImpEditEngine::UpdateViews( EditView* pCurView ) // convert to window coordinates .... aClipRect = pView->pImpEditView->GetWindowPos( aClipRect ); - if ( pView == pCurView ) + // For tiled rendering, we have to always go via Invalidate(). + if ( pView == pCurView && !pView->isTiledRendering()) Paint( pView->pImpEditView, aClipRect, 0, true ); else pView->GetWindow()->Invalidate( aClipRect ); diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 652fcaa..e545e9f 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -1420,6 +1420,10 @@ void OutlinerView::SetBackgroundColor( const Color& rColor ) pEditView->SetBackgroundColor( rColor ); } +void OutlinerView::setTiledRendering(bool bTiledRendering) +{ + pEditView->setTiledRendering(bTiledRendering); +} Color OutlinerView::GetBackgroundColor() { diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx index 3f7c637..439f63b 100644 --- a/include/editeng/editview.hxx +++ b/include/editeng/editview.hxx @@ -169,6 +169,9 @@ public: void SetBackgroundColor( const Color& rColor ); Color GetBackgroundColor() const; + void setTiledRendering(bool bTiledRendering); + bool isTiledRendering(); + void SetControlWord( sal_uInt32 nWord ); sal_uInt32 GetControlWord() const; diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 075fdeb..d63d884 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -257,6 +257,9 @@ public: void SetBackgroundColor( const Color& rColor ); Color GetBackgroundColor(); + /// Set if we are doing tiled rendering. + void setTiledRendering(bool bTiledRendering); + SfxItemSet GetAttribs(); void Cut(); diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index ddc3f8e..a8a185a 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -169,6 +169,8 @@ protected: SdrOutliner* pHitTestOutliner;// an Outliner for the HitTest sal_uIntPtr nDefTextHgt; // Default text heigth in logical units OutputDevice* pRefOutDev; // ReferenceDevice for the EditEngine + /// Set if we are doing tiled rendering. + bool mbTiledRendering; sal_uIntPtr nProgressAkt; // for the sal_uIntPtr nProgressMax; // ProgressBar- sal_uIntPtr nProgressOfs; // -Handler @@ -332,6 +334,10 @@ public: // ReferenceDevice for the EditEngine void SetRefDevice(OutputDevice* pDev); OutputDevice* GetRefDevice() const { return pRefOutDev; } + /// Set if we are doing tiled rendering. + void setTiledRendering(bool bTiledRendering); + /// Are we doing tiled rendering? + bool isTiledRendering() const; // If a new MapMode is set on the RefDevice (or similar) void RefDeviceChanged(); // not yet implemented // default font heigth in logical units diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 1b4c488..267a983 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2352,6 +2352,7 @@ void SdXImpressDocument::initializeForTiledRendering() SolarMutexGuard aGuard; // 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); + mpDoc->setTiledRendering(true); } void SdXImpressDocument::registerCallback(LibreOfficeKitCallback pCallback, void* pData) diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 9c47ca8..b7331da 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -446,6 +446,7 @@ OutlinerView* SdrObjEditView::ImpMakeOutlinerView(vcl::Window* pWin, bool /*bNoP } pOutlView->SetControlWord(nStat); pOutlView->SetBackgroundColor( aBackground ); + pOutlView->setTiledRendering(GetModel()->isTiledRendering()); if (pText!=NULL) { pOutlView->SetAnchorMode((EVAnchorMode)(pText->GetOutlinerViewAnchorMode())); diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 64a5304..c444fa5 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -124,6 +124,7 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe pDrawOutliner=NULL; pHitTestOutliner=NULL; pRefOutDev=NULL; + mbTiledRendering = false; nProgressAkt=0; nProgressMax=0; nProgressOfs=0; @@ -795,6 +796,16 @@ void SdrModel::SetRefDevice(OutputDevice* pDev) RefDeviceChanged(); } +void SdrModel::setTiledRendering(bool bTiledRendering) +{ + mbTiledRendering = bTiledRendering; +} + +bool SdrModel::isTiledRendering() const +{ + return mbTiledRendering; +} + void SdrModel::ImpReformatAllTextObjects() { if( isLocked() ) commit 8632db588d405f10506925ffd2db369691e5bc71 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Thu Feb 19 12:48:27 2015 +0100 svx: paint TextEdit to the output device in case of tiled rendering With this, we still miss invalidations when the user types characters into a TextEdit, but at least when manually triggering a full redraw we gets the typed characters without finishing the editing. Change-Id: I3ab8991a86c99fe3910ddc5e4f795b802c07c9a9 diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index f8b234b..9c47ca8 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -308,7 +308,7 @@ void SdrObjEditView::TextEditDrawing(SdrPaintWindow& rPaintWindow) const { OutlinerView* pOLV = pActiveOutliner->GetView(i); - if(pOLV->GetWindow() == &rPaintWindow.GetOutputDevice()) + if(pOLV->GetWindow() == &rPaintWindow.GetOutputDevice() || rPaintWindow.GetOutputDevice().isTiledRendering()) { ImpPaintOutlinerView(*pOLV, aCheckRect, rPaintWindow.GetTargetOutputDevice()); return; diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index 0643992..a3c294d 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <memory> #include <com/sun/star/awt/XWindow.hpp> #include <svx/svdpntv.hxx> #include <vcl/msgbox.hxx> @@ -734,6 +735,14 @@ void SdrPaintView::DoCompleteRedraw(SdrPaintWindow& rPaintWindow, const vcl::Reg void SdrPaintView::EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer) { + std::unique_ptr<SdrPaintWindow> pPaintWindow; + if (rPaintWindow.GetOutputDevice().isTiledRendering() && rPaintWindow.getTemporaryTarget()) + { + // Tiled rendering, we must paint the TextEdit to the output device. + pPaintWindow.reset(&rPaintWindow); + pPaintWindow->setTemporaryTarget(false); + } + if(rPaintWindow.getTemporaryTarget()) { // get rid of temp target again commit 2af65ff30e8cef6be21fee1ef20f6b1db4451ccf Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Thu Feb 19 12:12:34 2015 +0100 Add OutputDevice::isTiledRendering() This is similar to SwViewShell::isTiledRendering, but while SwViewShell describes a state of the application, this one describes a state of the output device. The output device may be created by LOK client code, while the view shell may not be accessible from lower layers of the stack, so we need both. Change-Id: I82f7755eb73603bd79283272fba4970dccae8784 diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index a144b51..b35a82e 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -607,6 +607,7 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, aDevice.SetOutputSizePixelScaleOffsetAndBuffer( Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(), aBuffer, true ); + aDevice.setTiledRendering(true); pDoc->paintTile(aDevice, nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index ec1063b..80178b3 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -275,6 +275,8 @@ private: ImplOutDevData* mpOutDevData; std::vector< VCLXGraphics* >* mpUnoGraphicsList; vcl::PDFWriterImpl* mpPDFWriter; + /// Set if we are doing the tiled rendering. + bool mbTiledRendering; vcl::ExtOutDevData* mpExtOutDevData; // TEMP TEMP TEMP @@ -476,6 +478,11 @@ public: void SetExtOutDevData( vcl::ExtOutDevData* pExtOutDevData ) { mpExtOutDevData = pExtOutDevData; } vcl::ExtOutDevData* GetExtOutDevData() const { return mpExtOutDevData; } + /// Set if we are doing tiled rendering. + void setTiledRendering(bool bTiledRendering); + /// Are we doing tiled rendering? + bool isTiledRendering() const; + ///@} diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index 0305c94..85a222c 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -99,6 +99,7 @@ OutputDevice::OutputDevice() : mpOutDevStateStack = new OutDevStateStack; mpPDFWriter = NULL; mpAlphaVDev = NULL; + mbTiledRendering = false; mpExtOutDevData = NULL; mnOutOffX = 0; mnOutOffY = 0; @@ -397,6 +398,16 @@ bool OutputDevice::SupportsOperation( OutDevSupportType eType ) const return bHasSupport; } +void OutputDevice::setTiledRendering(bool bTiledRendering) +{ + mbTiledRendering = bTiledRendering; +} + +bool OutputDevice::isTiledRendering() const +{ + return mbTiledRendering; +} + // Direct OutputDevice drawing public functions void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize, commit 98115a182d5c69cdbbefdf89b5584490c92faa19 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Thu Feb 19 16:24:29 2015 +0900 android: key press/release is in KeyEvent, no need to distinct them Change-Id: Ic68145a0f67ce9558570ab95b8057271c22481a3 diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java index bc786f5..807d0d0 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java @@ -83,10 +83,9 @@ public class LOEvent implements Comparable<LOEvent> { mDocumentTouchCoordinate = documentTouchCoordinate; } - public LOEvent(int type, String keyEventType, KeyEvent keyEvent) { + public LOEvent(int type, KeyEvent keyEvent) { mType = type; mTypeString = "Key Event"; - mKeyEventType = keyEventType; mKeyEvent = keyEvent; } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitInputConnectionHandler.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitInputConnectionHandler.java index dc4c856..36d477d 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitInputConnectionHandler.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitInputConnectionHandler.java @@ -16,13 +16,13 @@ public class LOKitInputConnectionHandler implements InputConnectionHandler { @Override public boolean onKeyPreIme(int keyCode, KeyEvent event) { - LOKitShell.sendKeyPressEvent(event); + LOKitShell.sendKeyEvent(event); return false; } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { - LOKitShell.sendKeyPressEvent(event); + LOKitShell.sendKeyEvent(event); return false; } @@ -33,13 +33,13 @@ public class LOKitInputConnectionHandler implements InputConnectionHandler { @Override public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) { - LOKitShell.sendKeyPressEvent(event); + LOKitShell.sendKeyEvent(event); return false; } @Override public boolean onKeyUp(int keyCode, KeyEvent event) { - LOKitShell.sendKeyReleaseEvent(event); + LOKitShell.sendKeyEvent(event); return false; } } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java index ab25078..1e3036c 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java @@ -90,17 +90,10 @@ public class LOKitShell { } /** - * Send key press event to LOKitThread. + * Send key event to LOKitThread. */ - public static void sendKeyPressEvent(KeyEvent event) { - LOKitShell.sendEvent(new LOEvent(LOEvent.KEY_EVENT, "KeyPress", event)); - } - - /** - * Send key release event to LOKitThread. - */ - public static void sendKeyReleaseEvent(KeyEvent event) { - LOKitShell.sendEvent(new LOEvent(LOEvent.KEY_EVENT, "KeyRelease", event)); + public static void sendKeyEvent(KeyEvent event) { + LOKitShell.sendEvent(new LOEvent(LOEvent.KEY_EVENT, event)); } public static void sendSizeChangedEvent(int width, int height) { diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java index 3d71423..8ae5749 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java @@ -194,7 +194,7 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation touch(event.mTouchType, event.mMotionEvent, event.mDocumentTouchCoordinate); break; case LOEvent.KEY_EVENT: - keyEvent(event.mKeyEventType, event.mKeyEvent); + keyEvent(event.mKeyEvent); break; case LOEvent.TILE_REEVALUATION_REQUEST: tileReevaluationRequest(event.mComposedTileLayer); @@ -205,18 +205,14 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation /** * Processes key events. */ - private void keyEvent(String keyEventType, KeyEvent keyEvent) { + private void keyEvent(KeyEvent keyEvent) { if (!LOKitShell.isEditingEnabled()) { return; } if (mTileProvider == null) { return; } - if (keyEventType.equals("KeyPress")) { - mTileProvider.keyPress(keyEvent); - } else if (keyEventType.equals("KeyRelease")) { - mTileProvider.keyRelease(keyEvent); - } + mTileProvider.sendKeyEvent(keyEvent); } /** diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index 97fb009..d8753de 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -314,23 +314,20 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback } @Override - public void keyPress(KeyEvent keyEvent) { + public void sendKeyEvent(KeyEvent keyEvent) { if (keyEvent.getAction() == KeyEvent.ACTION_MULTIPLE) { String keyString = keyEvent.getCharacters(); for (int i = 0; i < keyString.length(); i++) { int codePoint = keyString.codePointAt(i); mOffice.postKeyEvent(Office.KEY_PRESS, codePoint, getKeyCode(keyEvent)); } - } else { + } else if (keyEvent.getAction() == KeyEvent.ACTION_DOWN) { mOffice.postKeyEvent(Office.KEY_PRESS, getCharCode(keyEvent), getKeyCode(keyEvent)); + } else if (keyEvent.getAction() == KeyEvent.ACTION_UP) { + mOffice.postKeyEvent(Office.KEY_RELEASE, getCharCode(keyEvent), getKeyCode(keyEvent)); } } - @Override - public void keyRelease(KeyEvent keyEvent) { - mOffice.postKeyEvent(Office.KEY_RELEASE, getCharCode(keyEvent), getKeyCode(keyEvent)); - } - private void mouseButton(int type, PointF inDocument, int numberOfClicks) { int x = (int) pixelToTwip(inDocument.x, mDPI); int y = (int) pixelToTwip(inDocument.y, mDPI); diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java index ed1e069..e6fbcd2 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java @@ -94,11 +94,7 @@ public class MockTileProvider implements TileProvider { } @Override - public void keyPress(KeyEvent keyEvent) { - } - - @Override - public void keyRelease(KeyEvent keyEvent) { + public void sendKeyEvent(KeyEvent keyEvent) { } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java index 0050d1e..92dbb3d 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java @@ -69,18 +69,11 @@ public interface TileProvider { void registerInvalidationCallback(TileProvider.TileInvalidationCallback tileInvalidationCallback); /** - * Trigger a key press. + * Trigger a key event. * * @param keyEvent - contains information about key event */ - void keyPress(KeyEvent keyEvent); - - /** - * Trigger a key release. - * - * @param keyEvent - contains information about key event - */ - void keyRelease(KeyEvent keyEvent); + void sendKeyEvent(KeyEvent keyEvent); /** * Trigger a mouse button down event. commit c16de577de20d3f655b38e84509966fbaad548da Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Thu Feb 19 16:07:00 2015 +0900 android: support ACTION_MULTIPLE KeyEvent With ACTION_MULTIPLE more characters have been entered at the same time. In this case we send more key press events to LO for now. This is generally useful for IME input but Android also sends this if non-ASCII key has been hit - even when the key is only one character. Change-Id: Iaf48ed4e40b8e4413ed5735add34870ec263b61d diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index 4e5a842..97fb009 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -315,7 +315,15 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback @Override public void keyPress(KeyEvent keyEvent) { - mOffice.postKeyEvent(Office.KEY_PRESS, getCharCode(keyEvent), getKeyCode(keyEvent)); + if (keyEvent.getAction() == KeyEvent.ACTION_MULTIPLE) { + String keyString = keyEvent.getCharacters(); + for (int i = 0; i < keyString.length(); i++) { + int codePoint = keyString.codePointAt(i); + mOffice.postKeyEvent(Office.KEY_PRESS, codePoint, getKeyCode(keyEvent)); + } + } else { + mOffice.postKeyEvent(Office.KEY_PRESS, getCharCode(keyEvent), getKeyCode(keyEvent)); + } } @Override commit 89e9e70462d67b27682edc6b9eeded4e66ec293f Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Thu Feb 19 16:02:03 2015 +0900 android: also send key event in onKeyMultiple and onKeyPreIme Change-Id: Ib231edd7b659ca3d0360bb3ac3021ead652f5458 diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitInputConnectionHandler.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitInputConnectionHandler.java index 6a5837b..dc4c856 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitInputConnectionHandler.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitInputConnectionHandler.java @@ -7,6 +7,8 @@ import android.view.inputmethod.InputConnection; import org.mozilla.gecko.gfx.InputConnectionHandler; public class LOKitInputConnectionHandler implements InputConnectionHandler { + private static String LOGTAG = LOKitInputConnectionHandler.class.getSimpleName(); + @Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { return null; @@ -14,6 +16,7 @@ public class LOKitInputConnectionHandler implements InputConnectionHandler { @Override public boolean onKeyPreIme(int keyCode, KeyEvent event) { + LOKitShell.sendKeyPressEvent(event); return false; } @@ -30,6 +33,7 @@ public class LOKitInputConnectionHandler implements InputConnectionHandler { @Override public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) { + LOKitShell.sendKeyPressEvent(event); return false; } commit eb8ed9fcc5253925ba33e6b84831c559453ad87b Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Thu Feb 19 11:50:07 2015 +0900 android: can't compare strings with == in Java Change-Id: I5cf4d5db42f32b7c073e5899a6c90a3354dcb3c5 diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java index 35b0063..3d71423 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java @@ -212,7 +212,7 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation if (mTileProvider == null) { return; } - if (keyEventType == "KeyPress") { + if (keyEventType.equals("KeyPress")) { mTileProvider.keyPress(keyEvent); } else if (keyEventType.equals("KeyRelease")) { mTileProvider.keyRelease(keyEvent); commit 0ffb877c3680a5973213c01be7d35ad123b080d4 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Thu Feb 19 11:43:08 2015 +0900 anndroid: bind "LongPress" to mouse double click Change-Id: Iba56deccf3c342ac82ca6cf78e09caf323f4a14d diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java index e06107d..35b0063 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java @@ -229,8 +229,13 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation if (mTileProvider == null) { return; } - LibreOfficeMainActivity.mAppContext.showSoftKeyboard(); - mTileProvider.mouseButtonDown(mDocumentTouchCoordinate); + if (touchType.equals("LongPress")) { + LibreOfficeMainActivity.mAppContext.hideSoftKeyboard(); + mTileProvider.mouseButtonDown(mDocumentTouchCoordinate, 2); + } else { // "SingleTap" + LibreOfficeMainActivity.mAppContext.showSoftKeyboard(); + mTileProvider.mouseButtonDown(mDocumentTouchCoordinate, 1); + } } private void createThumbnail(final ThumbnailCreator.ThumbnailCreationTask task) { diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index 2eee22a..4e5a842 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -323,21 +323,21 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback mOffice.postKeyEvent(Office.KEY_RELEASE, getCharCode(keyEvent), getKeyCode(keyEvent)); } - private void mouseButton(int type, PointF inDocument) { + private void mouseButton(int type, PointF inDocument, int numberOfClicks) { int x = (int) pixelToTwip(inDocument.x, mDPI); int y = (int) pixelToTwip(inDocument.y, mDPI); - mDocument.postMouseEvent(type, x, y, 1); + mDocument.postMouseEvent(type, x, y, numberOfClicks); } @Override - public void mouseButtonDown(PointF inDocument) { - mouseButton(Document.MOUSE_BUTTON_DOWN, inDocument); + public void mouseButtonDown(PointF documentCoordinate, int numberOfClicks) { + mouseButton(Document.MOUSE_BUTTON_DOWN, documentCoordinate, numberOfClicks); } @Override - public void mouseButtonUp(PointF inDocument) { - mouseButton(Document.MOUSE_BUTTON_UP, inDocument); + public void mouseButtonUp(PointF documentCoordinate, int numberOfClicks) { + mouseButton(Document.MOUSE_BUTTON_UP, documentCoordinate, numberOfClicks); } @Override diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java index 34347bb..ed1e069 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java @@ -103,12 +103,12 @@ public class MockTileProvider implements TileProvider { } @Override - public void mouseButtonDown(PointF inDocument) { + public void mouseButtonDown(PointF documentCoordinate, int numberOfClicks) { } @Override - public void mouseButtonUp(PointF inDocument) { + public void mouseButtonUp(PointF documentCoordinate, int numberOfClicks) { } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java index c983c62..0050d1e 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java @@ -31,12 +31,14 @@ public interface TileProvider { /** * 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(); @@ -68,27 +70,33 @@ public interface TileProvider { /** * Trigger a key press. + * * @param keyEvent - contains information about key event */ void keyPress(KeyEvent keyEvent); /** * Trigger a key release. + * * @param keyEvent - contains information about key event */ void keyRelease(KeyEvent keyEvent); /** * Trigger a mouse button down event. + * * @param documentCoordinate - coordinate relative to the document where the mouse button should be triggered + * @param numberOfClicks - number of clicks (1 - single click, 2 - double click) */ - void mouseButtonDown(PointF documentCoordinate); + void mouseButtonDown(PointF documentCoordinate, int numberOfClicks); /** * Trigger a mouse button up event. + * * @param documentCoordinate - coordinate relative to the document where the mouse button should be triggered + * @param numberOfClicks - number of clicks (1 - single click, 2 - double click) */ - void mouseButtonUp(PointF documentCoordinate); + void mouseButtonUp(PointF documentCoordinate, int numberOfClicks); /** * Callback to retrieve invalidation calls @@ -96,6 +104,7 @@ public interface TileProvider { public interface TileInvalidationCallback { /** * Invoked when a region is invalidated. + * * @param rect area in pixels which was invalidated and needs to be redrawn */ void invalidate(RectF rect); commit 67c9a6dc3a3e7a66e986f5a49624a418b16ba0ab Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Thu Feb 19 11:37:16 2015 +0900 andorid: format the code on LOKitTileProvider Change-Id: I289cca3835350a00dbefa4cd8b35ae065477a683 diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index fec99cd..2eee22a 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -75,8 +75,7 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback if (checkDocument()) { postLoad(); mIsReady = true; - } - else { + } else { mIsReady = false; } } @@ -305,8 +304,7 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback * control keys). */ private int getKeyCode(KeyEvent keyEvent) { - switch (keyEvent.getKeyCode()) - { + switch (keyEvent.getKeyCode()) { case KeyEvent.KEYCODE_DEL: return com.sun.star.awt.Key.BACKSPACE; case KeyEvent.KEYCODE_ENTER: commit 9d0950d5ddced82ba300f466849b6182491f5cb8 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Thu Feb 19 11:35:21 2015 +0900 android: make invalidations more readable - extract to own methods Change-Id: I676475c028d446ff5f31a11990a09da54245f9ef diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index 8e7c4f6..fec99cd 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -398,28 +398,36 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback } switch (signalNumber) { - case Document.CALLBACK_INVALIDATE_TILES: { - RectF rect = convertCallbackMessageStringToRectF(payload); - if (rect != null) { - tileInvalidationCallback.invalidate(rect); - } + case Document.CALLBACK_INVALIDATE_TILES: + invalidateTiles(payload); break; - } - case Document.CALLBACK_INVALIDATE_VISIBLE_CURSOR: { - Log.i(LOGTAG, "Invalidate visible cursor: " + payload); - RectF rect = convertCallbackMessageStringToRectF(payload); - if (rect != null) { - RectF underSelection = new RectF(rect.centerX(), rect.bottom, rect.centerX(), rect.bottom); - TextSelection textSelection = LibreOfficeMainActivity.mAppContext.getTextSelection(); - textSelection.positionHandle(TextSelectionHandle.HandleType.MIDDLE, underSelection); - textSelection.showHandle(TextSelectionHandle.HandleType.MIDDLE); - - TextCursorLayer textCursorLayer = LibreOfficeMainActivity.mAppContext.getTextCursorLayer(); - textCursorLayer.positionCursor(rect); - textCursorLayer.showCursor(); - } + case Document.CALLBACK_INVALIDATE_VISIBLE_CURSOR: + invalidateCursor(payload); break; - } + } + } + + private void invalidateCursor(String payload) { + RectF rect = convertCallbackMessageStringToRectF(payload); + if (rect != null) { + RectF underSelection = new RectF(rect.centerX(), rect.bottom, rect.centerX(), rect.bottom); + TextSelection textSelection = LibreOfficeMainActivity.mAppContext.getTextSelection(); + textSelection.positionHandle(TextSelectionHandle.HandleType.MIDDLE, underSelection); + textSelection.showHandle(TextSelectionHandle.HandleType.MIDDLE); + + TextCursorLayer textCursorLayer = LibreOfficeMainActivity.mAppContext.getTextCursorLayer(); + textCursorLayer.positionCursor(rect); + textCursorLayer.showCursor(); + } + } + + private void invalidateTiles(String payload) { + if (tileInvalidationCallback == null) { + return; + } + RectF rect = convertCallbackMessageStringToRectF(payload); + if (rect != null) { + tileInvalidationCallback.invalidate(rect); } } } commit fe4f1194a9e1b686e58e50eacf1d70a6f0f67436 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Thu Feb 19 11:32:31 2015 +0900 android: don't hardcode touch type Change-Id: Ie64df7832daa002daa912c26b3c6f9f2497e0348 diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java index a829579..ab25078 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java @@ -86,7 +86,7 @@ public class LOKitShell { * Send touch event to LOKitThread. */ public static void sentTouchEvent(String touchType, MotionEvent motionEvent, PointF pointF) { - LOKitShell.sendEvent(new LOEvent(LOEvent.TOUCH, "SingleTap", motionEvent, pointF)); + LOKitShell.sendEvent(new LOEvent(LOEvent.TOUCH, touchType, motionEvent, pointF)); } /** commit 6f04b04dfd5ceff205ffedb74516b3af2eae7557 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Thu Feb 19 11:27:57 2015 +0900 android: organise imports Change-Id: Ie8178e34698ba686e899ddd8e4f8775081fc9d83 diff --git a/android/Bootstrap/src/org/libreoffice/kit/DirectBufferAllocator.java b/android/Bootstrap/src/org/libreoffice/kit/DirectBufferAllocator.java index 670e397..de90303 100644 --- a/android/Bootstrap/src/org/libreoffice/kit/DirectBufferAllocator.java +++ b/android/Bootstrap/src/org/libreoffice/kit/DirectBufferAllocator.java @@ -11,8 +11,6 @@ package org.libreoffice.kit; // https://code.google.com/p/android/issues/detail?id=16941 // -import android.util.Log; - import java.nio.ByteBuffer; public final class DirectBufferAllocator { diff --git a/android/Bootstrap/src/org/libreoffice/kit/Document.java b/android/Bootstrap/src/org/libreoffice/kit/Document.java index ca2f38c..f410693 100644 --- a/android/Bootstrap/src/org/libreoffice/kit/Document.java +++ b/android/Bootstrap/src/org/libreoffice/kit/Document.java @@ -9,8 +9,6 @@ package org.libreoffice.kit; -import android.util.Log; - import java.nio.ByteBuffer; public class Document { commit f62669d3227e425216a1e602f07e2cab79acc84c Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Feb 18 18:20:44 2015 +0100 CppunitTest_sd_uimpress: missing libxml2 external Change-Id: Idd087e41c54bf1cf3d0f5d92f9a8058d982c0a80 diff --git a/sd/CppunitTest_sd_uimpress.mk b/sd/CppunitTest_sd_uimpress.mk index bb8e977..a94b131 100644 --- a/sd/CppunitTest_sd_uimpress.mk +++ b/sd/CppunitTest_sd_uimpress.mk @@ -79,6 +79,7 @@ $(eval $(call gb_CppunitTest_use_externals,sd_uimpress,\ $(if $(ENABLE_AVAHI), \ avahi \ ) \ + libxml2 \ )) $(eval $(call gb_CppunitTest_add_exception_objects,sd_uimpress,\ commit 36e3a12aae55eb2b61d3b540ebe4b476d4b9e914 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed Feb 18 15:42:05 2015 +0900 android: restructure reevaluateTiles Change-Id: I1c0657e512e6d3bf7a4742a356f201c993aef658 diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java index 683955e..e11c91c 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java @@ -153,15 +153,18 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba return; } + long currentReevaluationNanoTime = System.nanoTime(); + if ((currentReevaluationNanoTime - reevaluationNanoTime) < 25 * 1000000) { + return; + } + + reevaluationNanoTime = currentReevaluationNanoTime; + currentViewport = newViewPort; currentZoom = newZoom; currentPageRect = viewportMetrics.getPageRect(); - long currentReevaluationNanoTime = System.nanoTime(); - if ((currentReevaluationNanoTime - reevaluationNanoTime) > 25 * 1000000) { - reevaluationNanoTime = currentReevaluationNanoTime; - LOKitShell.sendTileReevaluationRequest(this); - } + LOKitShell.sendTileReevaluationRequest(this); } protected abstract RectF getViewPort(ImmutableViewportMetrics viewportMetrics); commit 9a51a1f4cc6cea442957ae5f9bda4d1cd5379685 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed Feb 18 15:14:57 2015 +0900 android: do tile reevaluation in LOKitThread Currently the tile reevaluation was done in UI thread which could cause UI stutters as reevaluation is not a simple task. The result was also a lot of tile rendering requests to LOKitThread. This changes turns this around and the tile reevaluation is done in LOKitThread instead. Now the UI thread just sends a LOEvent when the reevaluation should be done. This should also reduce the amount of messages that are queued in LOKitThread, however an execution time should increase. Change-Id: I01ce911226a71607c06da6100de323ca555db474 diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java index 04afd80..bc786f5 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java @@ -16,7 +16,7 @@ public class LOEvent implements Comparable<LOEvent> { public static final int LOAD = 4; public static final int CLOSE = 5; public static final int REDRAW = 6; - public static final int TILE_REQUEST = 7; + public static final int TILE_REEVALUATION_REQUEST = 7; public static final int THUMBNAIL = 8; public static final int TILE_INVALIDATION = 9; public static final int TOUCH = 10; @@ -29,7 +29,6 @@ public class LOEvent implements Comparable<LOEvent> { public String mTypeString; public int mPartIndex; public String mFilename; - public SubTile mTile; public ComposedTileLayer mComposedTileLayer; public String mTouchType; public MotionEvent mMotionEvent; @@ -47,11 +46,10 @@ public class LOEvent implements Comparable<LOEvent> { mTypeString = "Size Changed: " + widthPixels + " " + heightPixels; } - public LOEvent(int type, ComposedTileLayer composedTileLayer, SubTile tile) { + public LOEvent(int type, ComposedTileLayer composedTileLayer) { mType = type; - mTypeString = "Tile Request"; + mTypeString = "Tile Reevaluation"; mComposedTileLayer = composedTileLayer; - mTile = tile; } public LOEvent(int type, String filename) { diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java index fab30b2..a829579 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java @@ -123,9 +123,7 @@ public class LOKitShell { LOKitShell.sendEvent(new LOEvent(LOEvent.REDRAW)); } - public static void sendTileRequestEvent(ComposedTileLayer composedTileLayer, SubTile tile, boolean forceRedraw, int priority) { - LOEvent event = new LOEvent(LOEvent.TILE_REQUEST, composedTileLayer, tile); - LOKitShell.sendEvent(event); + public static void sendTileReevaluationRequest(ComposedTileLayer composedTileLayer) { + LOKitShell.sendEvent(new LOEvent(LOEvent.TILE_REEVALUATION_REQUEST, composedTileLayer)); } - } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java index 7743047..e06107d 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java @@ -44,23 +44,36 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation } } - private void tileRequest(ComposedTileLayer composedTileLayer, SubTile tile) { + /* Viewport changed, recheck if tiles need to be added / removed */ + private void tileReevaluationRequest(ComposedTileLayer composedTileLayer) { if (mTileProvider == null) { return; } + List<SubTile> tiles = new ArrayList<SubTile>(); + + mLayerClient.beginDrawing(); + composedTileLayer.addNewTiles(tiles); + mLayerClient.endDrawing(); - if (composedTileLayer.isStillValid(tile.id)) { + for (SubTile tile : tiles) { TileIdentifier tileId = tile.id; CairoImage image = mTileProvider.createTile(tileId.x, tileId.y, tileId.size, tileId.zoom); + mLayerClient.beginDrawing(); if (image != null) { - mLayerClient.beginDrawing(); tile.setImage(image); - mLayerClient.endDrawing(); - mLayerClient.forceRender(); } + mLayerClient.endDrawing(); + mLayerClient.forceRender(); } + + mLayerClient.beginDrawing(); + composedTileLayer.markTiles(); + composedTileLayer.clearMarkedTiles(); + mLayerClient.endDrawing(); + mLayerClient.forceRender(); } + /* Invalidate tiles that intersect the input rect */ private void tileInvalidation(RectF rect) { if (mLayerClient == null || mTileProvider == null) { return; @@ -171,9 +184,6 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation case LOEvent.CHANGE_PART: changePart(event.mPartIndex); break; - case LOEvent.TILE_REQUEST: - tileRequest(event.mComposedTileLayer, event.mTile); - break; case LOEvent.TILE_INVALIDATION: tileInvalidation(event.mInvalidationRect); break; @@ -186,6 +196,9 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation case LOEvent.KEY_EVENT: keyEvent(event.mKeyEventType, event.mKeyEvent); break; + case LOEvent.TILE_REEVALUATION_REQUEST: + tileReevaluationRequest(event.mComposedTileLayer); + break; } } diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java index 62eae49..683955e 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java @@ -29,7 +29,10 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba private final Lock tilesWriteLock = tilesReadWriteLock.writeLock(); protected RectF currentViewport = new RectF(); - protected float currentZoom; + protected float currentZoom = 1.0f; + protected RectF currentPageRect = new RectF(); + + private long reevaluationNanoTime = 0; public ComposedTileLayer(Context context) { context.registerComponentCallbacks(this); @@ -149,12 +152,16 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba if (currentViewport.equals(newViewPort) && FloatUtils.fuzzyEquals(currentZoom, newZoom)) { return; } + currentViewport = newViewPort; currentZoom = newZoom; + currentPageRect = viewportMetrics.getPageRect(); - clearMarkedTiles(); - addNewTiles(viewportMetrics.getPageRect()); - markTiles(); + long currentReevaluationNanoTime = System.nanoTime(); + if ((currentReevaluationNanoTime - reevaluationNanoTime) > 25 * 1000000) { + reevaluationNanoTime = currentReevaluationNanoTime; + LOKitShell.sendTileReevaluationRequest(this); + } } protected abstract RectF getViewPort(ImmutableViewportMetrics viewportMetrics); @@ -177,27 +184,25 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba } } - private void addNewTiles(RectF pageRect) { - beginTransaction(); + public void addNewTiles(List<SubTile> newTiles) { for (float y = currentViewport.top; y < currentViewport.bottom; y += tileSize.height) { - if (y > pageRect.height()) { + if (y > currentPageRect.height()) { continue; } for (float x = currentViewport.left; x < currentViewport.right; x += tileSize.width) { - if (x > pageRect.width()) { + if (x > currentPageRect.width()) { continue; } if (!containsTilesMatching(x, y, currentZoom)) { TileIdentifier tileId = new TileIdentifier((int) x, (int) y, currentZoom, tileSize); SubTile tile = createNewTile(tileId); - LOKitShell.sendTileRequestEvent(this, tile, true, getTilePriority()); + newTiles.add(tile); } } } - endTransaction(); } - private void clearMarkedTiles() { + public void clearMarkedTiles() { tilesWriteLock.lock(); Iterator<SubTile> iterator = tiles.iterator(); while (iterator.hasNext()) { @@ -210,7 +215,7 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba tilesWriteLock.unlock(); } - private void markTiles() { + public void markTiles() { tilesReadLock.lock(); for (SubTile tile : tiles) { if (FloatUtils.fuzzyEquals(tile.id.zoom, currentZoom)) { commit f699de99bdc86408c47086d15f80408734c42ae4 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Tue Feb 17 19:15:52 2015 +0900 android: no need endDrawing to be synchronized Change-Id: I50bee82140e444d918ca759816edf6992a47644b diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java index 98f3221..40fb8bb 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java @@ -231,10 +231,8 @@ public class GeckoLayerClient implements PanZoomTarget { } public void endDrawing() { - synchronized (this) { - mLowResLayer.endTransaction(); - mRootLayer.endTransaction(); - } + mLowResLayer.endTransaction(); + mRootLayer.endTransaction(); } public void geometryChanged() { commit b8a2e465ff2e1893aab0a78cad180b7db3a1df04 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Tue Feb 17 19:14:12 2015 +0900 android: cleanup ComposedTileLayer Change-Id: I976384ac5515295a56bc1339791ab63a62dc4bea diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java index 9299656..62eae49 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java @@ -24,18 +24,50 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba protected final List<SubTile> tiles = new ArrayList<SubTile>(); protected final IntSize tileSize; - protected RectF currentViewport = new RectF(); - protected float currentZoom; - private final ReadWriteLock tilesReadWriteLock = new ReentrantReadWriteLock(); private final Lock tilesReadLock = tilesReadWriteLock.readLock(); private final Lock tilesWriteLock = tilesReadWriteLock.writeLock(); + protected RectF currentViewport = new RectF(); + protected float currentZoom; + public ComposedTileLayer(Context context) { context.registerComponentCallbacks(this); this.tileSize = new IntSize(256, 256); } + protected static RectF roundToTileSize(RectF input, IntSize tileSize) { + float minX = ((int) (input.left / tileSize.width)) * tileSize.width; + float minY = ((int) (input.top / tileSize.height)) * tileSize.height; + float maxX = ((int) (input.right / tileSize.width) + 1) * tileSize.width; ... etc. - the rest is truncated
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits