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" 2765908a7eSAndre Fischer #include "FocusManager.hxx" 28f120fe41SAndre Fischer #include "Panel.hxx" 2965908a7eSAndre Fischer #include "ResourceManager.hxx" 3065908a7eSAndre 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 10665908a7eSAndre Fischer FocusManager& GetFocusManager (void); 10765908a7eSAndre 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; 114*239cbbc0SAndre Fischer Context maRequestedContext; 11595a18594SAndre Fischer ::rtl::OUString msCurrentDeckId; 11654eaaa32SAndre Fischer ::rtl::OUString msCurrentDeckTitle; 11795a18594SAndre Fischer AsynchronousCall maPropertyChangeForwarder; 118*239cbbc0SAndre Fischer AsynchronousCall maContextChangeUpdate; 1197a32b0c8SAndre Fischer bool mbIsDeckClosed; 1207a32b0c8SAndre Fischer /** Before the deck is closed the sidebar width is saved into this variable, 1217a32b0c8SAndre Fischer so that it can be restored when the deck is reopended. 1227a32b0c8SAndre Fischer */ 1237a32b0c8SAndre Fischer sal_Int32 mnSavedSidebarWidth; 12465908a7eSAndre Fischer FocusManager maFocusManager; 12595a18594SAndre Fischer 12622de8995SAndre Fischer DECL_LINK(WindowEventHandler, VclWindowEvent*); 127*239cbbc0SAndre Fischer /** Make maRequestedContext the current context. 128*239cbbc0SAndre Fischer */ 129*239cbbc0SAndre Fischer void UpdateConfigurations (void); 13002c50d82SAndre Fischer bool ArePanelSetsEqual ( 131f120fe41SAndre Fischer const SharedPanelContainer& rCurrentPanels, 132f120fe41SAndre Fischer const ResourceManager::PanelContextDescriptorContainer& rRequestedPanels); 133ff12d537SAndre Fischer cssu::Reference<css::ui::XUIElement> CreateUIElement ( 134ff12d537SAndre Fischer const cssu::Reference<css::awt::XWindowPeer>& rxWindow, 13522f77e9eSAndre Fischer const ::rtl::OUString& rsImplementationURL, 13622f77e9eSAndre Fischer const bool bWantsCanvas); 137f120fe41SAndre Fischer SharedPanel CreatePanel ( 13895a18594SAndre Fischer const ::rtl::OUString& rsPanelId, 139f120fe41SAndre Fischer ::Window* pParentWindow, 140f120fe41SAndre Fischer const ::rtl::OUString& rsMenuCommand); 141ff12d537SAndre Fischer void SwitchToDeck ( 142ff12d537SAndre Fischer const DeckDescriptor& rDeckDescriptor, 1437a32b0c8SAndre Fischer const Context& rContext); 14495a18594SAndre Fischer void ShowPopupMenu ( 14595a18594SAndre Fischer const Rectangle& rButtonBox, 14695a18594SAndre Fischer const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData, 14795a18594SAndre Fischer const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const; 148f120fe41SAndre Fischer void ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) const; 14995a18594SAndre Fischer ::boost::shared_ptr<PopupMenu> CreatePopupMenu ( 15095a18594SAndre Fischer const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData, 15195a18594SAndre Fischer const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const; 152ff12d537SAndre Fischer DECL_LINK(OnMenuItemSelected, Menu*); 15395a18594SAndre Fischer void BroadcastPropertyChange (void); 15422de8995SAndre Fischer 1557a32b0c8SAndre Fischer /** The close of the deck changes the width of the child window. 1567a32b0c8SAndre Fischer That is only possible if there is no other docking window docked above or below the sidebar. 1577a32b0c8SAndre Fischer Return whether the width of the child window can be modified. 1587a32b0c8SAndre Fischer */ 1597a32b0c8SAndre Fischer bool CanModifyChildWindowWidth (void) const; 1607a32b0c8SAndre Fischer 1617a32b0c8SAndre Fischer /** Set the child window container to a new width. 1627a32b0c8SAndre Fischer Return the old width. 1637a32b0c8SAndre Fischer */ 1647a32b0c8SAndre Fischer sal_Int32 SetChildWindowWidth (const sal_Int32 nNewWidth); 1657a32b0c8SAndre Fischer 1667a32b0c8SAndre Fischer void RestrictWidth (void); 1677a32b0c8SAndre Fischer 16822de8995SAndre Fischer virtual void SAL_CALL disposing (void); 16922de8995SAndre Fischer }; 17022de8995SAndre Fischer 17122de8995SAndre Fischer 172ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar 17322de8995SAndre Fischer 17422de8995SAndre Fischer #endif 175