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