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