Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #ifndef SD_TOOLPANEL_TASK_PANE_SHELL_MANAGER_HXX
21 : : #define SD_TOOLPANEL_TASK_PANE_SHELL_MANAGER_HXX
22 : :
23 : : #include "ShellFactory.hxx"
24 : : #include "ViewShellManager.hxx"
25 : : #include <tools/link.hxx>
26 : : #include <map>
27 : :
28 : : class FrameView;
29 : : class SfxShell;
30 : : class VclWindowEvent;
31 : : class Window;
32 : :
33 : : namespace sd {
34 : : class ViewShell;
35 : : }
36 : :
37 : : namespace sd { namespace toolpanel {
38 : :
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.
44 : : */
45 : : class TaskPaneShellManager
46 : : : public ShellFactory<SfxShell>
47 : : {
48 : : public:
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.
51 : : */
52 : : TaskPaneShellManager (
53 : : const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager,
54 : : const ViewShell& rViewShell);
55 : : ~TaskPaneShellManager (void);
56 : :
57 : : /** Return the requested sub shell.
58 : : @param nId
59 : : The id of the requested sub shell.
60 : : @return
61 : : When there is no sub shell currently registered under the given
62 : : id then NULL is returned.
63 : : */
64 : : virtual SfxShell* CreateShell (
65 : : ShellId nId,
66 : : ::Window* pParentWindow,
67 : : FrameView* pFrameView = NULL);
68 : :
69 : : virtual void ReleaseShell (SfxShell* pShell);
70 : :
71 : : /** Add a sub shell to the set of sub shells managed by the
72 : : TaskPaneShellManager. Only shells added by this method are returned
73 : : by CreateShell().
74 : : */
75 : : void AddSubShell (ShellId nId, SfxShell* pShell, ::Window* pWindow);
76 : :
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.
80 : : */
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.
85 : : */
86 : : void RemoveSubShell (const ShellId i_nShellId);
87 : :
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.
91 : : */
92 : : void MoveToTop (SfxShell* pShell);
93 : :
94 : : DECL_LINK(WindowCallback,VclWindowEvent*);
95 : :
96 : : private:
97 : : ::boost::shared_ptr<ViewShellManager> mpViewShellManager;
98 : :
99 : : /// The view shell whose sub-shells this class manages.
100 : : const ViewShell& mrViewShell;
101 : :
102 : : class ShellDescriptor { public:
103 : : SfxShell* mpShell;
104 : : ::Window* mpWindow;
105 : 15 : ShellDescriptor(void) : mpShell(NULL),mpWindow(NULL){}
106 : 15 : ShellDescriptor(SfxShell*pShell,::Window*pWindow) : mpShell(pShell),mpWindow(pWindow){}
107 : : };
108 : : typedef ::std::map<ShellId,ShellDescriptor> SubShells;
109 : : SubShells maSubShells;
110 : : };
111 : :
112 : : } } // end of namespace ::sd::toolpanel
113 : :
114 : : #endif
115 : :
116 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|