toolbarmanager.cxx (796936d9) | toolbarmanager.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 --- 50 unchanged lines hidden (view full) --- 59#include <com/sun/star/awt/XDockableWindow.hpp> 60#include <com/sun/star/frame/XLayoutManager.hpp> 61#ifndef _COM_SUN_STAR_UI_XDOCKINGAREA_HPP_ 62#include <com/sun/star/ui/DockingArea.hpp> 63#endif 64#include <com/sun/star/graphic/XGraphic.hpp> 65#include <com/sun/star/lang/XMultiComponentFactory.hpp> 66#include <com/sun/star/frame/XModuleManager.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 --- 50 unchanged lines hidden (view full) --- 59#include <com/sun/star/awt/XDockableWindow.hpp> 60#include <com/sun/star/frame/XLayoutManager.hpp> 61#ifndef _COM_SUN_STAR_UI_XDOCKINGAREA_HPP_ 62#include <com/sun/star/ui/DockingArea.hpp> 63#endif 64#include <com/sun/star/graphic/XGraphic.hpp> 65#include <com/sun/star/lang/XMultiComponentFactory.hpp> 66#include <com/sun/star/frame/XModuleManager.hpp> |
67#include <com/sun/star/frame/ToolbarControllerFactory.hpp> |
|
67#include <com/sun/star/ui/XUIElementSettings.hpp> 68#include <com/sun/star/ui/XUIConfigurationPersistence.hpp> 69#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> 70#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> 71#include <com/sun/star/ui/ImageType.hpp> 72#include <com/sun/star/ui/UIElementType.hpp> 73#include <comphelper/sequence.hxx> 74#include <com/sun/star/frame/status/Visibility.hpp> --- 4 unchanged lines hidden (view full) --- 79//_________________________________________________________________________________________________________________ 80#include <svtools/imgdef.hxx> 81#include <svtools/toolboxcontroller.hxx> 82#include <unotools/cmdoptions.hxx> 83#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ 84#include <toolkit/unohlp.hxx> 85#endif 86#include <comphelper/mediadescriptor.hxx> | 68#include <com/sun/star/ui/XUIElementSettings.hpp> 69#include <com/sun/star/ui/XUIConfigurationPersistence.hpp> 70#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> 71#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> 72#include <com/sun/star/ui/ImageType.hpp> 73#include <com/sun/star/ui/UIElementType.hpp> 74#include <comphelper/sequence.hxx> 75#include <com/sun/star/frame/status/Visibility.hpp> --- 4 unchanged lines hidden (view full) --- 80//_________________________________________________________________________________________________________________ 81#include <svtools/imgdef.hxx> 82#include <svtools/toolboxcontroller.hxx> 83#include <unotools/cmdoptions.hxx> 84#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ 85#include <toolkit/unohlp.hxx> 86#endif 87#include <comphelper/mediadescriptor.hxx> |
88#include <comphelper/processfactory.hxx> |
|
87#include <svtools/miscopt.hxx> 88#include <svl/imageitm.hxx> 89#include <svtools/framestatuslistener.hxx> 90#include <vcl/svapp.hxx> 91#include <vcl/menu.hxx> 92#include <vcl/syswin.hxx> 93#include <vcl/taskpanelist.hxx> 94#include <rtl/logfile.hxx> --- 169 unchanged lines hidden (view full) --- 264{ 265 Window* pWindow = m_pToolBar; 266 while ( pWindow && !pWindow->IsSystemWindow() ) 267 pWindow = pWindow->GetParent(); 268 269 if ( pWindow ) 270 ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( m_pToolBar ); 271 | 89#include <svtools/miscopt.hxx> 90#include <svl/imageitm.hxx> 91#include <svtools/framestatuslistener.hxx> 92#include <vcl/svapp.hxx> 93#include <vcl/menu.hxx> 94#include <vcl/syswin.hxx> 95#include <vcl/taskpanelist.hxx> 96#include <rtl/logfile.hxx> --- 169 unchanged lines hidden (view full) --- 266{ 267 Window* pWindow = m_pToolBar; 268 while ( pWindow && !pWindow->IsSystemWindow() ) 269 pWindow = pWindow->GetParent(); 270 271 if ( pWindow ) 272 ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( m_pToolBar ); 273 |
272 if ( m_xServiceManager.is() ) | 274 Reference< XComponentContext > xContext(::comphelper::getProcessComponentContext()); 275 if ( xContext.is() ) |
273 { | 276 { |
274 m_xToolbarControllerRegistration = Reference< XUIControllerRegistration >( 275 m_xServiceManager->createInstance( SERVICENAME_TOOLBARCONTROLLERFACTORY ), 276 UNO_QUERY ); | 277 m_xToolbarControllerFactory = frame::ToolbarControllerFactory::create( xContext ); |
277 | 278 |
278 m_xURLTransformer.set( m_xServiceManager->createInstance( 279 SERVICENAME_URLTRANSFORMER), 280 UNO_QUERY ); | 279 m_xURLTransformer.set( xContext->getServiceManager()->createInstanceWithContext( 280 SERVICENAME_URLTRANSFORMER, xContext), UNO_QUERY ); |
281 } 282 283 m_pToolBar->SetSelectHdl( LINK( this, ToolBarManager, Select) ); 284 m_pToolBar->SetActivateHdl( LINK( this, ToolBarManager, Activate) ); 285 m_pToolBar->SetDeactivateHdl( LINK( this, ToolBarManager, Deactivate) ); 286 m_pToolBar->SetClickHdl( LINK( this, ToolBarManager, Click ) ); 287 m_pToolBar->SetDropdownClickHdl( LINK( this, ToolBarManager, DropdownClick ) ); 288 m_pToolBar->SetDoubleClickHdl( LINK( this, ToolBarManager, DoubleClick ) ); --- 634 unchanged lines hidden (view full) --- 923 } 924 return nProperties; 925} 926 927void ToolBarManager::CreateControllers() 928{ 929 RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::ToolBarManager::CreateControllers" ); 930 | 281 } 282 283 m_pToolBar->SetSelectHdl( LINK( this, ToolBarManager, Select) ); 284 m_pToolBar->SetActivateHdl( LINK( this, ToolBarManager, Activate) ); 285 m_pToolBar->SetDeactivateHdl( LINK( this, ToolBarManager, Deactivate) ); 286 m_pToolBar->SetClickHdl( LINK( this, ToolBarManager, Click ) ); 287 m_pToolBar->SetDropdownClickHdl( LINK( this, ToolBarManager, DropdownClick ) ); 288 m_pToolBar->SetDoubleClickHdl( LINK( this, ToolBarManager, DoubleClick ) ); --- 634 unchanged lines hidden (view full) --- 923 } 924 return nProperties; 925} 926 927void ToolBarManager::CreateControllers() 928{ 929 RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::ToolBarManager::CreateControllers" ); 930 |
931 Reference< XMultiComponentFactory > xToolbarControllerFactory( m_xToolbarControllerRegistration, UNO_QUERY ); | |
932 Reference< XComponentContext > xComponentContext; 933 Reference< XPropertySet > xProps( m_xServiceManager, UNO_QUERY ); 934 Reference< XWindow > xToolbarWindow = VCLUnoHelper::GetInterface( m_pToolBar ); 935 936 css::util::URL aURL; 937 sal_Bool bHasDisabledEntries = SvtCommandOptions().HasEntries( SvtCommandOptions::CMDOPTION_DISABLED ); 938 SvtCommandOptions aCmdOptions; 939 --- 23 unchanged lines hidden (view full) --- 963 if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, aURL.Path )) 964 { 965 m_aControllerMap[ nId ] = xController; 966 m_pToolBar->HideItem( nId ); 967 continue; 968 } 969 } 970 | 931 Reference< XComponentContext > xComponentContext; 932 Reference< XPropertySet > xProps( m_xServiceManager, UNO_QUERY ); 933 Reference< XWindow > xToolbarWindow = VCLUnoHelper::GetInterface( m_pToolBar ); 934 935 css::util::URL aURL; 936 sal_Bool bHasDisabledEntries = SvtCommandOptions().HasEntries( SvtCommandOptions::CMDOPTION_DISABLED ); 937 SvtCommandOptions aCmdOptions; 938 --- 23 unchanged lines hidden (view full) --- 962 if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, aURL.Path )) 963 { 964 m_aControllerMap[ nId ] = xController; 965 m_pToolBar->HideItem( nId ); 966 continue; 967 } 968 } 969 |
971 if ( m_xToolbarControllerRegistration.is() && 972 m_xToolbarControllerRegistration->hasController( aCommandURL, m_aModuleIdentifier )) | 970 if ( m_xToolbarControllerFactory.is() && 971 m_xToolbarControllerFactory->hasController( aCommandURL, m_aModuleIdentifier )) |
973 { | 972 { |
974 if ( xToolbarControllerFactory.is() ) 975 { 976 PropertyValue aPropValue; 977 std::vector< Any > aPropertyVector; | 973 PropertyValue aPropValue; 974 std::vector< Any > aPropertyVector; |
978 | 975 |
979 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" )); 980 aPropValue.Value <<= m_aModuleIdentifier; 981 aPropertyVector.push_back( makeAny( aPropValue )); 982 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); 983 aPropValue.Value <<= m_xFrame; 984 aPropertyVector.push_back( makeAny( aPropValue )); 985 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); 986 aPropValue.Value <<= m_xServiceManager; 987 aPropertyVector.push_back( makeAny( aPropValue )); 988 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); 989 aPropValue.Value <<= xToolbarWindow; 990 aPropertyVector.push_back( makeAny( aPropValue )); | 976 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" )); 977 aPropValue.Value <<= m_aModuleIdentifier; 978 aPropertyVector.push_back( makeAny( aPropValue )); 979 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); 980 aPropValue.Value <<= m_xFrame; 981 aPropertyVector.push_back( makeAny( aPropValue )); 982 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); 983 aPropValue.Value <<= m_xServiceManager; 984 aPropertyVector.push_back( makeAny( aPropValue )); 985 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); 986 aPropValue.Value <<= xToolbarWindow; 987 aPropertyVector.push_back( makeAny( aPropValue )); |
991 | 988 |
992 if ( nWidth > 0 ) 993 { 994 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" )); 995 aPropValue.Value <<= nWidth; 996 aPropertyVector.push_back( makeAny( aPropValue )); 997 } 998 999 Sequence< Any > aArgs( comphelper::containerToSequence( aPropertyVector )); 1000 xController = Reference< XStatusListener >( xToolbarControllerFactory->createInstanceWithArgumentsAndContext( 1001 aCommandURL, aArgs, xComponentContext ), 1002 UNO_QUERY ); 1003 bInit = sal_False; // Initialization is done through the factory service | 989 if ( nWidth > 0 ) 990 { 991 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" )); 992 aPropValue.Value <<= nWidth; 993 aPropertyVector.push_back( makeAny( aPropValue )); |
1004 } | 994 } |
995 996 Sequence< Any > aArgs( comphelper::containerToSequence( aPropertyVector )); 997 xController = Reference< XStatusListener >( m_xToolbarControllerFactory->createInstanceWithArgumentsAndContext( 998 aCommandURL, aArgs, xComponentContext ), 999 UNO_QUERY ); 1000 bInit = sal_False; // Initialization is done through the factory service |
|
1005 } 1006 1007 if (( aCommandURL == aLoadURL ) && ( !m_pToolBar->IsItemVisible(nId))) 1008 bCreate = sal_False; 1009 1010 if ( !xController.is() && m_pToolBar && bCreate ) 1011 { 1012 pController = CreateToolBoxController( m_xFrame, m_pToolBar, nId, aCommandURL ); --- 80 unchanged lines hidden (view full) --- 1093 aPropValue.Value <<= aCommandURL; 1094 aPropertyVector.push_back( makeAny( aPropValue )); 1095 aPropValue.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); 1096 aPropValue.Value <<= m_xServiceManager; 1097 aPropertyVector.push_back( makeAny( aPropValue )); 1098 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); 1099 aPropValue.Value <<= xToolbarWindow; 1100 aPropertyVector.push_back( makeAny( aPropValue )); | 1001 } 1002 1003 if (( aCommandURL == aLoadURL ) && ( !m_pToolBar->IsItemVisible(nId))) 1004 bCreate = sal_False; 1005 1006 if ( !xController.is() && m_pToolBar && bCreate ) 1007 { 1008 pController = CreateToolBoxController( m_xFrame, m_pToolBar, nId, aCommandURL ); --- 80 unchanged lines hidden (view full) --- 1089 aPropValue.Value <<= aCommandURL; 1090 aPropertyVector.push_back( makeAny( aPropValue )); 1091 aPropValue.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); 1092 aPropValue.Value <<= m_xServiceManager; 1093 aPropertyVector.push_back( makeAny( aPropValue )); 1094 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); 1095 aPropValue.Value <<= xToolbarWindow; 1096 aPropertyVector.push_back( makeAny( aPropValue )); |
1101 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" )); | 1097 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" )); |
1102 aPropValue.Value <<= m_aModuleIdentifier; 1103 aPropertyVector.push_back( makeAny( aPropValue )); 1104 1105 if ( nWidth > 0 ) 1106 { 1107 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" )); 1108 aPropValue.Value <<= nWidth; 1109 aPropertyVector.push_back( makeAny( aPropValue )); --- 1246 unchanged lines hidden --- | 1098 aPropValue.Value <<= m_aModuleIdentifier; 1099 aPropertyVector.push_back( makeAny( aPropValue )); 1100 1101 if ( nWidth > 0 ) 1102 { 1103 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" )); 1104 aPropValue.Value <<= nWidth; 1105 aPropertyVector.push_back( makeAny( aPropValue )); --- 1246 unchanged lines hidden --- |