1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SD_TOOLPANEL_TASK_PANE_SHELL_MANAGER_HXX
21 #define SD_TOOLPANEL_TASK_PANE_SHELL_MANAGER_HXX
23 #include "ShellFactory.hxx"
24 #include "ViewShellManager.hxx"
25 #include <tools/link.hxx>
37 namespace sd
{ namespace toolpanel
{
39 /** The TaskPaneShellManager implements the ViewShellManager::ShellFactory
40 interface. However, it does not create or delete shells. It only
41 gives the ViewShellManager access to the sub shells of the
42 ToolPanelViewShell. Life time control of the sub shells is managed by
43 the sub shells themselves.
45 class TaskPaneShellManager
46 : public ShellFactory
<SfxShell
>
49 /** Create a shell manager that manages the stacked shells for the given
50 view shell. It works together with the given view shell manager.
52 TaskPaneShellManager (
53 const ::boost::shared_ptr
<ViewShellManager
>& rpViewShellManager
,
54 const ViewShell
& rViewShell
);
55 ~TaskPaneShellManager (void);
57 /** Return the requested sub shell.
59 The id of the requested sub shell.
61 When there is no sub shell currently registered under the given
62 id then NULL is returned.
64 virtual SfxShell
* CreateShell (
66 ::Window
* pParentWindow
,
67 FrameView
* pFrameView
= NULL
);
69 virtual void ReleaseShell (SfxShell
* pShell
);
71 /** Add a sub shell to the set of sub shells managed by the
72 TaskPaneShellManager. Only shells added by this method are returned
75 void AddSubShell (ShellId nId
, SfxShell
* pShell
, ::Window
* pWindow
);
77 /** Remove the given shell from the set of sub shells managed by the
78 TaskPaneShellManager. Following calls to CreateShell() will return
79 NULL when this shell is requested.
81 void RemoveSubShell (const SfxShell
* pShell
);
82 /** removes the shell given by its ID from the set of sub shells managed by the
83 TaskPaneShellManager. Subsequent calls to CreateShell() will return
84 NULL when this shell is requested.
86 void RemoveSubShell (const ShellId i_nShellId
);
88 /** Move the given sub-shell to the top of the local shell stack.
89 Furthermore move the view shell whose sub-shells this class manages
90 to the top of the global shell stack.
92 void MoveToTop (SfxShell
* pShell
);
94 DECL_LINK(WindowCallback
,VclWindowEvent
*);
97 ::boost::shared_ptr
<ViewShellManager
> mpViewShellManager
;
99 /// The view shell whose sub-shells this class manages.
100 const ViewShell
& mrViewShell
;
102 class ShellDescriptor
{ public:
105 ShellDescriptor(void) : mpShell(NULL
),mpWindow(NULL
){}
106 ShellDescriptor(SfxShell
*pShell
,::Window
*pWindow
) : mpShell(pShell
),mpWindow(pWindow
){}
108 typedef ::std::map
<ShellId
,ShellDescriptor
> SubShells
;
109 SubShells maSubShells
;
112 } } // end of namespace ::sd::toolpanel
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */