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