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 SD_PRESENTER_CANVAS_UPDATE_REQUESTER_HEADER 25 #define SD_PRESENTER_CANVAS_UPDATE_REQUESTER_HEADER 26 27 #include "precompiled_sd.hxx" 28 29 #include <com/sun/star/rendering/XSpriteCanvas.hpp> 30 #include <boost/noncopyable.hpp> 31 #include <boost/shared_ptr.hpp> 32 #include <sal/types.h> 33 #include <tools/solar.h> 34 #include <tools/link.hxx> 35 #include <vector> 36 37 namespace css = ::com::sun::star; 38 39 namespace sd { namespace presenter { 40 41 /** Each UpdateRequester handles update requests (calls to 42 XCanvas::updateScreen()) for one shared canvas (a canvas that has one or 43 more PresenterCanvas wrappers). Multiple calls are collected and lead 44 to a single call to updateScreen. 45 */ 46 class CanvasUpdateRequester : private ::boost::noncopyable 47 { 48 public: 49 /** Return the Canvas UpdateRequester object for the given shared 50 canvas. A new object is created when it does not already exist. 51 */ 52 static ::boost::shared_ptr<CanvasUpdateRequester> Instance ( 53 const css::uno::Reference<css::rendering::XSpriteCanvas>& rxCanvas); 54 55 void RequestUpdate (const sal_Bool bUpdateAll); 56 57 private: 58 CanvasUpdateRequester (const css::uno::Reference<css::rendering::XSpriteCanvas>& rxCanvas); 59 ~CanvasUpdateRequester (void); 60 class Deleter; friend class Deleter; 61 62 typedef ::std::vector< 63 ::std::pair< 64 css::uno::Reference<css::rendering::XSpriteCanvas>, 65 ::boost::shared_ptr<CanvasUpdateRequester> > > RequesterMap; 66 static RequesterMap maRequesterMap; 67 68 css::uno::Reference<css::rendering::XSpriteCanvas> mxCanvas; 69 sal_uLong mnUserEventId; 70 sal_Bool mbUpdateFlag; 71 DECL_LINK(Callback, void*); 72 }; 73 74 } } // end of namespace ::sd::presenter 75 76 #endif 77