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 INCLUDED_SD_SOURCE_UI_INC_FORMSHELLMANAGER_HXX
21 : #define INCLUDED_SD_SOURCE_UI_INC_FORMSHELLMANAGER_HXX
22 :
23 : #include <ViewShellManager.hxx>
24 :
25 : #include <tools/link.hxx>
26 : #include <svl/lstner.hxx>
27 :
28 : class VclWindowEvent;
29 : class FmFormShell;
30 :
31 : namespace sd { namespace tools { class EventMultiplexerEvent; } }
32 :
33 : namespace sd {
34 :
35 : class ViewShellBase;
36 :
37 : /** This simple class is responsible for putting the form shell above or
38 : below the main view shell on the shell stack maintained by the ObjectBarManager.
39 :
40 : The form shell is moved above the view shell when the form shell is
41 : activated, i.e. the FormControlActivated handler is called.
42 :
43 : It is moved below the view shell when the main window of the
44 : main view shell is focused.
45 :
46 : The form shell is created and destroyed by the ViewShellManager by using
47 : a factory object provided by the FormShellManager.
48 : */
49 : class FormShellManager
50 : : public SfxListener
51 : {
52 : public:
53 : FormShellManager (ViewShellBase& rBase);
54 : virtual ~FormShellManager (void);
55 :
56 : /** Typically called by a ShellFactory. It tells the
57 : FormShellManager which form shell to manage.
58 : @param pFormShell
59 : This may be <NULL/> to disconnect the ViewShellManager from the
60 : form shell.
61 : */
62 : void SetFormShell (FmFormShell* pFormShell);
63 :
64 : /** Return the form shell last set with SetFormShell().
65 : @return
66 : The result may be <NULL/> when the SetFormShell() method has not
67 : yet been called or was last called with <NULL/>.
68 : */
69 2201 : FmFormShell* GetFormShell (void) { return mpFormShell;}
70 :
71 : private:
72 : ViewShellBase& mrBase;
73 :
74 : /** Ownership of the form shell lies with the ViewShellManager. This
75 : reference is kept so that the FormShellManager can detect when a new
76 : form shell is passed to SetFormShell().
77 : */
78 : FmFormShell* mpFormShell;
79 :
80 : /** Remember whether the form shell is currently above or below the main
81 : view shell.
82 : */
83 : bool mbFormShellAboveViewShell;
84 :
85 : /** The factory is remembered so that it removed from the
86 : ViewShellManager when the FormShellManager is destroyed.
87 : */
88 : ViewShellManager::SharedShellFactory mpSubShellFactory;
89 :
90 : bool mbIsMainViewChangePending;
91 :
92 : vcl::Window* mpMainViewShellWindow;
93 :
94 : /** Register at window of center pane and at the form shell that
95 : represents the form tool bar. The former informs this manager about
96 : the deselection of the form shell. The later informs about its
97 : selection.
98 : */
99 : void RegisterAtCenterPane (void);
100 :
101 : /** Unregister the listeners that were registered in
102 : RegisterAtCenterPane().
103 : */
104 : void UnregisterAtCenterPane (void);
105 :
106 : /** This call back is called by the application window (among others)
107 : when the window gets the focus. In this case the form shell is
108 : moved to the bottom of the shell stack.
109 : */
110 : DECL_LINK(WindowEventHandler, VclWindowEvent*);
111 :
112 : /** This call back is called when view in the center pane is replaced.
113 : When this happens then we unregister at the window of the old and
114 : register at the window of the new shell.
115 : */
116 : DECL_LINK(ConfigurationUpdateHandler, ::sd::tools::EventMultiplexerEvent*);
117 :
118 : /** This call back is called by the form shell when it gets the focus.
119 : In this case the form shell is moved to the top of the shell stack.
120 : */
121 : DECL_LINK(FormControlActivated, void *);
122 :
123 : /** This method is called by the form shell when that is destroyed. It
124 : acts as a last resort against referencing a dead form shell. With
125 : the factory working properly this method should not be necessary
126 : (and may be removed in the future.)
127 : */
128 : virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) SAL_OVERRIDE;
129 : };
130 :
131 : } // end of namespace sd
132 :
133 : #endif
134 :
135 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|