summaryrefslogtreecommitdiff
path: root/slideshow
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-08-26 22:04:37 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-08-27 21:58:17 +0200
commitae94ed1ffca7ec7fa86f3fd650dbee74db0565d6 (patch)
tree3ee9596ce7005cbf4ee365f479dc51e33d6e261b /slideshow
parent036e635678aedc414e2d55217e4f7f8359ed1b9a (diff)
tdf#74045 Make ImageMaps in slideshow clickable
Change-Id: I151983ce34a58c0f0d4b1e912f43525de4c0ad28 Reviewed-on: https://gerrit.libreoffice.org/78157 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'slideshow')
-rw-r--r--slideshow/CppunitTest_slideshow.mk2
-rw-r--r--slideshow/Library_slideshow.mk1
-rw-r--r--slideshow/source/engine/slide/shapemanagerimpl.cxx50
-rw-r--r--slideshow/source/engine/slide/shapemanagerimpl.hxx7
-rw-r--r--slideshow/source/engine/slide/slideimpl.cxx3
5 files changed, 56 insertions, 7 deletions
diff --git a/slideshow/CppunitTest_slideshow.mk b/slideshow/CppunitTest_slideshow.mk
index d72a0409d63b..030a4baa1fa5 100644
--- a/slideshow/CppunitTest_slideshow.mk
+++ b/slideshow/CppunitTest_slideshow.mk
@@ -29,6 +29,8 @@ $(eval $(call gb_CppunitTest_use_libraries,slideshow,\
sal \
salhelper \
svt \
+ svx \
+ svxcore \
tl \
utl \
vcl \
diff --git a/slideshow/Library_slideshow.mk b/slideshow/Library_slideshow.mk
index d1526754a1fb..0b9583011115 100644
--- a/slideshow/Library_slideshow.mk
+++ b/slideshow/Library_slideshow.mk
@@ -48,6 +48,7 @@ $(eval $(call gb_Library_use_libraries,slideshow,\
sal \
salhelper \
svt \
+ svxcore \
tl \
utl \
vcl \
diff --git a/slideshow/source/engine/slide/shapemanagerimpl.cxx b/slideshow/source/engine/slide/shapemanagerimpl.cxx
index d498e50cf90f..54be9f9daf60 100644
--- a/slideshow/source/engine/slide/shapemanagerimpl.cxx
+++ b/slideshow/source/engine/slide/shapemanagerimpl.cxx
@@ -17,17 +17,26 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
+#include <comphelper/processfactory.hxx>
+#include <comphelper/servicehelper.hxx>
#include <tools/diagnose_ex.h>
#include <com/sun/star/awt/MouseButton.hpp>
#include <com/sun/star/awt/SystemPointer.hpp>
#include <com/sun/star/presentation/XShapeEventListener.hpp>
+#include <com/sun/star/system/SystemShellExecute.hpp>
+#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
+#include <com/sun/star/system/XSystemShellExecute.hpp>
+#include <svx/unoshape.hxx>
+#include <svx/ImageMapInfo.hxx>
#include "shapemanagerimpl.hxx"
#include <functional>
-using namespace com::sun::star;
+using namespace css;
+using namespace css::uno;
+using namespace css::drawing;
+using namespace css::system;
namespace slideshow {
namespace internal {
@@ -36,7 +45,8 @@ ShapeManagerImpl::ShapeManagerImpl( EventMultiplexer& rMultiplexer,
LayerManagerSharedPtr const& rLayerManager,
CursorManager& rCursorManager,
const ShapeEventListenerMap& rGlobalListenersMap,
- const ShapeCursorMap& rGlobalCursorMap ):
+ const ShapeCursorMap& rGlobalCursorMap,
+ const Reference<XDrawPage>& xDrawPage ):
mrMultiplexer(rMultiplexer),
mpLayerManager(rLayerManager),
mrCursorManager(rCursorManager),
@@ -45,7 +55,8 @@ ShapeManagerImpl::ShapeManagerImpl( EventMultiplexer& rMultiplexer,
maShapeListenerMap(),
maShapeCursorMap(),
maHyperlinkShapes(),
- mbEnabled(false)
+ mbEnabled(false),
+ mxDrawPage(xDrawPage)
{
}
@@ -126,6 +137,17 @@ bool ShapeManagerImpl::handleMouseReleased( awt::MouseEvent const& e )
return true; // event consumed
}
+ // tdf#74045 Handle ImageMaps
+ OUString const imageMapLink(checkForImageMap(e));
+ if (!imageMapLink.isEmpty())
+ {
+ Reference<XSystemShellExecute> exec(
+ SystemShellExecute::create(comphelper::getProcessComponentContext()));
+ exec->execute(imageMapLink, OUString(), SystemShellExecuteFlags::URIS_ONLY);
+
+ return true;
+ }
+
// find matching shape (scan reversely, to coarsely match
// paint order)
auto aCurrBroadcaster = std::find_if(maShapeListenerMap.rbegin(), maShapeListenerMap.rend(),
@@ -172,7 +194,7 @@ bool ShapeManagerImpl::handleMouseMoved( const awt::MouseEvent& e )
const ::basegfx::B2DPoint aPosition( e.X, e.Y );
sal_Int16 nNewCursor(-1);
- if( !checkForHyperlink(aPosition).isEmpty() )
+ if( !checkForHyperlink(aPosition).isEmpty() || !checkForImageMap(e).isEmpty() )
{
nNewCursor = awt::SystemPointer::REFHAND;
}
@@ -362,6 +384,24 @@ OUString ShapeManagerImpl::checkForHyperlink( basegfx::B2DPoint const& hitPos )
return OUString();
}
+OUString ShapeManagerImpl::checkForImageMap( awt::MouseEvent const& evt ) const
+{
+ for (sal_Int32 i = 0; i < mxDrawPage->getCount(); i++)
+ {
+ Reference<XShape> xShape(mxDrawPage->getByIndex(i), UNO_QUERY_THROW);
+ SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>(xShape);
+ SdrObject* pObj = pShape ? pShape->GetSdrObject() : nullptr;
+ if (!pObj)
+ continue;
+ const IMapObject* pIMapObj = SvxIMapInfo::GetHitIMapObject(pObj, Point(evt.X, evt.Y));
+ if (pIMapObj && !pIMapObj->GetURL().isEmpty())
+ {
+ return pIMapObj->GetURL();
+ }
+ }
+ return OUString();
+}
+
void ShapeManagerImpl::addIntrinsicAnimationHandler( const IntrinsicAnimationEventHandlerSharedPtr& rHandler )
{
maIntrinsicAnimationEventHandlers.add( rHandler );
diff --git a/slideshow/source/engine/slide/shapemanagerimpl.hxx b/slideshow/source/engine/slide/shapemanagerimpl.hxx
index e4634064bc0c..9da754102429 100644
--- a/slideshow/source/engine/slide/shapemanagerimpl.hxx
+++ b/slideshow/source/engine/slide/shapemanagerimpl.hxx
@@ -20,6 +20,8 @@
#define INCLUDED_SLIDESHOW_SOURCE_ENGINE_SLIDE_SHAPEMANAGERIMPL_HXX
#include <cppuhelper/interfacecontainer.h>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/presentation/XShapeEventListener.hpp>
#include <shape.hxx>
@@ -64,7 +66,8 @@ public:
LayerManagerSharedPtr const& rLayerManager,
CursorManager& rCursorManager,
const ShapeEventListenerMap& rGlobalListenersMap,
- const ShapeCursorMap& rGlobalCursorMap );
+ const ShapeCursorMap& rGlobalCursorMap,
+ const css::uno::Reference<css::drawing::XDrawPage>& xDrawPage);
/// Forbid copy construction
ShapeManagerImpl(const ShapeManagerImpl&) = delete;
@@ -154,6 +157,7 @@ private:
OUString checkForHyperlink( ::basegfx::B2DPoint const& hitPos )const;
+ OUString checkForImageMap( css::awt::MouseEvent const& evt ) const;
typedef std::map<ShapeSharedPtr,
@@ -178,6 +182,7 @@ private:
AreaSet maHyperlinkShapes;
ImplIntrinsicAnimationEventHandlers maIntrinsicAnimationEventHandlers;
bool mbEnabled;
+ const css::uno::Reference<css::drawing::XDrawPage> mxDrawPage;
};
} // namespace internal
diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx
index f49e884b3d67..b23ad397093e 100644
--- a/slideshow/source/engine/slide/slideimpl.cxx
+++ b/slideshow/source/engine/slide/slideimpl.cxx
@@ -333,7 +333,8 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra
mpLayerManager,
rCursorManager,
rShapeListenerMap,
- rShapeCursorMap)),
+ rShapeCursorMap,
+ xDrawPage)),
mpSubsettableShapeManager( mpShapeManager ),
maContext( mpSubsettableShapeManager,
rEventQueue,