1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski  *
3*b1cdbd2cSJim Jagielski  * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski  * or more contributor license agreements.  See the NOTICE file
5*b1cdbd2cSJim Jagielski  * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski  * regarding copyright ownership.  The ASF licenses this file
7*b1cdbd2cSJim Jagielski  * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski  * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski  * with the License.  You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski  *
11*b1cdbd2cSJim Jagielski  *   http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski  *
13*b1cdbd2cSJim Jagielski  * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski  * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski  * KIND, either express or implied.  See the License for the
17*b1cdbd2cSJim Jagielski  * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski  * under the License.
19*b1cdbd2cSJim Jagielski  *
20*b1cdbd2cSJim Jagielski  *************************************************************/
21*b1cdbd2cSJim Jagielski 
22*b1cdbd2cSJim Jagielski 
23*b1cdbd2cSJim Jagielski 
24*b1cdbd2cSJim Jagielski #ifndef INCLUDED_SLIDESHOW_VIEWAPPLETSHAPE_HXX
25*b1cdbd2cSJim Jagielski #define INCLUDED_SLIDESHOW_VIEWAPPLETSHAPE_HXX
26*b1cdbd2cSJim Jagielski 
27*b1cdbd2cSJim Jagielski #include <basegfx/range/b2drectangle.hxx>
28*b1cdbd2cSJim Jagielski #include <com/sun/star/awt/Point.hpp>
29*b1cdbd2cSJim Jagielski 
30*b1cdbd2cSJim Jagielski #include <boost/utility.hpp>
31*b1cdbd2cSJim Jagielski #include <boost/shared_ptr.hpp>
32*b1cdbd2cSJim Jagielski 
33*b1cdbd2cSJim Jagielski #include "viewlayer.hxx"
34*b1cdbd2cSJim Jagielski 
35*b1cdbd2cSJim Jagielski namespace com { namespace sun { namespace star {
36*b1cdbd2cSJim Jagielski namespace frame {
37*b1cdbd2cSJim Jagielski     class XSynchronousFrameLoader;
38*b1cdbd2cSJim Jagielski     class XFrame;
39*b1cdbd2cSJim Jagielski }
40*b1cdbd2cSJim Jagielski namespace uno {
41*b1cdbd2cSJim Jagielski     class XComponentContext;
42*b1cdbd2cSJim Jagielski }
43*b1cdbd2cSJim Jagielski namespace drawing {
44*b1cdbd2cSJim Jagielski     class XShape;
45*b1cdbd2cSJim Jagielski }}}}
46*b1cdbd2cSJim Jagielski 
47*b1cdbd2cSJim Jagielski namespace slideshow
48*b1cdbd2cSJim Jagielski {
49*b1cdbd2cSJim Jagielski     namespace internal
50*b1cdbd2cSJim Jagielski     {
51*b1cdbd2cSJim Jagielski         /** This class is the viewable representation of a draw
52*b1cdbd2cSJim Jagielski             document's applet object, associated to a specific View
53*b1cdbd2cSJim Jagielski 
54*b1cdbd2cSJim Jagielski             The class is able to render the associated applet on View
55*b1cdbd2cSJim Jagielski             implementations.
56*b1cdbd2cSJim Jagielski          */
57*b1cdbd2cSJim Jagielski         class ViewAppletShape : private boost::noncopyable
58*b1cdbd2cSJim Jagielski         {
59*b1cdbd2cSJim Jagielski         public:
60*b1cdbd2cSJim Jagielski             /** Create a ViewAppletShape for the given View
61*b1cdbd2cSJim Jagielski 
62*b1cdbd2cSJim Jagielski             	@param rViewLayer
63*b1cdbd2cSJim Jagielski                 The associated View object.
64*b1cdbd2cSJim Jagielski 
65*b1cdbd2cSJim Jagielski                 @param rxShape
66*b1cdbd2cSJim Jagielski                 The associated Shape
67*b1cdbd2cSJim Jagielski 
68*b1cdbd2cSJim Jagielski                 @param rServiceName
69*b1cdbd2cSJim Jagielski                 The service name to use, when actually creating the
70*b1cdbd2cSJim Jagielski                 viewer component
71*b1cdbd2cSJim Jagielski 
72*b1cdbd2cSJim Jagielski                 @param pPropCopyTable
73*b1cdbd2cSJim Jagielski                 Table of plain ASCII property names, to copy from
74*b1cdbd2cSJim Jagielski                 xShape to applet.
75*b1cdbd2cSJim Jagielski 
76*b1cdbd2cSJim Jagielski                 @param nNumPropEntries
77*b1cdbd2cSJim Jagielski                 Number of property table entries (in pPropCopyTable)
78*b1cdbd2cSJim Jagielski              */
79*b1cdbd2cSJim Jagielski             ViewAppletShape( const ViewLayerSharedPtr&                         rViewLayer,
80*b1cdbd2cSJim Jagielski                              const ::com::sun::star::uno::Reference<
81*b1cdbd2cSJim Jagielski                                    ::com::sun::star::drawing::XShape >&        rxShape,
82*b1cdbd2cSJim Jagielski                              const ::rtl::OUString&                            rServiceName,
83*b1cdbd2cSJim Jagielski                              const char**                                      pPropCopyTable,
84*b1cdbd2cSJim Jagielski                              sal_Size                                          nNumPropEntries,
85*b1cdbd2cSJim Jagielski                              const ::com::sun::star::uno::Reference<
86*b1cdbd2cSJim Jagielski                                    ::com::sun::star::uno::XComponentContext >& rxContext );
87*b1cdbd2cSJim Jagielski 
88*b1cdbd2cSJim Jagielski             /** destroy the object
89*b1cdbd2cSJim Jagielski              */
90*b1cdbd2cSJim Jagielski             virtual ~ViewAppletShape();
91*b1cdbd2cSJim Jagielski 
92*b1cdbd2cSJim Jagielski             /** Query the associated view layer of this shape
93*b1cdbd2cSJim Jagielski              */
94*b1cdbd2cSJim Jagielski             ViewLayerSharedPtr getViewLayer() const;
95*b1cdbd2cSJim Jagielski 
96*b1cdbd2cSJim Jagielski             // animation methods
97*b1cdbd2cSJim Jagielski             //------------------------------------------------------------------
98*b1cdbd2cSJim Jagielski 
99*b1cdbd2cSJim Jagielski             /** Notify the ViewShape that an animation starts now
100*b1cdbd2cSJim Jagielski 
101*b1cdbd2cSJim Jagielski 				This method enters animation mode on the associate
102*b1cdbd2cSJim Jagielski 				target view. The shape can be animated in parallel on
103*b1cdbd2cSJim Jagielski 				different views.
104*b1cdbd2cSJim Jagielski 
105*b1cdbd2cSJim Jagielski                 @param rBounds
106*b1cdbd2cSJim Jagielski                 The current applet shape bounds
107*b1cdbd2cSJim Jagielski 
108*b1cdbd2cSJim Jagielski 	            @return whether the mode change finished successfully.
109*b1cdbd2cSJim Jagielski              */
110*b1cdbd2cSJim Jagielski             bool startApplet( const ::basegfx::B2DRectangle& rBounds );
111*b1cdbd2cSJim Jagielski 
112*b1cdbd2cSJim Jagielski             /** Notify the ViewShape that it is no longer animated
113*b1cdbd2cSJim Jagielski 
114*b1cdbd2cSJim Jagielski 				This methods ends animation mode on the associate
115*b1cdbd2cSJim Jagielski 				target view
116*b1cdbd2cSJim Jagielski              */
117*b1cdbd2cSJim Jagielski             void endApplet();
118*b1cdbd2cSJim Jagielski 
119*b1cdbd2cSJim Jagielski             // render methods
120*b1cdbd2cSJim Jagielski             //------------------------------------------------------------------
121*b1cdbd2cSJim Jagielski 
122*b1cdbd2cSJim Jagielski             /** Render the ViewShape
123*b1cdbd2cSJim Jagielski 
124*b1cdbd2cSJim Jagielski 				This method renders the ViewAppletShape on the associated view.
125*b1cdbd2cSJim Jagielski 
126*b1cdbd2cSJim Jagielski                 @param rBounds
127*b1cdbd2cSJim Jagielski                 The current applet shape bounds
128*b1cdbd2cSJim Jagielski 
129*b1cdbd2cSJim Jagielski 	            @return whether the rendering finished successfully.
130*b1cdbd2cSJim Jagielski             */
131*b1cdbd2cSJim Jagielski             bool render( const ::basegfx::B2DRectangle&	rBounds ) const;
132*b1cdbd2cSJim Jagielski 
133*b1cdbd2cSJim Jagielski             /** Resize the ViewShape
134*b1cdbd2cSJim Jagielski 
135*b1cdbd2cSJim Jagielski 				This method resizes the ViewAppletShape on the
136*b1cdbd2cSJim Jagielski 				associated view. It does not render.
137*b1cdbd2cSJim Jagielski 
138*b1cdbd2cSJim Jagielski                 @param rBounds
139*b1cdbd2cSJim Jagielski                 The current applet shape bounds
140*b1cdbd2cSJim Jagielski 
141*b1cdbd2cSJim Jagielski 	            @return whether the resize finished successfully.
142*b1cdbd2cSJim Jagielski             */
143*b1cdbd2cSJim Jagielski             bool resize( const ::basegfx::B2DRectangle& rBounds ) const;
144*b1cdbd2cSJim Jagielski 
145*b1cdbd2cSJim Jagielski         private:
146*b1cdbd2cSJim Jagielski 
147*b1cdbd2cSJim Jagielski 			ViewLayerSharedPtr                                    mpViewLayer;
148*b1cdbd2cSJim Jagielski 
149*b1cdbd2cSJim Jagielski             /// the actual viewer component for this applet
150*b1cdbd2cSJim Jagielski             ::com::sun::star::uno::Reference<
151*b1cdbd2cSJim Jagielski                 ::com::sun::star::frame::XSynchronousFrameLoader> mxViewer;
152*b1cdbd2cSJim Jagielski 
153*b1cdbd2cSJim Jagielski             /// the frame containing the applet
154*b1cdbd2cSJim Jagielski             ::com::sun::star::uno::Reference<
155*b1cdbd2cSJim Jagielski                 ::com::sun::star::frame::XFrame>                  mxFrame;
156*b1cdbd2cSJim Jagielski             ::com::sun::star::uno::Reference<
157*b1cdbd2cSJim Jagielski                 ::com::sun::star::uno::XComponentContext>         mxComponentContext;
158*b1cdbd2cSJim Jagielski 		};
159*b1cdbd2cSJim Jagielski 
160*b1cdbd2cSJim Jagielski         typedef ::boost::shared_ptr< ViewAppletShape > ViewAppletShapeSharedPtr;
161*b1cdbd2cSJim Jagielski 
162*b1cdbd2cSJim Jagielski     }
163*b1cdbd2cSJim Jagielski }
164*b1cdbd2cSJim Jagielski 
165*b1cdbd2cSJim Jagielski #endif /* INCLUDED_SLIDESHOW_VIEWAPPLETSHAPE_HXX */
166