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