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