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