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 .
22 #include "ViewShellManager.hxx"
24 #include <tools/link.hxx>
25 #include <svl/lstner.hxx>
26 #include <vcl/vclptr.hxx>
37 class EventMultiplexerEvent
;
44 /** This simple class is responsible for putting the form shell above or
45 below the main view shell on the shell stack maintained by the ObjectBarManager.
47 The form shell is moved above the view shell when the form shell is
48 activated, i.e. the FormControlActivated handler is called.
50 It is moved below the view shell when the main window of the
51 main view shell is focused.
53 The form shell is created and destroyed by the ViewShellManager by using
54 a factory object provided by the FormShellManager.
56 class FormShellManager final
: public SfxListener
59 FormShellManager(ViewShellBase
& rBase
);
60 virtual ~FormShellManager() override
;
62 /** Typically called by a ShellFactory. It tells the
63 FormShellManager which form shell to manage.
65 This may be <NULL/> to disconnect the ViewShellManager from the
68 void SetFormShell(FmFormShell
* pFormShell
);
70 /** Return the form shell last set with SetFormShell().
72 The result may be <NULL/> when the SetFormShell() method has not
73 yet been called or was last called with <NULL/>.
75 FmFormShell
* GetFormShell() { return mpFormShell
; }
78 ViewShellBase
& mrBase
;
80 /** Ownership of the form shell lies with the ViewShellManager. This
81 reference is kept so that the FormShellManager can detect when a new
82 form shell is passed to SetFormShell().
84 FmFormShell
* mpFormShell
;
86 /** Remember whether the form shell is currently above or below the main
89 bool mbFormShellAboveViewShell
;
91 /** The factory is remembered so that it removed from the
92 ViewShellManager when the FormShellManager is destroyed.
94 ViewShellManager::SharedShellFactory mpSubShellFactory
;
96 bool mbIsMainViewChangePending
;
98 VclPtr
<vcl::Window
> mpMainViewShellWindow
;
100 /** Register at window of center pane and at the form shell that
101 represents the form tool bar. The former informs this manager about
102 the deselection of the form shell. The later informs about its
105 void RegisterAtCenterPane();
107 /** Unregister the listeners that were registered in
108 RegisterAtCenterPane().
110 void UnregisterAtCenterPane();
112 /** This call back is called by the application window (among others)
113 when the window gets the focus. In this case the form shell is
114 moved to the bottom of the shell stack.
116 DECL_LINK(WindowEventHandler
, VclWindowEvent
&, void);
118 /** This call back is called when view in the center pane is replaced.
119 When this happens then we unregister at the window of the old and
120 register at the window of the new shell.
122 DECL_LINK(ConfigurationUpdateHandler
, ::sd::tools::EventMultiplexerEvent
&, void);
124 /** This call back is called by the form shell when it gets the focus.
125 In this case the form shell is moved to the top of the shell stack.
127 DECL_LINK(FormControlActivated
, LinkParamNone
*, void);
129 /** This method is called by the form shell when that is destroyed. It
130 acts as a last resort against referencing a dead form shell. With
131 the factory working properly this method should not be necessary
132 (and may be removed in the future.)
134 virtual void Notify(SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
140 } // end of namespace sd
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */