LCOV - code coverage report
Current view: top level - include/sfx2 - stbitem.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 6 6 100.0 %
Date: 2014-11-03 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        1882 :     SfxStbCtrlFactory( SfxStatusBarControlCtor pTheCtor,
      47             :             TypeId nTheTypeId, sal_uInt16 nTheSlotId ):
      48             :         pCtor(pTheCtor),
      49             :         nTypeId(nTheTypeId),
      50        1882 :         nSlotId(nTheSlotId)
      51        1882 :     {}
      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             :     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    DoubleClick();
     102             :     virtual void    Command( const CommandEvent& rCEvt );
     103             :     virtual bool    MouseButtonDown( const MouseEvent & );
     104             :     virtual bool    MouseMove( const MouseEvent & );
     105             :     virtual bool    MouseButtonUp( const MouseEvent & );
     106             :     virtual void    Paint( const UserDrawEvent &rUDEvt );
     107             : 
     108             :     static sal_uInt16   convertAwtToVCLMouseButtons( sal_Int16 nAwtMouseButtons );
     109             : 
     110             : public:
     111             :                     SfxStatusBarControl( sal_uInt16 nSlotID, sal_uInt16 nId, StatusBar& rBar );
     112             :     virtual         ~SfxStatusBarControl();
     113             : 
     114        1439 :     sal_uInt16      GetSlotId() const { return nSlotId; }
     115       41989 :     sal_uInt16      GetId() const { return nId; }
     116       54511 :     StatusBar&      GetStatusBar() const { return *pBar; }
     117             :     void            CaptureMouse();
     118             :     void            ReleaseMouse();
     119             : 
     120             :     static SfxStatusBarControl* CreateControl( sal_uInt16 nSlotID, sal_uInt16 nId, StatusBar *pBar, SfxModule* );
     121             :     static void RegisterStatusBarControl(SfxModule*, SfxStbCtrlFactory*);
     122             : 
     123             : };
     124             : 
     125             : 
     126             : 
     127             : #define SFX_DECL_STATUSBAR_CONTROL() \
     128             :         static SfxStatusBarControl* CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ); \
     129             :         static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=NULL)
     130             : 
     131             : #define SFX_IMPL_STATUSBAR_CONTROL(Class, nItemClass) \
     132             :         SfxStatusBarControl* Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ) \
     133             :                { return new Class( nSlotId, nId, rStb ); } \
     134             :         void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \
     135             :                { SfxStatusBarControl::RegisterStatusBarControl( pMod, new SfxStbCtrlFactory( \
     136             :                     Class::CreateImpl, TYPE(nItemClass), nSlotId ) ); }
     137             : 
     138             : 
     139             : #endif
     140             : 
     141             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10