1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef INCLUDED_SLIDESHOW_EXTERNALSHAPEBASE_HXX 25 #define INCLUDED_SLIDESHOW_EXTERNALSHAPEBASE_HXX 26 27 #include <vector> 28 29 #include "externalmediashape.hxx" 30 #include "unoview.hxx" 31 #include "subsettableshapemanager.hxx" 32 #include "slideshowexceptions.hxx" 33 #include "slideshowcontext.hxx" 34 35 36 namespace slideshow 37 { 38 namespace internal 39 { 40 /** Base class for shapes rendered by external engines. 41 42 Used as the common base for e.g. MediaShape or 43 AppletShape, all of which are rendered by external 44 components (and all employ distinct windows). 45 46 Please note that this base class indeed assumes the shape 47 does not interfere with the internal shapes in any way 48 (including mutual overdraw). It therefore reports yes for 49 the isBackgroundDetached() question. 50 */ 51 class ExternalShapeBase : public ExternalMediaShape 52 { 53 public: 54 /** Create a shape for the given XShape for an external shape 55 56 @param xShape 57 The XShape to represent. 58 59 @param nPrio 60 Externally-determined shape priority (used e.g. for 61 paint ordering). This number _must be_ unique! 62 */ 63 ExternalShapeBase( const ::com::sun::star::uno::Reference< 64 ::com::sun::star::drawing::XShape >& xShape, 65 double nPrio, 66 const SlideShowContext& rContext ); // throw ShapeLoadFailedException; 67 virtual ~ExternalShapeBase(); 68 69 virtual ::com::sun::star::uno::Reference< 70 ::com::sun::star::drawing::XShape > getXShape() const; 71 72 // animation methods 73 //------------------------------------------------------------------ 74 75 virtual void play(); 76 virtual void stop(); 77 virtual void pause(); 78 virtual bool isPlaying() const; 79 virtual void setMediaTime(double); 80 81 // render methods 82 //------------------------------------------------------------------ 83 84 virtual bool update() const; 85 virtual bool render() const; 86 virtual bool isContentChanged() const; 87 88 89 // Shape attributes 90 //------------------------------------------------------------------ 91 92 virtual ::basegfx::B2DRectangle getBounds() const; 93 virtual ::basegfx::B2DRectangle getDomBounds() const; 94 virtual ::basegfx::B2DRectangle getUpdateArea() const; 95 virtual bool isVisible() const; 96 virtual double getPriority() const; 97 virtual bool isBackgroundDetached() const; 98 99 protected: 100 const ::com::sun::star::uno::Reference< 101 ::com::sun::star::uno::XComponentContext> mxComponentContext; 102 103 private: 104 class ExternalShapeBaseListener; friend class ExternalShapeBaseListener; 105 106 /// override in derived class to render preview 107 virtual bool implRender( const ::basegfx::B2DRange& rCurrBounds ) const = 0; 108 109 /// override in derived class to resize 110 virtual void implViewChanged( const UnoViewSharedPtr& rView ) = 0; 111 /// override in derived class to resize 112 virtual void implViewsChanged() = 0; 113 114 /// override in derived class to start external viewer 115 virtual bool implStartIntrinsicAnimation() = 0; 116 /// override in derived class to stop external viewer 117 virtual bool implEndIntrinsicAnimation() = 0; 118 /// override in derived class to pause external viewer 119 virtual bool implPauseIntrinsicAnimation() = 0; 120 /// override in derived class to return status of animation 121 virtual bool implIsIntrinsicAnimationPlaying() const = 0; 122 /// override in derived class to set media time 123 virtual void implSetIntrinsicAnimationTime(double) = 0; 124 125 126 /// The associated XShape 127 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape; 128 129 boost::shared_ptr<ExternalShapeBaseListener> mpListener; 130 131 SubsettableShapeManagerSharedPtr mpShapeManager; 132 EventMultiplexer& mrEventMultiplexer; 133 134 // The attributes of this Shape 135 const double mnPriority; 136 ::basegfx::B2DRectangle maBounds; 137 }; 138 } 139 } 140 141 #endif /* INCLUDED_SLIDESHOW_EXTERNALSHAPEBASE_HXX */ 142