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 20 #ifndef INCLUDED_SLIDESHOW_SOURCE_INC_SHAPEMANAGER_HXX 21 #define INCLUDED_SLIDESHOW_SOURCE_INC_SHAPEMANAGER_HXX 22 23 #include "disposable.hxx" 24 #include <com/sun/star/uno/Reference.hxx> 25 #include <memory> 26 #include <unordered_map> 27 #include "tools.hxx" 28 29 namespace com::sun::star::drawing { class XShape; } 30 31 /* Definition of ShapeManager interface */ 32 33 namespace slideshow::internal 34 { 35 class HyperlinkArea; 36 class AnimatableShape; 37 class Shape; 38 typedef std::unordered_map< 39 css::uno::Reference< css::drawing::XShape >, 40 ShapeSharedPtr, 41 hash< css::uno::Reference< css::drawing::XShape > > 42 > XShapeToShapeMap; 43 typedef ::std::shared_ptr< AnimatableShape > AnimatableShapeSharedPtr; 44 typedef ::std::shared_ptr< Shape > ShapeSharedPtr; 45 typedef std::shared_ptr< HyperlinkArea > HyperlinkAreaSharedPtr; 46 47 /** ShapeManager interface 48 49 Implementers of this interface manage appearance and 50 animation of slideshow shapes. 51 */ 52 class ShapeManager : public Disposable 53 { 54 public: 55 /** Notify the ShapeManager that the given Shape starts an 56 animation now. 57 58 This method enters animation mode for the Shape. If 59 the shape is already in animation mode, the call is 60 counted, and the shape only leaves animation mode 61 after a corresponding number of leaveAnimationMode() 62 calls. 63 */ 64 virtual void enterAnimationMode( const AnimatableShapeSharedPtr& rShape ) = 0; 65 66 /** Notify the ShapeManager that the given Shape is no 67 longer animated. 68 69 When called a corresponding number of times as 70 enterAnimationMode() for a given shape, this methods 71 ends animation mode for the given Shape. It is illegal 72 to call this method more often than 73 enterAnimationMode(). 74 */ 75 virtual void leaveAnimationMode( const AnimatableShapeSharedPtr& rShape ) = 0; 76 77 /** Notify that a shape needs an update 78 79 This method notifies the ShapeManager that a shape 80 update is necessary. Use this if e.g. a running 81 animation changed the shape appearance. 82 83 @param rShape 84 Shape which needs an update 85 */ 86 virtual void notifyShapeUpdate( const ShapeSharedPtr& rShape ) = 0; 87 88 /** Lookup a Shape from an XShape model object 89 90 This method looks up the internal shape map for one 91 representing the given XShape. 92 93 @param xShape 94 The XShape object, for which the representing Shape 95 should be looked up. 96 */ 97 virtual ShapeSharedPtr lookupShape( 98 css::uno::Reference< css::drawing::XShape > const & xShape ) const = 0; 99 100 /** Get a map that maps all Shapes with their XShape reference as the key 101 * 102 * @return an unordered map that contains all shapes in the 103 * current page with their XShape reference as the key 104 */ 105 virtual const XShapeToShapeMap& getXShapeToShapeMap() const = 0; 106 107 /** Register given shape as a hyperlink target 108 109 @param rArea 110 Hyperlink sensitive area. Will participate in 111 hyperlink region lookup. Must be in absolute user 112 space coordinates. 113 */ 114 virtual void addHyperlinkArea( const HyperlinkAreaSharedPtr& rArea ) = 0; 115 }; 116 117 typedef ::std::shared_ptr< ShapeManager > ShapeManagerSharedPtr; 118 119 } 120 121 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_SHAPEMANAGER_HXX 122 123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 124