LCOV - code coverage report
Current view: top level - reportdesign/source/ui/misc - statusbarcontroller.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 96 0.0 %
Date: 2012-08-25 Functions: 0 21 0.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                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "statusbarcontroller.hxx"
      30                 :            : 
      31                 :            : #include <svx/zoomsliderctrl.hxx>
      32                 :            : #include <svx/zoomctrl.hxx>
      33                 :            : #include <svx/svxids.hrc>
      34                 :            : #include <sfx2/zoomitem.hxx>
      35                 :            : #include <svx/zoomslideritem.hxx>
      36                 :            : 
      37                 :            : #include <vcl/svapp.hxx>
      38                 :            : #include <vcl/status.hxx>
      39                 :            : #include <osl/mutex.hxx>
      40                 :            : #include <toolkit/helper/vclunohelper.hxx>
      41                 :            : 
      42                 :            : namespace rptui
      43                 :            : {
      44                 :            :     using namespace svt;
      45                 :            :     using namespace com::sun::star::uno;
      46                 :            :     using namespace com::sun::star::beans;
      47                 :            :     using namespace com::sun::star::lang;
      48                 :            :     using namespace ::com::sun::star::frame;
      49                 :            :     using namespace ::com::sun::star::util;
      50                 :            : 
      51                 :          0 : ::rtl::OUString SAL_CALL OStatusbarController::getImplementationName() throw( RuntimeException )
      52                 :            : {
      53                 :          0 :     return getImplementationName_Static();
      54                 :            : }
      55                 :            : 
      56                 :            : //------------------------------------------------------------------------------
      57                 :          0 : ::rtl::OUString OStatusbarController::getImplementationName_Static() throw( RuntimeException )
      58                 :            : {
      59                 :          0 :     return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.comp.StatusbarController"));
      60                 :            : }
      61                 :            : //------------------------------------------------------------------------------
      62                 :          0 : Sequence< ::rtl::OUString> OStatusbarController::getSupportedServiceNames_Static(void) throw( RuntimeException )
      63                 :            : {
      64                 :          0 :     Sequence< ::rtl::OUString> aSupported(1);
      65                 :          0 :     aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StatusbarController"));
      66                 :          0 :     return aSupported;
      67                 :            : }
      68                 :            : // -----------------------------------------------------------------------------
      69                 :          0 : ::sal_Bool SAL_CALL OStatusbarController::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException)
      70                 :            : {
      71                 :          0 :     return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_Static());
      72                 :            : }
      73                 :            : //-------------------------------------------------------------------------
      74                 :          0 : Sequence< ::rtl::OUString> SAL_CALL OStatusbarController::getSupportedServiceNames() throw(RuntimeException)
      75                 :            : {
      76                 :          0 :     return getSupportedServiceNames_Static();
      77                 :            : }
      78                 :            : // -------------------------------------------------------------------------
      79                 :          0 : Reference< XInterface > OStatusbarController::create(Reference< XComponentContext > const & xContext)
      80                 :            : {
      81                 :          0 :     return *(new OStatusbarController(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY)));
      82                 :            : }
      83                 :          0 : IMPLEMENT_FORWARD_XINTERFACE2(OStatusbarController, ::svt::StatusbarController,OStatusbarController_BASE)
      84                 :            : 
      85                 :          0 : OStatusbarController::OStatusbarController(const Reference< XMultiServiceFactory >& _rxORB)
      86                 :            : : m_nSlotId(0)
      87                 :          0 : ,m_nId(1)
      88                 :            : {
      89                 :          0 :     m_xServiceManager = _rxORB;
      90                 :          0 : }
      91                 :            : // -----------------------------------------------------------------------------
      92                 :          0 : void SAL_CALL OStatusbarController::initialize( const Sequence< Any >& _rArguments ) throw (Exception, RuntimeException)
      93                 :            : {
      94                 :          0 :     StatusbarController::initialize(_rArguments);
      95                 :          0 :     SolarMutexGuard aSolarMutexGuard;
      96                 :          0 :     ::osl::MutexGuard aGuard(m_aMutex);
      97                 :            : 
      98                 :          0 :     StatusBar* pStatusBar = static_cast<StatusBar*>(VCLUnoHelper::GetWindow(m_xParentWindow));
      99                 :          0 :     if ( pStatusBar )
     100                 :            :     {
     101                 :          0 :         const sal_uInt16 nCount = pStatusBar->GetItemCount();
     102                 :          0 :         for (sal_uInt16 nPos = 0; nPos < nCount; ++nPos)
     103                 :            :         {
     104                 :          0 :             const sal_uInt16 nItemId = pStatusBar->GetItemId(nPos);
     105                 :          0 :             if ( pStatusBar->GetItemCommand(nItemId) == String(m_aCommandURL) )
     106                 :            :             {
     107                 :          0 :                 m_nId = nItemId;
     108                 :          0 :                 break;
     109                 :            :             }
     110                 :            :         }
     111                 :          0 :         if ( m_aCommandURL == ".uno:ZoomSlider" )
     112                 :            :         {
     113                 :          0 :             m_pController = TStatusbarHelper::createFromQuery(new SvxZoomSliderControl(m_nSlotId = SID_ATTR_ZOOMSLIDER,m_nId,*pStatusBar));
     114                 :            :         }
     115                 :          0 :         else if ( m_aCommandURL == ".uno:Zoom" )
     116                 :            :         {
     117                 :          0 :             m_pController = TStatusbarHelper::createFromQuery(new SvxZoomStatusBarControl(m_nSlotId = SID_ATTR_ZOOM,m_nId,*pStatusBar));
     118                 :            :         }
     119                 :            : 
     120                 :          0 :         if ( m_pController.is() )
     121                 :            :         {
     122                 :          0 :             m_pController->initialize(_rArguments);
     123                 :          0 :             m_pController->update();
     124                 :            :         }
     125                 :            : 
     126                 :          0 :         addStatusListener(m_aCommandURL);
     127                 :          0 :         update();
     128                 :          0 :     }
     129                 :          0 : }
     130                 :            : // XStatusListener
     131                 :          0 : void SAL_CALL OStatusbarController::statusChanged( const FeatureStateEvent& _aEvent)throw ( RuntimeException )
     132                 :            : {
     133                 :          0 :     SolarMutexGuard aSolarGuard;
     134                 :          0 :     ::osl::MutexGuard aGuard(m_aMutex);
     135                 :            : 
     136                 :          0 :     if ( m_pController.is() )
     137                 :            :     {
     138                 :          0 :         if ( m_aCommandURL == ".uno:ZoomSlider" )
     139                 :            :         {
     140                 :          0 :             Sequence< PropertyValue > aSeq;
     141                 :          0 :             if ( (_aEvent.State >>= aSeq) && aSeq.getLength() == 2 )
     142                 :            :             {
     143                 :          0 :                 SvxZoomSliderItem aZoomSlider(100,20,400);
     144                 :          0 :                 aZoomSlider.PutValue(_aEvent.State);
     145                 :          0 :                 static_cast<SvxZoomSliderControl*>(m_pController.get())->StateChanged(m_nSlotId,SFX_ITEM_AVAILABLE,&aZoomSlider);
     146                 :          0 :             }
     147                 :            :         }
     148                 :          0 :         else if ( m_aCommandURL == ".uno:Zoom" )
     149                 :            :         {
     150                 :          0 :             Sequence< PropertyValue > aSeq;
     151                 :          0 :             if ( (_aEvent.State >>= aSeq) && aSeq.getLength() == 3 )
     152                 :            :             {
     153                 :          0 :                 SvxZoomItem aZoom;
     154                 :          0 :                 aZoom.PutValue(_aEvent.State);
     155                 :          0 :                 static_cast<SvxZoomStatusBarControl*>(m_pController.get())->StateChanged(m_nSlotId,SFX_ITEM_AVAILABLE,&aZoom);
     156                 :          0 :             }
     157                 :            :         }
     158                 :          0 :     }
     159                 :          0 : }
     160                 :            : 
     161                 :            : // XStatusbarController
     162                 :          0 : ::sal_Bool SAL_CALL OStatusbarController::mouseButtonDown(const ::com::sun::star::awt::MouseEvent& _aEvent)throw (::com::sun::star::uno::RuntimeException)
     163                 :            : {
     164                 :          0 :     return m_pController.is() && m_pController.getRef()->mouseButtonDown(_aEvent);
     165                 :            : }
     166                 :            : 
     167                 :          0 : ::sal_Bool SAL_CALL OStatusbarController::mouseMove(    const ::com::sun::star::awt::MouseEvent& _aEvent)throw (::com::sun::star::uno::RuntimeException)
     168                 :            : {
     169                 :          0 :     return m_pController.is() && m_pController.getRef()->mouseMove(_aEvent);
     170                 :            : }
     171                 :            : 
     172                 :          0 : ::sal_Bool SAL_CALL OStatusbarController::mouseButtonUp(    const ::com::sun::star::awt::MouseEvent& _aEvent)throw (::com::sun::star::uno::RuntimeException)
     173                 :            : {
     174                 :          0 :     return m_pController.is() && m_pController.getRef()->mouseButtonUp(_aEvent);
     175                 :            : }
     176                 :            : 
     177                 :          0 : void SAL_CALL OStatusbarController::command(
     178                 :            :     const ::com::sun::star::awt::Point& aPos,
     179                 :            :     ::sal_Int32 nCommand,
     180                 :            :     ::sal_Bool bMouseEvent,
     181                 :            :     const ::com::sun::star::uno::Any& aData )
     182                 :            : throw (::com::sun::star::uno::RuntimeException)
     183                 :            : {
     184                 :          0 :     if ( m_pController.is() )
     185                 :          0 :         m_pController.getRef()->command( aPos, nCommand, bMouseEvent, aData );
     186                 :          0 : }
     187                 :            : 
     188                 :          0 : void SAL_CALL OStatusbarController::paint(
     189                 :            :     const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics,
     190                 :            :     const ::com::sun::star::awt::Rectangle& rOutputRectangle,
     191                 :            :     ::sal_Int32 nItemId,
     192                 :            :     ::sal_Int32 nStyle )
     193                 :            : throw (::com::sun::star::uno::RuntimeException)
     194                 :            : {
     195                 :          0 :     if ( m_pController.is() )
     196                 :          0 :         m_pController.getRef()->paint( xGraphics, rOutputRectangle, nItemId, nStyle );
     197                 :          0 : }
     198                 :            : 
     199                 :          0 : void SAL_CALL OStatusbarController::click() throw (::com::sun::star::uno::RuntimeException)
     200                 :            : {
     201                 :          0 :     if ( m_pController.is() )
     202                 :          0 :         m_pController.getRef()->click();
     203                 :          0 : }
     204                 :            : 
     205                 :          0 : void SAL_CALL OStatusbarController::doubleClick() throw (::com::sun::star::uno::RuntimeException)
     206                 :            : {
     207                 :          0 :     if ( m_pController.is() )
     208                 :          0 :         m_pController.getRef()->doubleClick();
     209                 :          0 : }
     210                 :            : // -----------------------------------------------------------------------------
     211                 :          0 : void SAL_CALL OStatusbarController::update() throw ( RuntimeException )
     212                 :            : {
     213                 :          0 :     ::svt::StatusbarController::update();
     214                 :          0 :     Reference< XUpdatable > xUp(m_pController.getRef(),UNO_QUERY);
     215                 :          0 :     if ( xUp.is() )
     216                 :          0 :         xUp->update();
     217                 :          0 : }
     218                 :            : // -----------------------------------------------------------------------------
     219                 :            : // XComponent
     220                 :          0 : void SAL_CALL OStatusbarController::dispose() throw (::com::sun::star::uno::RuntimeException)
     221                 :            : {
     222                 :          0 :     Reference< XComponent > xComp( m_pController.getRef(), UNO_QUERY );
     223                 :          0 :     ::comphelper::disposeComponent(xComp);
     224                 :          0 :     m_pController.dispose();
     225                 :          0 :     svt::StatusbarController::dispose();
     226                 :          0 : }
     227                 :            : // =============================================================================
     228                 :            : } // rptui
     229                 :            : // =============================================================================
     230                 :            : 
     231                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10