From 718143b55ca9163f49fa7e86f677e3e83226a9fc Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Thu, 19 Mar 2015 11:36:26 +0900 Subject: 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 --- svx/source/svdraw/svdhdl.cxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'svx') 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) -- cgit