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" 2695a18594SAndre Fischer #include "AsynchronousCall.hxx" 2795a18594SAndre Fischer #include "TabBar.hxx" 287a32b0c8SAndre Fischer #include "Context.hxx" 2995a18594SAndre Fischer 3095a18594SAndre 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> 3595a18594SAndre Fischer #include <com/sun/star/ui/XUIElement.hpp> 367a32b0c8SAndre Fischer #include <com/sun/star/ui/XSidebar.hpp> 3795a18594SAndre Fischer 3822de8995SAndre Fischer #include <boost/noncopyable.hpp> 397a32b0c8SAndre Fischer #include <cppuhelper/compbase3.hxx> 4022de8995SAndre Fischer #include <cppuhelper/basemutex.hxx> 4122de8995SAndre Fischer 4222de8995SAndre Fischer namespace css = ::com::sun::star; 4322de8995SAndre Fischer namespace cssu = ::com::sun::star::uno; 4422de8995SAndre Fischer 457a32b0c8SAndre Fischer 4622de8995SAndre Fischer namespace 4722de8995SAndre Fischer { 487a32b0c8SAndre Fischer typedef ::cppu::WeakComponentImplHelper3 < 49b9e67834SAndre Fischer css::ui::XContextChangeEventListener, 507a32b0c8SAndre Fischer css::beans::XPropertyChangeListener, 517a32b0c8SAndre Fischer css::ui::XSidebar 5222de8995SAndre Fischer > SidebarControllerInterfaceBase; 5322de8995SAndre Fischer } 5422de8995SAndre Fischer 55ff12d537SAndre Fischer namespace sfx2 { namespace sidebar { 5622de8995SAndre Fischer 5795a18594SAndre Fischer class ContentPanelDescriptor; 5895a18594SAndre Fischer class Deck; 5995a18594SAndre Fischer class DeckConfiguration; 6095a18594SAndre Fischer class DeckDescriptor; 61b9e67834SAndre Fischer class Panel; 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 10622de8995SAndre Fischer private: 107ff12d537SAndre Fischer ::boost::shared_ptr<DeckConfiguration> mpCurrentConfiguration; 1087a32b0c8SAndre Fischer SidebarDockingWindow* mpParentWindow; 1097a32b0c8SAndre Fischer ::boost::scoped_ptr<TabBar> mpTabBar; 11022de8995SAndre Fischer cssu::Reference<css::frame::XFrame> mxFrame; 1117a32b0c8SAndre Fischer Context maCurrentContext; 11295a18594SAndre Fischer ::rtl::OUString msCurrentDeckId; 11395a18594SAndre Fischer AsynchronousCall maPropertyChangeForwarder; 1147a32b0c8SAndre Fischer bool mbIsDeckClosed; 1157a32b0c8SAndre Fischer /** Before the deck is closed the sidebar width is saved into this variable, 1167a32b0c8SAndre Fischer so that it can be restored when the deck is reopended. 1177a32b0c8SAndre Fischer */ 1187a32b0c8SAndre Fischer sal_Int32 mnSavedSidebarWidth; 11995a18594SAndre Fischer 12022de8995SAndre Fischer DECL_LINK(WindowEventHandler, VclWindowEvent*); 1217a32b0c8SAndre Fischer void UpdateConfigurations (const Context& rContext); 122*02c50d82SAndre Fischer bool ArePanelSetsEqual ( 123*02c50d82SAndre Fischer const ::std::vector<Panel*>& rCurrentPanels, 124*02c50d82SAndre Fischer const ResourceManager::IdContainer& rRequestedPanelIds); 125ff12d537SAndre Fischer cssu::Reference<css::ui::XUIElement> CreateUIElement ( 126ff12d537SAndre Fischer const cssu::Reference<css::awt::XWindowPeer>& rxWindow, 127b9e67834SAndre Fischer const ::rtl::OUString& rsImplementationURL, 1287a32b0c8SAndre Fischer Panel* pPanel); 12995a18594SAndre Fischer Panel* CreatePanel ( 13095a18594SAndre Fischer const ::rtl::OUString& rsPanelId, 1317a32b0c8SAndre Fischer ::Window* pParentWindow); 132ff12d537SAndre Fischer void SwitchToDeck ( 133ff12d537SAndre Fischer const DeckDescriptor& rDeckDescriptor, 1347a32b0c8SAndre Fischer const Context& rContext); 13595a18594SAndre Fischer void ShowPopupMenu ( 13695a18594SAndre Fischer const Rectangle& rButtonBox, 13795a18594SAndre Fischer const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData, 13895a18594SAndre Fischer const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const; 13995a18594SAndre Fischer ::boost::shared_ptr<PopupMenu> CreatePopupMenu ( 14095a18594SAndre Fischer const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData, 14195a18594SAndre Fischer const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const; 142ff12d537SAndre Fischer DECL_LINK(OnMenuItemSelected, Menu*); 14395a18594SAndre Fischer void BroadcastPropertyChange (void); 14422de8995SAndre Fischer 1457a32b0c8SAndre Fischer /** The close of the deck changes the width of the child window. 1467a32b0c8SAndre Fischer That is only possible if there is no other docking window docked above or below the sidebar. 1477a32b0c8SAndre Fischer Return whether the width of the child window can be modified. 1487a32b0c8SAndre Fischer */ 1497a32b0c8SAndre Fischer bool CanModifyChildWindowWidth (void) const; 1507a32b0c8SAndre Fischer 1517a32b0c8SAndre Fischer /** Set the child window container to a new width. 1527a32b0c8SAndre Fischer Return the old width. 1537a32b0c8SAndre Fischer */ 1547a32b0c8SAndre Fischer sal_Int32 SetChildWindowWidth (const sal_Int32 nNewWidth); 1557a32b0c8SAndre Fischer 1567a32b0c8SAndre Fischer void RestrictWidth (void); 1577a32b0c8SAndre Fischer 15822de8995SAndre Fischer virtual void SAL_CALL disposing (void); 15922de8995SAndre Fischer }; 16022de8995SAndre Fischer 16122de8995SAndre Fischer 162ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar 16322de8995SAndre Fischer 16422de8995SAndre Fischer #endif 165