102c50d82SAndre Fischer /************************************************************** 202c50d82SAndre Fischer * 302c50d82SAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one 402c50d82SAndre Fischer * or more contributor license agreements. See the NOTICE file 502c50d82SAndre Fischer * distributed with this work for additional information 602c50d82SAndre Fischer * regarding copyright ownership. The ASF licenses this file 702c50d82SAndre Fischer * to you under the Apache License, Version 2.0 (the 802c50d82SAndre Fischer * "License"); you may not use this file except in compliance 902c50d82SAndre Fischer * with the License. You may obtain a copy of the License at 1002c50d82SAndre Fischer * 1102c50d82SAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0 1202c50d82SAndre Fischer * 1302c50d82SAndre Fischer * Unless required by applicable law or agreed to in writing, 1402c50d82SAndre Fischer * software distributed under the License is distributed on an 1502c50d82SAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1602c50d82SAndre Fischer * KIND, either express or implied. See the License for the 1702c50d82SAndre Fischer * specific language governing permissions and limitations 1802c50d82SAndre Fischer * under the License. 1902c50d82SAndre Fischer * 2002c50d82SAndre Fischer *************************************************************/ 2102c50d82SAndre Fischer 2202c50d82SAndre Fischer #ifndef SD_SIDEBAR_SHELL_MANAGER_HXX 2302c50d82SAndre Fischer #define SD_SIDEBAR_SHELL_MANAGER_HXX 2402c50d82SAndre Fischer 2502c50d82SAndre Fischer #include "ShellFactory.hxx" 2602c50d82SAndre Fischer #include "ViewShellManager.hxx" 2702c50d82SAndre Fischer #include <map> 2802c50d82SAndre Fischer 2902c50d82SAndre Fischer class FrameView; 3002c50d82SAndre Fischer class SfxShell; 3102c50d82SAndre Fischer class VclWindowEvent; 3202c50d82SAndre Fischer class Window; 3302c50d82SAndre Fischer 3402c50d82SAndre Fischer namespace sd { 3502c50d82SAndre Fischer class ViewShell; 3602c50d82SAndre Fischer } 3702c50d82SAndre Fischer 3802c50d82SAndre Fischer namespace sd { namespace sidebar { 3902c50d82SAndre Fischer 4002c50d82SAndre Fischer /** The TaskPaneShellManager implements the ViewShellManager::ShellFactory 4102c50d82SAndre Fischer interface. However, it does not create or delete shells. It only 4202c50d82SAndre Fischer gives the ViewShellManager access to the sub shells of the 4302c50d82SAndre Fischer ToolPanelViewShell. Life time control of the sub shells is managed by 4402c50d82SAndre Fischer the sub shells themselves. 4502c50d82SAndre Fischer */ 4602c50d82SAndre Fischer class SidebarShellManager 4702c50d82SAndre Fischer : public ShellFactory<SfxShell> 4802c50d82SAndre Fischer { 4902c50d82SAndre Fischer public: 5002c50d82SAndre Fischer /** Create a shell manager that manages the stacked shells for the given 5102c50d82SAndre Fischer view shell. It works together with the given view shell manager. 5202c50d82SAndre Fischer */ 5302c50d82SAndre Fischer SidebarShellManager ( 5402c50d82SAndre Fischer const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager, 5502c50d82SAndre Fischer const ViewShell& rViewShell); 5602c50d82SAndre Fischer ~SidebarShellManager (void); 5702c50d82SAndre Fischer 5802c50d82SAndre Fischer /** Return the requested sub shell. 5902c50d82SAndre Fischer @param nId 6002c50d82SAndre Fischer The id of the requested sub shell. 6102c50d82SAndre Fischer @return 6202c50d82SAndre Fischer When there is no sub shell currently registered under the given 6302c50d82SAndre Fischer id then NULL is returned. 6402c50d82SAndre Fischer */ 6502c50d82SAndre Fischer virtual SfxShell* CreateShell ( 6602c50d82SAndre Fischer ShellId nId, 6702c50d82SAndre Fischer ::Window* pParentWindow, 6802c50d82SAndre Fischer FrameView* pFrameView = NULL); 6902c50d82SAndre Fischer 7002c50d82SAndre Fischer virtual void ReleaseShell (SfxShell* pShell); 7102c50d82SAndre Fischer 7202c50d82SAndre Fischer /** Add a sub shell to the set of sub shells managed by the 7302c50d82SAndre Fischer TaskPaneShellManager. Only shells added by this method are returned 7402c50d82SAndre Fischer by CreateShell(). 7502c50d82SAndre Fischer */ 7602c50d82SAndre Fischer void AddSubShell (ShellId nId, SfxShell* pShell, ::Window* pWindow); 7702c50d82SAndre Fischer 7802c50d82SAndre Fischer /** Remove the given shell from the set of sub shells managed by the 7902c50d82SAndre Fischer TaskPaneShellManager. Following calls to CreateShell() will return 8002c50d82SAndre Fischer NULL when this shell is requested. 8102c50d82SAndre Fischer */ 8202c50d82SAndre Fischer void RemoveSubShell (const SfxShell* pShell); 8302c50d82SAndre Fischer /** removes the shell given by its ID from the set of sub shells managed by the 8402c50d82SAndre Fischer TaskPaneShellManager. Subsequent calls to CreateShell() will return 8502c50d82SAndre Fischer NULL when this shell is requested. 8602c50d82SAndre Fischer */ 8702c50d82SAndre Fischer void RemoveSubShell (const ShellId i_nShellId); 8802c50d82SAndre Fischer 8902c50d82SAndre Fischer /** Move the given sub-shell to the top of the local shell stack. 9002c50d82SAndre Fischer Furthermore move the view shell whose sub-shells this class manages 9102c50d82SAndre Fischer to the top of the global shell stack. 9202c50d82SAndre Fischer */ 9302c50d82SAndre Fischer void MoveToTop (SfxShell* pShell); 9402c50d82SAndre Fischer 9502c50d82SAndre Fischer DECL_LINK(WindowCallback,VclWindowEvent*); 9602c50d82SAndre Fischer 9702c50d82SAndre Fischer private: 9802c50d82SAndre Fischer ::boost::shared_ptr<ViewShellManager> mpViewShellManager; 9902c50d82SAndre Fischer 100*6c3f4600Smseidel // The view shell whose sub-shells this class manages. 10102c50d82SAndre Fischer const ViewShell& mrViewShell; 10202c50d82SAndre Fischer 10302c50d82SAndre Fischer class ShellDescriptor { public: 10402c50d82SAndre Fischer SfxShell* mpShell; 10502c50d82SAndre Fischer ::Window* mpWindow; ShellDescriptor(void)10602c50d82SAndre Fischer ShellDescriptor(void) : mpShell(NULL),mpWindow(NULL){} ShellDescriptor(SfxShell * pShell,::Window * pWindow)10702c50d82SAndre Fischer ShellDescriptor(SfxShell*pShell,::Window*pWindow) : mpShell(pShell),mpWindow(pWindow){} 10802c50d82SAndre Fischer }; 10902c50d82SAndre Fischer typedef ::std::map<ShellId,ShellDescriptor> SubShells; 11002c50d82SAndre Fischer SubShells maSubShells; 11102c50d82SAndre Fischer }; 11202c50d82SAndre Fischer 11302c50d82SAndre Fischer } } // end of namespace ::sd::sidebar 11402c50d82SAndre Fischer 11502c50d82SAndre Fischer #endif 116*6c3f4600Smseidel 117*6c3f4600Smseidel /* vim: set noet sw=4 ts=4: */ 118