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_VIEWAPPLETSHAPE_HXX
25cdf0e10cSrcweir #define INCLUDED_SLIDESHOW_VIEWAPPLETSHAPE_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <basegfx/range/b2drectangle.hxx>
28cdf0e10cSrcweir #include <com/sun/star/awt/Point.hpp>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <boost/utility.hpp>
31cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include "viewlayer.hxx"
34cdf0e10cSrcweir 
35cdf0e10cSrcweir namespace com { namespace sun { namespace star {
36cdf0e10cSrcweir namespace frame {
37cdf0e10cSrcweir     class XSynchronousFrameLoader;
38cdf0e10cSrcweir     class XFrame;
39cdf0e10cSrcweir }
40cdf0e10cSrcweir namespace uno {
41cdf0e10cSrcweir     class XComponentContext;
42cdf0e10cSrcweir }
43cdf0e10cSrcweir namespace drawing {
44cdf0e10cSrcweir     class XShape;
45cdf0e10cSrcweir }}}}
46cdf0e10cSrcweir 
47cdf0e10cSrcweir namespace slideshow
48cdf0e10cSrcweir {
49cdf0e10cSrcweir     namespace internal
50cdf0e10cSrcweir     {
51cdf0e10cSrcweir         /** This class is the viewable representation of a draw
52cdf0e10cSrcweir             document's applet object, associated to a specific View
53cdf0e10cSrcweir 
54cdf0e10cSrcweir             The class is able to render the associated applet on View
55cdf0e10cSrcweir             implementations.
56cdf0e10cSrcweir          */
57cdf0e10cSrcweir         class ViewAppletShape : private boost::noncopyable
58cdf0e10cSrcweir         {
59cdf0e10cSrcweir         public:
60cdf0e10cSrcweir             /** Create a ViewAppletShape for the given View
61cdf0e10cSrcweir 
62cdf0e10cSrcweir             	@param rViewLayer
63cdf0e10cSrcweir                 The associated View object.
64cdf0e10cSrcweir 
65cdf0e10cSrcweir                 @param rxShape
66cdf0e10cSrcweir                 The associated Shape
67cdf0e10cSrcweir 
68cdf0e10cSrcweir                 @param rServiceName
69cdf0e10cSrcweir                 The service name to use, when actually creating the
70cdf0e10cSrcweir                 viewer component
71cdf0e10cSrcweir 
72cdf0e10cSrcweir                 @param pPropCopyTable
73cdf0e10cSrcweir                 Table of plain ASCII property names, to copy from
74cdf0e10cSrcweir                 xShape to applet.
75cdf0e10cSrcweir 
76cdf0e10cSrcweir                 @param nNumPropEntries
77cdf0e10cSrcweir                 Number of property table entries (in pPropCopyTable)
78cdf0e10cSrcweir              */
79cdf0e10cSrcweir             ViewAppletShape( const ViewLayerSharedPtr&                         rViewLayer,
80cdf0e10cSrcweir                              const ::com::sun::star::uno::Reference<
81cdf0e10cSrcweir                                    ::com::sun::star::drawing::XShape >&        rxShape,
82cdf0e10cSrcweir                              const ::rtl::OUString&                            rServiceName,
83cdf0e10cSrcweir                              const char**                                      pPropCopyTable,
84cdf0e10cSrcweir                              sal_Size                                          nNumPropEntries,
85cdf0e10cSrcweir                              const ::com::sun::star::uno::Reference<
86cdf0e10cSrcweir                                    ::com::sun::star::uno::XComponentContext >& rxContext );
87cdf0e10cSrcweir 
88cdf0e10cSrcweir             /** destroy the object
89cdf0e10cSrcweir              */
90cdf0e10cSrcweir             virtual ~ViewAppletShape();
91cdf0e10cSrcweir 
92cdf0e10cSrcweir             /** Query the associated view layer of this shape
93cdf0e10cSrcweir              */
94cdf0e10cSrcweir             ViewLayerSharedPtr getViewLayer() const;
95cdf0e10cSrcweir 
96cdf0e10cSrcweir             // animation methods
97cdf0e10cSrcweir             //------------------------------------------------------------------
98cdf0e10cSrcweir 
99cdf0e10cSrcweir             /** Notify the ViewShape that an animation starts now
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 				This method enters animation mode on the associate
102cdf0e10cSrcweir 				target view. The shape can be animated in parallel on
103cdf0e10cSrcweir 				different views.
104cdf0e10cSrcweir 
105cdf0e10cSrcweir                 @param rBounds
106cdf0e10cSrcweir                 The current applet shape bounds
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 	            @return whether the mode change finished successfully.
109cdf0e10cSrcweir              */
110cdf0e10cSrcweir             bool startApplet( const ::basegfx::B2DRectangle& rBounds );
111cdf0e10cSrcweir 
112cdf0e10cSrcweir             /** Notify the ViewShape that it is no longer animated
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 				This methods ends animation mode on the associate
115cdf0e10cSrcweir 				target view
116cdf0e10cSrcweir              */
117cdf0e10cSrcweir             void endApplet();
118cdf0e10cSrcweir 
119cdf0e10cSrcweir             // render methods
120cdf0e10cSrcweir             //------------------------------------------------------------------
121cdf0e10cSrcweir 
122cdf0e10cSrcweir             /** Render the ViewShape
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 				This method renders the ViewAppletShape on the associated view.
125cdf0e10cSrcweir 
126cdf0e10cSrcweir                 @param rBounds
127cdf0e10cSrcweir                 The current applet shape bounds
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 	            @return whether the rendering finished successfully.
130cdf0e10cSrcweir             */
131cdf0e10cSrcweir             bool render( const ::basegfx::B2DRectangle&	rBounds ) const;
132cdf0e10cSrcweir 
133cdf0e10cSrcweir             /** Resize the ViewShape
134cdf0e10cSrcweir 
135cdf0e10cSrcweir 				This method resizes the ViewAppletShape on the
136cdf0e10cSrcweir 				associated view. It does not render.
137cdf0e10cSrcweir 
138cdf0e10cSrcweir                 @param rBounds
139cdf0e10cSrcweir                 The current applet shape bounds
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 	            @return whether the resize finished successfully.
142cdf0e10cSrcweir             */
143cdf0e10cSrcweir             bool resize( const ::basegfx::B2DRectangle& rBounds ) const;
144cdf0e10cSrcweir 
145cdf0e10cSrcweir         private:
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 			ViewLayerSharedPtr                                    mpViewLayer;
148cdf0e10cSrcweir 
149cdf0e10cSrcweir             /// the actual viewer component for this applet
150cdf0e10cSrcweir             ::com::sun::star::uno::Reference<
151cdf0e10cSrcweir                 ::com::sun::star::frame::XSynchronousFrameLoader> mxViewer;
152cdf0e10cSrcweir 
153cdf0e10cSrcweir             /// the frame containing the applet
154cdf0e10cSrcweir             ::com::sun::star::uno::Reference<
155cdf0e10cSrcweir                 ::com::sun::star::frame::XFrame>                  mxFrame;
156cdf0e10cSrcweir             ::com::sun::star::uno::Reference<
157cdf0e10cSrcweir                 ::com::sun::star::uno::XComponentContext>         mxComponentContext;
158cdf0e10cSrcweir 		};
159cdf0e10cSrcweir 
160cdf0e10cSrcweir         typedef ::boost::shared_ptr< ViewAppletShape > ViewAppletShapeSharedPtr;
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     }
163cdf0e10cSrcweir }
164cdf0e10cSrcweir 
165cdf0e10cSrcweir #endif /* INCLUDED_SLIDESHOW_VIEWAPPLETSHAPE_HXX */
166