1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef INCLUDED_SLIDESHOW_EXTERNALSHAPEBASE_HXX 29 #define INCLUDED_SLIDESHOW_EXTERNALSHAPEBASE_HXX 30 31 #include <vector> 32 33 #include "externalmediashape.hxx" 34 #include "unoview.hxx" 35 #include "subsettableshapemanager.hxx" 36 #include "slideshowexceptions.hxx" 37 #include "slideshowcontext.hxx" 38 39 40 namespace slideshow 41 { 42 namespace internal 43 { 44 /** Base class for shapes rendered by external engines. 45 46 Used as the common base for e.g. MediaShape or 47 AppletShape, all of which are rendered by external 48 components (and all employ distinct windows). 49 50 Please note that this base class indeed assumes the shape 51 does not interfere with the internal shapes in any way 52 (including mutual overdraw). It therefore reports yes for 53 the isBackgroundDetached() question. 54 */ 55 class ExternalShapeBase : public ExternalMediaShape 56 { 57 public: 58 /** Create a shape for the given XShape for an external shape 59 60 @param xShape 61 The XShape to represent. 62 63 @param nPrio 64 Externally-determined shape priority (used e.g. for 65 paint ordering). This number _must be_ unique! 66 */ 67 ExternalShapeBase( const ::com::sun::star::uno::Reference< 68 ::com::sun::star::drawing::XShape >& xShape, 69 double nPrio, 70 const SlideShowContext& rContext ); // throw ShapeLoadFailedException; 71 virtual ~ExternalShapeBase(); 72 73 virtual ::com::sun::star::uno::Reference< 74 ::com::sun::star::drawing::XShape > getXShape() const; 75 76 // animation methods 77 //------------------------------------------------------------------ 78 79 virtual void play(); 80 virtual void stop(); 81 virtual void pause(); 82 virtual bool isPlaying() const; 83 virtual void setMediaTime(double); 84 85 // render methods 86 //------------------------------------------------------------------ 87 88 virtual bool update() const; 89 virtual bool render() const; 90 virtual bool isContentChanged() const; 91 92 93 // Shape attributes 94 //------------------------------------------------------------------ 95 96 virtual ::basegfx::B2DRectangle getBounds() const; 97 virtual ::basegfx::B2DRectangle getDomBounds() const; 98 virtual ::basegfx::B2DRectangle getUpdateArea() const; 99 virtual bool isVisible() const; 100 virtual double getPriority() const; 101 virtual bool isBackgroundDetached() const; 102 103 protected: 104 const ::com::sun::star::uno::Reference< 105 ::com::sun::star::uno::XComponentContext> mxComponentContext; 106 107 private: 108 class ExternalShapeBaseListener; friend class ExternalShapeBaseListener; 109 110 /// override in derived class to render preview 111 virtual bool implRender( const ::basegfx::B2DRange& rCurrBounds ) const = 0; 112 113 /// override in derived class to resize 114 virtual void implViewChanged( const UnoViewSharedPtr& rView ) = 0; 115 /// override in derived class to resize 116 virtual void implViewsChanged() = 0; 117 118 /// override in derived class to start external viewer 119 virtual bool implStartIntrinsicAnimation() = 0; 120 /// override in derived class to stop external viewer 121 virtual bool implEndIntrinsicAnimation() = 0; 122 /// override in derived class to pause external viewer 123 virtual bool implPauseIntrinsicAnimation() = 0; 124 /// override in derived class to return status of animation 125 virtual bool implIsIntrinsicAnimationPlaying() const = 0; 126 /// override in derived class to set media time 127 virtual void implSetIntrinsicAnimationTime(double) = 0; 128 129 130 /// The associated XShape 131 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape; 132 133 boost::shared_ptr<ExternalShapeBaseListener> mpListener; 134 135 SubsettableShapeManagerSharedPtr mpShapeManager; 136 EventMultiplexer& mrEventMultiplexer; 137 138 // The attributes of this Shape 139 const double mnPriority; 140 ::basegfx::B2DRectangle maBounds; 141 }; 142 } 143 } 144 145 #endif /* INCLUDED_SLIDESHOW_EXTERNALSHAPEBASE_HXX */ 146