statusbarmanager.cxx (2503e1a5) | statusbarmanager.cxx (dccf82be) |
---|---|
1/************************************************************** 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 --- 30 unchanged lines hidden (view full) --- 39#include <stdtypes.h> 40#include "services.h" 41#include "general.h" 42#include "properties.h" 43#include <helper/mischelper.hxx> 44 45#include <com/sun/star/frame/XFrame.hpp> 46#include <com/sun/star/frame/XStatusListener.hpp> | 1/************************************************************** 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 --- 30 unchanged lines hidden (view full) --- 39#include <stdtypes.h> 40#include "services.h" 41#include "general.h" 42#include "properties.h" 43#include <helper/mischelper.hxx> 44 45#include <com/sun/star/frame/XFrame.hpp> 46#include <com/sun/star/frame/XStatusListener.hpp> |
47#include <com/sun/star/frame/StatusbarControllerFactory.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> 54#include <com/sun/star/lang/DisposedException.hpp> 55 56#include <toolkit/helper/vclunohelper.hxx> 57 58#include <svtools/statusbarcontroller.hxx> | 48#include <com/sun/star/util/XUpdatable.hpp> 49#include <com/sun/star/ui/ItemStyle.hpp> 50#include <com/sun/star/ui/ItemType.hpp> 51#include <com/sun/star/lang/XMultiComponentFactory.hpp> 52#include <com/sun/star/beans/XPropertySet.hpp> 53#include <com/sun/star/awt/Command.hpp> 54#include <com/sun/star/ui/XStatusbarItem.hdl> 55#include <com/sun/star/lang/DisposedException.hpp> 56 57#include <toolkit/helper/vclunohelper.hxx> 58 59#include <svtools/statusbarcontroller.hxx> |
60#include <comphelper/processfactory.hxx> |
|
59 60#include <vcl/status.hxx> 61#include <vcl/svapp.hxx> 62#include <rtl/logfile.hxx> 63 64#include <functional> 65 66using namespace ::com::sun::star; --- 116 unchanged lines hidden (view full) --- 183 m_pStatusBar( pStatusBar ), 184 m_aResourceName( rResourceName ), 185 m_xFrame( rFrame ), 186 m_aListenerContainer( m_aLock.getShareableOslMutex() ), 187 m_xServiceManager( rServiceManager ) 188{ 189 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::StatusBarManager" ); 190 | 61 62#include <vcl/status.hxx> 63#include <vcl/svapp.hxx> 64#include <rtl/logfile.hxx> 65 66#include <functional> 67 68using namespace ::com::sun::star; --- 116 unchanged lines hidden (view full) --- 185 m_pStatusBar( pStatusBar ), 186 m_aResourceName( rResourceName ), 187 m_xFrame( rFrame ), 188 m_aListenerContainer( m_aLock.getShareableOslMutex() ), 189 m_xServiceManager( rServiceManager ) 190{ 191 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::StatusBarManager" ); 192 |
191 if ( m_xServiceManager.is() ) 192 m_xStatusbarControllerRegistration = uno::Reference< css::frame::XUIControllerRegistration >( 193 m_xServiceManager->createInstance( SERVICENAME_STATUSBARCONTROLLERFACTORY ), 194 uno::UNO_QUERY ); | 193 m_xStatusbarControllerFactory = frame::StatusbarControllerFactory::create( 194 ::comphelper::getProcessComponentContext()); |
195 196 m_pStatusBar->SetClickHdl( LINK( this, StatusBarManager, Click ) ); 197 m_pStatusBar->SetDoubleClickHdl( LINK( this, StatusBarManager, DoubleClick ) ); 198} 199 200StatusBarManager::~StatusBarManager() 201{ 202} --- 161 unchanged lines hidden (view full) --- 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" ); | 195 196 m_pStatusBar->SetClickHdl( LINK( this, StatusBarManager, Click ) ); 197 m_pStatusBar->SetDoubleClickHdl( LINK( this, StatusBarManager, DoubleClick ) ); 198} 199 200StatusBarManager::~StatusBarManager() 201{ 202} --- 161 unchanged lines hidden (view full) --- 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 ); 376 377 if ( xProps.is() ) 378 xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xComponentContext; 379 380 for ( sal_uInt16 i = 0; i < m_pStatusBar->GetItemCount(); i++ ) --- 8 unchanged lines hidden (view full) --- 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 394 svt::StatusbarController* pController( 0 ); 395 396 // 1º) UNO Statusbar controllers, registered in Controllers.xcu | 372 uno::Reference< uno::XComponentContext > xComponentContext; 373 uno::Reference< beans::XPropertySet > xProps( m_xServiceManager, uno::UNO_QUERY ); 374 uno::Reference< awt::XWindow > xStatusbarWindow = VCLUnoHelper::GetInterface( m_pStatusBar ); 375 376 if ( xProps.is() ) 377 xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xComponentContext; 378 379 for ( sal_uInt16 i = 0; i < m_pStatusBar->GetItemCount(); i++ ) --- 8 unchanged lines hidden (view full) --- 388 AddonStatusbarItemData *pItemData = static_cast< AddonStatusbarItemData *>( m_pStatusBar->GetItemData( nId ) ); 389 uno::Reference< ui::XStatusbarItem > xStatusbarItem( 390 static_cast< cppu::OWeakObject *>( new StatusbarItem( m_pStatusBar, pItemData, nId, aCommandURL ) ), 391 uno::UNO_QUERY ); 392 393 svt::StatusbarController* pController( 0 ); 394 395 // 1º) UNO Statusbar controllers, registered in Controllers.xcu |
397 if ( m_xStatusbarControllerRegistration.is() && 398 m_xStatusbarControllerRegistration->hasController( aCommandURL, m_aModuleIdentifier )) | 396 if ( m_xStatusbarControllerFactory.is() && 397 m_xStatusbarControllerFactory->hasController( aCommandURL, m_aModuleIdentifier )) |
399 { | 398 { |
400 if ( xStatusbarControllerFactory.is() ) 401 { 402 beans::PropertyValue aPropValue; 403 std::vector< uno::Any > aPropVector; | 399 beans::PropertyValue aPropValue; 400 std::vector< uno::Any > aPropVector; |
404 | 401 |
405 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" )); 406 aPropValue.Value = uno::makeAny( m_aModuleIdentifier ); 407 aPropVector.push_back( uno::makeAny( aPropValue ) ); | 402 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" )); 403 aPropValue.Value = uno::makeAny( m_aModuleIdentifier ); 404 aPropVector.push_back( uno::makeAny( aPropValue ) ); |
408 | 405 |
409 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); 410 aPropValue.Value = uno::makeAny( m_xFrame ); 411 aPropVector.push_back( uno::makeAny( aPropValue ) ); | 406 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); 407 aPropValue.Value = uno::makeAny( m_xFrame ); 408 aPropVector.push_back( uno::makeAny( aPropValue ) ); |
412 | 409 |
413 // TODO remove this 414 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); 415 aPropValue.Value = uno::makeAny( m_xServiceManager ); 416 aPropVector.push_back( uno::makeAny( aPropValue ) ); | 410 // TODO remove this 411 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); 412 aPropValue.Value = uno::makeAny( m_xServiceManager ); 413 aPropVector.push_back( uno::makeAny( aPropValue ) ); |
417 | 414 |
418 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); 419 aPropValue.Value = uno::makeAny( xStatusbarWindow ); 420 aPropVector.push_back( uno::makeAny( aPropValue ) ); | 415 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); 416 aPropValue.Value = uno::makeAny( xStatusbarWindow ); 417 aPropVector.push_back( uno::makeAny( aPropValue ) ); |
421 | 418 |
422 // TODO still needing with the css::ui::XStatusbarItem? 423 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Identifier" )); 424 aPropValue.Value = uno::makeAny( nId ); 425 aPropVector.push_back( uno::makeAny( aPropValue ) ); | 419 // TODO still needing with the css::ui::XStatusbarItem? 420 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Identifier" )); 421 aPropValue.Value = uno::makeAny( nId ); 422 aPropVector.push_back( uno::makeAny( aPropValue ) ); |
426 | 423 |
427 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StatusbarItem" )); 428 aPropValue.Value <<= xStatusbarItem; 429 aPropVector.push_back( uno::makeAny( aPropValue ) ); | 424 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StatusbarItem" )); 425 aPropValue.Value <<= xStatusbarItem; 426 aPropVector.push_back( uno::makeAny( aPropValue ) ); |
430 | 427 |
431 uno::Sequence< uno::Any > aArgs( comphelper::containerToSequence( aPropVector ) ); 432 xController = uno::Reference< frame::XStatusListener >( 433 xStatusbarControllerFactory->createInstanceWithArgumentsAndContext( 434 aCommandURL, aArgs, xComponentContext ), 435 uno::UNO_QUERY ); 436 bInit = sal_False; // Initialization is done through the factory service 437 } | 428 uno::Sequence< uno::Any > aArgs( comphelper::containerToSequence( aPropVector ) ); 429 xController = uno::Reference< frame::XStatusListener >( 430 m_xStatusbarControllerFactory->createInstanceWithArgumentsAndContext( 431 aCommandURL, aArgs, xComponentContext ), 432 uno::UNO_QUERY ); 433 bInit = sal_False; // Initialization is done through the factory service |
438 } 439 440 if ( !xController.is() ) 441 { 442 // 2º) Old SFX2 Statusbar controllers 443 pController = CreateStatusBarController( m_xFrame, m_pStatusBar, nId, aCommandURL ); 444 if ( !pController ) 445 { --- 366 unchanged lines hidden --- | 434 } 435 436 if ( !xController.is() ) 437 { 438 // 2º) Old SFX2 Statusbar controllers 439 pController = CreateStatusBarController( m_xFrame, m_pStatusBar, nId, aCommandURL ); 440 if ( !pController ) 441 { --- 366 unchanged lines hidden --- |