LCOV - code coverage report
Current view: top level - sfx2/source/statbar - stbitem.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 142 215 66.0 %
Date: 2015-06-13 12:38:46 Functions: 14 29 48.3 %
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             : #include <svl/stritem.hxx>
      21             : #include <com/sun/star/util/URL.hpp>
      22             : #include <com/sun/star/util/URLTransformer.hpp>
      23             : #include <com/sun/star/util/XURLTransformer.hpp>
      24             : #include <com/sun/star/frame/XController.hpp>
      25             : #include <com/sun/star/lang/XUnoTunnel.hpp>
      26             : #include <com/sun/star/frame/status/ItemStatus.hpp>
      27             : #include <com/sun/star/frame/status/ItemState.hpp>
      28             : #include <com/sun/star/awt/MouseButton.hpp>
      29             : 
      30             : #include <vcl/status.hxx>
      31             : 
      32             : #include <sfx2/app.hxx>
      33             : #include <sfx2/stbitem.hxx>
      34             : #include "sfxtypes.hxx"
      35             : #include <sfx2/msg.hxx>
      36             : #include <sfx2/bindings.hxx>
      37             : #include <sfx2/msgpool.hxx>
      38             : #include <sfx2/module.hxx>
      39             : #include <sfx2/dispatch.hxx>
      40             : #include <sfx2/unoctitm.hxx>
      41             : #include <sfx2/objsh.hxx>
      42             : #include <sfx2/sfx.hrc>
      43             : 
      44             : #include <comphelper/processfactory.hxx>
      45             : #include <svl/eitem.hxx>
      46             : #include <svl/intitem.hxx>
      47             : #include <toolkit/helper/vclunohelper.hxx>
      48             : #include <toolkit/helper/convert.hxx>
      49             : #include <ctrlfactoryimpl.hxx>
      50             : 
      51             : using namespace ::com::sun::star;
      52             : 
      53             : 
      54             : 
      55           0 : sal_uInt16 SfxStatusBarControl::convertAwtToVCLMouseButtons( sal_Int16 nAwtMouseButtons )
      56             : {
      57           0 :     sal_uInt16 nVCLMouseButtons( 0 );
      58             : 
      59           0 :     if ( nAwtMouseButtons & awt::MouseButton::LEFT )
      60           0 :         nVCLMouseButtons |= MOUSE_LEFT;
      61           0 :     if ( nAwtMouseButtons & awt::MouseButton::RIGHT )
      62           0 :         nVCLMouseButtons |= MOUSE_RIGHT;
      63           0 :     if ( nAwtMouseButtons & awt::MouseButton::MIDDLE )
      64           0 :         nVCLMouseButtons |= MOUSE_MIDDLE;
      65             : 
      66           0 :     return nVCLMouseButtons;
      67             : }
      68             : 
      69             : 
      70             : 
      71        6112 : svt::StatusbarController* SAL_CALL SfxStatusBarControllerFactory(
      72             :     const uno::Reference< frame::XFrame >& rFrame,
      73             :     StatusBar* pStatusBar,
      74             :     unsigned short nID,
      75             :     const OUString& aCommandURL )
      76             : {
      77        6112 :     SolarMutexGuard aGuard;
      78             : 
      79       12224 :     util::URL aTargetURL;
      80        6112 :     aTargetURL.Complete = aCommandURL;
      81       12224 :     uno::Reference < util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
      82        6112 :     xTrans->parseStrict( aTargetURL );
      83             : 
      84        6112 :     SfxObjectShell* pObjShell = NULL;
      85       12224 :     uno::Reference < frame::XController > xController;
      86       12224 :     uno::Reference < frame::XModel > xModel;
      87        6112 :     if ( rFrame.is() )
      88             :     {
      89        6112 :         xController = rFrame->getController();
      90        6112 :         if ( xController.is() )
      91        6112 :             xModel = xController->getModel();
      92             :     }
      93             : 
      94        6112 :     if ( xModel.is() )
      95             :     {
      96             :         // Get tunnel from model to retrieve the SfxObjectShell pointer from it
      97        6112 :         ::com::sun::star::uno::Reference < ::com::sun::star::lang::XUnoTunnel > xObj( xModel, uno::UNO_QUERY );
      98       12224 :         ::com::sun::star::uno::Sequence < sal_Int8 > aSeq = SvGlobalName( SFX_GLOBAL_CLASSID ).GetByteSequence();
      99        6112 :         if ( xObj.is() )
     100             :         {
     101        6108 :             sal_Int64 nHandle = xObj->getSomething( aSeq );
     102        6108 :             if ( nHandle )
     103        6074 :                         pObjShell = reinterpret_cast< SfxObjectShell* >( sal::static_int_cast< sal_IntPtr >( nHandle ));
     104        6112 :         }
     105             :     }
     106             : 
     107        6112 :     SfxModule*     pModule   = pObjShell ? pObjShell->GetModule() : NULL;
     108        6112 :     SfxSlotPool*   pSlotPool = 0;
     109             : 
     110        6112 :     if ( pModule )
     111        6074 :         pSlotPool = pModule->GetSlotPool();
     112             :     else
     113          38 :         pSlotPool = &(SfxSlotPool::GetSlotPool( NULL ));
     114             : 
     115        6112 :     const SfxSlot* pSlot = pSlotPool->GetUnoSlot( aTargetURL.Path );
     116        6112 :     if ( pSlot )
     117             :     {
     118        6091 :         sal_uInt16 nSlotId = pSlot->GetSlotId();
     119        6091 :         if ( nSlotId > 0 )
     120             :         {
     121        6091 :             OString aCmd(".uno:");
     122        6091 :             aCmd += pSlot->GetUnoName();
     123        6091 :             pStatusBar->SetHelpId( nSlotId, aCmd );
     124        6091 :             return SfxStatusBarControl::CreateControl( nSlotId, nID, pStatusBar, pModule );
     125             :         }
     126             :     }
     127             : 
     128        6133 :     return NULL;
     129             : }
     130             : 
     131             : 
     132             : 
     133        5445 : SfxStatusBarControl::SfxStatusBarControl
     134             : (
     135             :     sal_uInt16      nSlotID,            /* Slot-Id which is connected to this
     136             :                                        instance. If a Slot-Id is set to != 0 at
     137             :                                        registration it will always be set there.
     138             :                                     */
     139             : 
     140             : 
     141             :     sal_uInt16      nCtrlID,            /* ID of this controller in the status bar */
     142             : 
     143             :     StatusBar&  rBar                /* Reference to the StatusBar,for which
     144             :                                        this Control was created. */
     145             : )
     146             : 
     147             : 
     148             : /*  [Description]
     149             : 
     150             :     Constructor of the SfxStatusBarControl Class. The Subclasses are
     151             :     created at the Factory if necessary.
     152             : 
     153             :     Instances of this base class are created for all StatusBar-fields
     154             :     for which no specific ones have been registered.
     155             : */
     156             : 
     157             : :   svt::StatusbarController(),
     158             :     nSlotId( nSlotID ),
     159             :     nId( nCtrlID ),
     160        5445 :     pBar( &rBar )
     161             : {
     162        5445 : }
     163             : 
     164             : 
     165             : 
     166        5445 : SfxStatusBarControl::~SfxStatusBarControl()
     167             : 
     168             : /*  [Description]
     169             : 
     170             :     Destructor of the SfxStatusBarControl Class. The Class and its Subclasses
     171             :     are destroyed by SFx.
     172             : */
     173             : 
     174        5445 : {}
     175             : 
     176             : 
     177             : // XInterface
     178       21780 : uno::Any SAL_CALL SfxStatusBarControl::queryInterface( const uno::Type & rType )
     179             : throw( uno::RuntimeException, std::exception)
     180             : {
     181       21780 :     return svt::StatusbarController::queryInterface( rType );
     182             : }
     183             : 
     184      108189 : void SAL_CALL SfxStatusBarControl::acquire() throw()
     185             : {
     186      108189 :     OWeakObject::acquire();
     187      108189 : }
     188             : 
     189      108189 : void SAL_CALL SfxStatusBarControl::release() throw()
     190             : {
     191      108189 :     OWeakObject::release();
     192      108189 : }
     193             : 
     194             : 
     195             : // XEventListener
     196           0 : void SAL_CALL SfxStatusBarControl::disposing( const lang::EventObject& aEvent )
     197             : throw( uno::RuntimeException, std::exception )
     198             : {
     199           0 :     svt::StatusbarController::disposing( aEvent );
     200           0 : }
     201             : 
     202             : 
     203             : // XComponent
     204        5445 : void SAL_CALL SfxStatusBarControl::dispose()
     205             : throw (uno::RuntimeException, std::exception)
     206             : {
     207        5445 :     svt::StatusbarController::dispose();
     208        5445 : }
     209             : 
     210             : 
     211             : // XStatusListener
     212       11441 : void SAL_CALL SfxStatusBarControl::statusChanged( const frame::FeatureStateEvent& rEvent )
     213             : throw ( ::com::sun::star::uno::RuntimeException, std::exception )
     214             : {
     215       11441 :     SfxViewFrame* pViewFrame = NULL;
     216       11441 :     uno::Reference < frame::XController > xController;
     217             : 
     218       22882 :     SolarMutexGuard aGuard;
     219       11441 :     if ( m_xFrame.is() )
     220       11441 :         xController = m_xFrame->getController();
     221             : 
     222       22882 :     uno::Reference < frame::XDispatchProvider > xProvider( xController, uno::UNO_QUERY );
     223       11441 :     if ( xProvider.is() )
     224             :     {
     225       11441 :         uno::Reference < frame::XDispatch > xDisp = xProvider->queryDispatch( rEvent.FeatureURL, OUString(), 0 );
     226       11441 :         if ( xDisp.is() )
     227             :         {
     228       11441 :             uno::Reference< lang::XUnoTunnel > xTunnel( xDisp, uno::UNO_QUERY );
     229       11441 :             SfxOfficeDispatch* pDisp = NULL;
     230       11441 :             if ( xTunnel.is() )
     231             :             {
     232       11441 :                 sal_Int64 nImplementation = xTunnel->getSomething(SfxOfficeDispatch::impl_getStaticIdentifier());
     233       11441 :                 pDisp = reinterpret_cast< SfxOfficeDispatch* >(sal::static_int_cast< sal_IntPtr >( nImplementation ));
     234             :             }
     235             : 
     236       11441 :             if ( pDisp )
     237       11441 :                 pViewFrame = pDisp->GetDispatcher_Impl()->GetFrame();
     238       11441 :         }
     239             :     }
     240             : 
     241       11441 :     sal_uInt16 nSlotID = 0;
     242       11441 :     SfxSlotPool& rPool = SfxSlotPool::GetSlotPool( pViewFrame );
     243       11441 :     const SfxSlot* pSlot = rPool.GetUnoSlot( rEvent.FeatureURL.Path );
     244       11441 :     if ( pSlot )
     245       11441 :         nSlotID = pSlot->GetSlotId();
     246             : 
     247       11441 :     if ( nSlotID > 0 )
     248             :     {
     249       11441 :         if ( rEvent.Requery )
     250           0 :             svt::StatusbarController::statusChanged( rEvent );
     251             :         else
     252             :         {
     253       11441 :             SfxItemState eState = SfxItemState::DISABLED;
     254       11441 :             SfxPoolItem* pItem = NULL;
     255       11441 :             if ( rEvent.IsEnabled )
     256             :             {
     257       11028 :                 eState = SfxItemState::DEFAULT;
     258       11028 :                 uno::Type pType = rEvent.State.getValueType();
     259             : 
     260       11028 :                 if ( pType == cppu::UnoType<void>::get() )
     261             :                 {
     262        2306 :                     pItem = new SfxVoidItem( nSlotID );
     263        2306 :                     eState = SfxItemState::UNKNOWN;
     264             :                 }
     265        8722 :                 else if ( pType == cppu::UnoType<bool>::get() )
     266             :                 {
     267        1692 :                     bool bTemp = false;
     268        1692 :                     rEvent.State >>= bTemp ;
     269        1692 :                     pItem = new SfxBoolItem( nSlotID, bTemp );
     270             :                 }
     271        7030 :                 else if ( pType == ::cppu::UnoType< ::cppu::UnoUnsignedShortType >::get() )
     272             :                 {
     273           0 :                     sal_uInt16 nTemp = 0;
     274           0 :                     rEvent.State >>= nTemp ;
     275           0 :                     pItem = new SfxUInt16Item( nSlotID, nTemp );
     276             :                 }
     277        7030 :                 else if ( pType == cppu::UnoType<sal_uInt32>::get() )
     278             :                 {
     279           0 :                     sal_uInt32 nTemp = 0;
     280           0 :                     rEvent.State >>= nTemp ;
     281           0 :                     pItem = new SfxUInt32Item( nSlotID, nTemp );
     282             :                 }
     283        7030 :                 else if ( pType == cppu::UnoType<OUString>::get() )
     284             :                 {
     285        2381 :                     OUString sTemp ;
     286        2381 :                     rEvent.State >>= sTemp ;
     287        2381 :                     pItem = new SfxStringItem( nSlotID, sTemp );
     288             :                 }
     289        4649 :                 else if ( pType == cppu::UnoType< ::com::sun::star::frame::status::ItemStatus>::get() )
     290             :                 {
     291           0 :                     frame::status::ItemStatus aItemStatus;
     292           0 :                     rEvent.State >>= aItemStatus;
     293           0 :                     eState = (SfxItemState) aItemStatus.State;
     294           0 :                     pItem = new SfxVoidItem( nSlotID );
     295             :                 }
     296             :                 else
     297             :                 {
     298        4649 :                     if ( pSlot )
     299        4649 :                         pItem = pSlot->GetType()->CreateItem();
     300        4649 :                     if ( pItem )
     301             :                     {
     302        4649 :                         pItem->SetWhich( nSlotID );
     303        4649 :                         pItem->PutValue( rEvent.State );
     304             :                     }
     305             :                     else
     306           0 :                         pItem = new SfxVoidItem( nSlotID );
     307       11028 :                 }
     308             :             }
     309             : 
     310       11441 :             StateChanged( nSlotID, eState, pItem );
     311       11441 :             delete pItem;
     312             :         }
     313       11441 :     }
     314       11441 : }
     315             : 
     316             : 
     317             : // XStatusbarController
     318             : 
     319           0 : sal_Bool SAL_CALL SfxStatusBarControl::mouseButtonDown(
     320             :     const awt::MouseEvent& rMouseEvent )
     321             : throw ( uno::RuntimeException, std::exception )
     322             : {
     323           0 :     SolarMutexGuard aGuard;
     324           0 :     ::Point aPos( rMouseEvent.X, rMouseEvent.Y );
     325             : 
     326             :     ::MouseEvent aMouseEvent( aPos,
     327             :                               (sal_uInt16)rMouseEvent.ClickCount,
     328             :                               MouseEventModifiers::NONE,
     329           0 :                               convertAwtToVCLMouseButtons( rMouseEvent.Buttons ),
     330           0 :                               0 );
     331             : 
     332           0 :     return MouseButtonDown( aMouseEvent );
     333             : }
     334             : 
     335             : 
     336             : 
     337           0 : sal_Bool SAL_CALL SfxStatusBarControl::mouseMove(
     338             :     const awt::MouseEvent& rMouseEvent )
     339             : throw (uno::RuntimeException, std::exception)
     340             : {
     341           0 :     SolarMutexGuard aGuard;
     342           0 :     ::Point aPos( rMouseEvent.X, rMouseEvent.Y );
     343             : 
     344             :     ::MouseEvent aMouseEvent( aPos,
     345             :                               (sal_uInt16)rMouseEvent.ClickCount,
     346             :                               MouseEventModifiers::NONE,
     347           0 :                               convertAwtToVCLMouseButtons( rMouseEvent.Buttons ),
     348           0 :                               0 );
     349           0 :     return MouseMove( aMouseEvent );
     350             : }
     351             : 
     352             : 
     353             : 
     354           0 : sal_Bool SAL_CALL SfxStatusBarControl::mouseButtonUp(
     355             :     const ::awt::MouseEvent& rMouseEvent )
     356             : throw ( uno::RuntimeException, std::exception )
     357             : {
     358           0 :     SolarMutexGuard aGuard;
     359           0 :     ::Point aPos( rMouseEvent.X, rMouseEvent.Y );
     360             : 
     361             :     ::MouseEvent aMouseEvent( aPos,
     362             :                               (sal_uInt16)rMouseEvent.ClickCount,
     363             :                               MouseEventModifiers::NONE,
     364           0 :                               convertAwtToVCLMouseButtons( rMouseEvent.Buttons ),
     365           0 :                               0 );
     366           0 :     return MouseButtonUp( aMouseEvent );
     367             : }
     368             : 
     369             : 
     370             : 
     371           0 : void SAL_CALL SfxStatusBarControl::command(
     372             :     const awt::Point& rPos,
     373             :     ::sal_Int32 nCommand,
     374             :     sal_Bool /*bMouseEvent*/,
     375             :     const ::com::sun::star::uno::Any& /*aData*/ )
     376             : throw (::com::sun::star::uno::RuntimeException, std::exception)
     377             : {
     378           0 :     SolarMutexGuard aGuard;
     379           0 :     ::Point aPos( rPos.X, rPos.Y );
     380           0 :     CommandEvent aCmdEvent( aPos, static_cast<CommandEventId>(nCommand), true, NULL );
     381             : 
     382           0 :     Command( aCmdEvent );
     383           0 : }
     384             : 
     385             : 
     386             : 
     387       23578 : void SAL_CALL SfxStatusBarControl::paint(
     388             :     const uno::Reference< awt::XGraphics >& xGraphics,
     389             :     const awt::Rectangle& rOutputRectangle,
     390             :     ::sal_Int32 nStyle )
     391             : throw ( ::uno::RuntimeException, std::exception )
     392             : {
     393       23578 :     SolarMutexGuard aGuard;
     394             : 
     395       23578 :     OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( xGraphics );
     396       23578 :     if ( pOutDev )
     397             :     {
     398       23578 :         ::Rectangle aRect = VCLRectangle( rOutputRectangle );
     399       23578 :         UserDrawEvent aUserDrawEvent( pOutDev, aRect, pBar->GetCurItemId(), (sal_uInt16)nStyle );
     400       23578 :         Paint( aUserDrawEvent );
     401       23578 :     }
     402       23578 : }
     403             : 
     404             : 
     405             : 
     406           0 : void SAL_CALL SfxStatusBarControl::click( const awt::Point& )
     407             : throw ( uno::RuntimeException, std::exception )
     408             : {
     409           0 :     SolarMutexGuard aGuard;
     410           0 :     Click();
     411           0 : }
     412             : 
     413             : 
     414             : 
     415           0 : void SAL_CALL SfxStatusBarControl::doubleClick( const awt::Point& )
     416             : throw ( uno::RuntimeException, std::exception )
     417             : {
     418           0 : }
     419             : 
     420             : 
     421             : // old sfx2 interface
     422             : 
     423             : 
     424         107 : void SfxStatusBarControl::StateChanged
     425             : (
     426             :     sal_uInt16              nSID,
     427             :     SfxItemState        eState,
     428             :     const SfxPoolItem*  pState  /* Pointer to SfxPoolItem, is only valid
     429             :                                    withih this Method call. This can be a
     430             :                                    Null-Pointer, a Pointer to SfxVoidItem
     431             :                                    or of this Type found registered by the
     432             :                                    Subclass of SfxStatusBarControl.
     433             :                                 */
     434             : )
     435             : 
     436             : /*  [Description]
     437             : 
     438             :     The base implementation includes items of type SfxStringItem
     439             :     where the text is entered in the status row field and
     440             :     SfxVoidItem, where the field is emptied. The base implementation
     441             :     should not be called in overriding methods.
     442             : */
     443             : 
     444             : {
     445             :     DBG_ASSERT( pBar != nullptr, "setting state to dangling StatusBar" );
     446             : 
     447         107 :     const SfxStringItem* pStr = PTR_CAST( SfxStringItem, pState );
     448         107 :     if ( eState == SfxItemState::DEFAULT && pStr )
     449           0 :         pBar->SetItemText( nSID, pStr->GetValue() );
     450             :     else
     451             :     {
     452             :         DBG_ASSERT( eState != SfxItemState::DEFAULT || pState->ISA(SfxVoidItem),
     453             :                     "wrong SfxPoolItem subclass in SfxStatusBarControl" );
     454         107 :         pBar->SetItemText( nSID, OUString() );
     455             :     }
     456         107 : }
     457             : 
     458             : 
     459             : 
     460           0 : bool SfxStatusBarControl::MouseButtonDown( const MouseEvent & )
     461             : 
     462             : /*  [Description]
     463             : 
     464             :     This virtual method forwards the Event MouseButtonDown() of the
     465             :     StatusBar if the mouse position is within the range of the items,
     466             :     or if the mouse was captured by <SfxStatusBarControl::CaptureMouse()>
     467             : 
     468             :     The default implementation is empty and returns FALSE.
     469             : 
     470             :     [Return value]
     471             : 
     472             :     sal_Bool                TRUE
     473             :            The event has been processed and is not intended to
     474             :            be forwarded to StatusBar
     475             : 
     476             :                         FALSE
     477             :            The event was not processed and is to be
     478             :            be forwarded to StatusBar
     479             : */
     480             : 
     481             : {
     482           0 :     return false;
     483             : }
     484             : 
     485             : 
     486             : 
     487           0 : bool SfxStatusBarControl::MouseMove( const MouseEvent & )
     488             : 
     489             : /*  [Description]
     490             : 
     491             :     This virtual method forwards the Event MouseMove() of the
     492             :     StatusBar if the mouse position is within the range of the items,
     493             :     or if the mouse was captured by <SfxStatusBarControl::CaptureMouse()>
     494             : 
     495             :     The default implementation is empty and returns FALSE.
     496             : 
     497             :     [Return value]
     498             : 
     499             :     sal_Bool                TRUE
     500             :            The event has been processed and is not intended to
     501             :            be forwarded to StatusBar
     502             : 
     503             :                         FALSE
     504             :            The event was not processed and is to be
     505             :            be forwarded to StatusBar
     506             : */
     507             : 
     508             : {
     509           0 :     return false;
     510             : }
     511             : 
     512             : 
     513           0 : bool SfxStatusBarControl::MouseButtonUp( const MouseEvent & )
     514             : 
     515             : /*  [Description]
     516             : 
     517             :     This virtual method forwards the Event MouseButtonUp() of the
     518             :     StatusBar if the mouse position is within the range of the items,
     519             :     or if the mouse was captured by <SfxStatusBarControl::CaptureMouse()>
     520             : 
     521             :     The default implementation is empty and returns FALSE.
     522             : 
     523             :     [Return value]
     524             : 
     525             :     sal_Bool                TRUE
     526             :            The event has been processed and is not intended to
     527             :            be forwarded to StatusBar
     528             : 
     529             :                         FALSE
     530             :            The event was not processed and is to be
     531             :            be forwarded to StatusBar
     532             : */
     533             : 
     534             : {
     535           0 :     return false;
     536             : }
     537             : 
     538             : 
     539             : 
     540           0 : void SfxStatusBarControl::Command( const CommandEvent& )
     541             : 
     542             : /*  [Description]
     543             : 
     544             :     This virtual method is called when a CommandEvent is received by
     545             :     SfxStatusBarControl.
     546             : 
     547             :     The default implementation is empty.
     548             : */
     549             : 
     550             : {
     551           0 : }
     552             : 
     553             : 
     554             : 
     555           0 : void SfxStatusBarControl::Click()
     556             : 
     557             : /*  [Description]
     558             : 
     559             :     This virtual method is called when the user clicks on the
     560             :     field in the status row that belongs to this control.
     561             : */
     562             : 
     563             : {
     564           0 :     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs;
     565           0 :     execute( aArgs );
     566           0 : }
     567             : 
     568             : 
     569             : 
     570           0 : void SfxStatusBarControl::Paint
     571             : (
     572             :     const UserDrawEvent& /* Reference to an UserDrawEvent */
     573             : )
     574             : 
     575             : /*  [Description]
     576             : 
     577             :     This virtual method is called to paint the contents if the field
     578             :     at hand is marked with SIB_USERDRAW. The output must be obtained
     579             :     within the Rectangle of rUDEvt.GetRect() by the OutputDevice
     580             :     given by rUDEvt.GetDevice().
     581             : 
     582             :     The default implementation is empty.
     583             : */
     584             : 
     585             : {
     586           0 : }
     587             : 
     588             : 
     589             : 
     590        6091 : SfxStatusBarControl* SfxStatusBarControl::CreateControl
     591             : (
     592             :     sal_uInt16     nSlotID,
     593             :     sal_uInt16     nStbId,
     594             :     StatusBar* pBar,
     595             :     SfxModule* pMod
     596             : )
     597             : {
     598        6091 :     SolarMutexGuard aGuard;
     599        6091 :     SfxApplication *pApp = SfxGetpApp();
     600             : 
     601             :     SfxSlotPool *pSlotPool;
     602        6091 :     if ( pMod )
     603        6074 :         pSlotPool = pMod->GetSlotPool();
     604             :     else
     605          17 :         pSlotPool = &SfxSlotPool::GetSlotPool();
     606             : 
     607        6091 :     TypeId aSlotType = pSlotPool->GetSlotType(nSlotID);
     608        6091 :     if ( aSlotType )
     609             :     {
     610        6091 :         if ( pMod )
     611             :         {
     612        6074 :             SfxStbCtrlFactArr_Impl *pFactories = pMod->GetStbCtrlFactories_Impl();
     613        6074 :             if ( pFactories )
     614             :             {
     615        6074 :                 SfxStbCtrlFactArr_Impl &rFactories = *pFactories;
     616       34291 :                 for ( size_t nFactory = 0; nFactory < rFactories.size(); ++nFactory )
     617       46732 :                 if ( rFactories[nFactory].nTypeId == aSlotType &&
     618       14904 :                      ( ( rFactories[nFactory].nSlotId == 0 ) ||
     619        7279 :                      ( rFactories[nFactory].nSlotId == nSlotID) ) )
     620        5445 :                     return rFactories[nFactory].pCtor( nSlotID, nStbId, *pBar );
     621             :             }
     622             :         }
     623             : 
     624         646 :         SfxStbCtrlFactArr_Impl &rFactories = pApp->GetStbCtrlFactories_Impl();
     625         646 :         for ( size_t nFactory = 0; nFactory < rFactories.size(); ++nFactory )
     626           0 :         if ( rFactories[nFactory].nTypeId == aSlotType &&
     627           0 :              ( ( rFactories[nFactory].nSlotId == 0 ) ||
     628           0 :              ( rFactories[nFactory].nSlotId == nSlotID) ) )
     629           0 :             return rFactories[nFactory].pCtor( nSlotID, nStbId, *pBar );
     630             :     }
     631             : 
     632         646 :     return NULL;
     633             : }
     634             : 
     635             : 
     636        1230 : void SfxStatusBarControl::RegisterStatusBarControl(SfxModule* pMod, SfxStbCtrlFactory* pFact)
     637             : {
     638        1230 :     SfxGetpApp()->RegisterStatusBarControl_Impl( pMod, pFact );
     639        1878 : }
     640             : 
     641             : 
     642             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11