LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/svtools/toolpanel - toolpaneldeck.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 4 4 100.0 %
Date: 2012-08-25 Functions: 4 4 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       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 SVT_TOOLPANELDECK_HXX
      29                 :            : #define SVT_TOOLPANELDECK_HXX
      30                 :            : 
      31                 :            : #include "svtools/svtdllapi.h"
      32                 :            : #include "svtools/toolpanel/toolpanel.hxx"
      33                 :            : #include "svtools/toolpanel/decklayouter.hxx"
      34                 :            : 
      35                 :            : #include <vcl/ctrl.hxx>
      36                 :            : 
      37                 :            : #include <boost/optional.hpp>
      38                 :            : #include <memory>
      39                 :            : 
      40                 :            : //........................................................................
      41                 :            : namespace svt
      42                 :            : {
      43                 :            : //........................................................................
      44                 :            : 
      45                 :            :     class ToolPanelCollection;
      46                 :            :     class ToolPanelDeck_Impl;
      47                 :            : 
      48                 :            :     //====================================================================
      49                 :            :     //= IToolPanelDeckListener
      50                 :            :     //====================================================================
      51                 :        104 :     class SAL_NO_VTABLE IToolPanelDeckListener
      52                 :            :     {
      53                 :            :     public:
      54                 :            :         /** called when a panel has been inserted into the deck
      55                 :            :         */
      56                 :            :         virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0;
      57                 :            : 
      58                 :            :         /** called when a panel has been removed from the deck
      59                 :            :         */
      60                 :            :         virtual void PanelRemoved( const size_t i_nPosition ) = 0;
      61                 :            : 
      62                 :            :         /** called when the active panel of the deck changed
      63                 :            :         */
      64                 :            :         virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) = 0;
      65                 :            : 
      66                 :            :         /** called when a new layouter has been set at a tool panel deck.
      67                 :            : 
      68                 :            :             The method is called after the old layouter has been disposed (i.e. its Destroy method has been
      69                 :            :             invoked), and after the complete deck has been re-layouter.
      70                 :            :         */
      71                 :            :         virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter ) = 0;
      72                 :            : 
      73                 :            :         /** called when the tool panel deck which the listener registered at is dying. The listener is required to
      74                 :            :             release all references to the deck then.
      75                 :            :         */
      76                 :            :         virtual void Dying() = 0;
      77                 :            : 
      78                 :            :     protected:
      79                 :        104 :         ~IToolPanelDeckListener() {}
      80                 :            :     };
      81                 :            : 
      82                 :            :     //====================================================================
      83                 :            :     //= IToolPanelDeck
      84                 :            :     //====================================================================
      85                 :         52 :     class SVT_DLLPUBLIC IToolPanelDeck
      86                 :            :     {
      87                 :            :     public:
      88                 :            :         /** returns the number of panels in the container
      89                 :            :         */
      90                 :            :         virtual size_t      GetPanelCount() const = 0;
      91                 :            : 
      92                 :            :         /** retrieves the panel with the given index. Invalid indexes will be reported via an assertion in the
      93                 :            :             non-product version, and silently ignored in the product version, with a NULL panel being returned.
      94                 :            :         */
      95                 :            :         virtual PToolPanel  GetPanel( const size_t i_nPos ) const = 0;
      96                 :            : 
      97                 :            :         /** returns the number of the currently active panel.
      98                 :            :         */
      99                 :            :         virtual ::boost::optional< size_t >
     100                 :            :                             GetActivePanel() const = 0;
     101                 :            : 
     102                 :            :         /** activates the panel with the given number. If the given number is larger or equal to the number of panels
     103                 :            :             in the deck, this will be reported via an assertion in non-product builds, and otherwise ignored.
     104                 :            :             @param i_rPanel
     105                 :            :                 the number of the panel to activate. If this is not set, the currently active panel is de-activated,
     106                 :            :                 and no new panel is activated at all. Whether or not this makes sense for your application is at
     107                 :            :                 your own discretion.
     108                 :            :         */
     109                 :            :         virtual void        ActivatePanel( const ::boost::optional< size_t >& i_rPanel ) = 0;
     110                 :            : 
     111                 :            :         /** inserts a new panel into the container. NULL panels are not allowed, as are positions greater than the
     112                 :            :             current panel count. Violations of this will be reported via an assertion in the non-product version, and
     113                 :            :             silently ignored in the product version.
     114                 :            :         */
     115                 :            :         virtual size_t      InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0;
     116                 :            : 
     117                 :            :         /** removes a panel specified by its position.
     118                 :            : 
     119                 :            :             Note: It is the responsibility of the caller to ensure that the panel is destroyed appropriately. That is,
     120                 :            :             the tool panel deck will <em>not</em> invoke <member>IToolPanel::Dispose</member> on the removed panel.
     121                 :            :             The advantage is that the panel might be re-used later, with the disadvantage that the owner of the panel
     122                 :            :             deck must know whether Dispose must be invoked after removal, or whether the panel will properly
     123                 :            :             dispose itself when its ref count drops to 0.
     124                 :            :         */
     125                 :            :         virtual PToolPanel  RemovePanel( const size_t i_nPosition ) = 0;
     126                 :            : 
     127                 :            :         /** adds a new listener to be notified when the container content changes. The caller is responsible
     128                 :            :             for life time control, i.e. removing the listener before it actually dies.
     129                 :            :         */
     130                 :            :         virtual void        AddListener( IToolPanelDeckListener& i_rListener ) = 0;
     131                 :            : 
     132                 :            :         /** removes a container listener previously added via addListener.
     133                 :            :         */
     134                 :            :         virtual void        RemoveListener( IToolPanelDeckListener& i_rListener ) = 0;
     135                 :            : 
     136                 :            :     protected:
     137                 :         52 :         ~IToolPanelDeck() {}
     138                 :            :     };
     139                 :            : 
     140                 :            :     //====================================================================
     141                 :            :     //= ToolPanelDeck
     142                 :            :     //====================================================================
     143                 :            :     class SVT_DLLPUBLIC ToolPanelDeck   :public Control
     144                 :            :                                         ,public IToolPanelDeck
     145                 :            :     {
     146                 :            :     public:
     147                 :            :         ToolPanelDeck( Window& i_rParent, const WinBits i_nStyle = WB_DIALOGCONTROL );
     148                 :            :         ~ToolPanelDeck();
     149                 :            : 
     150                 :            :         // attributes
     151                 :            :         PDeckLayouter       GetLayouter() const;
     152                 :            :         void                SetLayouter( const PDeckLayouter& i_pNewLayouter );
     153                 :            : 
     154                 :            :         /** returns the window which acts as anchor for the panel windows.
     155                 :            : 
     156                 :            :             This is a single dedicated window, which is passed to the IToolPanel::ActivatePanel method
     157                 :            :             whenever a panel is activated, to act as parent window for the panel's VCL-Window.
     158                 :            :         */
     159                 :            :         ::Window&           GetPanelWindowAnchor();
     160                 :            :         const ::Window&     GetPanelWindowAnchor() const;
     161                 :            : 
     162                 :            :         /** sets the window which should act as parent in the A11Y object hierarchy.
     163                 :            : 
     164                 :            :             Calling this method has no effect if CreateAccessible had always been called.
     165                 :            :         */
     166                 :            :         void                SetAccessibleParentWindow( ::Window* i_pAccessibleParent );
     167                 :            :         ::Window*           GetAccessibleParentWindow() const;
     168                 :            : 
     169                 :            :         // IToolPanelDeck
     170                 :            :         virtual size_t      GetPanelCount() const;
     171                 :            :         virtual PToolPanel  GetPanel( const size_t i_nPos ) const;
     172                 :            :         virtual ::boost::optional< size_t >
     173                 :            :                             GetActivePanel() const;
     174                 :            :         virtual void        ActivatePanel( const ::boost::optional< size_t >& i_rPanel );
     175                 :            :         virtual size_t      InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition );
     176                 :            :         virtual PToolPanel  RemovePanel( const size_t i_nPosition );
     177                 :            :         virtual void        AddListener( IToolPanelDeckListener& i_rListener );
     178                 :            :         virtual void        RemoveListener( IToolPanelDeckListener& i_rListener );
     179                 :            : 
     180                 :            :     protected:
     181                 :            :         // Window overridables
     182                 :            :         virtual void Resize();
     183                 :            :         virtual long Notify( NotifyEvent& i_rNotifyEvent );
     184                 :            :         virtual void GetFocus();
     185                 :            : 
     186                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
     187                 :            :                      GetComponentInterface( sal_Bool i_bCreate );
     188                 :            : 
     189                 :            :     private:
     190                 :            :         ::std::auto_ptr< ToolPanelDeck_Impl >   m_pImpl;
     191                 :            : 
     192                 :            :     private:
     193                 :            :         using Window::GetAccessibleParentWindow;
     194                 :            :     };
     195                 :            : 
     196                 :            : //........................................................................
     197                 :            : } // namespace svt
     198                 :            : //........................................................................
     199                 :            : 
     200                 :            : #endif // SVT_TOOLPANELDECK_HXX
     201                 :            : 
     202                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10