1b9e67834SAndre Fischer /**************************************************************
2b9e67834SAndre Fischer  *
3b9e67834SAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
4b9e67834SAndre Fischer  * or more contributor license agreements.  See the NOTICE file
5b9e67834SAndre Fischer  * distributed with this work for additional information
6b9e67834SAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
7b9e67834SAndre Fischer  * to you under the Apache License, Version 2.0 (the
8b9e67834SAndre Fischer  * "License"); you may not use this file except in compliance
9b9e67834SAndre Fischer  * with the License.  You may obtain a copy of the License at
10b9e67834SAndre Fischer  *
11b9e67834SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
12b9e67834SAndre Fischer  *
13b9e67834SAndre Fischer  * Unless required by applicable law or agreed to in writing,
14b9e67834SAndre Fischer  * software distributed under the License is distributed on an
15b9e67834SAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b9e67834SAndre Fischer  * KIND, either express or implied.  See the License for the
17b9e67834SAndre Fischer  * specific language governing permissions and limitations
18b9e67834SAndre Fischer  * under the License.
19b9e67834SAndre Fischer  *
20b9e67834SAndre Fischer  *************************************************************/
21b9e67834SAndre Fischer 
22b9e67834SAndre Fischer #ifndef SFX_SIDEBAR_PANEL_BASE_HXX
23b9e67834SAndre Fischer #define SFX_SIDEBAR_PANEL_BASE_HXX
24b9e67834SAndre Fischer 
25b9e67834SAndre Fischer #include "EnumContext.hxx"
26*3fc59d38SAndre Fischer #include "IContextChangeReceiver.hxx"
27b9e67834SAndre Fischer 
2895a18594SAndre Fischer #include <cppuhelper/compbase4.hxx>
29b9e67834SAndre Fischer #include <cppuhelper/basemutex.hxx>
30b9e67834SAndre Fischer 
31b9e67834SAndre Fischer #include <com/sun/star/frame/XController.hpp>
32b9e67834SAndre Fischer #include <com/sun/star/ui/XContextChangeEventListener.hpp>
33b9e67834SAndre Fischer #include <com/sun/star/ui/XUIElement.hpp>
34b9e67834SAndre Fischer #include <com/sun/star/ui/XToolPanel.hpp>
357a32b0c8SAndre Fischer #include <com/sun/star/ui/XSidebarPanel.hpp>
367a32b0c8SAndre Fischer 
37b9e67834SAndre Fischer #include <boost/noncopyable.hpp>
387a32b0c8SAndre Fischer #include <boost/function.hpp>
39b9e67834SAndre Fischer 
40b9e67834SAndre Fischer 
41b9e67834SAndre Fischer namespace css = ::com::sun::star;
42b9e67834SAndre Fischer namespace cssu = ::com::sun::star::uno;
43b9e67834SAndre Fischer 
44b9e67834SAndre Fischer 
457a32b0c8SAndre Fischer class Window;
4695a18594SAndre Fischer 
47b9e67834SAndre Fischer namespace sfx2 { namespace sidebar {
48b9e67834SAndre Fischer 
49b9e67834SAndre Fischer namespace
50b9e67834SAndre Fischer {
5195a18594SAndre Fischer     typedef ::cppu::WeakComponentImplHelper4 <
52b9e67834SAndre Fischer         css::ui::XContextChangeEventListener,
53b9e67834SAndre Fischer         css::ui::XUIElement,
5495a18594SAndre Fischer         css::ui::XToolPanel,
557a32b0c8SAndre Fischer         css::ui::XSidebarPanel
56b9e67834SAndre Fischer         > SidebarPanelBaseInterfaceBase;
57b9e67834SAndre Fischer }
58b9e67834SAndre Fischer 
59b9e67834SAndre Fischer /** Base class for sidebar panels that provides some convenience
60b9e67834SAndre Fischer     functionality.
61b9e67834SAndre Fischer */
62b9e67834SAndre Fischer class SFX2_DLLPUBLIC SidebarPanelBase
63b9e67834SAndre Fischer     : private ::boost::noncopyable,
64b9e67834SAndre Fischer       private ::cppu::BaseMutex,
6595a18594SAndre Fischer       public SidebarPanelBaseInterfaceBase
66b9e67834SAndre Fischer {
67b9e67834SAndre Fischer public:
6895a18594SAndre Fischer     static cssu::Reference<css::ui::XUIElement> Create (
6995a18594SAndre Fischer         const ::rtl::OUString& rsResourceURL,
7095a18594SAndre Fischer         const cssu::Reference<css::frame::XFrame>& rxFrame,
71*3fc59d38SAndre Fischer         Window* pControl,
7202c50d82SAndre Fischer         const css::ui::LayoutSize& rLayoutSize);
7395a18594SAndre Fischer 
74b9e67834SAndre Fischer     // XContextChangeEventListener
75b9e67834SAndre Fischer     virtual void SAL_CALL notifyContextChangeEvent (
7695a18594SAndre Fischer         const css::ui::ContextChangeEventObject& rEvent)
7795a18594SAndre Fischer         throw (cssu::RuntimeException);
78b9e67834SAndre Fischer 
79b9e67834SAndre Fischer     // XEventListener
80b9e67834SAndre Fischer     virtual void SAL_CALL disposing (
81b9e67834SAndre Fischer         const css::lang::EventObject& rEvent)
82b9e67834SAndre Fischer         throw (cssu::RuntimeException);
83b9e67834SAndre Fischer 
84b9e67834SAndre Fischer     // XUIElement
85b9e67834SAndre Fischer     virtual cssu::Reference<css::frame::XFrame> SAL_CALL getFrame (void)
86b9e67834SAndre Fischer         throw(cssu::RuntimeException);
87b9e67834SAndre Fischer     virtual ::rtl::OUString SAL_CALL getResourceURL (void)
88b9e67834SAndre Fischer         throw(cssu::RuntimeException);
89b9e67834SAndre Fischer     virtual sal_Int16 SAL_CALL getType (void)
90b9e67834SAndre Fischer         throw(cssu::RuntimeException);
91b9e67834SAndre Fischer     virtual cssu::Reference<cssu::XInterface> SAL_CALL getRealInterface (void)
92b9e67834SAndre Fischer         throw(cssu::RuntimeException);
93b9e67834SAndre Fischer 
94b9e67834SAndre Fischer     // XToolPanel
95b9e67834SAndre Fischer     virtual cssu::Reference<css::accessibility::XAccessible> SAL_CALL createAccessible (
96b9e67834SAndre Fischer         const cssu::Reference<css::accessibility::XAccessible>& rxParentAccessible)
97b9e67834SAndre Fischer         throw(cssu::RuntimeException);
98b9e67834SAndre Fischer     virtual cssu::Reference<css::awt::XWindow> SAL_CALL getWindow (void)
99b9e67834SAndre Fischer         throw(cssu::RuntimeException);
10095a18594SAndre Fischer 
1017a32b0c8SAndre Fischer     // XSidebarPanel
1027a32b0c8SAndre Fischer     virtual css::ui::LayoutSize SAL_CALL getHeightForWidth (sal_Int32 nWidth)
10395a18594SAndre Fischer         throw(cssu::RuntimeException);
1047a32b0c8SAndre Fischer 
105b9e67834SAndre Fischer protected:
1067a32b0c8SAndre Fischer     cssu::Reference<css::frame::XFrame> mxFrame;
1077a32b0c8SAndre Fischer 
108b9e67834SAndre Fischer     SidebarPanelBase (
109b9e67834SAndre Fischer         const ::rtl::OUString& rsResourceURL,
110b9e67834SAndre Fischer         const cssu::Reference<css::frame::XFrame>& rxFrame,
1117a32b0c8SAndre Fischer         Window* pWindow,
11202c50d82SAndre Fischer         const css::ui::LayoutSize& rLayoutSize);
113b9e67834SAndre Fischer     virtual ~SidebarPanelBase (void);
114b9e67834SAndre Fischer 
115b9e67834SAndre Fischer     virtual void SAL_CALL disposing (void)
116b9e67834SAndre Fischer         throw (cssu::RuntimeException);
117b9e67834SAndre Fischer 
1187a32b0c8SAndre Fischer     void SetControl (::Window* pControl);
1197a32b0c8SAndre Fischer     ::Window* GetControl (void) const;
1207a32b0c8SAndre Fischer 
121b9e67834SAndre Fischer private:
1227a32b0c8SAndre Fischer     Window* mpControl;
123b9e67834SAndre Fischer     const ::rtl::OUString msResourceURL;
12402c50d82SAndre Fischer     const css::ui::LayoutSize maLayoutSize;
125b9e67834SAndre Fischer };
126b9e67834SAndre Fischer 
127b9e67834SAndre Fischer } } // end of namespace sfx2::sidebar
128b9e67834SAndre Fischer 
129b9e67834SAndre Fischer #endif
130