122de8995SAndre Fischer /**************************************************************
222de8995SAndre Fischer  *
322de8995SAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
422de8995SAndre Fischer  * or more contributor license agreements.  See the NOTICE file
522de8995SAndre Fischer  * distributed with this work for additional information
622de8995SAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
722de8995SAndre Fischer  * to you under the Apache License, Version 2.0 (the
822de8995SAndre Fischer  * "License"); you may not use this file except in compliance
922de8995SAndre Fischer  * with the License.  You may obtain a copy of the License at
1022de8995SAndre Fischer  *
1122de8995SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
1222de8995SAndre Fischer  *
1322de8995SAndre Fischer  * Unless required by applicable law or agreed to in writing,
1422de8995SAndre Fischer  * software distributed under the License is distributed on an
1522de8995SAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1622de8995SAndre Fischer  * KIND, either express or implied.  See the License for the
1722de8995SAndre Fischer  * specific language governing permissions and limitations
1822de8995SAndre Fischer  * under the License.
1922de8995SAndre Fischer  *
2022de8995SAndre Fischer  *************************************************************/
2122de8995SAndre Fischer 
2222de8995SAndre Fischer #ifndef SFX_SIDEBAR_CONTROLLER_HXX
2322de8995SAndre Fischer #define SFX_SIDEBAR_CONTROLLER_HXX
2422de8995SAndre Fischer 
25ff12d537SAndre Fischer #include "ResourceManager.hxx"
26*95a18594SAndre Fischer #include "sfx2/sidebar/EnumContext.hxx"
27*95a18594SAndre Fischer #include "AsynchronousCall.hxx"
28*95a18594SAndre Fischer #include "TabBar.hxx"
29*95a18594SAndre Fischer 
30*95a18594SAndre Fischer #include <vcl/menu.hxx>
3122de8995SAndre Fischer 
32b9e67834SAndre Fischer #include <com/sun/star/awt/XWindowPeer.hpp>
33b9e67834SAndre Fischer #include <com/sun/star/beans/XPropertyChangeListener.hpp>
3422de8995SAndre Fischer #include <com/sun/star/ui/XContextChangeEventListener.hpp>
35*95a18594SAndre Fischer #include <com/sun/star/ui/XUIElement.hpp>
36*95a18594SAndre Fischer 
3722de8995SAndre Fischer #include <boost/noncopyable.hpp>
38b9e67834SAndre Fischer #include <cppuhelper/compbase2.hxx>
3922de8995SAndre Fischer #include <cppuhelper/basemutex.hxx>
4022de8995SAndre Fischer 
4122de8995SAndre Fischer namespace css = ::com::sun::star;
4222de8995SAndre Fischer namespace cssu = ::com::sun::star::uno;
4322de8995SAndre Fischer 
4422de8995SAndre Fischer namespace
4522de8995SAndre Fischer {
46b9e67834SAndre Fischer     typedef ::cppu::WeakComponentImplHelper2 <
47b9e67834SAndre Fischer         css::ui::XContextChangeEventListener,
48b9e67834SAndre Fischer         css::beans::XPropertyChangeListener
4922de8995SAndre Fischer         > SidebarControllerInterfaceBase;
5022de8995SAndre Fischer }
5122de8995SAndre Fischer 
5222de8995SAndre Fischer 
53ff12d537SAndre Fischer class DockingWindow;
54ff12d537SAndre Fischer 
55ff12d537SAndre Fischer namespace sfx2 { namespace sidebar {
5622de8995SAndre Fischer 
57*95a18594SAndre Fischer class ContentPanelDescriptor;
58*95a18594SAndre Fischer class Deck;
59*95a18594SAndre Fischer class DeckConfiguration;
60*95a18594SAndre Fischer class DeckDescriptor;
61b9e67834SAndre Fischer class Panel;
6222de8995SAndre Fischer class TabBar;
63ff12d537SAndre Fischer class TabBarConfiguration;
6422de8995SAndre Fischer 
6522de8995SAndre Fischer class SidebarController
6622de8995SAndre Fischer     : private ::boost::noncopyable,
6722de8995SAndre Fischer       private ::cppu::BaseMutex,
6822de8995SAndre Fischer       public SidebarControllerInterfaceBase
6922de8995SAndre Fischer {
7022de8995SAndre Fischer public:
7122de8995SAndre Fischer     SidebarController(
72ff12d537SAndre Fischer         DockingWindow* pParentWindow,
7322de8995SAndre Fischer         const cssu::Reference<css::frame::XFrame>& rxFrame);
7422de8995SAndre Fischer     virtual ~SidebarController (void);
7522de8995SAndre Fischer 
76b9e67834SAndre Fischer     // ui::XContextChangeEventListener
7722de8995SAndre Fischer     virtual void SAL_CALL notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent)
7822de8995SAndre Fischer         throw(cssu::RuntimeException);
7922de8995SAndre Fischer 
80b9e67834SAndre Fischer     // XEventListener
8122de8995SAndre Fischer     virtual void SAL_CALL disposing (const css::lang::EventObject& rEventObject)
8222de8995SAndre Fischer         throw(cssu::RuntimeException);
8322de8995SAndre Fischer 
84b9e67834SAndre Fischer     // beans::XPropertyChangeListener
85b9e67834SAndre Fischer     virtual void SAL_CALL propertyChange (const css::beans::PropertyChangeEvent& rEvent)
86b9e67834SAndre Fischer         throw(cssu::RuntimeException);
87b9e67834SAndre Fischer 
8822de8995SAndre Fischer     void NotifyResize (void);
8922de8995SAndre Fischer 
90ff12d537SAndre Fischer     void SwitchToDeck (
91*95a18594SAndre Fischer         const ::rtl::OUString& rsDeckId);
92ff12d537SAndre Fischer 
9322de8995SAndre Fischer private:
94ff12d537SAndre Fischer     ::boost::shared_ptr<DeckConfiguration> mpCurrentConfiguration;
95ff12d537SAndre Fischer     DockingWindow* mpParentWindow;
9622de8995SAndre Fischer     TabBar* mpTabBar;
9722de8995SAndre Fischer     cssu::Reference<css::frame::XFrame> mxFrame;
98*95a18594SAndre Fischer     EnumContext maCurrentContext;
99*95a18594SAndre Fischer     ::rtl::OUString msCurrentDeckId;
100*95a18594SAndre Fischer     AsynchronousCall maPropertyChangeForwarder;
101*95a18594SAndre Fischer 
10222de8995SAndre Fischer     DECL_LINK(WindowEventHandler, VclWindowEvent*);
103*95a18594SAndre Fischer     void UpdateConfigurations (const EnumContext& rContext);
104ff12d537SAndre Fischer     cssu::Reference<css::ui::XUIElement> CreateUIElement (
105ff12d537SAndre Fischer         const cssu::Reference<css::awt::XWindowPeer>& rxWindow,
106b9e67834SAndre Fischer         const ::rtl::OUString& rsImplementationURL,
107b9e67834SAndre Fischer         Panel* pPanel) const;
108*95a18594SAndre Fischer     Panel* CreatePanel (
109*95a18594SAndre Fischer         const ::rtl::OUString& rsPanelId,
110*95a18594SAndre Fischer         Deck* pDeck) const;
111ff12d537SAndre Fischer     void SwitchToDeck (
112ff12d537SAndre Fischer         const DeckDescriptor& rDeckDescriptor,
113*95a18594SAndre Fischer         const EnumContext& rContext);
114*95a18594SAndre Fischer     void ShowPopupMenu (
115*95a18594SAndre Fischer         const Rectangle& rButtonBox,
116*95a18594SAndre Fischer         const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
117*95a18594SAndre Fischer         const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const;
118*95a18594SAndre Fischer     ::boost::shared_ptr<PopupMenu> CreatePopupMenu (
119*95a18594SAndre Fischer         const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
120*95a18594SAndre Fischer         const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const;
121ff12d537SAndre Fischer     DECL_LINK(OnMenuItemSelected, Menu*);
122*95a18594SAndre Fischer     void BroadcastPropertyChange (void);
12322de8995SAndre Fischer 
12422de8995SAndre Fischer     virtual void SAL_CALL disposing (void);
12522de8995SAndre Fischer };
12622de8995SAndre Fischer 
12722de8995SAndre Fischer 
128ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar
12922de8995SAndre Fischer 
13022de8995SAndre Fischer #endif
131