LibreOffice Module slideshow (master) 1
shapemanagerimpl.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#ifndef INCLUDED_SLIDESHOW_SOURCE_ENGINE_SLIDE_SHAPEMANAGERIMPL_HXX
20#define INCLUDED_SLIDESHOW_SOURCE_ENGINE_SLIDE_SHAPEMANAGERIMPL_HXX
21
22#include <com/sun/star/drawing/XDrawPage.hpp>
23#include <com/sun/star/uno/Reference.hxx>
24
26#include <shape.hxx>
28#include <eventmultiplexer.hxx>
29#include "layermanager.hxx"
30#include <viewupdate.hxx>
31#include <shapemaps.hxx>
32#include <cursormanager.hxx>
33#include <hyperlinkarea.hxx>
34#include <listenercontainer.hxx>
36#include <mouseeventhandler.hxx>
37
38#include <set>
39#include <map>
40#include <memory>
41
42namespace slideshow::internal {
43
52 public MouseEventHandler,
53 public ViewUpdate,
54 public std::enable_shared_from_this<ShapeManagerImpl>
55{
56public:
64 LayerManagerSharedPtr xLayerManager,
65 CursorManager& rCursorManager,
66 const ShapeEventListenerMap& rGlobalListenersMap,
67 const ShapeCursorMap& rGlobalCursorMap,
68 const css::uno::Reference<css::drawing::XDrawPage>& xDrawPage);
69
72
75
82 void activate();
83
86 void deactivate();
87
88 // Disposable interface
89
90
91 virtual void dispose() override;
92
93private:
94
95 // MouseEventHandler interface
96
97
98 virtual bool handleMousePressed(
99 css::awt::MouseEvent const& evt ) override;
100 virtual bool handleMouseReleased(
101 css::awt::MouseEvent const& evt ) override;
102 virtual bool handleMouseDragged(
103 css::awt::MouseEvent const& evt ) override;
104 virtual bool handleMouseMoved(
105 css::awt::MouseEvent const& evt ) override;
106
107
108 // ViewUpdate interface
109
110
111 virtual bool update() override;
112 virtual bool needsUpdate() const override;
113
114
115 // ShapeManager interface
116
117
118 virtual void enterAnimationMode( const AnimatableShapeSharedPtr& rShape ) override;
119 virtual void leaveAnimationMode( const AnimatableShapeSharedPtr& rShape ) override;
120 virtual void notifyShapeUpdate( const ShapeSharedPtr& rShape ) override;
122 css::uno::Reference< css::drawing::XShape > const & xShape ) const override;
123 virtual const XShapeToShapeMap& getXShapeToShapeMap() const override;
124 virtual void addHyperlinkArea( const HyperlinkAreaSharedPtr& rArea ) override;
125
126
127 // SubsettableShapeManager interface
128
129
131 const AttributableShapeSharedPtr& rOrigShape,
132 const DocTreeNode& rTreeNode ) override;
133 virtual void revokeSubset(
134 const AttributableShapeSharedPtr& rOrigShape,
135 const AttributableShapeSharedPtr& rSubsetShape ) override;
136
137 virtual void addIntrinsicAnimationHandler(
138 const IntrinsicAnimationEventHandlerSharedPtr& rHandler ) override;
140 const IntrinsicAnimationEventHandlerSharedPtr& rHandler ) override;
141 virtual void notifyIntrinsicAnimationsEnabled() override;
142 virtual void notifyIntrinsicAnimationsDisabled() override;
143
144
145 // ShapeListenerEventHandler
146
147
148 virtual bool listenerAdded( const css::uno::Reference< css::drawing::XShape>& xShape ) override;
149
150 virtual bool listenerRemoved( const css::uno::Reference< css::drawing::XShape>& xShape ) override;
151
152 void cursorChanged( const css::uno::Reference< css::drawing::XShape>& xShape,
153 sal_Int16 nCursor );
154
155
156 OUString checkForHyperlink( ::basegfx::B2DPoint const& hitPos )const;
157 OUString checkForImageMap( css::awt::MouseEvent const& evt ) const;
158
159
160 typedef std::map<ShapeSharedPtr,
161 std::shared_ptr< ::comphelper::OInterfaceContainerHelper3<css::presentation::XShapeEventListener> >,
163 typedef std::map<ShapeSharedPtr, sal_Int16,
165 typedef std::set<HyperlinkAreaSharedPtr,
167
170 std::vector<IntrinsicAnimationEventHandlerSharedPtr> > ImplIntrinsicAnimationEventHandlers;
171
174 CursorManager& mrCursorManager;
182 const css::uno::Reference<css::drawing::XDrawPage> mxDrawPage;
183};
184
185} // namespace presentation::internal
186
187#endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_SLIDE_SHAPEMANAGERIMPL_HXX
188
189/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class represents kind of a DOM tree node for shape text.
Definition: doctreenode.hxx:45
This class multiplexes user-activated and slide-show global events.
Interface for handling mouse events.
Listener class for shape events.
virtual void addHyperlinkArea(const HyperlinkAreaSharedPtr &rArea) override
Register given shape as a hyperlink target.
virtual bool handleMousePressed(css::awt::MouseEvent const &evt) override
Handle a mouse button pressed event.
ShapeManagerImpl & operator=(const ShapeManagerImpl &)=delete
Forbid copy assignment.
virtual bool update() override
Perform the update action on all views.
std::set< HyperlinkAreaSharedPtr, HyperlinkArea::lessThanArea > AreaSet
virtual bool handleMouseMoved(css::awt::MouseEvent const &evt) override
Handle a mouse was moved event.
const ShapeEventListenerMap & mrGlobalListenersMap
virtual void notifyIntrinsicAnimationsEnabled() override
Notify that shape-intrinsic animations are now enabled.
void cursorChanged(const css::uno::Reference< css::drawing::XShape > &xShape, sal_Int16 nCursor)
ImplIntrinsicAnimationEventHandlers maIntrinsicAnimationEventHandlers
virtual void enterAnimationMode(const AnimatableShapeSharedPtr &rShape) override
Notify the ShapeManager that the given Shape starts an animation now.
virtual bool handleMouseDragged(css::awt::MouseEvent const &evt) override
Handle a mouse was moved with a pressed button event.
OUString checkForImageMap(css::awt::MouseEvent const &evt) const
void deactivate()
Disables event listening.
const css::uno::Reference< css::drawing::XDrawPage > mxDrawPage
virtual void notifyShapeUpdate(const ShapeSharedPtr &rShape) override
Notify that a shape needs an update.
void activate()
Enables event listening.
virtual AttributableShapeSharedPtr getSubsetShape(const AttributableShapeSharedPtr &rOrigShape, const DocTreeNode &rTreeNode) override
Query a subset of the given original shape.
virtual bool listenerAdded(const css::uno::Reference< css::drawing::XShape > &xShape) override
virtual bool listenerRemoved(const css::uno::Reference< css::drawing::XShape > &xShape) override
virtual bool handleMouseReleased(css::awt::MouseEvent const &evt) override
Handle a mouse button released event.
virtual bool needsUpdate() const override
Query whether updates are pending.
virtual void addIntrinsicAnimationHandler(const IntrinsicAnimationEventHandlerSharedPtr &rHandler) override
Register an event handler that will be called when user paint parameters change.
virtual ShapeSharedPtr lookupShape(css::uno::Reference< css::drawing::XShape > const &xShape) const override
Lookup a Shape from an XShape model object.
virtual void dispose() override
Dispose all object references.
virtual void revokeSubset(const AttributableShapeSharedPtr &rOrigShape, const AttributableShapeSharedPtr &rSubsetShape) override
Revoke a previously queried subset shape.
ShapeManagerImpl(EventMultiplexer &rMultiplexer, LayerManagerSharedPtr xLayerManager, CursorManager &rCursorManager, const ShapeEventListenerMap &rGlobalListenersMap, const ShapeCursorMap &rGlobalCursorMap, const css::uno::Reference< css::drawing::XDrawPage > &xDrawPage)
Create a shape event broadcaster.
std::map< ShapeSharedPtr, sal_Int16, Shape::lessThanShape > ShapeToCursorMap
OUString checkForHyperlink(::basegfx::B2DPoint const &hitPos) const
std::map< ShapeSharedPtr, std::shared_ptr< ::comphelper::OInterfaceContainerHelper3< css::presentation::XShapeEventListener > >, Shape::lessThanShape > ShapeToListenersMap
ThreadUnsafeListenerContainer< IntrinsicAnimationEventHandlerSharedPtr, std::vector< IntrinsicAnimationEventHandlerSharedPtr > > ImplIntrinsicAnimationEventHandlers
ShapeManagerImpl(const ShapeManagerImpl &)=delete
Forbid copy construction.
virtual const XShapeToShapeMap & getXShapeToShapeMap() const override
Get a map that maps all Shapes with their XShape reference as the key.
virtual void leaveAnimationMode(const AnimatableShapeSharedPtr &rShape) override
Notify the ShapeManager that the given Shape is no longer animated.
virtual void notifyIntrinsicAnimationsDisabled() override
Notify that shape-intrinsic animations are now disabled.
virtual void removeIntrinsicAnimationHandler(const IntrinsicAnimationEventHandlerSharedPtr &rHandler) override
ListenerContainer variant that does not serialize access.
Interface for something that can perform view updates.
Definition: viewupdate.hxx:37
::std::shared_ptr< AnimatableShape > AnimatableShapeSharedPtr
std::shared_ptr< HyperlinkArea > HyperlinkAreaSharedPtr
::std::shared_ptr< LayerManager > LayerManagerSharedPtr
::std::map< css::uno::Reference< css::drawing::XShape >, sal_Int16 > ShapeCursorMap
Maps XShape to mouse cursor.
Definition: shapemaps.hxx:43
::std::shared_ptr< IntrinsicAnimationEventHandler > IntrinsicAnimationEventHandlerSharedPtr
::std::map< css::uno::Reference< css::drawing::XShape >, std::shared_ptr< ::comphelper::OInterfaceContainerHelper3< css::presentation::XShapeEventListener > > > ShapeEventListenerMap
Maps XShape to shape listener.
Definition: shapemaps.hxx:39
::std::shared_ptr< AttributableShape > AttributableShapeSharedPtr
std::unordered_map< css::uno::Reference< css::drawing::XShape >, ShapeSharedPtr, hash< css::uno::Reference< css::drawing::XShape > > > XShapeToShapeMap
A hash map which maps the XShape to the corresponding Shape object.
::std::shared_ptr< Shape > ShapeSharedPtr
Functor struct, for area ordering.
Functor struct, for shape ordering.
Definition: shape.hxx:235