LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/svtools - statusbarcontroller.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 3 100.0 %
Date: 2013-07-09 Functions: 3 3 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             : 
      20             : #ifndef _SVTOOLS_STATUSBARCONTROLLER_HXX
      21             : #define _SVTOOLS_STATUSBARCONTROLLER_HXX
      22             : 
      23             : #include "svtools/svtdllapi.h"
      24             : #include <com/sun/star/frame/XFrame.hpp>
      25             : #include <com/sun/star/frame/XDispatch.hpp>
      26             : #include <com/sun/star/frame/XStatusbarController.hpp>
      27             : #include <com/sun/star/frame/XLayoutManager.hpp>
      28             : #include <com/sun/star/ui/XStatusbarItem.hpp>
      29             : #include <com/sun/star/uno/XComponentContext.hpp>
      30             : #include <com/sun/star/util/XURLTransformer.hpp>
      31             : #include <cppuhelper/weak.hxx>
      32             : #include <cppuhelper/interfacecontainer.hxx>
      33             : #include <comphelper/broadcasthelper.hxx>
      34             : 
      35             : #include <boost/unordered_map.hpp>
      36             : 
      37             : #include <tools/gen.hxx>
      38             : 
      39             : namespace svt
      40             : {
      41             : 
      42             : class SVT_DLLPUBLIC StatusbarController :
      43             :                             public ::com::sun::star::frame::XStatusbarController,
      44             :                             public ::comphelper::OBaseMutex,
      45             :                             public ::cppu::OWeakObject
      46             : {
      47             :     public:
      48             :         StatusbarController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
      49             :                              const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
      50             :                              const OUString& aCommandURL,
      51             :                              unsigned short       nID );
      52             :         StatusbarController();
      53             :         virtual ~StatusbarController();
      54             : 
      55             :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > getFrameInterface() const;
      56             :         ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > getURLTransformer() const;
      57             : 
      58             :         ::Rectangle getControlRect() const;
      59             : 
      60             :         // XInterface
      61             :         virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
      62             :         virtual void SAL_CALL acquire() throw ();
      63             :         virtual void SAL_CALL release() throw ();
      64             : 
      65             :         // XInitialization
      66             :         virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
      67             : 
      68             :         // XUpdatable
      69             :         virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException);
      70             : 
      71             :         // XComponent
      72             :         virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
      73             :         virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
      74             :         virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
      75             : 
      76             :         // XEventListener
      77             :         virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
      78             : 
      79             :         // XStatusListener
      80             :         virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
      81             : 
      82             :         // XStatusbarController
      83             :         virtual ::sal_Bool SAL_CALL mouseButtonDown( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException);
      84             :         virtual ::sal_Bool SAL_CALL mouseMove( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException);
      85             :         virtual ::sal_Bool SAL_CALL mouseButtonUp( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException);
      86             :         virtual void SAL_CALL command( const ::com::sun::star::awt::Point& aPos,
      87             :                                        ::sal_Int32 nCommand,
      88             :                                        ::sal_Bool bMouseEvent,
      89             :                                        const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException);
      90             :         virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics,
      91             :                                      const ::com::sun::star::awt::Rectangle& rOutputRectangle,
      92             :                                      ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException);
      93             :         virtual void SAL_CALL click( const ::com::sun::star::awt::Point& aPos ) throw (::com::sun::star::uno::RuntimeException);
      94             :         virtual void SAL_CALL doubleClick( const ::com::sun::star::awt::Point& aPos ) throw (::com::sun::star::uno::RuntimeException);
      95             : 
      96             :     protected:
      97       29004 :         struct Listener
      98             :         {
      99        8456 :             Listener( const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& rDispatch ) :
     100        8456 :                 aURL( rURL ), xDispatch( rDispatch ) {}
     101             : 
     102             :             ::com::sun::star::util::URL aURL;
     103             :             ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch;
     104             :         };
     105             : 
     106             :         typedef ::boost::unordered_map< OUString,
     107             :                                  com::sun::star::uno::Reference< com::sun::star::frame::XDispatch >,
     108             :                                  OUStringHash,
     109             :                                  ::std::equal_to< OUString > > URLToDispatchMap;
     110             : 
     111             :         // methods to support status forwarder, known by the old sfx2 toolbox controller implementation
     112             :         void addStatusListener( const OUString& aCommandURL );
     113             :         void bindListener();
     114             : 
     115             :         // execute methods
     116             :         // execute bound status bar controller command/execute various commands
     117             :         void execute( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs );
     118             :         void execute( const OUString& aCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs );
     119             : 
     120             :         sal_Bool                                                                            m_bInitialized : 1,
     121             :                                                                                             m_bDisposed : 1;
     122             :         unsigned short                                                                      m_nID;
     123             :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >                 m_xFrame;
     124             :         ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >                  m_xParentWindow;
     125             :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >        m_xContext;
     126             :         OUString                                                                       m_aCommandURL;
     127             :         URLToDispatchMap                                                                    m_aListenerMap;
     128             :         ::cppu::OMultiTypeInterfaceContainerHelper                                          m_aListenerContainer;   /// container for ALL Listener
     129             :         mutable ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
     130             :         ::com::sun::star::uno::Reference< ::com::sun::star::ui::XStatusbarItem >           m_xStatusbarItem;
     131             : };
     132             : 
     133             : }
     134             : 
     135             : #endif // _SVTOOLS_TOOLBOXCONTROLLER_HXX
     136             : 
     137             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10