summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-03-19 11:36:26 +0900
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-03-23 09:19:04 +0100
commit718143b55ca9163f49fa7e86f677e3e83226a9fc (patch)
treefa3599bcbf00ad10e5c2749329882db5bd8af1e1 /svx
parent6d9610c694ab44dcc09bd9f62f6fa0b2f0f26518 (diff)
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
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdhdl.cxx16
1 files changed, 15 insertions, 1 deletions
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 60f7e0b91594..4e251272eca3 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)