1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef SD_FORM_SHELL_MANAGER_HXX 29 #define SD_FORM_SHELL_MANAGER_HXX 30 31 #include <ViewShellManager.hxx> 32 33 #include <tools/link.hxx> 34 #include <svl/lstner.hxx> 35 36 class VclWindowEvent; 37 class FmFormShell; 38 39 namespace sd { namespace tools { class EventMultiplexerEvent; } } 40 41 namespace sd { 42 43 class PaneManagerEvent; 44 class ViewShell; 45 class ViewShellBase; 46 47 /** This simple class is responsible for putting the form shell above or 48 below the main view shell on the shell stack maintained by the ObjectBarManager. 49 50 The form shell is moved above the view shell when the form shell is 51 activated, i.e. the FormControlActivated handler is called. 52 53 It is moved below the view shell when the main window of the 54 main view shell is focused. 55 56 The form shell is created and destroyed by the ViewShellManager by using 57 a factory object provided by the FormShellManager. 58 */ 59 class FormShellManager 60 : public SfxListener 61 { 62 public: 63 FormShellManager (ViewShellBase& rBase); 64 virtual ~FormShellManager (void); 65 66 /** Typically called by a ShellFactory. It tells the 67 FormShellManager which form shell to manage. 68 @param pFormShell 69 This may be <NULL/> to disconnect the ViewShellManager from the 70 form shell. 71 */ 72 void SetFormShell (FmFormShell* pFormShell); 73 74 /** Return the form shell last set with SetFormShell(). 75 @return 76 The result may be <NULL/> when the SetFormShell() method has not 77 yet been called or was last called with <NULL/>. 78 */ 79 FmFormShell* GetFormShell (void); 80 81 private: 82 ViewShellBase& mrBase; 83 84 /** Ownership of the form shell lies with the ViewShellManager. This 85 reference is kept so that the FormShellManager can detect when a new 86 form shell is passed to SetFormShell(). 87 */ 88 FmFormShell* mpFormShell; 89 90 /** Remember whether the form shell is currently above or below the main 91 view shell. 92 */ 93 bool mbFormShellAboveViewShell; 94 95 /** The factory is remembered so that it removed from the 96 ViewShellManager when the FormShellManager is destroyed. 97 */ 98 ViewShellManager::SharedShellFactory mpSubShellFactory; 99 100 bool mbIsMainViewChangePending; 101 102 ::Window* mpMainViewShellWindow; 103 104 /** Register at window of center pane and at the form shell that 105 represents the form tool bar. The former informs this manager about 106 the deselection of the form shell. The later informs about its 107 selection. 108 */ 109 void RegisterAtCenterPane (void); 110 111 /** Unregister the listeners that were registered in 112 RegisterAtCenterPane(). 113 */ 114 void UnregisterAtCenterPane (void); 115 116 /** This call back is called by the application window (among others) 117 when the window gets the focus. In this case the form shell is 118 moved to the bottom of the shell stack. 119 */ 120 DECL_LINK(WindowEventHandler, VclWindowEvent*); 121 122 /** This call back is called when view in the center pane is replaced. 123 When this happens then we unregister at the window of the old and 124 register at the window of the new shell. 125 */ 126 DECL_LINK(ConfigurationUpdateHandler, ::sd::tools::EventMultiplexerEvent*); 127 128 /** This call back is called by the form shell when it gets the focus. 129 In this case the form shell is moved to the top of the shell stack. 130 */ 131 DECL_LINK(FormControlActivated, FmFormShell*); 132 133 /** This method is called by the form shell when that is destroyed. It 134 acts as a last resort against referencing a dead form shell. With 135 the factory working properly this method should not be necessary 136 (and may be removed in the future.) 137 */ 138 virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint); 139 }; 140 141 } // end of namespace sd 142 143 #endif 144