1*6d739b60SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*6d739b60SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*6d739b60SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*6d739b60SAndrew Rist * distributed with this work for additional information 6*6d739b60SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*6d739b60SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*6d739b60SAndrew Rist * "License"); you may not use this file except in compliance 9*6d739b60SAndrew Rist * with the License. You may obtain a copy of the License at 10*6d739b60SAndrew Rist * 11*6d739b60SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*6d739b60SAndrew Rist * 13*6d739b60SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*6d739b60SAndrew Rist * software distributed under the License is distributed on an 15*6d739b60SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*6d739b60SAndrew Rist * KIND, either express or implied. See the License for the 17*6d739b60SAndrew Rist * specific language governing permissions and limitations 18*6d739b60SAndrew Rist * under the License. 19*6d739b60SAndrew Rist * 20*6d739b60SAndrew Rist *************************************************************/ 21*6d739b60SAndrew Rist 22*6d739b60SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_framework.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <uielement/statusbarmanager.hxx> 28cdf0e10cSrcweir 29cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 30cdf0e10cSrcweir // my own includes 31cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 32cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx> 33cdf0e10cSrcweir #include <threadhelp/resetableguard.hxx> 34cdf0e10cSrcweir #include <framework/sfxhelperfunctions.hxx> 35cdf0e10cSrcweir #include <macros/generic.hxx> 36cdf0e10cSrcweir #include <macros/xinterface.hxx> 37cdf0e10cSrcweir #include <macros/xtypeprovider.hxx> 38cdf0e10cSrcweir #include <stdtypes.h> 39cdf0e10cSrcweir #include "services.h" 40cdf0e10cSrcweir #include "general.h" 41cdf0e10cSrcweir #include "properties.h" 42cdf0e10cSrcweir #include <helper/mischelper.hxx> 43cdf0e10cSrcweir 44cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 45cdf0e10cSrcweir // interface includes 46cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 47cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp> 48cdf0e10cSrcweir #include <com/sun/star/frame/XStatusListener.hpp> 49cdf0e10cSrcweir #include <com/sun/star/util/XUpdatable.hpp> 50cdf0e10cSrcweir #include <com/sun/star/ui/ItemStyle.hpp> 51cdf0e10cSrcweir #include <com/sun/star/ui/ItemType.hpp> 52cdf0e10cSrcweir #include <com/sun/star/lang/XMultiComponentFactory.hpp> 53cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 54cdf0e10cSrcweir #include <com/sun/star/awt/Command.hpp> 55cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp> 56cdf0e10cSrcweir 57cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 58cdf0e10cSrcweir // other includes 59cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 60cdf0e10cSrcweir 61cdf0e10cSrcweir #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ 62cdf0e10cSrcweir #include <toolkit/unohlp.hxx> 63cdf0e10cSrcweir #endif 64cdf0e10cSrcweir #include <svtools/statusbarcontroller.hxx> 65cdf0e10cSrcweir 66cdf0e10cSrcweir #include <vcl/status.hxx> 67cdf0e10cSrcweir #include <vcl/svapp.hxx> 68cdf0e10cSrcweir #include <rtl/logfile.hxx> 69cdf0e10cSrcweir 70cdf0e10cSrcweir using namespace ::com::sun::star; 71cdf0e10cSrcweir #ifndef css 72cdf0e10cSrcweir #define css ::com::sun::star 73cdf0e10cSrcweir #endif 74cdf0e10cSrcweir #ifndef css_ui 75cdf0e10cSrcweir #define css_ui ::com::sun::star::ui 76cdf0e10cSrcweir #endif 77cdf0e10cSrcweir 78cdf0e10cSrcweir const sal_Int32 HELPID_PREFIX_LENGTH = 7; 79cdf0e10cSrcweir static const char* HELPID_PREFIX = "helpid:"; 80cdf0e10cSrcweir 81cdf0e10cSrcweir // Property names of a menu/menu item ItemDescriptor 82cdf0e10cSrcweir static const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL"; 83cdf0e10cSrcweir static const char ITEM_DESCRIPTOR_HELPURL[] = "HelpURL"; 84cdf0e10cSrcweir static const char ITEM_DESCRIPTOR_OFFSET[] = "Offset"; 85cdf0e10cSrcweir static const char ITEM_DESCRIPTOR_STYLE[] = "Style"; 86cdf0e10cSrcweir static const char ITEM_DESCRIPTOR_WIDTH[] = "Width"; 87cdf0e10cSrcweir static const char ITEM_DESCRIPTOR_TYPE[] = "Type"; 88cdf0e10cSrcweir 89cdf0e10cSrcweir namespace framework 90cdf0e10cSrcweir { 91cdf0e10cSrcweir 92cdf0e10cSrcweir static sal_uInt16 impl_convertItemStyleToItemBits( sal_Int16 nStyle ) 93cdf0e10cSrcweir { 94cdf0e10cSrcweir sal_uInt16 nItemBits( 0 ); 95cdf0e10cSrcweir 96cdf0e10cSrcweir if (( nStyle & css_ui::ItemStyle::ALIGN_RIGHT ) == css_ui::ItemStyle::ALIGN_RIGHT ) 97cdf0e10cSrcweir nItemBits |= SIB_RIGHT; 98cdf0e10cSrcweir else if ( nStyle & css_ui::ItemStyle::ALIGN_LEFT ) 99cdf0e10cSrcweir nItemBits |= SIB_LEFT; 100cdf0e10cSrcweir else 101cdf0e10cSrcweir nItemBits |= SIB_CENTER; 102cdf0e10cSrcweir 103cdf0e10cSrcweir if (( nStyle & css_ui::ItemStyle::DRAW_FLAT ) == css_ui::ItemStyle::DRAW_FLAT ) 104cdf0e10cSrcweir nItemBits |= SIB_FLAT; 105cdf0e10cSrcweir else if ( nStyle & css_ui::ItemStyle::DRAW_OUT3D ) 106cdf0e10cSrcweir nItemBits |= SIB_OUT; 107cdf0e10cSrcweir else 108cdf0e10cSrcweir nItemBits |= SIB_IN; 109cdf0e10cSrcweir 110cdf0e10cSrcweir if (( nStyle & css_ui::ItemStyle::AUTO_SIZE ) == css_ui::ItemStyle::AUTO_SIZE ) 111cdf0e10cSrcweir nItemBits |= SIB_AUTOSIZE; 112cdf0e10cSrcweir if ( nStyle & css_ui::ItemStyle::OWNER_DRAW ) 113cdf0e10cSrcweir nItemBits |= SIB_USERDRAW; 114cdf0e10cSrcweir 115cdf0e10cSrcweir return nItemBits; 116cdf0e10cSrcweir } 117cdf0e10cSrcweir 118cdf0e10cSrcweir //***************************************************************************************************************** 119cdf0e10cSrcweir // XInterface, XTypeProvider, XServiceInfo 120cdf0e10cSrcweir //***************************************************************************************************************** 121cdf0e10cSrcweir DEFINE_XINTERFACE_5 ( StatusBarManager , 122cdf0e10cSrcweir ::cppu::OWeakObject , 123cdf0e10cSrcweir DIRECT_INTERFACE( lang::XTypeProvider ), 124cdf0e10cSrcweir DIRECT_INTERFACE( lang::XComponent ), 125cdf0e10cSrcweir DIRECT_INTERFACE( frame::XFrameActionListener ), 126cdf0e10cSrcweir DIRECT_INTERFACE( css::ui::XUIConfigurationListener ), 127cdf0e10cSrcweir DERIVED_INTERFACE( lang::XEventListener, frame::XFrameActionListener ) 128cdf0e10cSrcweir ) 129cdf0e10cSrcweir 130cdf0e10cSrcweir DEFINE_XTYPEPROVIDER_5 ( StatusBarManager , 131cdf0e10cSrcweir lang::XTypeProvider , 132cdf0e10cSrcweir lang::XComponent , 133cdf0e10cSrcweir css::ui::XUIConfigurationListener , 134cdf0e10cSrcweir frame::XFrameActionListener , 135cdf0e10cSrcweir lang::XEventListener 136cdf0e10cSrcweir ) 137cdf0e10cSrcweir 138cdf0e10cSrcweir StatusBarManager::StatusBarManager( 139cdf0e10cSrcweir const uno::Reference< lang::XMultiServiceFactory >& rServiceManager, 140cdf0e10cSrcweir const uno::Reference< frame::XFrame >& rFrame, 141cdf0e10cSrcweir const rtl::OUString& rResourceName, 142cdf0e10cSrcweir StatusBar* pStatusBar ) : 143cdf0e10cSrcweir ThreadHelpBase( &Application::GetSolarMutex() ), 144cdf0e10cSrcweir OWeakObject(), 145cdf0e10cSrcweir m_bDisposed( sal_False ), 146cdf0e10cSrcweir m_bFrameActionRegistered( sal_False ), 147cdf0e10cSrcweir m_bUpdateControllers( sal_False ), 148cdf0e10cSrcweir m_bModuleIdentified( sal_False ), 149cdf0e10cSrcweir m_pStatusBar( pStatusBar ), 150cdf0e10cSrcweir m_aResourceName( rResourceName ), 151cdf0e10cSrcweir m_xFrame( rFrame ), 152cdf0e10cSrcweir m_aListenerContainer( m_aLock.getShareableOslMutex() ), 153cdf0e10cSrcweir m_xServiceManager( rServiceManager ) 154cdf0e10cSrcweir { 155cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::StatusBarManager" ); 156cdf0e10cSrcweir 157cdf0e10cSrcweir if ( m_xServiceManager.is() ) 158cdf0e10cSrcweir m_xStatusbarControllerRegistration = uno::Reference< css::frame::XUIControllerRegistration >( 159cdf0e10cSrcweir m_xServiceManager->createInstance( SERVICENAME_STATUSBARCONTROLLERFACTORY ), 160cdf0e10cSrcweir uno::UNO_QUERY ); 161cdf0e10cSrcweir 162cdf0e10cSrcweir m_pStatusBar->SetClickHdl( LINK( this, StatusBarManager, Click ) ); 163cdf0e10cSrcweir m_pStatusBar->SetDoubleClickHdl( LINK( this, StatusBarManager, DoubleClick ) ); 164cdf0e10cSrcweir } 165cdf0e10cSrcweir 166cdf0e10cSrcweir StatusBarManager::~StatusBarManager() 167cdf0e10cSrcweir { 168cdf0e10cSrcweir } 169cdf0e10cSrcweir 170cdf0e10cSrcweir StatusBar* StatusBarManager::GetStatusBar() const 171cdf0e10cSrcweir { 172cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::GetStatusBar" ); 173cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 174cdf0e10cSrcweir return m_pStatusBar; 175cdf0e10cSrcweir } 176cdf0e10cSrcweir 177cdf0e10cSrcweir void StatusBarManager::frameAction( const frame::FrameActionEvent& Action ) 178cdf0e10cSrcweir throw ( uno::RuntimeException ) 179cdf0e10cSrcweir { 180cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::frameAction" ); 181cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 182cdf0e10cSrcweir if ( Action.Action == frame::FrameAction_CONTEXT_CHANGED ) 183cdf0e10cSrcweir UpdateControllers(); 184cdf0e10cSrcweir } 185cdf0e10cSrcweir 186cdf0e10cSrcweir void SAL_CALL StatusBarManager::disposing( const lang::EventObject& Source ) throw ( uno::RuntimeException ) 187cdf0e10cSrcweir { 188cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::disposing" ); 189cdf0e10cSrcweir { 190cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 191cdf0e10cSrcweir if ( m_bDisposed ) 192cdf0e10cSrcweir return; 193cdf0e10cSrcweir } 194cdf0e10cSrcweir 195cdf0e10cSrcweir RemoveControllers(); 196cdf0e10cSrcweir 197cdf0e10cSrcweir { 198cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 199cdf0e10cSrcweir if ( Source.Source == uno::Reference< uno::XInterface >( m_xFrame, uno::UNO_QUERY )) 200cdf0e10cSrcweir m_xFrame.clear(); 201cdf0e10cSrcweir 202cdf0e10cSrcweir m_xServiceManager.clear(); 203cdf0e10cSrcweir } 204cdf0e10cSrcweir } 205cdf0e10cSrcweir 206cdf0e10cSrcweir // XComponent 207cdf0e10cSrcweir void SAL_CALL StatusBarManager::dispose() throw( uno::RuntimeException ) 208cdf0e10cSrcweir { 209cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::dispose" ); 210cdf0e10cSrcweir uno::Reference< lang::XComponent > xThis( 211cdf0e10cSrcweir static_cast< OWeakObject* >(this), uno::UNO_QUERY ); 212cdf0e10cSrcweir 213cdf0e10cSrcweir lang::EventObject aEvent( xThis ); 214cdf0e10cSrcweir m_aListenerContainer.disposeAndClear( aEvent ); 215cdf0e10cSrcweir 216cdf0e10cSrcweir { 217cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 218cdf0e10cSrcweir if ( !m_bDisposed ) 219cdf0e10cSrcweir { 220cdf0e10cSrcweir RemoveControllers(); 221cdf0e10cSrcweir 222cdf0e10cSrcweir delete m_pStatusBar; 223cdf0e10cSrcweir m_pStatusBar = 0; 224cdf0e10cSrcweir 225cdf0e10cSrcweir if ( m_bFrameActionRegistered && m_xFrame.is() ) 226cdf0e10cSrcweir { 227cdf0e10cSrcweir try 228cdf0e10cSrcweir { 229cdf0e10cSrcweir m_xFrame->removeFrameActionListener( uno::Reference< frame::XFrameActionListener >( 230cdf0e10cSrcweir static_cast< ::cppu::OWeakObject *>( this ), 231cdf0e10cSrcweir uno::UNO_QUERY )); 232cdf0e10cSrcweir } 233cdf0e10cSrcweir catch ( uno::Exception& ) 234cdf0e10cSrcweir { 235cdf0e10cSrcweir } 236cdf0e10cSrcweir } 237cdf0e10cSrcweir 238cdf0e10cSrcweir m_xFrame.clear(); 239cdf0e10cSrcweir m_xServiceManager.clear(); 240cdf0e10cSrcweir 241cdf0e10cSrcweir m_bDisposed = sal_True; 242cdf0e10cSrcweir } 243cdf0e10cSrcweir } 244cdf0e10cSrcweir } 245cdf0e10cSrcweir 246cdf0e10cSrcweir void SAL_CALL StatusBarManager::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) throw( uno::RuntimeException ) 247cdf0e10cSrcweir { 248cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::addEventListener" ); 249cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 250cdf0e10cSrcweir 251cdf0e10cSrcweir /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 252cdf0e10cSrcweir if ( m_bDisposed ) 253cdf0e10cSrcweir throw lang::DisposedException(); 254cdf0e10cSrcweir 255cdf0e10cSrcweir m_aListenerContainer.addInterface( ::getCppuType( 256cdf0e10cSrcweir ( const uno::Reference< lang::XEventListener >* ) NULL ), xListener ); 257cdf0e10cSrcweir } 258cdf0e10cSrcweir 259cdf0e10cSrcweir void SAL_CALL StatusBarManager::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) throw( uno::RuntimeException ) 260cdf0e10cSrcweir { 261cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::removeEventListener" ); 262cdf0e10cSrcweir m_aListenerContainer.removeInterface( ::getCppuType( 263cdf0e10cSrcweir ( const uno::Reference< lang::XEventListener >* ) NULL ), xListener ); 264cdf0e10cSrcweir } 265cdf0e10cSrcweir 266cdf0e10cSrcweir // XUIConfigurationListener 267cdf0e10cSrcweir void SAL_CALL StatusBarManager::elementInserted( const css::ui::ConfigurationEvent& ) throw ( uno::RuntimeException ) 268cdf0e10cSrcweir { 269cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::elementInserted" ); 270cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 271cdf0e10cSrcweir 272cdf0e10cSrcweir /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 273cdf0e10cSrcweir if ( m_bDisposed ) 274cdf0e10cSrcweir return; 275cdf0e10cSrcweir } 276cdf0e10cSrcweir 277cdf0e10cSrcweir void SAL_CALL StatusBarManager::elementRemoved( const css::ui::ConfigurationEvent& ) throw ( uno::RuntimeException ) 278cdf0e10cSrcweir { 279cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::elementRemoved" ); 280cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 281cdf0e10cSrcweir 282cdf0e10cSrcweir /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 283cdf0e10cSrcweir if ( m_bDisposed ) 284cdf0e10cSrcweir return; 285cdf0e10cSrcweir } 286cdf0e10cSrcweir 287cdf0e10cSrcweir void SAL_CALL StatusBarManager::elementReplaced( const css::ui::ConfigurationEvent& ) throw ( uno::RuntimeException ) 288cdf0e10cSrcweir { 289cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::elementReplaced" ); 290cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 291cdf0e10cSrcweir 292cdf0e10cSrcweir /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 293cdf0e10cSrcweir if ( m_bDisposed ) 294cdf0e10cSrcweir return; 295cdf0e10cSrcweir } 296cdf0e10cSrcweir 297cdf0e10cSrcweir void StatusBarManager::UpdateControllers() 298cdf0e10cSrcweir { 299cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::UpdateControllers" ); 300cdf0e10cSrcweir if ( !m_bUpdateControllers ) 301cdf0e10cSrcweir { 302cdf0e10cSrcweir m_bUpdateControllers = sal_True; 303cdf0e10cSrcweir const sal_uInt32 nCount = m_aControllerVector.size(); 304cdf0e10cSrcweir for ( sal_uInt32 n = 0; n < nCount; n++ ) 305cdf0e10cSrcweir { 306cdf0e10cSrcweir try 307cdf0e10cSrcweir { 308cdf0e10cSrcweir uno::Reference< util::XUpdatable > xUpdatable( m_aControllerVector[n], uno::UNO_QUERY ); 309cdf0e10cSrcweir if ( xUpdatable.is() ) 310cdf0e10cSrcweir xUpdatable->update(); 311cdf0e10cSrcweir } 312cdf0e10cSrcweir catch ( uno::Exception& ) 313cdf0e10cSrcweir { 314cdf0e10cSrcweir } 315cdf0e10cSrcweir } 316cdf0e10cSrcweir } 317cdf0e10cSrcweir m_bUpdateControllers = sal_False; 318cdf0e10cSrcweir } 319cdf0e10cSrcweir 320cdf0e10cSrcweir void StatusBarManager::RemoveControllers() 321cdf0e10cSrcweir { 322cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::RemoveControllers" ); 323cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 324cdf0e10cSrcweir 325cdf0e10cSrcweir if ( m_bDisposed ) 326cdf0e10cSrcweir return; 327cdf0e10cSrcweir 328cdf0e10cSrcweir const sal_uInt32 nCount = m_aControllerVector.size(); 329cdf0e10cSrcweir for ( sal_uInt32 n = 0; n < nCount; n++ ) 330cdf0e10cSrcweir { 331cdf0e10cSrcweir try 332cdf0e10cSrcweir { 333cdf0e10cSrcweir uno::Reference< lang::XComponent > xComponent( 334cdf0e10cSrcweir m_aControllerVector[n], uno::UNO_QUERY ); 335cdf0e10cSrcweir if ( xComponent.is() ) 336cdf0e10cSrcweir xComponent->dispose(); 337cdf0e10cSrcweir } 338cdf0e10cSrcweir catch ( uno::Exception& ) 339cdf0e10cSrcweir { 340cdf0e10cSrcweir } 341cdf0e10cSrcweir 342cdf0e10cSrcweir m_aControllerVector[n].clear(); 343cdf0e10cSrcweir } 344cdf0e10cSrcweir } 345cdf0e10cSrcweir 346cdf0e10cSrcweir rtl::OUString StatusBarManager::RetrieveLabelFromCommand( const rtl::OUString& aCmdURL ) 347cdf0e10cSrcweir { 348cdf0e10cSrcweir return framework::RetrieveLabelFromCommand(aCmdURL,m_xServiceManager,m_xUICommandLabels,m_xFrame,m_aModuleIdentifier,m_bModuleIdentified,"Name"); 349cdf0e10cSrcweir } 350cdf0e10cSrcweir 351cdf0e10cSrcweir void StatusBarManager::CreateControllers() 352cdf0e10cSrcweir { 353cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::CreateControllers" ); 354cdf0e10cSrcweir uno::Reference< lang::XMultiComponentFactory > xStatusbarControllerFactory( m_xStatusbarControllerRegistration, uno::UNO_QUERY ); 355cdf0e10cSrcweir uno::Reference< uno::XComponentContext > xComponentContext; 356cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( m_xServiceManager, uno::UNO_QUERY ); 357cdf0e10cSrcweir uno::Reference< awt::XWindow > xStatusbarWindow = VCLUnoHelper::GetInterface( m_pStatusBar ); 358cdf0e10cSrcweir 359cdf0e10cSrcweir if ( xProps.is() ) 360cdf0e10cSrcweir xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xComponentContext; 361cdf0e10cSrcweir 362cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < m_pStatusBar->GetItemCount(); i++ ) 363cdf0e10cSrcweir { 364cdf0e10cSrcweir sal_uInt16 nId = m_pStatusBar->GetItemId( i ); 365cdf0e10cSrcweir if ( nId == 0 ) 366cdf0e10cSrcweir continue; 367cdf0e10cSrcweir 368cdf0e10cSrcweir rtl::OUString aCommandURL( m_pStatusBar->GetItemCommand( nId )); 369cdf0e10cSrcweir sal_Bool bInit( sal_True ); 370cdf0e10cSrcweir uno::Reference< frame::XStatusListener > xController; 371cdf0e10cSrcweir 372cdf0e10cSrcweir svt::StatusbarController* pController( 0 ); 373cdf0e10cSrcweir 374cdf0e10cSrcweir if ( m_xStatusbarControllerRegistration.is() && 375cdf0e10cSrcweir m_xStatusbarControllerRegistration->hasController( aCommandURL, m_aModuleIdentifier )) 376cdf0e10cSrcweir { 377cdf0e10cSrcweir if ( xStatusbarControllerFactory.is() ) 378cdf0e10cSrcweir { 379cdf0e10cSrcweir uno::Sequence< uno::Any > aSeq( 5 ); 380cdf0e10cSrcweir beans::PropertyValue aPropValue; 381cdf0e10cSrcweir 382cdf0e10cSrcweir aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" )); 383cdf0e10cSrcweir aPropValue.Value = uno::makeAny( m_aModuleIdentifier ); 384cdf0e10cSrcweir aSeq[0] = uno::makeAny( aPropValue ); 385cdf0e10cSrcweir aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); 386cdf0e10cSrcweir aPropValue.Value = uno::makeAny( m_xFrame ); 387cdf0e10cSrcweir aSeq[1] = uno::makeAny( aPropValue ); 388cdf0e10cSrcweir aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); 389cdf0e10cSrcweir aPropValue.Value = uno::makeAny( m_xServiceManager ); 390cdf0e10cSrcweir aSeq[2] = uno::makeAny( aPropValue ); 391cdf0e10cSrcweir aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); 392cdf0e10cSrcweir aPropValue.Value = uno::makeAny( xStatusbarWindow ); 393cdf0e10cSrcweir aSeq[3] = uno::makeAny( aPropValue ); 394cdf0e10cSrcweir aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Identifier" )); 395cdf0e10cSrcweir aPropValue.Value = uno::makeAny( nId ); 396cdf0e10cSrcweir aSeq[4] = uno::makeAny( aPropValue ); 397cdf0e10cSrcweir 398cdf0e10cSrcweir xController = uno::Reference< frame::XStatusListener >( 399cdf0e10cSrcweir xStatusbarControllerFactory->createInstanceWithArgumentsAndContext( 400cdf0e10cSrcweir aCommandURL, aSeq, xComponentContext ), 401cdf0e10cSrcweir uno::UNO_QUERY ); 402cdf0e10cSrcweir bInit = sal_False; // Initialization is done through the factory service 403cdf0e10cSrcweir } 404cdf0e10cSrcweir } 405cdf0e10cSrcweir 406cdf0e10cSrcweir if ( !xController.is() ) 407cdf0e10cSrcweir { 408cdf0e10cSrcweir pController = CreateStatusBarController( m_xFrame, m_pStatusBar, nId, aCommandURL ); 409cdf0e10cSrcweir if ( !pController ) 410cdf0e10cSrcweir pController = new svt::StatusbarController( m_xServiceManager, m_xFrame, aCommandURL, nId ); 411cdf0e10cSrcweir 412cdf0e10cSrcweir if ( pController ) 413cdf0e10cSrcweir xController = uno::Reference< frame::XStatusListener >( 414cdf0e10cSrcweir static_cast< ::cppu::OWeakObject *>( pController ), 415cdf0e10cSrcweir uno::UNO_QUERY ); 416cdf0e10cSrcweir } 417cdf0e10cSrcweir 418cdf0e10cSrcweir m_aControllerVector.push_back( xController ); 419cdf0e10cSrcweir uno::Reference< lang::XInitialization > xInit( xController, uno::UNO_QUERY ); 420cdf0e10cSrcweir 421cdf0e10cSrcweir if ( xInit.is() ) 422cdf0e10cSrcweir { 423cdf0e10cSrcweir if ( bInit ) 424cdf0e10cSrcweir { 425cdf0e10cSrcweir beans::PropertyValue aPropValue; 426cdf0e10cSrcweir uno::Sequence< uno::Any > aArgs( 5 ); 427cdf0e10cSrcweir aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); 428cdf0e10cSrcweir aPropValue.Value = uno::makeAny( m_xFrame ); 429cdf0e10cSrcweir aArgs[0] = uno::makeAny( aPropValue ); 430cdf0e10cSrcweir aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" )); 431cdf0e10cSrcweir aPropValue.Value = uno::makeAny( aCommandURL ); 432cdf0e10cSrcweir aArgs[1] = uno::makeAny( aPropValue ); 433cdf0e10cSrcweir aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); 434cdf0e10cSrcweir aPropValue.Value = uno::makeAny( m_xServiceManager ); 435cdf0e10cSrcweir aArgs[2] = uno::makeAny( aPropValue ); 436cdf0e10cSrcweir aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); 437cdf0e10cSrcweir aPropValue.Value = uno::makeAny( xStatusbarWindow ); 438cdf0e10cSrcweir aArgs[3] = uno::makeAny( aPropValue ); 439cdf0e10cSrcweir aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Identifier" )); 440cdf0e10cSrcweir aPropValue.Value = uno::makeAny( nId ); 441cdf0e10cSrcweir aArgs[4] = uno::makeAny( aPropValue ); 442cdf0e10cSrcweir xInit->initialize( aArgs ); 443cdf0e10cSrcweir } 444cdf0e10cSrcweir } 445cdf0e10cSrcweir } 446cdf0e10cSrcweir 447cdf0e10cSrcweir AddFrameActionListener(); 448cdf0e10cSrcweir } 449cdf0e10cSrcweir 450cdf0e10cSrcweir void StatusBarManager::AddFrameActionListener() 451cdf0e10cSrcweir { 452cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::AddFrameActionListener" ); 453cdf0e10cSrcweir if ( !m_bFrameActionRegistered && m_xFrame.is() ) 454cdf0e10cSrcweir { 455cdf0e10cSrcweir m_bFrameActionRegistered = sal_True; 456cdf0e10cSrcweir m_xFrame->addFrameActionListener( uno::Reference< frame::XFrameActionListener >( 457cdf0e10cSrcweir static_cast< ::cppu::OWeakObject *>( this ), uno::UNO_QUERY )); 458cdf0e10cSrcweir } 459cdf0e10cSrcweir } 460cdf0e10cSrcweir 461cdf0e10cSrcweir void StatusBarManager::FillStatusBar( const uno::Reference< container::XIndexAccess >& rItemContainer ) 462cdf0e10cSrcweir { 463cdf0e10cSrcweir RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::StatusBarManager::FillStatusbar" ); 464cdf0e10cSrcweir 465cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 466cdf0e10cSrcweir 467cdf0e10cSrcweir if ( m_bDisposed || !m_pStatusBar ) 468cdf0e10cSrcweir return; 469cdf0e10cSrcweir 470cdf0e10cSrcweir sal_uInt16 nId( 1 ); 471cdf0e10cSrcweir rtl::OUString aHelpIdPrefix( RTL_CONSTASCII_USTRINGPARAM( HELPID_PREFIX )); 472cdf0e10cSrcweir 473cdf0e10cSrcweir RemoveControllers(); 474cdf0e10cSrcweir 475cdf0e10cSrcweir // reset and fill command map 476cdf0e10cSrcweir m_pStatusBar->Clear(); 477cdf0e10cSrcweir m_aControllerVector.clear(); 478cdf0e10cSrcweir 479cdf0e10cSrcweir for ( sal_Int32 n = 0; n < rItemContainer->getCount(); n++ ) 480cdf0e10cSrcweir { 481cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::FillStatusBar" ); 482cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aProp; 483cdf0e10cSrcweir rtl::OUString aCommandURL; 484cdf0e10cSrcweir rtl::OUString aHelpURL; 485cdf0e10cSrcweir sal_Int16 nOffset( 0 ); 486cdf0e10cSrcweir sal_Int16 nStyle( 0 ); 487cdf0e10cSrcweir sal_Int16 nWidth( 0 ); 488cdf0e10cSrcweir sal_uInt16 nType( css_ui::ItemType::DEFAULT ); 489cdf0e10cSrcweir 490cdf0e10cSrcweir try 491cdf0e10cSrcweir { 492cdf0e10cSrcweir if ( rItemContainer->getByIndex( n ) >>= aProp ) 493cdf0e10cSrcweir { 494cdf0e10cSrcweir for ( int i = 0; i < aProp.getLength(); i++ ) 495cdf0e10cSrcweir { 496cdf0e10cSrcweir if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_COMMANDURL )) 497cdf0e10cSrcweir { 498cdf0e10cSrcweir aProp[i].Value >>= aCommandURL; 499cdf0e10cSrcweir } 500cdf0e10cSrcweir else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_HELPURL )) 501cdf0e10cSrcweir { 502cdf0e10cSrcweir aProp[i].Value >>= aHelpURL; 503cdf0e10cSrcweir } 504cdf0e10cSrcweir else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_STYLE )) 505cdf0e10cSrcweir { 506cdf0e10cSrcweir aProp[i].Value >>= nStyle; 507cdf0e10cSrcweir } 508cdf0e10cSrcweir else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_TYPE )) 509cdf0e10cSrcweir { 510cdf0e10cSrcweir aProp[i].Value >>= nType; 511cdf0e10cSrcweir } 512cdf0e10cSrcweir else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_WIDTH )) 513cdf0e10cSrcweir { 514cdf0e10cSrcweir aProp[i].Value >>= nWidth; 515cdf0e10cSrcweir } 516cdf0e10cSrcweir else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_OFFSET )) 517cdf0e10cSrcweir { 518cdf0e10cSrcweir aProp[i].Value >>= nOffset; 519cdf0e10cSrcweir } 520cdf0e10cSrcweir } 521cdf0e10cSrcweir 522cdf0e10cSrcweir if (( nType == ::com::sun::star::ui::ItemType::DEFAULT ) && ( aCommandURL.getLength() > 0 )) 523cdf0e10cSrcweir { 524cdf0e10cSrcweir rtl::OUString aString( RetrieveLabelFromCommand( aCommandURL )); 525cdf0e10cSrcweir sal_uInt16 nItemBits( impl_convertItemStyleToItemBits( nStyle )); 526cdf0e10cSrcweir 527cdf0e10cSrcweir m_pStatusBar->InsertItem( nId, nWidth, nItemBits, nOffset ); 528cdf0e10cSrcweir m_pStatusBar->SetItemCommand( nId, aCommandURL ); 529cdf0e10cSrcweir m_pStatusBar->SetAccessibleName( nId, aString ); 530cdf0e10cSrcweir ++nId; 531cdf0e10cSrcweir } 532cdf0e10cSrcweir } 533cdf0e10cSrcweir } 534cdf0e10cSrcweir catch ( ::com::sun::star::lang::IndexOutOfBoundsException& ) 535cdf0e10cSrcweir { 536cdf0e10cSrcweir break; 537cdf0e10cSrcweir } 538cdf0e10cSrcweir } 539cdf0e10cSrcweir 540cdf0e10cSrcweir // Create controllers 541cdf0e10cSrcweir CreateControllers(); 542cdf0e10cSrcweir 543cdf0e10cSrcweir // Notify controllers that they are now correctly initialized and can start listening 544cdf0e10cSrcweir UpdateControllers(); 545cdf0e10cSrcweir } 546cdf0e10cSrcweir 547cdf0e10cSrcweir void StatusBarManager::StateChanged( StateChangedType ) 548cdf0e10cSrcweir { 549cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::StateChanged" ); 550cdf0e10cSrcweir } 551cdf0e10cSrcweir 552cdf0e10cSrcweir void StatusBarManager::DataChanged( const DataChangedEvent& rDCEvt ) 553cdf0e10cSrcweir { 554cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::DataChanged" ); 555cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 556cdf0e10cSrcweir 557cdf0e10cSrcweir if ((( rDCEvt.GetType() == DATACHANGED_SETTINGS ) || 558cdf0e10cSrcweir ( rDCEvt.GetType() == DATACHANGED_FONTS ) || 559cdf0e10cSrcweir ( rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION ) || 560cdf0e10cSrcweir ( rDCEvt.GetType() == DATACHANGED_DISPLAY )) && 561cdf0e10cSrcweir ( rDCEvt.GetFlags() & SETTINGS_STYLE )) 562cdf0e10cSrcweir { 563cdf0e10cSrcweir css::uno::Reference< css::frame::XLayoutManager > xLayoutManager; 564cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xPropSet( m_xFrame, css::uno::UNO_QUERY ); 565cdf0e10cSrcweir if ( xPropSet.is() ) 566cdf0e10cSrcweir xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))) >>= xLayoutManager; 567cdf0e10cSrcweir if ( xLayoutManager.is() ) 568cdf0e10cSrcweir { 569cdf0e10cSrcweir aGuard.unlock(); 570cdf0e10cSrcweir xLayoutManager->doLayout(); 571cdf0e10cSrcweir } 572cdf0e10cSrcweir } 573cdf0e10cSrcweir } 574cdf0e10cSrcweir 575cdf0e10cSrcweir void StatusBarManager::UserDraw( const UserDrawEvent& rUDEvt ) 576cdf0e10cSrcweir { 577cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::UserDraw" ); 578cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 579cdf0e10cSrcweir 580cdf0e10cSrcweir if ( m_bDisposed ) 581cdf0e10cSrcweir return; 582cdf0e10cSrcweir 583cdf0e10cSrcweir sal_uInt16 nId( rUDEvt.GetItemId() ); 584cdf0e10cSrcweir if (( nId > 0 ) && ( nId <= m_aControllerVector.size() )) 585cdf0e10cSrcweir { 586cdf0e10cSrcweir uno::Reference< frame::XStatusbarController > xController( 587cdf0e10cSrcweir m_aControllerVector[nId-1], uno::UNO_QUERY ); 588cdf0e10cSrcweir if ( xController.is() && rUDEvt.GetDevice() ) 589cdf0e10cSrcweir { 590cdf0e10cSrcweir uno::Reference< awt::XGraphics > xGraphics = 591cdf0e10cSrcweir rUDEvt.GetDevice()->CreateUnoGraphics(); 592cdf0e10cSrcweir 593cdf0e10cSrcweir awt::Rectangle aRect( rUDEvt.GetRect().Left(), 594cdf0e10cSrcweir rUDEvt.GetRect().Top(), 595cdf0e10cSrcweir rUDEvt.GetRect().GetWidth(), 596cdf0e10cSrcweir rUDEvt.GetRect().GetHeight() ); 597cdf0e10cSrcweir aGuard.unlock(); 598cdf0e10cSrcweir xController->paint( xGraphics, aRect, rUDEvt.GetItemId(), rUDEvt.GetStyle() ); 599cdf0e10cSrcweir } 600cdf0e10cSrcweir } 601cdf0e10cSrcweir } 602cdf0e10cSrcweir 603cdf0e10cSrcweir void StatusBarManager::Command( const CommandEvent& rEvt ) 604cdf0e10cSrcweir { 605cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::Command" ); 606cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 607cdf0e10cSrcweir 608cdf0e10cSrcweir if ( m_bDisposed ) 609cdf0e10cSrcweir return; 610cdf0e10cSrcweir 611cdf0e10cSrcweir if ( rEvt.GetCommand() == COMMAND_CONTEXTMENU ) 612cdf0e10cSrcweir { 613cdf0e10cSrcweir sal_uInt16 nId = m_pStatusBar->GetItemId( rEvt.GetMousePosPixel() ); 614cdf0e10cSrcweir if (( nId > 0 ) && ( nId <= m_aControllerVector.size() )) 615cdf0e10cSrcweir { 616cdf0e10cSrcweir uno::Reference< frame::XStatusbarController > xController( 617cdf0e10cSrcweir m_aControllerVector[nId-1], uno::UNO_QUERY ); 618cdf0e10cSrcweir if ( xController.is() ) 619cdf0e10cSrcweir { 620cdf0e10cSrcweir awt::Point aPos; 621cdf0e10cSrcweir aPos.X = rEvt.GetMousePosPixel().X(); 622cdf0e10cSrcweir aPos.Y = rEvt.GetMousePosPixel().Y(); 623cdf0e10cSrcweir xController->command( aPos, awt::Command::CONTEXTMENU, sal_True, uno::Any() ); 624cdf0e10cSrcweir } 625cdf0e10cSrcweir } 626cdf0e10cSrcweir } 627cdf0e10cSrcweir } 628cdf0e10cSrcweir 629cdf0e10cSrcweir void StatusBarManager::MouseMove( const MouseEvent& rMEvt ) 630cdf0e10cSrcweir { 631cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::MouseMove" ); 632cdf0e10cSrcweir MouseButton(rMEvt,&frame::XStatusbarController::mouseMove); 633cdf0e10cSrcweir } 634cdf0e10cSrcweir void StatusBarManager::MouseButton( const MouseEvent& rMEvt ,sal_Bool ( SAL_CALL frame::XStatusbarController::*_pMethod )(const ::com::sun::star::awt::MouseEvent&)) 635cdf0e10cSrcweir { 636cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::MouseButton" ); 637cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 638cdf0e10cSrcweir 639cdf0e10cSrcweir if ( !m_bDisposed ) 640cdf0e10cSrcweir { 641cdf0e10cSrcweir sal_uInt16 nId = m_pStatusBar->GetItemId( rMEvt.GetPosPixel() ); 642cdf0e10cSrcweir if (( nId > 0 ) && ( nId <= m_aControllerVector.size() )) 643cdf0e10cSrcweir { 644cdf0e10cSrcweir uno::Reference< frame::XStatusbarController > xController( 645cdf0e10cSrcweir m_aControllerVector[nId-1], uno::UNO_QUERY ); 646cdf0e10cSrcweir if ( xController.is() ) 647cdf0e10cSrcweir { 648cdf0e10cSrcweir ::com::sun::star::awt::MouseEvent aMouseEvent; 649cdf0e10cSrcweir aMouseEvent.Buttons = rMEvt.GetButtons(); 650cdf0e10cSrcweir aMouseEvent.X = rMEvt.GetPosPixel().X(); 651cdf0e10cSrcweir aMouseEvent.Y = rMEvt.GetPosPixel().Y(); 652cdf0e10cSrcweir aMouseEvent.ClickCount = rMEvt.GetClicks(); 653cdf0e10cSrcweir (xController.get()->*_pMethod)( aMouseEvent); 654cdf0e10cSrcweir } 655cdf0e10cSrcweir } // if (( nId > 0 ) && ( nId <= m_aControllerVector.size() )) 656cdf0e10cSrcweir } 657cdf0e10cSrcweir } 658cdf0e10cSrcweir void StatusBarManager::MouseButtonDown( const MouseEvent& rMEvt ) 659cdf0e10cSrcweir { 660cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::MouseButtonDown" ); 661cdf0e10cSrcweir MouseButton(rMEvt,&frame::XStatusbarController::mouseButtonDown); 662cdf0e10cSrcweir } 663cdf0e10cSrcweir 664cdf0e10cSrcweir void StatusBarManager::MouseButtonUp( const MouseEvent& rMEvt ) 665cdf0e10cSrcweir { 666cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::MouseButtonUp" ); 667cdf0e10cSrcweir MouseButton(rMEvt,&frame::XStatusbarController::mouseButtonUp); 668cdf0e10cSrcweir } 669cdf0e10cSrcweir 670cdf0e10cSrcweir IMPL_LINK( StatusBarManager, Click, StatusBar*, EMPTYARG ) 671cdf0e10cSrcweir { 672cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 673cdf0e10cSrcweir 674cdf0e10cSrcweir if ( m_bDisposed ) 675cdf0e10cSrcweir return 1; 676cdf0e10cSrcweir 677cdf0e10cSrcweir sal_uInt16 nId = m_pStatusBar->GetCurItemId(); 678cdf0e10cSrcweir if (( nId > 0 ) && ( nId <= m_aControllerVector.size() )) 679cdf0e10cSrcweir { 680cdf0e10cSrcweir uno::Reference< frame::XStatusbarController > xController( 681cdf0e10cSrcweir m_aControllerVector[nId-1], uno::UNO_QUERY ); 682cdf0e10cSrcweir if ( xController.is() ) 683cdf0e10cSrcweir xController->click(); 684cdf0e10cSrcweir } 685cdf0e10cSrcweir 686cdf0e10cSrcweir return 1; 687cdf0e10cSrcweir } 688cdf0e10cSrcweir 689cdf0e10cSrcweir IMPL_LINK( StatusBarManager, DoubleClick, StatusBar*, EMPTYARG ) 690cdf0e10cSrcweir { 691cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 692cdf0e10cSrcweir 693cdf0e10cSrcweir if ( m_bDisposed ) 694cdf0e10cSrcweir return 1; 695cdf0e10cSrcweir 696cdf0e10cSrcweir sal_uInt16 nId = m_pStatusBar->GetCurItemId(); 697cdf0e10cSrcweir if (( nId > 0 ) && ( nId <= m_aControllerVector.size() )) 698cdf0e10cSrcweir { 699cdf0e10cSrcweir uno::Reference< frame::XStatusbarController > xController( 700cdf0e10cSrcweir m_aControllerVector[nId-1], uno::UNO_QUERY ); 701cdf0e10cSrcweir if ( xController.is() ) 702cdf0e10cSrcweir xController->doubleClick(); 703cdf0e10cSrcweir } 704cdf0e10cSrcweir 705cdf0e10cSrcweir return 1; 706cdf0e10cSrcweir } 707cdf0e10cSrcweir 708cdf0e10cSrcweir } 709