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 #include <cppuhelper/compbase1.hxx> 23 #include <cppuhelper/basemutex.hxx> 24 25 #include "SidebarPanelId.hxx" 26 27 #include <com/sun/star/drawing/framework/XResource.hpp> 28 #include <boost/scoped_ptr.hpp> 29 30 31 namespace css = ::com::sun::star; 32 namespace cssu = ::com::sun::star::uno; 33 namespace cssdf = ::com::sun::star::drawing::framework; 34 35 class Window; 36 37 namespace sd { namespace sidebar { 38 class SidebarViewShell; 39 } } 40 41 42 namespace sd { namespace framework { 43 44 typedef ::cppu::WeakComponentImplHelper1 < 45 cssdf::XResource 46 > TaskPanelResourceInterfaceBase; 47 48 49 /** A simple wrapper around a legacy task pane control that gives 50 access to that control (via GetControl()). 51 */ 52 class TaskPanelResource 53 : private ::cppu::BaseMutex, 54 public TaskPanelResourceInterfaceBase 55 { 56 public: 57 /** Create a resource object that represents the legacy taskpane 58 panel. 59 @param rxResourceId 60 drawing framework resource id 61 @param pControl 62 The new TaskPanelResource object takes ownership for this control. 63 */ 64 TaskPanelResource ( 65 sidebar::SidebarViewShell& rSidebarViewShell, 66 sidebar::PanelId ePanelId, 67 const cssu::Reference<cssdf::XResourceId>& rxResourceId); 68 virtual ~TaskPanelResource (void); 69 virtual void SAL_CALL disposing (void); 70 71 // XResource 72 virtual cssu::Reference<cssdf::XResourceId> SAL_CALL getResourceId (void) throw (cssu::RuntimeException); 73 virtual sal_Bool SAL_CALL isAnchorOnly () throw (cssu::RuntimeException); 74 75 ::Window* GetControl (void) const; 76 77 private: 78 const cssu::Reference<cssdf::XResourceId> mxResourceId; 79 // Using auto_ptr because it has release(), what scoped_ptr doesn't. 80 ::std::auto_ptr< ::Window> mpControl; 81 82 DECL_LINK(WindowEventHandler,VclWindowEvent*); 83 }; 84 85 } } // end of namespace sd::framework 86