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" 29f120fe41SAndre Fischer #include "Panel.hxx" 3095a18594SAndre Fischer 3195a18594SAndre Fischer #include <vcl/menu.hxx> 3222de8995SAndre Fischer 33b9e67834SAndre Fischer #include <com/sun/star/awt/XWindowPeer.hpp> 34b9e67834SAndre Fischer #include <com/sun/star/beans/XPropertyChangeListener.hpp> 3522de8995SAndre Fischer #include <com/sun/star/ui/XContextChangeEventListener.hpp> 3695a18594SAndre Fischer #include <com/sun/star/ui/XUIElement.hpp> 377a32b0c8SAndre Fischer #include <com/sun/star/ui/XSidebar.hpp> 3895a18594SAndre Fischer 3922de8995SAndre Fischer #include <boost/noncopyable.hpp> 407a32b0c8SAndre Fischer #include <cppuhelper/compbase3.hxx> 4122de8995SAndre Fischer #include <cppuhelper/basemutex.hxx> 4222de8995SAndre Fischer 4322de8995SAndre Fischer namespace css = ::com::sun::star; 4422de8995SAndre Fischer namespace cssu = ::com::sun::star::uno; 4522de8995SAndre Fischer 467a32b0c8SAndre Fischer 4722de8995SAndre Fischer namespace 4822de8995SAndre Fischer { 497a32b0c8SAndre Fischer typedef ::cppu::WeakComponentImplHelper3 < 50b9e67834SAndre Fischer css::ui::XContextChangeEventListener, 517a32b0c8SAndre Fischer css::beans::XPropertyChangeListener, 527a32b0c8SAndre Fischer css::ui::XSidebar 5322de8995SAndre Fischer > SidebarControllerInterfaceBase; 5422de8995SAndre Fischer } 5522de8995SAndre Fischer 56ff12d537SAndre Fischer namespace sfx2 { namespace sidebar { 5722de8995SAndre Fischer 5895a18594SAndre Fischer class ContentPanelDescriptor; 5995a18594SAndre Fischer class Deck; 6095a18594SAndre Fischer class DeckDescriptor; 617a32b0c8SAndre Fischer class SidebarDockingWindow; 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( 727a32b0c8SAndre Fischer SidebarDockingWindow* 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); 877a32b0c8SAndre Fischer 887a32b0c8SAndre Fischer // ui::XSidebar 897a32b0c8SAndre Fischer virtual void SAL_CALL requestLayout (void) 907a32b0c8SAndre Fischer throw(cssu::RuntimeException); 91b9e67834SAndre Fischer 9222de8995SAndre Fischer void NotifyResize (void); 9322de8995SAndre Fischer 94ff12d537SAndre Fischer void SwitchToDeck ( 9595a18594SAndre Fischer const ::rtl::OUString& rsDeckId); 96ff12d537SAndre Fischer 977a32b0c8SAndre Fischer /** Show only the tab bar, not the deck. 987a32b0c8SAndre Fischer */ 997a32b0c8SAndre Fischer void CloseDeck (void); 1007a32b0c8SAndre Fischer 1017a32b0c8SAndre Fischer /** Open the deck area and restore the parent window to its old width. 1027a32b0c8SAndre Fischer */ 1037a32b0c8SAndre Fischer void OpenDeck (void); 1047a32b0c8SAndre Fischer 10522de8995SAndre Fischer private: 106f120fe41SAndre Fischer ::boost::scoped_ptr<Deck> mpCurrentDeck; 1077a32b0c8SAndre Fischer SidebarDockingWindow* mpParentWindow; 1087a32b0c8SAndre Fischer ::boost::scoped_ptr<TabBar> mpTabBar; 10922de8995SAndre Fischer cssu::Reference<css::frame::XFrame> mxFrame; 1107a32b0c8SAndre Fischer Context maCurrentContext; 11195a18594SAndre Fischer ::rtl::OUString msCurrentDeckId; 112*54eaaa32SAndre Fischer ::rtl::OUString msCurrentDeckTitle; 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); 12202c50d82SAndre Fischer bool ArePanelSetsEqual ( 123f120fe41SAndre Fischer const SharedPanelContainer& rCurrentPanels, 124f120fe41SAndre Fischer const ResourceManager::PanelContextDescriptorContainer& rRequestedPanels); 125ff12d537SAndre Fischer cssu::Reference<css::ui::XUIElement> CreateUIElement ( 126ff12d537SAndre Fischer const cssu::Reference<css::awt::XWindowPeer>& rxWindow, 127f120fe41SAndre Fischer const ::rtl::OUString& rsImplementationURL); 128f120fe41SAndre Fischer SharedPanel CreatePanel ( 12995a18594SAndre Fischer const ::rtl::OUString& rsPanelId, 130f120fe41SAndre Fischer ::Window* pParentWindow, 131f120fe41SAndre Fischer const ::rtl::OUString& rsMenuCommand); 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; 139f120fe41SAndre Fischer void ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) const; 14095a18594SAndre Fischer ::boost::shared_ptr<PopupMenu> CreatePopupMenu ( 14195a18594SAndre Fischer const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData, 14295a18594SAndre Fischer const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const; 143ff12d537SAndre Fischer DECL_LINK(OnMenuItemSelected, Menu*); 14495a18594SAndre Fischer void BroadcastPropertyChange (void); 14522de8995SAndre Fischer 1467a32b0c8SAndre Fischer /** The close of the deck changes the width of the child window. 1477a32b0c8SAndre Fischer That is only possible if there is no other docking window docked above or below the sidebar. 1487a32b0c8SAndre Fischer Return whether the width of the child window can be modified. 1497a32b0c8SAndre Fischer */ 1507a32b0c8SAndre Fischer bool CanModifyChildWindowWidth (void) const; 1517a32b0c8SAndre Fischer 1527a32b0c8SAndre Fischer /** Set the child window container to a new width. 1537a32b0c8SAndre Fischer Return the old width. 1547a32b0c8SAndre Fischer */ 1557a32b0c8SAndre Fischer sal_Int32 SetChildWindowWidth (const sal_Int32 nNewWidth); 1567a32b0c8SAndre Fischer 1577a32b0c8SAndre Fischer void RestrictWidth (void); 1587a32b0c8SAndre Fischer 15922de8995SAndre Fischer virtual void SAL_CALL disposing (void); 16022de8995SAndre Fischer }; 16122de8995SAndre Fischer 16222de8995SAndre Fischer 163ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar 16422de8995SAndre Fischer 16522de8995SAndre Fischer #endif 166