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 #ifndef SFX_SIDEBAR_CONTROLLER_HXX
23 #define SFX_SIDEBAR_CONTROLLER_HXX
24 
25 #include "ContentPanelManager.hxx"
26 
27 #include <com/sun/star/ui/XContextChangeEventListener.hpp>
28 #include <boost/noncopyable.hpp>
29 #include <cppuhelper/compbase1.hxx>
30 #include <cppuhelper/basemutex.hxx>
31 
32 namespace css = ::com::sun::star;
33 namespace cssu = ::com::sun::star::uno;
34 
35 namespace
36 {
37     typedef ::cppu::WeakComponentImplHelper1 <
38         css::ui::XContextChangeEventListener
39         > SidebarControllerInterfaceBase;
40 }
41 
42 
43 namespace sfx2 {
44 
45 class TabBar;
46 class DeckDescriptor;
47 class ContentPanelDescriptor;
48 
49 class SidebarController
50     : private ::boost::noncopyable,
51       private ::cppu::BaseMutex,
52       public SidebarControllerInterfaceBase
53 {
54 public:
55     SidebarController(
56         Window* pParentWindow,
57         const cssu::Reference<css::frame::XFrame>& rxFrame);
58     virtual ~SidebarController (void);
59 
60     virtual void SAL_CALL notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent)
61         throw(cssu::RuntimeException);
62 
63     virtual void SAL_CALL disposing (const css::lang::EventObject& rEventObject)
64         throw(cssu::RuntimeException);
65 
66     void NotifyResize (void);
67 
68 private:
69     class Configuration;
70     ::boost::scoped_ptr<Configuration> mpCurrentConfiguration;
71     Window* mpParentWindow;
72     TabBar* mpTabBar;
73     cssu::Reference<css::frame::XFrame> mxFrame;
74 
75     DECL_LINK(WindowEventHandler, VclWindowEvent*);
76     void UpdateConfiguration (
77         const Context& rContext);
78     void ProcessMatchingDeck (
79         const DeckDescriptor& rDeck,
80         Configuration& rConfiguration);
81     void ProcessMatchingPanel (
82         const ContentPanelDescriptor& rPanel,
83         Configuration& rConfiguration);
84     void MakeConfigurationCurrent (Configuration& rConfiguration);
85 
86     virtual void SAL_CALL disposing (void);
87 };
88 
89 
90 } // end of namespace sfx2
91 
92 
93 #endif
94