1*7a32b0c8SAndre Fischer /**************************************************************
2*7a32b0c8SAndre Fischer  *
3*7a32b0c8SAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
4*7a32b0c8SAndre Fischer  * or more contributor license agreements.  See the NOTICE file
5*7a32b0c8SAndre Fischer  * distributed with this work for additional information
6*7a32b0c8SAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
7*7a32b0c8SAndre Fischer  * to you under the Apache License, Version 2.0 (the
8*7a32b0c8SAndre Fischer  * "License"); you may not use this file except in compliance
9*7a32b0c8SAndre Fischer  * with the License.  You may obtain a copy of the License at
10*7a32b0c8SAndre Fischer  *
11*7a32b0c8SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
12*7a32b0c8SAndre Fischer  *
13*7a32b0c8SAndre Fischer  * Unless required by applicable law or agreed to in writing,
14*7a32b0c8SAndre Fischer  * software distributed under the License is distributed on an
15*7a32b0c8SAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*7a32b0c8SAndre Fischer  * KIND, either express or implied.  See the License for the
17*7a32b0c8SAndre Fischer  * specific language governing permissions and limitations
18*7a32b0c8SAndre Fischer  * under the License.
19*7a32b0c8SAndre Fischer  *
20*7a32b0c8SAndre Fischer  *************************************************************/
21*7a32b0c8SAndre Fischer 
22*7a32b0c8SAndre Fischer #include <cppuhelper/compbase1.hxx>
23*7a32b0c8SAndre Fischer #include <cppuhelper/basemutex.hxx>
24*7a32b0c8SAndre Fischer 
25*7a32b0c8SAndre Fischer #include "SidebarPanelId.hxx"
26*7a32b0c8SAndre Fischer 
27*7a32b0c8SAndre Fischer #include <com/sun/star/drawing/framework/XResource.hpp>
28*7a32b0c8SAndre Fischer #include <boost/scoped_ptr.hpp>
29*7a32b0c8SAndre Fischer 
30*7a32b0c8SAndre Fischer 
31*7a32b0c8SAndre Fischer namespace css = ::com::sun::star;
32*7a32b0c8SAndre Fischer namespace cssu = ::com::sun::star::uno;
33*7a32b0c8SAndre Fischer namespace cssdf = ::com::sun::star::drawing::framework;
34*7a32b0c8SAndre Fischer 
35*7a32b0c8SAndre Fischer class Window;
36*7a32b0c8SAndre Fischer 
37*7a32b0c8SAndre Fischer namespace sd { namespace sidebar {
38*7a32b0c8SAndre Fischer     class SidebarViewShell;
39*7a32b0c8SAndre Fischer } }
40*7a32b0c8SAndre Fischer 
41*7a32b0c8SAndre Fischer 
42*7a32b0c8SAndre Fischer namespace sd { namespace framework {
43*7a32b0c8SAndre Fischer 
44*7a32b0c8SAndre Fischer typedef ::cppu::WeakComponentImplHelper1 <
45*7a32b0c8SAndre Fischer     cssdf::XResource
46*7a32b0c8SAndre Fischer     > TaskPanelResourceInterfaceBase;
47*7a32b0c8SAndre Fischer 
48*7a32b0c8SAndre Fischer 
49*7a32b0c8SAndre Fischer /** A simple wrapper around a legacy task pane control that gives
50*7a32b0c8SAndre Fischer     access to that control (via GetControl()).
51*7a32b0c8SAndre Fischer */
52*7a32b0c8SAndre Fischer class TaskPanelResource
53*7a32b0c8SAndre Fischer     : private ::cppu::BaseMutex,
54*7a32b0c8SAndre Fischer       public TaskPanelResourceInterfaceBase
55*7a32b0c8SAndre Fischer {
56*7a32b0c8SAndre Fischer public:
57*7a32b0c8SAndre Fischer     /** Create a resource object that represents the legacy taskpane
58*7a32b0c8SAndre Fischer         panel.
59*7a32b0c8SAndre Fischer         @param rxResourceId
60*7a32b0c8SAndre Fischer             drawing framework resource id
61*7a32b0c8SAndre Fischer         @param pControl
62*7a32b0c8SAndre Fischer             The new TaskPanelResource object takes ownership for this control.
63*7a32b0c8SAndre Fischer     */
64*7a32b0c8SAndre Fischer     TaskPanelResource (
65*7a32b0c8SAndre Fischer         sidebar::SidebarViewShell& rSidebarViewShell,
66*7a32b0c8SAndre Fischer         sidebar::PanelId ePanelId,
67*7a32b0c8SAndre Fischer         const cssu::Reference<cssdf::XResourceId>& rxResourceId);
68*7a32b0c8SAndre Fischer     virtual ~TaskPanelResource (void);
69*7a32b0c8SAndre Fischer     virtual void SAL_CALL disposing (void);
70*7a32b0c8SAndre Fischer 
71*7a32b0c8SAndre Fischer     // XResource
72*7a32b0c8SAndre Fischer     virtual cssu::Reference<cssdf::XResourceId> SAL_CALL getResourceId (void) throw (cssu::RuntimeException);
73*7a32b0c8SAndre Fischer     virtual sal_Bool SAL_CALL isAnchorOnly () throw (cssu::RuntimeException);
74*7a32b0c8SAndre Fischer 
75*7a32b0c8SAndre Fischer     ::Window* GetControl (void) const;
76*7a32b0c8SAndre Fischer 
77*7a32b0c8SAndre Fischer private:
78*7a32b0c8SAndre Fischer     const cssu::Reference<cssdf::XResourceId> mxResourceId;
79*7a32b0c8SAndre Fischer     // Using auto_ptr because it has release(), what scoped_ptr doesn't.
80*7a32b0c8SAndre Fischer     ::std::auto_ptr< ::Window> mpControl;
81*7a32b0c8SAndre Fischer 
82*7a32b0c8SAndre Fischer     DECL_LINK(WindowEventHandler,VclWindowEvent*);
83*7a32b0c8SAndre Fischer };
84*7a32b0c8SAndre Fischer 
85*7a32b0c8SAndre Fischer } } // end of namespace sd::framework
86