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