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