1*c45d927aSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*c45d927aSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*c45d927aSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*c45d927aSAndrew Rist * distributed with this work for additional information 6*c45d927aSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*c45d927aSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*c45d927aSAndrew Rist * "License"); you may not use this file except in compliance 9*c45d927aSAndrew Rist * with the License. You may obtain a copy of the License at 10*c45d927aSAndrew Rist * 11*c45d927aSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*c45d927aSAndrew Rist * 13*c45d927aSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*c45d927aSAndrew Rist * software distributed under the License is distributed on an 15*c45d927aSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*c45d927aSAndrew Rist * KIND, either express or implied. See the License for the 17*c45d927aSAndrew Rist * specific language governing permissions and limitations 18*c45d927aSAndrew Rist * under the License. 19*c45d927aSAndrew Rist * 20*c45d927aSAndrew Rist *************************************************************/ 21*c45d927aSAndrew Rist 22*c45d927aSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SD_FORM_SHELL_MANAGER_HXX 25cdf0e10cSrcweir #define SD_FORM_SHELL_MANAGER_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <ViewShellManager.hxx> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <tools/link.hxx> 30cdf0e10cSrcweir #include <svl/lstner.hxx> 31cdf0e10cSrcweir 32cdf0e10cSrcweir class VclWindowEvent; 33cdf0e10cSrcweir class FmFormShell; 34cdf0e10cSrcweir 35cdf0e10cSrcweir namespace sd { namespace tools { class EventMultiplexerEvent; } } 36cdf0e10cSrcweir 37cdf0e10cSrcweir namespace sd { 38cdf0e10cSrcweir 39cdf0e10cSrcweir class PaneManagerEvent; 40cdf0e10cSrcweir class ViewShell; 41cdf0e10cSrcweir class ViewShellBase; 42cdf0e10cSrcweir 43cdf0e10cSrcweir /** This simple class is responsible for putting the form shell above or 44cdf0e10cSrcweir below the main view shell on the shell stack maintained by the ObjectBarManager. 45cdf0e10cSrcweir 46cdf0e10cSrcweir The form shell is moved above the view shell when the form shell is 47cdf0e10cSrcweir activated, i.e. the FormControlActivated handler is called. 48cdf0e10cSrcweir 49cdf0e10cSrcweir It is moved below the view shell when the main window of the 50cdf0e10cSrcweir main view shell is focused. 51cdf0e10cSrcweir 52cdf0e10cSrcweir The form shell is created and destroyed by the ViewShellManager by using 53cdf0e10cSrcweir a factory object provided by the FormShellManager. 54cdf0e10cSrcweir */ 55cdf0e10cSrcweir class FormShellManager 56cdf0e10cSrcweir : public SfxListener 57cdf0e10cSrcweir { 58cdf0e10cSrcweir public: 59cdf0e10cSrcweir FormShellManager (ViewShellBase& rBase); 60cdf0e10cSrcweir virtual ~FormShellManager (void); 61cdf0e10cSrcweir 62cdf0e10cSrcweir /** Typically called by a ShellFactory. It tells the 63cdf0e10cSrcweir FormShellManager which form shell to manage. 64cdf0e10cSrcweir @param pFormShell 65cdf0e10cSrcweir This may be <NULL/> to disconnect the ViewShellManager from the 66cdf0e10cSrcweir form shell. 67cdf0e10cSrcweir */ 68cdf0e10cSrcweir void SetFormShell (FmFormShell* pFormShell); 69cdf0e10cSrcweir 70cdf0e10cSrcweir /** Return the form shell last set with SetFormShell(). 71cdf0e10cSrcweir @return 72cdf0e10cSrcweir The result may be <NULL/> when the SetFormShell() method has not 73cdf0e10cSrcweir yet been called or was last called with <NULL/>. 74cdf0e10cSrcweir */ 75cdf0e10cSrcweir FmFormShell* GetFormShell (void); 76cdf0e10cSrcweir 77cdf0e10cSrcweir private: 78cdf0e10cSrcweir ViewShellBase& mrBase; 79cdf0e10cSrcweir 80cdf0e10cSrcweir /** Ownership of the form shell lies with the ViewShellManager. This 81cdf0e10cSrcweir reference is kept so that the FormShellManager can detect when a new 82cdf0e10cSrcweir form shell is passed to SetFormShell(). 83cdf0e10cSrcweir */ 84cdf0e10cSrcweir FmFormShell* mpFormShell; 85cdf0e10cSrcweir 86cdf0e10cSrcweir /** Remember whether the form shell is currently above or below the main 87cdf0e10cSrcweir view shell. 88cdf0e10cSrcweir */ 89cdf0e10cSrcweir bool mbFormShellAboveViewShell; 90cdf0e10cSrcweir 91cdf0e10cSrcweir /** The factory is remembered so that it removed from the 92cdf0e10cSrcweir ViewShellManager when the FormShellManager is destroyed. 93cdf0e10cSrcweir */ 94cdf0e10cSrcweir ViewShellManager::SharedShellFactory mpSubShellFactory; 95cdf0e10cSrcweir 96cdf0e10cSrcweir bool mbIsMainViewChangePending; 97cdf0e10cSrcweir 98cdf0e10cSrcweir ::Window* mpMainViewShellWindow; 99cdf0e10cSrcweir 100cdf0e10cSrcweir /** Register at window of center pane and at the form shell that 101cdf0e10cSrcweir represents the form tool bar. The former informs this manager about 102cdf0e10cSrcweir the deselection of the form shell. The later informs about its 103cdf0e10cSrcweir selection. 104cdf0e10cSrcweir */ 105cdf0e10cSrcweir void RegisterAtCenterPane (void); 106cdf0e10cSrcweir 107cdf0e10cSrcweir /** Unregister the listeners that were registered in 108cdf0e10cSrcweir RegisterAtCenterPane(). 109cdf0e10cSrcweir */ 110cdf0e10cSrcweir void UnregisterAtCenterPane (void); 111cdf0e10cSrcweir 112cdf0e10cSrcweir /** This call back is called by the application window (among others) 113cdf0e10cSrcweir when the window gets the focus. In this case the form shell is 114cdf0e10cSrcweir moved to the bottom of the shell stack. 115cdf0e10cSrcweir */ 116cdf0e10cSrcweir DECL_LINK(WindowEventHandler, VclWindowEvent*); 117cdf0e10cSrcweir 118cdf0e10cSrcweir /** This call back is called when view in the center pane is replaced. 119cdf0e10cSrcweir When this happens then we unregister at the window of the old and 120cdf0e10cSrcweir register at the window of the new shell. 121cdf0e10cSrcweir */ 122cdf0e10cSrcweir DECL_LINK(ConfigurationUpdateHandler, ::sd::tools::EventMultiplexerEvent*); 123cdf0e10cSrcweir 124cdf0e10cSrcweir /** This call back is called by the form shell when it gets the focus. 125cdf0e10cSrcweir In this case the form shell is moved to the top of the shell stack. 126cdf0e10cSrcweir */ 127cdf0e10cSrcweir DECL_LINK(FormControlActivated, FmFormShell*); 128cdf0e10cSrcweir 129cdf0e10cSrcweir /** This method is called by the form shell when that is destroyed. It 130cdf0e10cSrcweir acts as a last resort against referencing a dead form shell. With 131cdf0e10cSrcweir the factory working properly this method should not be necessary 132cdf0e10cSrcweir (and may be removed in the future.) 133cdf0e10cSrcweir */ 134cdf0e10cSrcweir virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint); 135cdf0e10cSrcweir }; 136cdf0e10cSrcweir 137cdf0e10cSrcweir } // end of namespace sd 138cdf0e10cSrcweir 139cdf0e10cSrcweir #endif 140