1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 #ifndef SD_SIDEBAR_SHELL_MANAGER_HXX 23 #define SD_SIDEBAR_SHELL_MANAGER_HXX 24 25 #include "ShellFactory.hxx" 26 #include "ViewShellManager.hxx" 27 #include <map> 28 29 class FrameView; 30 class SfxShell; 31 class VclWindowEvent; 32 class Window; 33 34 namespace sd { 35 class ViewShell; 36 } 37 38 namespace sd { namespace sidebar { 39 40 /** The TaskPaneShellManager implements the ViewShellManager::ShellFactory 41 interface. However, it does not create or delete shells. It only 42 gives the ViewShellManager access to the sub shells of the 43 ToolPanelViewShell. Life time control of the sub shells is managed by 44 the sub shells themselves. 45 */ 46 class SidebarShellManager 47 : public ShellFactory<SfxShell> 48 { 49 public: 50 /** Create a shell manager that manages the stacked shells for the given 51 view shell. It works together with the given view shell manager. 52 */ 53 SidebarShellManager ( 54 const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager, 55 const ViewShell& rViewShell); 56 ~SidebarShellManager (void); 57 58 /** Return the requested sub shell. 59 @param nId 60 The id of the requested sub shell. 61 @return 62 When there is no sub shell currently registered under the given 63 id then NULL is returned. 64 */ 65 virtual SfxShell* CreateShell ( 66 ShellId nId, 67 ::Window* pParentWindow, 68 FrameView* pFrameView = NULL); 69 70 virtual void ReleaseShell (SfxShell* pShell); 71 72 /** Add a sub shell to the set of sub shells managed by the 73 TaskPaneShellManager. Only shells added by this method are returned 74 by CreateShell(). 75 */ 76 void AddSubShell (ShellId nId, SfxShell* pShell, ::Window* pWindow); 77 78 /** Remove the given shell from the set of sub shells managed by the 79 TaskPaneShellManager. Following calls to CreateShell() will return 80 NULL when this shell is requested. 81 */ 82 void RemoveSubShell (const SfxShell* pShell); 83 /** removes the shell given by its ID from the set of sub shells managed by the 84 TaskPaneShellManager. Subsequent calls to CreateShell() will return 85 NULL when this shell is requested. 86 */ 87 void RemoveSubShell (const ShellId i_nShellId); 88 89 /** Move the given sub-shell to the top of the local shell stack. 90 Furthermore move the view shell whose sub-shells this class manages 91 to the top of the global shell stack. 92 */ 93 void MoveToTop (SfxShell* pShell); 94 95 DECL_LINK(WindowCallback,VclWindowEvent*); 96 97 private: 98 ::boost::shared_ptr<ViewShellManager> mpViewShellManager; 99 100 // The view shell whose sub-shells this class manages. 101 const ViewShell& mrViewShell; 102 103 class ShellDescriptor { public: 104 SfxShell* mpShell; 105 ::Window* mpWindow; 106 ShellDescriptor(void) : mpShell(NULL),mpWindow(NULL){} 107 ShellDescriptor(SfxShell*pShell,::Window*pWindow) : mpShell(pShell),mpWindow(pWindow){} 108 }; 109 typedef ::std::map<ShellId,ShellDescriptor> SubShells; 110 SubShells maSubShells; 111 }; 112 113 } } // end of namespace ::sd::sidebar 114 115 #endif 116 117 /* vim: set noet sw=4 ts=4: */ 118