From 533c6cb6bad6ef0432e8eebbfd4daf90ef71f3b4 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 25 Jun 2014 08:43:20 +0200 Subject: fixes for up-casting to Reference Fix regressions introduced with 6a043e9c0acff20e1618ca8ec15c21d5d0fd0d37 "Use the new type-checking Reference constructor to reduce code noise" Change-Id: I85662856f21c810a7db497fe3b0e116f075b1687 Signed-off-by: Stephan Bergmann --- .../moduleuiconfigurationmanager.cxx | 23 +++++++++++++--------- .../uiconfiguration/uiconfigurationmanager.cxx | 17 ++++++++++------ framework/source/uifactory/menubarfactory.cxx | 2 +- .../source/uifactory/uielementfactorymanager.cxx | 2 +- 4 files changed, 27 insertions(+), 17 deletions(-) (limited to 'framework') diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 3fea283a21e4..71560d765039 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -637,6 +637,7 @@ void ModuleUIConfigurationManager::impl_resetElementTypeData( UIElementDataHashMap::iterator pIter = rHashMap.begin(); Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XInterface > xIfac( xThis, UNO_QUERY ); Reference< XNameAccess > xDefaultNameAccess( rDefaultElementType.xStorage, UNO_QUERY ); sal_Int16 nType = rUserElementType.nElementType; @@ -656,7 +657,7 @@ void ModuleUIConfigurationManager::impl_resetElementTypeData( ui::ConfigurationEvent aReplaceEvent; aReplaceEvent.ResourceURL = rElement.aResourceURL; aReplaceEvent.Accessor <<= xThis; - aReplaceEvent.Source = xThis; + aReplaceEvent.Source = xIfac; aReplaceEvent.ReplacedElement <<= xOldSettings; aReplaceEvent.Element <<= rElement.xSettings; @@ -673,7 +674,7 @@ void ModuleUIConfigurationManager::impl_resetElementTypeData( ui::ConfigurationEvent aEvent; aEvent.ResourceURL = rElement.aResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xThis; + aEvent.Source = xIfac; aEvent.Element <<= rElement.xSettings; rRemoveNotifyContainer.push_back( aEvent ); @@ -706,6 +707,7 @@ void ModuleUIConfigurationManager::impl_reloadElementTypeData( Reference< XNameAccess > xDefaultNameAccess( rDefaultElementType.xStorage, UNO_QUERY ); Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XInterface > xIfac( xThis, UNO_QUERY ); sal_Int16 nType = rUserElementType.nElementType; while ( pIter != rHashMap.end() ) @@ -724,7 +726,7 @@ void ModuleUIConfigurationManager::impl_reloadElementTypeData( aReplaceEvent.ResourceURL = rElement.aResourceURL; aReplaceEvent.Accessor <<= xThis; - aReplaceEvent.Source = xThis; + aReplaceEvent.Source = xIfac; aReplaceEvent.ReplacedElement <<= xOldSettings; aReplaceEvent.Element <<= rElement.xSettings; rReplaceNotifyContainer.push_back( aReplaceEvent ); @@ -742,7 +744,7 @@ void ModuleUIConfigurationManager::impl_reloadElementTypeData( aReplaceEvent.ResourceURL = rElement.aResourceURL; aReplaceEvent.Accessor <<= xThis; - aReplaceEvent.Source = xThis; + aReplaceEvent.Source = xIfac; aReplaceEvent.ReplacedElement <<= xOldSettings; aReplaceEvent.Element <<= rElement.xSettings; rReplaceNotifyContainer.push_back( aReplaceEvent ); @@ -759,7 +761,7 @@ void ModuleUIConfigurationManager::impl_reloadElementTypeData( aRemoveEvent.ResourceURL = rElement.aResourceURL; aRemoveEvent.Accessor <<= xThis; - aRemoveEvent.Source = xThis; + aRemoveEvent.Source = xIfac; aRemoveEvent.Element <<= rElement.xSettings; rRemoveNotifyContainer.push_back( aRemoveEvent ); @@ -1232,12 +1234,13 @@ throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::la rElementType.bModified = true; Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Create event to notify listener about replaced element settings ui::ConfigurationEvent aEvent; aEvent.ResourceURL = ResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xThis; + aEvent.Source = xIfac; aEvent.ReplacedElement <<= xOldSettings; aEvent.Element <<= pDataSettings->xSettings; @@ -1279,13 +1282,14 @@ throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::la rElements.insert( UIElementDataHashMap::value_type( ResourceURL, aUIElementData )); Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Create event to notify listener about replaced element settings ui::ConfigurationEvent aEvent; aEvent.ResourceURL = ResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xThis; + aEvent.Source = xIfac; aEvent.ReplacedElement <<= pDataSettings->xSettings; aEvent.Element <<= aUIElementData.xSettings; @@ -1338,6 +1342,7 @@ throw ( NoSuchElementException, IllegalArgumentException, IllegalAccessException rElementType.bModified = true; Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Check if we have settings in the default layer which replaces the user-defined one! UIElementData* pDefaultDataSettings = impl_findUIElementData( ResourceURL, nElementType ); @@ -1348,7 +1353,7 @@ throw ( NoSuchElementException, IllegalArgumentException, IllegalAccessException aEvent.ResourceURL = ResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xThis; + aEvent.Source = xIfac; aEvent.Element <<= xRemovedSettings; aEvent.ReplacedElement <<= pDefaultDataSettings->xSettings; @@ -1363,7 +1368,7 @@ throw ( NoSuchElementException, IllegalArgumentException, IllegalAccessException aEvent.ResourceURL = ResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xThis; + aEvent.Source = xIfac; aEvent.Element <<= xRemovedSettings; aGuard.clear(); diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index 09a201d72554..df9115fe231a 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -547,6 +547,7 @@ void UIConfigurationManager::impl_resetElementTypeData( UIElementDataHashMap::iterator pIter = rHashMap.begin(); Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Make copies of the event structures to be thread-safe. We have to unlock our mutex before calling // our listeners! @@ -559,7 +560,7 @@ void UIConfigurationManager::impl_resetElementTypeData( ConfigurationEvent aEvent; aEvent.ResourceURL = rElement.aResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xThis; + aEvent.Source = xIfac; aEvent.Element <<= rElement.xSettings; rRemoveNotifyContainer.push_back( aEvent ); @@ -588,6 +589,7 @@ void UIConfigurationManager::impl_reloadElementTypeData( Reference< XStorage > xElementStorage( rDocElementType.xStorage ); Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XInterface > xIfac( xThis, UNO_QUERY ); sal_Int16 nType = rDocElementType.nElementType; while ( pIter != rHashMap.end() ) @@ -606,7 +608,7 @@ void UIConfigurationManager::impl_reloadElementTypeData( aReplaceEvent.ResourceURL = rElement.aResourceURL; aReplaceEvent.Accessor <<= xThis; - aReplaceEvent.Source = xThis; + aReplaceEvent.Source = xIfac; aReplaceEvent.ReplacedElement <<= xOldSettings; aReplaceEvent.Element <<= rElement.xSettings; rReplaceNotifyContainer.push_back( aReplaceEvent ); @@ -620,7 +622,7 @@ void UIConfigurationManager::impl_reloadElementTypeData( aRemoveEvent.ResourceURL = rElement.aResourceURL; aRemoveEvent.Accessor <<= xThis; - aRemoveEvent.Source = xThis; + aRemoveEvent.Source = xIfac; aRemoveEvent.Element <<= rElement.xSettings; rRemoveNotifyContainer.push_back( aRemoveEvent ); @@ -992,13 +994,14 @@ throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::la rElementType.bModified = true; Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Create event to notify listener about replaced element settings ConfigurationEvent aEvent; aEvent.ResourceURL = ResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xThis; + aEvent.Source = xIfac; aEvent.ReplacedElement <<= xOldSettings; aEvent.Element <<= pDataSettings->xSettings; @@ -1049,13 +1052,14 @@ throw ( NoSuchElementException, IllegalArgumentException, IllegalAccessException rElementType.bModified = true; Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Create event to notify listener about removed element settings ConfigurationEvent aEvent; aEvent.ResourceURL = ResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xThis; + aEvent.Source = xIfac; aEvent.Element <<= xRemovedSettings; aGuard.clear(); @@ -1125,13 +1129,14 @@ throw ( ElementExistException, IllegalArgumentException, IllegalAccessException, Reference< XIndexAccess > xInsertSettings( aUIElementData.xSettings ); Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Create event to notify listener about removed element settings ConfigurationEvent aEvent; aEvent.ResourceURL = NewResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xThis; + aEvent.Source = xIfac; aEvent.Element <<= xInsertSettings; aGuard.clear(); diff --git a/framework/source/uifactory/menubarfactory.cxx b/framework/source/uifactory/menubarfactory.cxx index 1a139c4f76ec..55afe317e5b6 100644 --- a/framework/source/uifactory/menubarfactory.cxx +++ b/framework/source/uifactory/menubarfactory.cxx @@ -118,7 +118,7 @@ void MenuBarFactory::CreateUIElement(const OUString& ResourceURL { Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = ModuleManager::create( _rxContext ); - OUString aModuleIdentifier = xModuleManager->identify( xFrame ); + OUString aModuleIdentifier = xModuleManager->identify( Reference( xFrame, UNO_QUERY ) ); if ( !aModuleIdentifier.isEmpty() ) { Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier = diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx index b18f82a43cf4..932b90b55f1d 100644 --- a/framework/source/uifactory/uielementfactorymanager.cxx +++ b/framework/source/uifactory/uielementfactorymanager.cxx @@ -453,7 +453,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l { OUString aModuleId; if ( xFrame.is() && xManager.is() ) - aModuleId = xManager->identify( xFrame ); + aModuleId = xManager->identify( Reference( xFrame, UNO_QUERY ) ); Reference< XUIElementFactory > xUIElementFactory = getFactory( ResourceURL, aModuleId ); if ( xUIElementFactory.is() ) -- cgit