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 2595a18594SAndre Fischer #include "AsynchronousCall.hxx" 267a32b0c8SAndre Fischer #include "Context.hxx" 27*65908a7eSAndre Fischer #include "FocusManager.hxx" 28f120fe41SAndre Fischer #include "Panel.hxx" 29*65908a7eSAndre Fischer #include "ResourceManager.hxx" 30*65908a7eSAndre Fischer #include "TabBar.hxx" 3195a18594SAndre Fischer 3295a18594SAndre Fischer #include <vcl/menu.hxx> 3322de8995SAndre Fischer 34b9e67834SAndre Fischer #include <com/sun/star/awt/XWindowPeer.hpp> 35b9e67834SAndre Fischer #include <com/sun/star/beans/XPropertyChangeListener.hpp> 3622de8995SAndre Fischer #include <com/sun/star/ui/XContextChangeEventListener.hpp> 3795a18594SAndre Fischer #include <com/sun/star/ui/XUIElement.hpp> 387a32b0c8SAndre Fischer #include <com/sun/star/ui/XSidebar.hpp> 3995a18594SAndre Fischer 4022de8995SAndre Fischer #include <boost/noncopyable.hpp> 417a32b0c8SAndre Fischer #include <cppuhelper/compbase3.hxx> 4222de8995SAndre Fischer #include <cppuhelper/basemutex.hxx> 4322de8995SAndre Fischer 4422de8995SAndre Fischer namespace css = ::com::sun::star; 4522de8995SAndre Fischer namespace cssu = ::com::sun::star::uno; 4622de8995SAndre Fischer 477a32b0c8SAndre Fischer 4822de8995SAndre Fischer namespace 4922de8995SAndre Fischer { 507a32b0c8SAndre Fischer typedef ::cppu::WeakComponentImplHelper3 < 51b9e67834SAndre Fischer css::ui::XContextChangeEventListener, 527a32b0c8SAndre Fischer css::beans::XPropertyChangeListener, 537a32b0c8SAndre Fischer css::ui::XSidebar 5422de8995SAndre Fischer > SidebarControllerInterfaceBase; 5522de8995SAndre Fischer } 5622de8995SAndre Fischer 57ff12d537SAndre Fischer namespace sfx2 { namespace sidebar { 5822de8995SAndre Fischer 5995a18594SAndre Fischer class ContentPanelDescriptor; 6095a18594SAndre Fischer class Deck; 6195a18594SAndre Fischer class DeckDescriptor; 627a32b0c8SAndre Fischer class SidebarDockingWindow; 6322de8995SAndre Fischer class TabBar; 64ff12d537SAndre Fischer class TabBarConfiguration; 6522de8995SAndre Fischer 6622de8995SAndre Fischer class SidebarController 6722de8995SAndre Fischer : private ::boost::noncopyable, 6822de8995SAndre Fischer private ::cppu::BaseMutex, 6922de8995SAndre Fischer public SidebarControllerInterfaceBase 7022de8995SAndre Fischer { 7122de8995SAndre Fischer public: 7222de8995SAndre Fischer SidebarController( 737a32b0c8SAndre Fischer SidebarDockingWindow* pParentWindow, 7422de8995SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame); 7522de8995SAndre Fischer virtual ~SidebarController (void); 7622de8995SAndre Fischer 77b9e67834SAndre Fischer // ui::XContextChangeEventListener 7822de8995SAndre Fischer virtual void SAL_CALL notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent) 7922de8995SAndre Fischer throw(cssu::RuntimeException); 8022de8995SAndre Fischer 81b9e67834SAndre Fischer // XEventListener 8222de8995SAndre Fischer virtual void SAL_CALL disposing (const css::lang::EventObject& rEventObject) 8322de8995SAndre Fischer throw(cssu::RuntimeException); 8422de8995SAndre Fischer 85b9e67834SAndre Fischer // beans::XPropertyChangeListener 86b9e67834SAndre Fischer virtual void SAL_CALL propertyChange (const css::beans::PropertyChangeEvent& rEvent) 87b9e67834SAndre Fischer throw(cssu::RuntimeException); 887a32b0c8SAndre Fischer 897a32b0c8SAndre Fischer // ui::XSidebar 907a32b0c8SAndre Fischer virtual void SAL_CALL requestLayout (void) 917a32b0c8SAndre Fischer throw(cssu::RuntimeException); 92b9e67834SAndre Fischer 9322de8995SAndre Fischer void NotifyResize (void); 9422de8995SAndre Fischer 95ff12d537SAndre Fischer void SwitchToDeck ( 9695a18594SAndre Fischer const ::rtl::OUString& rsDeckId); 97ff12d537SAndre Fischer 987a32b0c8SAndre Fischer /** Show only the tab bar, not the deck. 997a32b0c8SAndre Fischer */ 1007a32b0c8SAndre Fischer void CloseDeck (void); 1017a32b0c8SAndre Fischer 1027a32b0c8SAndre Fischer /** Open the deck area and restore the parent window to its old width. 1037a32b0c8SAndre Fischer */ 1047a32b0c8SAndre Fischer void OpenDeck (void); 1057a32b0c8SAndre Fischer 106*65908a7eSAndre Fischer FocusManager& GetFocusManager (void); 107*65908a7eSAndre Fischer 10822de8995SAndre Fischer private: 109f120fe41SAndre Fischer ::boost::scoped_ptr<Deck> mpCurrentDeck; 1107a32b0c8SAndre Fischer SidebarDockingWindow* mpParentWindow; 1117a32b0c8SAndre Fischer ::boost::scoped_ptr<TabBar> mpTabBar; 11222de8995SAndre Fischer cssu::Reference<css::frame::XFrame> mxFrame; 1137a32b0c8SAndre Fischer Context maCurrentContext; 11495a18594SAndre Fischer ::rtl::OUString msCurrentDeckId; 11554eaaa32SAndre Fischer ::rtl::OUString msCurrentDeckTitle; 11695a18594SAndre Fischer AsynchronousCall maPropertyChangeForwarder; 1177a32b0c8SAndre Fischer bool mbIsDeckClosed; 1187a32b0c8SAndre Fischer /** Before the deck is closed the sidebar width is saved into this variable, 1197a32b0c8SAndre Fischer so that it can be restored when the deck is reopended. 1207a32b0c8SAndre Fischer */ 1217a32b0c8SAndre Fischer sal_Int32 mnSavedSidebarWidth; 122*65908a7eSAndre Fischer FocusManager maFocusManager; 12395a18594SAndre Fischer 12422de8995SAndre Fischer DECL_LINK(WindowEventHandler, VclWindowEvent*); 1257a32b0c8SAndre Fischer void UpdateConfigurations (const Context& rContext); 12602c50d82SAndre Fischer bool ArePanelSetsEqual ( 127f120fe41SAndre Fischer const SharedPanelContainer& rCurrentPanels, 128f120fe41SAndre Fischer const ResourceManager::PanelContextDescriptorContainer& rRequestedPanels); 129ff12d537SAndre Fischer cssu::Reference<css::ui::XUIElement> CreateUIElement ( 130ff12d537SAndre Fischer const cssu::Reference<css::awt::XWindowPeer>& rxWindow, 131f120fe41SAndre Fischer const ::rtl::OUString& rsImplementationURL); 132f120fe41SAndre Fischer SharedPanel CreatePanel ( 13395a18594SAndre Fischer const ::rtl::OUString& rsPanelId, 134f120fe41SAndre Fischer ::Window* pParentWindow, 135f120fe41SAndre Fischer const ::rtl::OUString& rsMenuCommand); 136ff12d537SAndre Fischer void SwitchToDeck ( 137ff12d537SAndre Fischer const DeckDescriptor& rDeckDescriptor, 1387a32b0c8SAndre Fischer const Context& rContext); 13995a18594SAndre Fischer void ShowPopupMenu ( 14095a18594SAndre Fischer const Rectangle& rButtonBox, 14195a18594SAndre Fischer const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData, 14295a18594SAndre Fischer const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const; 143f120fe41SAndre Fischer void ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) const; 14495a18594SAndre Fischer ::boost::shared_ptr<PopupMenu> CreatePopupMenu ( 14595a18594SAndre Fischer const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData, 14695a18594SAndre Fischer const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const; 147ff12d537SAndre Fischer DECL_LINK(OnMenuItemSelected, Menu*); 14895a18594SAndre Fischer void BroadcastPropertyChange (void); 14922de8995SAndre Fischer 1507a32b0c8SAndre Fischer /** The close of the deck changes the width of the child window. 1517a32b0c8SAndre Fischer That is only possible if there is no other docking window docked above or below the sidebar. 1527a32b0c8SAndre Fischer Return whether the width of the child window can be modified. 1537a32b0c8SAndre Fischer */ 1547a32b0c8SAndre Fischer bool CanModifyChildWindowWidth (void) const; 1557a32b0c8SAndre Fischer 1567a32b0c8SAndre Fischer /** Set the child window container to a new width. 1577a32b0c8SAndre Fischer Return the old width. 1587a32b0c8SAndre Fischer */ 1597a32b0c8SAndre Fischer sal_Int32 SetChildWindowWidth (const sal_Int32 nNewWidth); 1607a32b0c8SAndre Fischer 1617a32b0c8SAndre Fischer void RestrictWidth (void); 1627a32b0c8SAndre Fischer 16322de8995SAndre Fischer virtual void SAL_CALL disposing (void); 16422de8995SAndre Fischer }; 16522de8995SAndre Fischer 16622de8995SAndre Fischer 167ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar 16822de8995SAndre Fischer 16922de8995SAndre Fischer #endif 170