[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - 2 commits - android/experimental svx/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Wed Mar 18 19:45:13 PDT 2015
android/experimental/LOAndroid3/src/java/org/libreoffice/DrawElementHandle.java | 8 ++---
svx/source/svdraw/svdhdl.cxx | 16 +++++++++-
2 files changed, 19 insertions(+), 5 deletions(-)
New commits:
commit af8f4cb4c0bffc5ff00b7b8381ea4aa48a9c4111
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu Mar 19 11:36:26 2015 +0900
svx: if the handle bitmap is empty - create a replacement bitmap
When the bitmap with handles is not found (usually happens when
using LO as a library (for example on Android)), the returned
bitmap was empty. This caused that the hit test for the handle
always returned false. This commit replaces the empty bitmap with
a black 13x13 bitmap which should respond to hit test. This should
not influence normal behaviour when the bitmap with handles is
present.
Change-Id: I39330b1867abfb540c215f03b77e5eac2447f0dc
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 60f7e0b..4e25127 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -744,9 +744,23 @@ BitmapEx SdrHdl::ImpGetBitmapEx( BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd
else
{
// create normal handle: use ImpGetBitmapEx(...) now
+ BitmapEx aBmpEx = ImpGetBitmapEx(eKindOfMarker, (sal_uInt16)eColIndex);
+ // When the image with handles is not found, the bitmap returned is
+ // empty. This is a problem when we use LibreOffice as a library
+ // (through LOKit - for example on Android) even when we don't show
+ // the handles, beacuse the hit test would always return false.
+ //
+ // This HACK replaces the empty bitmap with a black 13x13 bitmap handle
+ // so that the hit test works for this case.
+ if (aBmpEx.IsEmpty())
+ {
+ aBmpEx = BitmapEx(Bitmap(Size(13, 13), 24));
+ aBmpEx.Erase(COL_BLACK);
+ }
+
+ // Scale the handle with the DPI scale factor
sal_Int32 nScaleFactor = rOutDev.GetDPIScaleFactor();
- BitmapEx aBmpEx = ImpGetBitmapEx(eKindOfMarker, (sal_uInt16)eColIndex);
aBmpEx.Scale(nScaleFactor, nScaleFactor);
if(eKindOfMarker == Anchor || eKindOfMarker == AnchorPressed)
commit a0cd30d3919f187869441c568bca562f46f26b95
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed Mar 18 21:16:25 2015 +0900
android: a bit smaller hit area for selection handles
Change-Id: I985b7b22c4794862a421ad797b907e33266c2c27
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/DrawElementHandle.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/DrawElementHandle.java
index 7968b31..1912d01 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/DrawElementHandle.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/DrawElementHandle.java
@@ -55,10 +55,10 @@ public class DrawElementHandle {
public void reposition(float x, float y) {
mPosition.x = x;
mPosition.y = y;
- mHitRect.left = mPosition.x - mRadius * 2;
- mHitRect.right = mPosition.x + mRadius * 2;
- mHitRect.top = mPosition.y - mRadius * 2;
- mHitRect.bottom = mPosition.y + mRadius * 2;
+ mHitRect.left = mPosition.x - mRadius * 1.5f;
+ mHitRect.right = mPosition.x + mRadius * 1.5f;
+ mHitRect.top = mPosition.y - mRadius * 1.5f;
+ mHitRect.bottom = mPosition.y + mRadius * 1.5f;
}
public boolean contains(float x, float y) {
More information about the Libreoffice-commits
mailing list