LCOV - code coverage report
Current view: top level - include/sfx2 - stbitem.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 6 6 100.0 %
Date: 2015-06-13 12:38:46 Functions: 4 4 100.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             : #ifndef INCLUDED_SFX2_STBITEM_HXX
      20             : #define INCLUDED_SFX2_STBITEM_HXX
      21             : 
      22             : #include <sal/config.h>
      23             : #include <sfx2/dllapi.h>
      24             : #include <svl/poolitem.hxx>
      25             : #include <svtools/statusbarcontroller.hxx>
      26             : #include <vcl/status.hxx>
      27             : 
      28             : 
      29             : class SfxModule;
      30             : class SfxStatusBarControl;
      31             : class SfxBindings;
      32             : 
      33             : svt::StatusbarController* SAL_CALL SfxStatusBarControllerFactory(
      34             :     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
      35             :     StatusBar* pStatusBar,
      36             :     unsigned short nID,
      37             :     const OUString& aCommandURL );
      38             : typedef SfxStatusBarControl* (*SfxStatusBarControlCtor)( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb );
      39             : 
      40             : struct SfxStbCtrlFactory
      41             : {
      42             :     SfxStatusBarControlCtor pCtor;
      43             :     TypeId                  nTypeId;
      44             :     sal_uInt16              nSlotId;
      45             : 
      46        1230 :     SfxStbCtrlFactory( SfxStatusBarControlCtor pTheCtor,
      47             :             TypeId nTheTypeId, sal_uInt16 nTheSlotId ):
      48             :         pCtor(pTheCtor),
      49             :         nTypeId(nTheTypeId),
      50        1230 :         nSlotId(nTheSlotId)
      51        1230 :     {}
      52             : };
      53             : 
      54             : 
      55             : 
      56             : class CommandEvent;
      57             : class MouseEvent;
      58             : class UserDrawEvent;
      59             : 
      60             : class SFX2_DLLPUBLIC SfxStatusBarControl: public svt::StatusbarController
      61             : {
      62             :     sal_uInt16         nSlotId;
      63             :     sal_uInt16         nId;
      64             :     VclPtr<StatusBar>  pBar;
      65             : 
      66             : protected:
      67             :     // new controller API
      68             :     // XInterface
      69             :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      70             :     virtual void               SAL_CALL acquire() throw() SAL_OVERRIDE;
      71             :     virtual void               SAL_CALL release() throw() SAL_OVERRIDE;
      72             : 
      73             :     // XEventListener
      74             :     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      75             : 
      76             :     // XComponent
      77             :     virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      78             : 
      79             :     // XStatusListener
      80             :     virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event )
      81             :         throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      82             : 
      83             :     // XStatusbarController
      84             :     virtual sal_Bool SAL_CALL mouseButtonDown( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      85             :     virtual sal_Bool SAL_CALL mouseMove( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      86             :     virtual sal_Bool SAL_CALL mouseButtonUp( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      87             :     virtual void SAL_CALL command( const ::com::sun::star::awt::Point& aPos,
      88             :                                     ::sal_Int32 nCommand,
      89             :                                     sal_Bool bMouseEvent,
      90             :                                     const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      91             :     virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics,
      92             :                                  const ::com::sun::star::awt::Rectangle& rOutputRectangle,
      93             :                                  ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      94             :     virtual void SAL_CALL click( const ::com::sun::star::awt::Point& aPos ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      95             :     virtual void SAL_CALL doubleClick( const ::com::sun::star::awt::Point& aPos ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      96             : 
      97             :     // Old sfx2 interface
      98             :     virtual void    StateChanged( sal_uInt16 nSID, SfxItemState eState,
      99             :                                   const SfxPoolItem* pState );
     100             :     virtual void    Click();
     101             :     virtual void    Command( const CommandEvent& rCEvt );
     102             :     virtual bool    MouseButtonDown( const MouseEvent & );
     103             :     virtual bool    MouseMove( const MouseEvent & );
     104             :     virtual bool    MouseButtonUp( const MouseEvent & );
     105             :     virtual void    Paint( const UserDrawEvent &rUDEvt );
     106             : 
     107             :     static sal_uInt16   convertAwtToVCLMouseButtons( sal_Int16 nAwtMouseButtons );
     108             : 
     109             : public:
     110             :                     SfxStatusBarControl( sal_uInt16 nSlotID, sal_uInt16 nId, StatusBar& rBar );
     111             :     virtual         ~SfxStatusBarControl();
     112             : 
     113         808 :     sal_uInt16      GetSlotId() const { return nSlotId; }
     114       28989 :     sal_uInt16      GetId() const { return nId; }
     115       35967 :     StatusBar&      GetStatusBar() const { return *pBar; }
     116             : 
     117             :     static SfxStatusBarControl* CreateControl( sal_uInt16 nSlotID, sal_uInt16 nId, StatusBar *pBar, SfxModule* );
     118             :     static void RegisterStatusBarControl(SfxModule*, SfxStbCtrlFactory*);
     119             : 
     120             : };
     121             : 
     122             : 
     123             : 
     124             : #define SFX_DECL_STATUSBAR_CONTROL() \
     125             :         static SfxStatusBarControl* CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ); \
     126             :         static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=NULL)
     127             : 
     128             : #define SFX_IMPL_STATUSBAR_CONTROL(Class, nItemClass) \
     129             :         SfxStatusBarControl* Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ) \
     130             :                { return new Class( nSlotId, nId, rStb ); } \
     131             :         void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \
     132             :                { SfxStatusBarControl::RegisterStatusBarControl( pMod, new SfxStbCtrlFactory( \
     133             :                     Class::CreateImpl, TYPE(nItemClass), nSlotId ) ); }
     134             : 
     135             : 
     136             : #endif
     137             : 
     138             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11