Update ooo320-m1
[ooovba.git] / sd / source / ui / toolpanel / TaskPaneShellManager.hxx
blobe7a6a2a5b3fd6a56667b6b5f8d9defa1a2ecefc5
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: TaskPaneShellManager.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SD_TOOLPANEL_TASK_PANE_SHELL_MANAGER_HXX
32 #define SD_TOOLPANEL_TASK_PANE_SHELL_MANAGER_HXX
34 #include "ShellFactory.hxx"
35 #include "ViewShellManager.hxx"
36 #include <map>
38 class FrameView;
39 class SfxShell;
40 class VclWindowEvent;
41 class Window;
43 namespace sd {
44 class ViewShell;
47 namespace sd { namespace toolpanel {
49 /** The TaskPaneShellManager implements the ViewShellManager::ShellFactory
50 interface. However, it does not create or delete shells. It only
51 gives the ViewShellManager access to the sub shells of the
52 TaskPaneViewShell. Life time control of the sub shells is managed by
53 the sub shells themselves.
55 class TaskPaneShellManager
56 : public ShellFactory<SfxShell>
58 public:
59 /** Create a shell manager that manages the stacked shells for the given
60 view shell. It works together with the given view shell manager.
62 TaskPaneShellManager (
63 const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager,
64 const ViewShell& rViewShell);
65 ~TaskPaneShellManager (void);
67 /** Return the requested sub shell.
68 @param nId
69 The id of the requested sub shell.
70 @return
71 When there is no sub shell currently registered under the given
72 id then NULL is returned.
74 virtual SfxShell* CreateShell (
75 ShellId nId,
76 ::Window* pParentWindow,
77 FrameView* pFrameView = NULL);
79 virtual void ReleaseShell (SfxShell* pShell);
81 /** Add a sub shell to the set of sub shells managed by the
82 TaskPaneShellManager. Only shells added by this method are returned
83 by CreateShell().
85 void AddSubShell (ShellId nId, SfxShell* pShell, ::Window* pWindow);
87 /** Remove the given shell from the set of sub shells managed by the
88 TaskPaneShellManager. Following calls to CreateShell() will return
89 NULL when this shell is requested.
91 void RemoveSubShell (const SfxShell* pShell);
93 /** Move the given sub-shell to the top of the local shell stack.
94 Furthermore move the view shell whose sub-shells this class manages
95 to the top of the global shell stack.
97 void MoveToTop (SfxShell* pShell);
99 DECL_LINK(WindowCallback,VclWindowEvent*);
101 private:
102 ::boost::shared_ptr<ViewShellManager> mpViewShellManager;
104 /// The view shell whose sub-shells this class manages.
105 const ViewShell& mrViewShell;
107 class ShellDescriptor { public:
108 SfxShell* mpShell;
109 ::Window* mpWindow;
110 ShellDescriptor(void) : mpShell(NULL),mpWindow(NULL){}
111 ShellDescriptor(SfxShell*pShell,::Window*pWindow) : mpShell(pShell),mpWindow(pWindow){}
113 typedef ::std::map<ShellId,ShellDescriptor> SubShells;
114 SubShells maSubShells;
117 } } // end of namespace ::sd::toolpanel
119 #endif