LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/inc - ViewShellManager.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 3 0.0 %
Date: 2012-12-27 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef SD_VIEW_SHELL_MANAGER_HXX
      21             : #define SD_VIEW_SHELL_MANAGER_HXX
      22             : 
      23             : #include "ShellFactory.hxx"
      24             : #include <memory>
      25             : #include <vector>
      26             : #include <boost/shared_ptr.hpp>
      27             : 
      28             : class FmFormShell;
      29             : class SfxShell;
      30             : 
      31             : namespace sd {
      32             : 
      33             : class ViewShell;
      34             : class ViewShellBase;
      35             : 
      36             : /** The ViewShellManager has the responsibility to manage the view shells
      37             :     and sub shells on the SFX shell stack.  They form a two level hierarchy
      38             :     (the underlying ViewShellBase, the only true SfxViewShell descendant,
      39             :     forms a third level.)  On the first level there are the view shells
      40             :     (what formely was called view shell, anyway; nowadays they are derived
      41             :     from SfxShell.) and shells for panes. On the second level there are sub
      42             :     shells (also derived from SfxShell) that usually are tool bars.
      43             : 
      44             :     <p>On the SFX shell stack the regular sub shells are placed above their
      45             :     view shells.  The FormShell is a special case.  With the SetFormShell()
      46             :     method it can be placed directly above or below one of the view
      47             :     shells.</p>
      48             : 
      49             :     <p>Shells managed by this class are created by factories or are given
      50             :     directly to Activate... methods.  For the sub shells there is one
      51             :     factory for every view shell.  Factories are added or removed via the
      52             :     (Add|Remove)SubShellFactory() methods.  The FormShell is managed with the
      53             :     factory of its view shell.</p>
      54             : */
      55             : class ViewShellManager
      56             : {
      57             : public:
      58             :     typedef ::boost::shared_ptr<ShellFactory<SfxShell> > SharedShellFactory;
      59             : 
      60             :     ViewShellManager (ViewShellBase& rBase);
      61             : 
      62             :     /** Before the destructor is called the method Shutdown() has to have
      63             :         been called.
      64             :     */
      65             :     ~ViewShellManager (void);
      66             : 
      67             :     /** Tell a ViewShellManager object to prepare to be deleted, i.e. to
      68             :         destroy all of its resources and to ignore all following calls.
      69             :         Use this when the owner of the view shell manager is about being
      70             :         destroyed but the view shell manager itself can not yet be deleted.
      71             :     */
      72             :     void Shutdown (void);
      73             : 
      74             :     /** Set the factory for sub shells of the specified view shell.
      75             :     */
      76             :     void AddSubShellFactory (
      77             :         ViewShell* pViewShell,
      78             :         const SharedShellFactory& rpFactory);
      79             :     void RemoveSubShellFactory (
      80             :         ViewShell* pViewShell,
      81             :         const SharedShellFactory& rpFactory);
      82             : 
      83             :     /** Activate the given view shell.
      84             :     */
      85             :     void ActivateViewShell (ViewShell* pViewShell);
      86             : 
      87             :     /** Activate the given shell which is not a view shell.  For view shells
      88             :         use the ActivateViewShell() method.
      89             :     */
      90             :     void ActivateShell (SfxShell* pShell);
      91             : 
      92             :     /** Deactivate the specified shell, i.e. take it and all of its
      93             :         object bars from the shell stack.
      94             :         @param pShell
      95             :             The shell to deactivate.
      96             :     */
      97             :     void DeactivateViewShell (const ViewShell* pShell);
      98             : 
      99             :     /** Deactivate the specified shell.  The shell is not destroyed.
     100             :     */
     101             :     void DeactivateShell (const SfxShell* pShell);
     102             : 
     103             :     /** Associate the form shell with a view shell and their relative
     104             :         position.  This method does not change the shell stack, it just
     105             :         stores the given values for the next shell stack update.
     106             :         @param pParentShell
     107             :             The view shell of the form shell.
     108             :         @param pFormShell
     109             :             The form shell.
     110             :         @param bAbove
     111             :             When <TRUE/> then the form shell will be placed directly above
     112             :             pViewShell on the SFX shell stack.  Otherwise the form shell is
     113             :             placed directly below the view shell.
     114             :     */
     115             :     void SetFormShell (const ViewShell* pParentShell, FmFormShell* pFormShell, bool bAbove);
     116             : 
     117             :     /** Activate the specified shell as sub shell for the given view shell.
     118             :         The sub shell factory associated with the view shell is used to
     119             :         create the sub shell.
     120             :         @param rParentShell
     121             :             The new sub shell will be placed above this view shell.
     122             :         @param nId
     123             :             This id is used only with the factory registered for the parent
     124             :             view shell.
     125             :     */
     126             :     void ActivateSubShell (const ViewShell& rParentShell, ShellId nId);
     127             : 
     128             :     /** Deactivate the specified sub shell.
     129             :     */
     130             :     void DeactivateSubShell (const ViewShell& rParentShell, ShellId nId);
     131             : 
     132             :     /** Move the specified sub shells to the top position among the sub
     133             :         shells of the parent view shell.  The rest of the SFX shell stack
     134             :         does not change (but the all shells above the sub shells have to be
     135             :         taken once off the stack and are then moved back on again.)
     136             :     */
     137             :     void MoveSubShellToTop (const ViewShell& rParentShell, ShellId nId);
     138             : 
     139             :     /** Send all sub shells of the specified view shell an Invalidate()
     140             :         call.  This does not modify the shell stack.
     141             :     */
     142             :     void InvalidateAllSubShells (
     143             :         ViewShell* pViewShell);
     144             : 
     145             :     /** Move the specified view shell to the top most position on the stack
     146             :         of view shells in relation to the other view shells.  After this the
     147             :         only shells that are higher on the stack are its object bars.
     148             : 
     149             :         Call this method after a focus change to bring a view mode view
     150             :         shell and ist associated tool bar shells to the top of the
     151             :         stack.
     152             : 
     153             :         The mbKeepMainViewShellOnTop flag is not obeyed.
     154             : 
     155             :         @param nId
     156             :             The id of the shell to move to the top.
     157             :     */
     158             :     void MoveToTop (const ViewShell& rShell);
     159             : 
     160             :     /** Return the first, i.e. top most, view shell that has been activated
     161             :         under the given id.
     162             :         @param nId
     163             :             The id of the shell for which to return a pointer.
     164             :         @return
     165             :             When the specified shell is currently not active then NULL is
     166             :             returned.
     167             :     */
     168             :     SfxShell* GetShell (ShellId nId) const;
     169             : 
     170             :     /** Return the top-most shell on the SFX shell stack regardless of
     171             :         whether that is a view shell or a sub shell.
     172             :     */
     173             :     SfxShell* GetTopShell (void) const;
     174             : 
     175             :     /** Use this class to safely lock updates of the view shell stack.
     176             :     */
     177             :     class UpdateLock
     178             :     {
     179             :     public:
     180           0 :         UpdateLock (const ::boost::shared_ptr<ViewShellManager>& rpManager)
     181           0 :             : mpManager(rpManager) {mpManager->LockUpdate();}
     182           0 :         ~UpdateLock (void) {mpManager->UnlockUpdate();};
     183             :     private:
     184             :         ::boost::shared_ptr<ViewShellManager> mpManager;
     185             :     };
     186             :     friend class UpdateLock;
     187             : 
     188             : private:
     189             :     class Implementation;
     190             :     ::std::auto_ptr<ViewShellManager::Implementation> mpImpl;
     191             :     bool mbValid;
     192             : 
     193             :     void LockUpdate (void);
     194             :     void UnlockUpdate (void);
     195             : };
     196             : 
     197             : 
     198             : 
     199             : } // end of namespace sd
     200             : 
     201             : #endif
     202             : 
     203             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10