statusbarmanager.cxx (6d739b60) | statusbarmanager.cxx (2503e1a5) |
---|---|
1/************************************************************** | 1/************************************************************** |
2 * | 2 * |
3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at | 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at |
10 * | 10 * |
11 * http://www.apache.org/licenses/LICENSE-2.0 | 11 * http://www.apache.org/licenses/LICENSE-2.0 |
12 * | 12 * |
13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. | 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. |
19 * | 19 * |
20 *************************************************************/ 21 22 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_framework.hxx" 26 27#include <uielement/statusbarmanager.hxx> | 20 *************************************************************/ 21 22 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_framework.hxx" 26 27#include <uielement/statusbarmanager.hxx> |
28#include <uielement/genericstatusbarcontroller.hxx> |
|
28 | 29 |
29//_________________________________________________________________________________________________________________ 30// my own includes 31//_________________________________________________________________________________________________________________ | |
32#include <threadhelp/threadhelpbase.hxx> 33#include <threadhelp/resetableguard.hxx> 34#include <framework/sfxhelperfunctions.hxx> | 30#include <threadhelp/threadhelpbase.hxx> 31#include <threadhelp/resetableguard.hxx> 32#include <framework/sfxhelperfunctions.hxx> |
33#include <framework/addonsoptions.hxx> 34#include <uielement/statusbarmerger.hxx> 35#include <uielement/statusbaritem.hxx> |
|
35#include <macros/generic.hxx> 36#include <macros/xinterface.hxx> 37#include <macros/xtypeprovider.hxx> 38#include <stdtypes.h> 39#include "services.h" 40#include "general.h" 41#include "properties.h" 42#include <helper/mischelper.hxx> 43 | 36#include <macros/generic.hxx> 37#include <macros/xinterface.hxx> 38#include <macros/xtypeprovider.hxx> 39#include <stdtypes.h> 40#include "services.h" 41#include "general.h" 42#include "properties.h" 43#include <helper/mischelper.hxx> 44 |
44//_________________________________________________________________________________________________________________ 45// interface includes 46//_________________________________________________________________________________________________________________ | |
47#include <com/sun/star/frame/XFrame.hpp> 48#include <com/sun/star/frame/XStatusListener.hpp> 49#include <com/sun/star/util/XUpdatable.hpp> 50#include <com/sun/star/ui/ItemStyle.hpp> 51#include <com/sun/star/ui/ItemType.hpp> 52#include <com/sun/star/lang/XMultiComponentFactory.hpp> 53#include <com/sun/star/beans/XPropertySet.hpp> 54#include <com/sun/star/awt/Command.hpp> | 45#include <com/sun/star/frame/XFrame.hpp> 46#include <com/sun/star/frame/XStatusListener.hpp> 47#include <com/sun/star/util/XUpdatable.hpp> 48#include <com/sun/star/ui/ItemStyle.hpp> 49#include <com/sun/star/ui/ItemType.hpp> 50#include <com/sun/star/lang/XMultiComponentFactory.hpp> 51#include <com/sun/star/beans/XPropertySet.hpp> 52#include <com/sun/star/awt/Command.hpp> |
53#include <com/sun/star/ui/XStatusbarItem.hdl> |
|
55#include <com/sun/star/lang/DisposedException.hpp> 56 | 54#include <com/sun/star/lang/DisposedException.hpp> 55 |
57//_________________________________________________________________________________________________________________ 58// other includes 59//_________________________________________________________________________________________________________________ | 56#include <toolkit/helper/vclunohelper.hxx> |
60 | 57 |
61#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ 62#include <toolkit/unohlp.hxx> 63#endif | |
64#include <svtools/statusbarcontroller.hxx> 65 66#include <vcl/status.hxx> 67#include <vcl/svapp.hxx> 68#include <rtl/logfile.hxx> 69 | 58#include <svtools/statusbarcontroller.hxx> 59 60#include <vcl/status.hxx> 61#include <vcl/svapp.hxx> 62#include <rtl/logfile.hxx> 63 |
64#include <functional> 65 |
|
70using namespace ::com::sun::star; 71#ifndef css 72#define css ::com::sun::star 73#endif 74#ifndef css_ui 75#define css_ui ::com::sun::star::ui 76#endif 77 --- 6 unchanged lines hidden (view full) --- 84static const char ITEM_DESCRIPTOR_OFFSET[] = "Offset"; 85static const char ITEM_DESCRIPTOR_STYLE[] = "Style"; 86static const char ITEM_DESCRIPTOR_WIDTH[] = "Width"; 87static const char ITEM_DESCRIPTOR_TYPE[] = "Type"; 88 89namespace framework 90{ 91 | 66using namespace ::com::sun::star; 67#ifndef css 68#define css ::com::sun::star 69#endif 70#ifndef css_ui 71#define css_ui ::com::sun::star::ui 72#endif 73 --- 6 unchanged lines hidden (view full) --- 80static const char ITEM_DESCRIPTOR_OFFSET[] = "Offset"; 81static const char ITEM_DESCRIPTOR_STYLE[] = "Style"; 82static const char ITEM_DESCRIPTOR_WIDTH[] = "Width"; 83static const char ITEM_DESCRIPTOR_TYPE[] = "Type"; 84 85namespace framework 86{ 87 |
88namespace 89{ 90 91template< class MAP > 92struct lcl_UpdateController : public std::unary_function< typename MAP::value_type, void > 93{ 94 void operator()( typename MAP::value_type &rElement ) const 95 { 96 try 97 { 98 uno::Reference< util::XUpdatable > xUpdatable( rElement.second, uno::UNO_QUERY ); 99 if ( xUpdatable.is() ) 100 xUpdatable->update(); 101 } 102 catch ( uno::Exception& ) 103 { 104 } 105 } 106}; 107 108template< class MAP > 109struct lcl_RemoveController : public std::unary_function< typename MAP::value_type, void > 110{ 111 void operator()( typename MAP::value_type &rElement ) const 112 { 113 try 114 { 115 uno::Reference< lang::XComponent > xComponent( rElement.second, uno::UNO_QUERY ); 116 if ( xComponent.is() ) 117 xComponent->dispose(); 118 } 119 catch ( uno::Exception& ) 120 { 121 } 122 } 123}; 124 |
|
92static sal_uInt16 impl_convertItemStyleToItemBits( sal_Int16 nStyle ) 93{ 94 sal_uInt16 nItemBits( 0 ); 95 96 if (( nStyle & css_ui::ItemStyle::ALIGN_RIGHT ) == css_ui::ItemStyle::ALIGN_RIGHT ) 97 nItemBits |= SIB_RIGHT; 98 else if ( nStyle & css_ui::ItemStyle::ALIGN_LEFT ) 99 nItemBits |= SIB_LEFT; --- 9 unchanged lines hidden (view full) --- 109 110 if (( nStyle & css_ui::ItemStyle::AUTO_SIZE ) == css_ui::ItemStyle::AUTO_SIZE ) 111 nItemBits |= SIB_AUTOSIZE; 112 if ( nStyle & css_ui::ItemStyle::OWNER_DRAW ) 113 nItemBits |= SIB_USERDRAW; 114 115 return nItemBits; 116} | 125static sal_uInt16 impl_convertItemStyleToItemBits( sal_Int16 nStyle ) 126{ 127 sal_uInt16 nItemBits( 0 ); 128 129 if (( nStyle & css_ui::ItemStyle::ALIGN_RIGHT ) == css_ui::ItemStyle::ALIGN_RIGHT ) 130 nItemBits |= SIB_RIGHT; 131 else if ( nStyle & css_ui::ItemStyle::ALIGN_LEFT ) 132 nItemBits |= SIB_LEFT; --- 9 unchanged lines hidden (view full) --- 142 143 if (( nStyle & css_ui::ItemStyle::AUTO_SIZE ) == css_ui::ItemStyle::AUTO_SIZE ) 144 nItemBits |= SIB_AUTOSIZE; 145 if ( nStyle & css_ui::ItemStyle::OWNER_DRAW ) 146 nItemBits |= SIB_USERDRAW; 147 148 return nItemBits; 149} |
117 | 150 151} |
118//***************************************************************************************************************** 119// XInterface, XTypeProvider, XServiceInfo 120//***************************************************************************************************************** 121DEFINE_XINTERFACE_5 ( StatusBarManager , 122 ::cppu::OWeakObject , 123 DIRECT_INTERFACE( lang::XTypeProvider ), 124 DIRECT_INTERFACE( lang::XComponent ), 125 DIRECT_INTERFACE( frame::XFrameActionListener ), --- 81 unchanged lines hidden (view full) --- 207void SAL_CALL StatusBarManager::dispose() throw( uno::RuntimeException ) 208{ 209 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::dispose" ); 210 uno::Reference< lang::XComponent > xThis( 211 static_cast< OWeakObject* >(this), uno::UNO_QUERY ); 212 213 lang::EventObject aEvent( xThis ); 214 m_aListenerContainer.disposeAndClear( aEvent ); | 152//***************************************************************************************************************** 153// XInterface, XTypeProvider, XServiceInfo 154//***************************************************************************************************************** 155DEFINE_XINTERFACE_5 ( StatusBarManager , 156 ::cppu::OWeakObject , 157 DIRECT_INTERFACE( lang::XTypeProvider ), 158 DIRECT_INTERFACE( lang::XComponent ), 159 DIRECT_INTERFACE( frame::XFrameActionListener ), --- 81 unchanged lines hidden (view full) --- 241void SAL_CALL StatusBarManager::dispose() throw( uno::RuntimeException ) 242{ 243 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::dispose" ); 244 uno::Reference< lang::XComponent > xThis( 245 static_cast< OWeakObject* >(this), uno::UNO_QUERY ); 246 247 lang::EventObject aEvent( xThis ); 248 m_aListenerContainer.disposeAndClear( aEvent ); |
215 | 249 |
216 { 217 ResetableGuard aGuard( m_aLock ); 218 if ( !m_bDisposed ) 219 { 220 RemoveControllers(); | 250 { 251 ResetableGuard aGuard( m_aLock ); 252 if ( !m_bDisposed ) 253 { 254 RemoveControllers(); |
221 | 255 256 // destroy the item data 257 for ( sal_uInt16 n = 0; n < m_pStatusBar->GetItemCount(); n++ ) 258 { 259 AddonStatusbarItemData *pUserData = static_cast< AddonStatusbarItemData *>( 260 m_pStatusBar->GetItemData( m_pStatusBar->GetItemId( n ) ) ); 261 if ( pUserData ) 262 delete pUserData; 263 } 264 |
222 delete m_pStatusBar; 223 m_pStatusBar = 0; 224 225 if ( m_bFrameActionRegistered && m_xFrame.is() ) 226 { 227 try 228 { 229 m_xFrame->removeFrameActionListener( uno::Reference< frame::XFrameActionListener >( --- 33 unchanged lines hidden (view full) --- 263 ( const uno::Reference< lang::XEventListener >* ) NULL ), xListener ); 264} 265 266// XUIConfigurationListener 267void SAL_CALL StatusBarManager::elementInserted( const css::ui::ConfigurationEvent& ) throw ( uno::RuntimeException ) 268{ 269 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::elementInserted" ); 270 ResetableGuard aGuard( m_aLock ); | 265 delete m_pStatusBar; 266 m_pStatusBar = 0; 267 268 if ( m_bFrameActionRegistered && m_xFrame.is() ) 269 { 270 try 271 { 272 m_xFrame->removeFrameActionListener( uno::Reference< frame::XFrameActionListener >( --- 33 unchanged lines hidden (view full) --- 306 ( const uno::Reference< lang::XEventListener >* ) NULL ), xListener ); 307} 308 309// XUIConfigurationListener 310void SAL_CALL StatusBarManager::elementInserted( const css::ui::ConfigurationEvent& ) throw ( uno::RuntimeException ) 311{ 312 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::elementInserted" ); 313 ResetableGuard aGuard( m_aLock ); |
271 272 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ | 314 |
273 if ( m_bDisposed ) 274 return; 275} 276 277void SAL_CALL StatusBarManager::elementRemoved( const css::ui::ConfigurationEvent& ) throw ( uno::RuntimeException ) 278{ 279 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::elementRemoved" ); 280 ResetableGuard aGuard( m_aLock ); | 315 if ( m_bDisposed ) 316 return; 317} 318 319void SAL_CALL StatusBarManager::elementRemoved( const css::ui::ConfigurationEvent& ) throw ( uno::RuntimeException ) 320{ 321 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::elementRemoved" ); 322 ResetableGuard aGuard( m_aLock ); |
281 282 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ | 323 |
283 if ( m_bDisposed ) 284 return; 285} | 324 if ( m_bDisposed ) 325 return; 326} |
286 | 327 |
287void SAL_CALL StatusBarManager::elementReplaced( const css::ui::ConfigurationEvent& ) throw ( uno::RuntimeException ) 288{ 289 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::elementReplaced" ); 290 ResetableGuard aGuard( m_aLock ); | 328void SAL_CALL StatusBarManager::elementReplaced( const css::ui::ConfigurationEvent& ) throw ( uno::RuntimeException ) 329{ 330 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::elementReplaced" ); 331 ResetableGuard aGuard( m_aLock ); |
291 292 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ | 332 |
293 if ( m_bDisposed ) 294 return; 295} 296 297void StatusBarManager::UpdateControllers() 298{ 299 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::UpdateControllers" ); 300 if ( !m_bUpdateControllers ) 301 { 302 m_bUpdateControllers = sal_True; | 333 if ( m_bDisposed ) 334 return; 335} 336 337void StatusBarManager::UpdateControllers() 338{ 339 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::UpdateControllers" ); 340 if ( !m_bUpdateControllers ) 341 { 342 m_bUpdateControllers = sal_True; |
303 const sal_uInt32 nCount = m_aControllerVector.size(); 304 for ( sal_uInt32 n = 0; n < nCount; n++ ) 305 { 306 try 307 { 308 uno::Reference< util::XUpdatable > xUpdatable( m_aControllerVector[n], uno::UNO_QUERY ); 309 if ( xUpdatable.is() ) 310 xUpdatable->update(); 311 } 312 catch ( uno::Exception& ) 313 { 314 } 315 } | 343 std::for_each( m_aControllerMap.begin(), 344 m_aControllerMap.end(), 345 lcl_UpdateController< StatusBarControllerMap >() ); |
316 } 317 m_bUpdateControllers = sal_False; 318} 319 320void StatusBarManager::RemoveControllers() 321{ 322 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::RemoveControllers" ); 323 ResetableGuard aGuard( m_aLock ); 324 325 if ( m_bDisposed ) 326 return; 327 | 346 } 347 m_bUpdateControllers = sal_False; 348} 349 350void StatusBarManager::RemoveControllers() 351{ 352 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::RemoveControllers" ); 353 ResetableGuard aGuard( m_aLock ); 354 355 if ( m_bDisposed ) 356 return; 357 |
328 const sal_uInt32 nCount = m_aControllerVector.size(); 329 for ( sal_uInt32 n = 0; n < nCount; n++ ) 330 { 331 try 332 { 333 uno::Reference< lang::XComponent > xComponent( 334 m_aControllerVector[n], uno::UNO_QUERY ); 335 if ( xComponent.is() ) 336 xComponent->dispose(); 337 } 338 catch ( uno::Exception& ) 339 { 340 } 341 342 m_aControllerVector[n].clear(); 343 } | 358 std::for_each( m_aControllerMap.begin(), 359 m_aControllerMap.end(), 360 lcl_RemoveController< StatusBarControllerMap >() ); 361 m_aControllerMap.clear(); |
344} 345 346rtl::OUString StatusBarManager::RetrieveLabelFromCommand( const rtl::OUString& aCmdURL ) 347{ 348 return framework::RetrieveLabelFromCommand(aCmdURL,m_xServiceManager,m_xUICommandLabels,m_xFrame,m_aModuleIdentifier,m_bModuleIdentified,"Name"); 349} 350 351void StatusBarManager::CreateControllers() 352{ 353 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::CreateControllers" ); 354 uno::Reference< lang::XMultiComponentFactory > xStatusbarControllerFactory( m_xStatusbarControllerRegistration, uno::UNO_QUERY ); 355 uno::Reference< uno::XComponentContext > xComponentContext; 356 uno::Reference< beans::XPropertySet > xProps( m_xServiceManager, uno::UNO_QUERY ); 357 uno::Reference< awt::XWindow > xStatusbarWindow = VCLUnoHelper::GetInterface( m_pStatusBar ); | 362} 363 364rtl::OUString StatusBarManager::RetrieveLabelFromCommand( const rtl::OUString& aCmdURL ) 365{ 366 return framework::RetrieveLabelFromCommand(aCmdURL,m_xServiceManager,m_xUICommandLabels,m_xFrame,m_aModuleIdentifier,m_bModuleIdentified,"Name"); 367} 368 369void StatusBarManager::CreateControllers() 370{ 371 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::CreateControllers" ); 372 uno::Reference< lang::XMultiComponentFactory > xStatusbarControllerFactory( m_xStatusbarControllerRegistration, uno::UNO_QUERY ); 373 uno::Reference< uno::XComponentContext > xComponentContext; 374 uno::Reference< beans::XPropertySet > xProps( m_xServiceManager, uno::UNO_QUERY ); 375 uno::Reference< awt::XWindow > xStatusbarWindow = VCLUnoHelper::GetInterface( m_pStatusBar ); |
358 | 376 |
359 if ( xProps.is() ) 360 xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xComponentContext; | 377 if ( xProps.is() ) 378 xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xComponentContext; |
361 | 379 |
362 for ( sal_uInt16 i = 0; i < m_pStatusBar->GetItemCount(); i++ ) 363 { 364 sal_uInt16 nId = m_pStatusBar->GetItemId( i ); 365 if ( nId == 0 ) 366 continue; | 380 for ( sal_uInt16 i = 0; i < m_pStatusBar->GetItemCount(); i++ ) 381 { 382 sal_uInt16 nId = m_pStatusBar->GetItemId( i ); 383 if ( nId == 0 ) 384 continue; |
367 | 385 |
368 rtl::OUString aCommandURL( m_pStatusBar->GetItemCommand( nId )); 369 sal_Bool bInit( sal_True ); 370 uno::Reference< frame::XStatusListener > xController; | 386 rtl::OUString aCommandURL( m_pStatusBar->GetItemCommand( nId )); 387 sal_Bool bInit( sal_True ); 388 uno::Reference< frame::XStatusListener > xController; |
371 | 389 AddonStatusbarItemData *pItemData = static_cast< AddonStatusbarItemData *>( m_pStatusBar->GetItemData( nId ) ); 390 uno::Reference< ui::XStatusbarItem > xStatusbarItem( 391 static_cast< cppu::OWeakObject *>( new StatusbarItem( m_pStatusBar, pItemData, nId, aCommandURL ) ), 392 uno::UNO_QUERY ); 393 |
372 svt::StatusbarController* pController( 0 ); | 394 svt::StatusbarController* pController( 0 ); |
373 | 395 396 // 1º) UNO Statusbar controllers, registered in Controllers.xcu |
374 if ( m_xStatusbarControllerRegistration.is() && 375 m_xStatusbarControllerRegistration->hasController( aCommandURL, m_aModuleIdentifier )) 376 { 377 if ( xStatusbarControllerFactory.is() ) 378 { | 397 if ( m_xStatusbarControllerRegistration.is() && 398 m_xStatusbarControllerRegistration->hasController( aCommandURL, m_aModuleIdentifier )) 399 { 400 if ( xStatusbarControllerFactory.is() ) 401 { |
379 uno::Sequence< uno::Any > aSeq( 5 ); | |
380 beans::PropertyValue aPropValue; | 402 beans::PropertyValue aPropValue; |
381 | 403 std::vector< uno::Any > aPropVector; 404 |
382 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" )); 383 aPropValue.Value = uno::makeAny( m_aModuleIdentifier ); | 405 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" )); 406 aPropValue.Value = uno::makeAny( m_aModuleIdentifier ); |
384 aSeq[0] = uno::makeAny( aPropValue ); | 407 aPropVector.push_back( uno::makeAny( aPropValue ) ); 408 |
385 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); 386 aPropValue.Value = uno::makeAny( m_xFrame ); | 409 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); 410 aPropValue.Value = uno::makeAny( m_xFrame ); |
387 aSeq[1] = uno::makeAny( aPropValue ); | 411 aPropVector.push_back( uno::makeAny( aPropValue ) ); 412 413 // TODO remove this |
388 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); 389 aPropValue.Value = uno::makeAny( m_xServiceManager ); | 414 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); 415 aPropValue.Value = uno::makeAny( m_xServiceManager ); |
390 aSeq[2] = uno::makeAny( aPropValue ); | 416 aPropVector.push_back( uno::makeAny( aPropValue ) ); 417 |
391 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); 392 aPropValue.Value = uno::makeAny( xStatusbarWindow ); | 418 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); 419 aPropValue.Value = uno::makeAny( xStatusbarWindow ); |
393 aSeq[3] = uno::makeAny( aPropValue ); | 420 aPropVector.push_back( uno::makeAny( aPropValue ) ); 421 422 // TODO still needing with the css::ui::XStatusbarItem? |
394 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Identifier" )); 395 aPropValue.Value = uno::makeAny( nId ); | 423 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Identifier" )); 424 aPropValue.Value = uno::makeAny( nId ); |
396 aSeq[4] = uno::makeAny( aPropValue ); | 425 aPropVector.push_back( uno::makeAny( aPropValue ) ); |
397 | 426 |
427 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StatusbarItem" )); 428 aPropValue.Value <<= xStatusbarItem; 429 aPropVector.push_back( uno::makeAny( aPropValue ) ); 430 431 uno::Sequence< uno::Any > aArgs( comphelper::containerToSequence( aPropVector ) ); |
|
398 xController = uno::Reference< frame::XStatusListener >( 399 xStatusbarControllerFactory->createInstanceWithArgumentsAndContext( | 432 xController = uno::Reference< frame::XStatusListener >( 433 xStatusbarControllerFactory->createInstanceWithArgumentsAndContext( |
400 aCommandURL, aSeq, xComponentContext ), | 434 aCommandURL, aArgs, xComponentContext ), |
401 uno::UNO_QUERY ); 402 bInit = sal_False; // Initialization is done through the factory service 403 } 404 } 405 406 if ( !xController.is() ) 407 { | 435 uno::UNO_QUERY ); 436 bInit = sal_False; // Initialization is done through the factory service 437 } 438 } 439 440 if ( !xController.is() ) 441 { |
442 // 2º) Old SFX2 Statusbar controllers |
|
408 pController = CreateStatusBarController( m_xFrame, m_pStatusBar, nId, aCommandURL ); 409 if ( !pController ) | 443 pController = CreateStatusBarController( m_xFrame, m_pStatusBar, nId, aCommandURL ); 444 if ( !pController ) |
410 pController = new svt::StatusbarController( m_xServiceManager, m_xFrame, aCommandURL, nId ); 411 | 445 { 446 // 3º) Is Add-on? Generic statusbar controller 447 if ( pItemData ) 448 { 449 pController = new GenericStatusbarController( m_xServiceManager, 450 m_xFrame, 451 xStatusbarItem, 452 pItemData ); 453 } 454 else 455 { 456 // 4º) Default Statusbar controller 457 pController = new svt::StatusbarController( m_xServiceManager, m_xFrame, aCommandURL, nId ); 458 } 459 } 460 |
412 if ( pController ) 413 xController = uno::Reference< frame::XStatusListener >( 414 static_cast< ::cppu::OWeakObject *>( pController ), 415 uno::UNO_QUERY ); 416 } | 461 if ( pController ) 462 xController = uno::Reference< frame::XStatusListener >( 463 static_cast< ::cppu::OWeakObject *>( pController ), 464 uno::UNO_QUERY ); 465 } |
417 418 m_aControllerVector.push_back( xController ); | 466 467 m_aControllerMap[nId] = xController; |
419 uno::Reference< lang::XInitialization > xInit( xController, uno::UNO_QUERY ); | 468 uno::Reference< lang::XInitialization > xInit( xController, uno::UNO_QUERY ); |
420 | 469 |
421 if ( xInit.is() ) 422 { 423 if ( bInit ) 424 { 425 beans::PropertyValue aPropValue; | 470 if ( xInit.is() ) 471 { 472 if ( bInit ) 473 { 474 beans::PropertyValue aPropValue; |
426 uno::Sequence< uno::Any > aArgs( 5 ); | 475 uno::Sequence< uno::Any > aArgs( 6 ); |
427 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); 428 aPropValue.Value = uno::makeAny( m_xFrame ); 429 aArgs[0] = uno::makeAny( aPropValue ); 430 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" )); 431 aPropValue.Value = uno::makeAny( aCommandURL ); 432 aArgs[1] = uno::makeAny( aPropValue ); 433 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); 434 aPropValue.Value = uno::makeAny( m_xServiceManager ); 435 aArgs[2] = uno::makeAny( aPropValue ); 436 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); 437 aPropValue.Value = uno::makeAny( xStatusbarWindow ); 438 aArgs[3] = uno::makeAny( aPropValue ); 439 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Identifier" )); 440 aPropValue.Value = uno::makeAny( nId ); 441 aArgs[4] = uno::makeAny( aPropValue ); | 476 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); 477 aPropValue.Value = uno::makeAny( m_xFrame ); 478 aArgs[0] = uno::makeAny( aPropValue ); 479 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" )); 480 aPropValue.Value = uno::makeAny( aCommandURL ); 481 aArgs[1] = uno::makeAny( aPropValue ); 482 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); 483 aPropValue.Value = uno::makeAny( m_xServiceManager ); 484 aArgs[2] = uno::makeAny( aPropValue ); 485 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); 486 aPropValue.Value = uno::makeAny( xStatusbarWindow ); 487 aArgs[3] = uno::makeAny( aPropValue ); 488 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Identifier" )); 489 aPropValue.Value = uno::makeAny( nId ); 490 aArgs[4] = uno::makeAny( aPropValue ); |
491 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StatusbarItem" )); 492 aPropValue.Value <<= xStatusbarItem; 493 aArgs[5] = uno::makeAny( aPropValue ); |
|
442 xInit->initialize( aArgs ); 443 } 444 } 445 } 446 447 AddFrameActionListener(); 448} 449 --- 19 unchanged lines hidden (view full) --- 469 470 sal_uInt16 nId( 1 ); 471 rtl::OUString aHelpIdPrefix( RTL_CONSTASCII_USTRINGPARAM( HELPID_PREFIX )); 472 473 RemoveControllers(); 474 475 // reset and fill command map 476 m_pStatusBar->Clear(); | 494 xInit->initialize( aArgs ); 495 } 496 } 497 } 498 499 AddFrameActionListener(); 500} 501 --- 19 unchanged lines hidden (view full) --- 521 522 sal_uInt16 nId( 1 ); 523 rtl::OUString aHelpIdPrefix( RTL_CONSTASCII_USTRINGPARAM( HELPID_PREFIX )); 524 525 RemoveControllers(); 526 527 // reset and fill command map 528 m_pStatusBar->Clear(); |
477 m_aControllerVector.clear(); | 529 m_aControllerMap.clear();// TODO already done in RemoveControllers |
478 479 for ( sal_Int32 n = 0; n < rItemContainer->getCount(); n++ ) 480 { 481 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::FillStatusBar" ); 482 uno::Sequence< beans::PropertyValue > aProp; 483 rtl::OUString aCommandURL; 484 rtl::OUString aHelpURL; 485 sal_Int16 nOffset( 0 ); --- 32 unchanged lines hidden (view full) --- 518 aProp[i].Value >>= nOffset; 519 } 520 } 521 522 if (( nType == ::com::sun::star::ui::ItemType::DEFAULT ) && ( aCommandURL.getLength() > 0 )) 523 { 524 rtl::OUString aString( RetrieveLabelFromCommand( aCommandURL )); 525 sal_uInt16 nItemBits( impl_convertItemStyleToItemBits( nStyle )); | 530 531 for ( sal_Int32 n = 0; n < rItemContainer->getCount(); n++ ) 532 { 533 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::FillStatusBar" ); 534 uno::Sequence< beans::PropertyValue > aProp; 535 rtl::OUString aCommandURL; 536 rtl::OUString aHelpURL; 537 sal_Int16 nOffset( 0 ); --- 32 unchanged lines hidden (view full) --- 570 aProp[i].Value >>= nOffset; 571 } 572 } 573 574 if (( nType == ::com::sun::star::ui::ItemType::DEFAULT ) && ( aCommandURL.getLength() > 0 )) 575 { 576 rtl::OUString aString( RetrieveLabelFromCommand( aCommandURL )); 577 sal_uInt16 nItemBits( impl_convertItemStyleToItemBits( nStyle )); |
526 | 578 |
527 m_pStatusBar->InsertItem( nId, nWidth, nItemBits, nOffset ); 528 m_pStatusBar->SetItemCommand( nId, aCommandURL ); 529 m_pStatusBar->SetAccessibleName( nId, aString ); 530 ++nId; 531 } 532 } 533 } 534 catch ( ::com::sun::star::lang::IndexOutOfBoundsException& ) 535 { 536 break; 537 } 538 } 539 | 579 m_pStatusBar->InsertItem( nId, nWidth, nItemBits, nOffset ); 580 m_pStatusBar->SetItemCommand( nId, aCommandURL ); 581 m_pStatusBar->SetAccessibleName( nId, aString ); 582 ++nId; 583 } 584 } 585 } 586 catch ( ::com::sun::star::lang::IndexOutOfBoundsException& ) 587 { 588 break; 589 } 590 } 591 |
592 // Statusbar Merging 593 const sal_uInt16 STATUSBAR_ITEM_STARTID = 1000; 594 MergeStatusbarInstructionContainer aMergeInstructions = AddonsOptions().GetMergeStatusbarInstructions(); 595 if ( !aMergeInstructions.empty() ) 596 { 597 const sal_uInt32 nCount = aMergeInstructions.size(); 598 sal_uInt16 nItemId( STATUSBAR_ITEM_STARTID ); 599 600 for ( sal_uInt32 i = 0; i < nCount; i++ ) 601 { 602 MergeStatusbarInstruction &rInstruction = aMergeInstructions[i]; 603 if ( !StatusbarMerger::IsCorrectContext( rInstruction.aMergeContext, m_aModuleIdentifier ) ) 604 continue; 605 606 AddonStatusbarItemContainer aItems; 607 StatusbarMerger::ConvertSeqSeqToVector( rInstruction.aMergeStatusbarItems, aItems ); 608 609 sal_uInt16 nRefPos = StatusbarMerger::FindReferencePos( m_pStatusBar, rInstruction.aMergePoint ); 610 if ( nRefPos != STATUSBAR_ITEM_NOTFOUND ) 611 { 612 StatusbarMerger::ProcessMergeOperation( m_pStatusBar, 613 nRefPos, 614 nItemId, 615 m_aModuleIdentifier, 616 rInstruction.aMergeCommand, 617 rInstruction.aMergeCommandParameter, 618 aItems ); 619 } 620 else 621 { 622 StatusbarMerger::ProcessMergeFallback( m_pStatusBar, 623 nRefPos, 624 nItemId, 625 m_aModuleIdentifier, 626 rInstruction.aMergeCommand, 627 rInstruction.aMergeCommandParameter, 628 aItems ); 629 } 630 } 631 } 632 |
|
540 // Create controllers 541 CreateControllers(); 542 543 // Notify controllers that they are now correctly initialized and can start listening 544 UpdateControllers(); 545} 546 547void StatusBarManager::StateChanged( StateChangedType ) --- 23 unchanged lines hidden (view full) --- 571 } 572 } 573} 574 575void StatusBarManager::UserDraw( const UserDrawEvent& rUDEvt ) 576{ 577 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::UserDraw" ); 578 ResetableGuard aGuard( m_aLock ); | 633 // Create controllers 634 CreateControllers(); 635 636 // Notify controllers that they are now correctly initialized and can start listening 637 UpdateControllers(); 638} 639 640void StatusBarManager::StateChanged( StateChangedType ) --- 23 unchanged lines hidden (view full) --- 664 } 665 } 666} 667 668void StatusBarManager::UserDraw( const UserDrawEvent& rUDEvt ) 669{ 670 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::UserDraw" ); 671 ResetableGuard aGuard( m_aLock ); |
579 | 672 |
580 if ( m_bDisposed ) 581 return; | 673 if ( m_bDisposed ) 674 return; |
582 | 675 |
583 sal_uInt16 nId( rUDEvt.GetItemId() ); | 676 sal_uInt16 nId( rUDEvt.GetItemId() ); |
584 if (( nId > 0 ) && ( nId <= m_aControllerVector.size() )) | 677 StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId ); 678 if (( nId > 0 ) && ( it != m_aControllerMap.end() )) |
585 { | 679 { |
586 uno::Reference< frame::XStatusbarController > xController( 587 m_aControllerVector[nId-1], uno::UNO_QUERY ); | 680 uno::Reference< frame::XStatusbarController > xController( it->second, uno::UNO_QUERY ); |
588 if ( xController.is() && rUDEvt.GetDevice() ) 589 { | 681 if ( xController.is() && rUDEvt.GetDevice() ) 682 { |
590 uno::Reference< awt::XGraphics > xGraphics = | 683 uno::Reference< awt::XGraphics > xGraphics = |
591 rUDEvt.GetDevice()->CreateUnoGraphics(); 592 | 684 rUDEvt.GetDevice()->CreateUnoGraphics(); 685 |
593 awt::Rectangle aRect( rUDEvt.GetRect().Left(), | 686 awt::Rectangle aRect( rUDEvt.GetRect().Left(), |
594 rUDEvt.GetRect().Top(), | 687 rUDEvt.GetRect().Top(), |
595 rUDEvt.GetRect().GetWidth(), | 688 rUDEvt.GetRect().GetWidth(), |
596 rUDEvt.GetRect().GetHeight() ); 597 aGuard.unlock(); | 689 rUDEvt.GetRect().GetHeight() ); 690 aGuard.unlock(); |
598 xController->paint( xGraphics, aRect, rUDEvt.GetItemId(), rUDEvt.GetStyle() ); | 691 xController->paint( xGraphics, aRect, rUDEvt.GetStyle() ); |
599 } 600 } 601} 602 603void StatusBarManager::Command( const CommandEvent& rEvt ) 604{ 605 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::Command" ); 606 ResetableGuard aGuard( m_aLock ); | 692 } 693 } 694} 695 696void StatusBarManager::Command( const CommandEvent& rEvt ) 697{ 698 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::Command" ); 699 ResetableGuard aGuard( m_aLock ); |
607 | 700 |
608 if ( m_bDisposed ) 609 return; | 701 if ( m_bDisposed ) 702 return; |
610 | 703 |
611 if ( rEvt.GetCommand() == COMMAND_CONTEXTMENU ) 612 { 613 sal_uInt16 nId = m_pStatusBar->GetItemId( rEvt.GetMousePosPixel() ); | 704 if ( rEvt.GetCommand() == COMMAND_CONTEXTMENU ) 705 { 706 sal_uInt16 nId = m_pStatusBar->GetItemId( rEvt.GetMousePosPixel() ); |
614 if (( nId > 0 ) && ( nId <= m_aControllerVector.size() )) | 707 StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId ); 708 if (( nId > 0 ) && ( it != m_aControllerMap.end() )) |
615 { | 709 { |
616 uno::Reference< frame::XStatusbarController > xController( 617 m_aControllerVector[nId-1], uno::UNO_QUERY ); | 710 uno::Reference< frame::XStatusbarController > xController( it->second, uno::UNO_QUERY ); |
618 if ( xController.is() ) 619 { 620 awt::Point aPos; 621 aPos.X = rEvt.GetMousePosPixel().X(); 622 aPos.Y = rEvt.GetMousePosPixel().Y(); 623 xController->command( aPos, awt::Command::CONTEXTMENU, sal_True, uno::Any() ); 624 } 625 } 626 } 627} 628 629void StatusBarManager::MouseMove( const MouseEvent& rMEvt ) 630{ 631 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::MouseMove" ); 632 MouseButton(rMEvt,&frame::XStatusbarController::mouseMove); 633} | 711 if ( xController.is() ) 712 { 713 awt::Point aPos; 714 aPos.X = rEvt.GetMousePosPixel().X(); 715 aPos.Y = rEvt.GetMousePosPixel().Y(); 716 xController->command( aPos, awt::Command::CONTEXTMENU, sal_True, uno::Any() ); 717 } 718 } 719 } 720} 721 722void StatusBarManager::MouseMove( const MouseEvent& rMEvt ) 723{ 724 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::MouseMove" ); 725 MouseButton(rMEvt,&frame::XStatusbarController::mouseMove); 726} |
727 |
|
634void StatusBarManager::MouseButton( const MouseEvent& rMEvt ,sal_Bool ( SAL_CALL frame::XStatusbarController::*_pMethod )(const ::com::sun::star::awt::MouseEvent&)) 635{ 636 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::MouseButton" ); 637 ResetableGuard aGuard( m_aLock ); | 728void StatusBarManager::MouseButton( const MouseEvent& rMEvt ,sal_Bool ( SAL_CALL frame::XStatusbarController::*_pMethod )(const ::com::sun::star::awt::MouseEvent&)) 729{ 730 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::MouseButton" ); 731 ResetableGuard aGuard( m_aLock ); |
638 | 732 |
639 if ( !m_bDisposed ) 640 { 641 sal_uInt16 nId = m_pStatusBar->GetItemId( rMEvt.GetPosPixel() ); | 733 if ( !m_bDisposed ) 734 { 735 sal_uInt16 nId = m_pStatusBar->GetItemId( rMEvt.GetPosPixel() ); |
642 if (( nId > 0 ) && ( nId <= m_aControllerVector.size() )) | 736 StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId ); 737 if (( nId > 0 ) && ( it != m_aControllerMap.end() )) |
643 { | 738 { |
644 uno::Reference< frame::XStatusbarController > xController( 645 m_aControllerVector[nId-1], uno::UNO_QUERY ); | 739 uno::Reference< frame::XStatusbarController > xController( it->second, uno::UNO_QUERY ); |
646 if ( xController.is() ) 647 { 648 ::com::sun::star::awt::MouseEvent aMouseEvent; 649 aMouseEvent.Buttons = rMEvt.GetButtons(); 650 aMouseEvent.X = rMEvt.GetPosPixel().X(); 651 aMouseEvent.Y = rMEvt.GetPosPixel().Y(); 652 aMouseEvent.ClickCount = rMEvt.GetClicks(); 653 (xController.get()->*_pMethod)( aMouseEvent); 654 } | 740 if ( xController.is() ) 741 { 742 ::com::sun::star::awt::MouseEvent aMouseEvent; 743 aMouseEvent.Buttons = rMEvt.GetButtons(); 744 aMouseEvent.X = rMEvt.GetPosPixel().X(); 745 aMouseEvent.Y = rMEvt.GetPosPixel().Y(); 746 aMouseEvent.ClickCount = rMEvt.GetClicks(); 747 (xController.get()->*_pMethod)( aMouseEvent); 748 } |
655 } // if (( nId > 0 ) && ( nId <= m_aControllerVector.size() )) | 749 } |
656 } 657} | 750 } 751} |
752 |
|
658void StatusBarManager::MouseButtonDown( const MouseEvent& rMEvt ) 659{ 660 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::MouseButtonDown" ); 661 MouseButton(rMEvt,&frame::XStatusbarController::mouseButtonDown); 662} 663 664void StatusBarManager::MouseButtonUp( const MouseEvent& rMEvt ) 665{ 666 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::MouseButtonUp" ); 667 MouseButton(rMEvt,&frame::XStatusbarController::mouseButtonUp); 668} 669 670IMPL_LINK( StatusBarManager, Click, StatusBar*, EMPTYARG ) 671{ 672 ResetableGuard aGuard( m_aLock ); | 753void StatusBarManager::MouseButtonDown( const MouseEvent& rMEvt ) 754{ 755 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::MouseButtonDown" ); 756 MouseButton(rMEvt,&frame::XStatusbarController::mouseButtonDown); 757} 758 759void StatusBarManager::MouseButtonUp( const MouseEvent& rMEvt ) 760{ 761 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::MouseButtonUp" ); 762 MouseButton(rMEvt,&frame::XStatusbarController::mouseButtonUp); 763} 764 765IMPL_LINK( StatusBarManager, Click, StatusBar*, EMPTYARG ) 766{ 767 ResetableGuard aGuard( m_aLock ); |
673 | 768 |
674 if ( m_bDisposed ) 675 return 1; | 769 if ( m_bDisposed ) 770 return 1; |
676 | 771 |
677 sal_uInt16 nId = m_pStatusBar->GetCurItemId(); | 772 sal_uInt16 nId = m_pStatusBar->GetCurItemId(); |
678 if (( nId > 0 ) && ( nId <= m_aControllerVector.size() )) | 773 StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId ); 774 if (( nId > 0 ) && ( it != m_aControllerMap.end() )) |
679 { | 775 { |
680 uno::Reference< frame::XStatusbarController > xController( 681 m_aControllerVector[nId-1], uno::UNO_QUERY ); | 776 uno::Reference< frame::XStatusbarController > xController( it->second, uno::UNO_QUERY ); |
682 if ( xController.is() ) | 777 if ( xController.is() ) |
683 xController->click(); | 778 { 779 const Point aVCLPos = m_pStatusBar->GetPointerPosPixel(); 780 const awt::Point aAWTPoint( aVCLPos.X(), aVCLPos.Y() ); 781 xController->click( aAWTPoint ); 782 } |
684 } | 783 } |
685 | 784 |
686 return 1; 687} 688 689IMPL_LINK( StatusBarManager, DoubleClick, StatusBar*, EMPTYARG ) 690{ 691 ResetableGuard aGuard( m_aLock ); | 785 return 1; 786} 787 788IMPL_LINK( StatusBarManager, DoubleClick, StatusBar*, EMPTYARG ) 789{ 790 ResetableGuard aGuard( m_aLock ); |
692 | 791 |
693 if ( m_bDisposed ) 694 return 1; | 792 if ( m_bDisposed ) 793 return 1; |
695 | 794 |
696 sal_uInt16 nId = m_pStatusBar->GetCurItemId(); | 795 sal_uInt16 nId = m_pStatusBar->GetCurItemId(); |
697 if (( nId > 0 ) && ( nId <= m_aControllerVector.size() )) | 796 StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId ); 797 if (( nId > 0 ) && ( it != m_aControllerMap.end() )) |
698 { | 798 { |
699 uno::Reference< frame::XStatusbarController > xController( 700 m_aControllerVector[nId-1], uno::UNO_QUERY ); | 799 uno::Reference< frame::XStatusbarController > xController( it->second, uno::UNO_QUERY ); |
701 if ( xController.is() ) | 800 if ( xController.is() ) |
702 xController->doubleClick(); | 801 { 802 const Point aVCLPos = m_pStatusBar->GetPointerPosPixel(); 803 const awt::Point aAWTPoint( aVCLPos.X(), aVCLPos.Y() ); 804 xController->doubleClick( aAWTPoint ); 805 } |
703 } | 806 } |
704 | 807 |
705 return 1; 706} 707 708} | 808 return 1; 809} 810 811} |