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 --- basic/source/basmgr/basicmanagerrepository.cxx | 3 ++- basic/source/uno/dlgcont.cxx | 2 +- basic/source/uno/namecont.cxx | 10 +++++----- .../source/processfactory/processfactory.cxx | 4 ++-- dbaccess/source/core/dataaccess/connection.cxx | 2 +- filter/source/svg/svgexport.cxx | 6 +++--- filter/source/svg/svgwriter.cxx | 10 +++++----- forms/source/misc/InterfaceContainer.cxx | 2 +- .../moduleuiconfigurationmanager.cxx | 23 +++++++++++++--------- .../uiconfiguration/uiconfigurationmanager.cxx | 17 ++++++++++------ framework/source/uifactory/menubarfactory.cxx | 2 +- .../source/uifactory/uielementfactorymanager.cxx | 2 +- scripting/source/dlgprov/dlgprov.cxx | 4 ++-- scripting/source/stringresource/stringresource.cxx | 4 ++-- sd/source/core/sdpage2.cxx | 4 ++-- sd/source/ui/view/ViewShellBase.cxx | 2 +- svx/source/form/fmobj.cxx | 2 +- svx/source/form/fmshimp.cxx | 4 ++-- svx/source/form/fmtools.cxx | 2 +- svx/source/form/fmundo.cxx | 4 ++-- svx/source/form/fmvwimp.cxx | 2 +- svx/source/form/formcontroller.cxx | 6 +++--- svx/source/form/navigatortree.cxx | 2 +- ucb/source/ucp/file/bc.cxx | 2 +- ucb/source/ucp/file/filglob.cxx | 8 ++++---- ucb/source/ucp/ftp/ftpcontent.cxx | 2 +- unotools/source/config/configitem.cxx | 2 +- xmloff/source/text/txtparai.cxx | 2 +- 28 files changed, 73 insertions(+), 62 deletions(-) diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index f062de05fba8..45cb4682eb48 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -381,9 +381,10 @@ namespace basic BasicManagerPointer& ImplRepository::impl_getLocationForModel( const Reference< XModel >& _rxDocumentModel ) { + Reference< XInterface > xNormalized( _rxDocumentModel, UNO_QUERY ); DBG_ASSERT( _rxDocumentModel.is(), "ImplRepository::impl_getLocationForModel: invalid model!" ); - BasicManagerPointer& location = m_aStore[ _rxDocumentModel ]; + BasicManagerPointer& location = m_aStore[ xNormalized ]; return location; } diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx index bc4223a0e2b9..b9d128b91355 100644 --- a/basic/source/uno/dlgcont.cxx +++ b/basic/source/uno/dlgcont.cxx @@ -241,7 +241,7 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e UNO_QUERY ); ::xmlscript::importDialogModel( xInput, xDialogModel, mxContext, mxOwnerDocument ); std::vector< OUString > vEmbeddedImageURLs; - GraphicObject::InspectForGraphicObjectImageURL( xDialogModel, vEmbeddedImageURLs ); + GraphicObject::InspectForGraphicObjectImageURL( Reference(xDialogModel, UNO_QUERY), vEmbeddedImageURLs ); if ( !vEmbeddedImageURLs.empty() ) { // Export the images to the storage diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index 49be779952c0..71af61e43a24 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -298,7 +298,7 @@ void SAL_CALL NameContainer::addContainerListener( const Reference< XContainerLi throw RuntimeException("addContainerListener called with null xListener", static_cast< cppu::OWeakObject * >(this)); } - maContainerListeners.addInterface( xListener ); + maContainerListeners.addInterface( Reference(xListener, UNO_QUERY) ); } void SAL_CALL NameContainer::removeContainerListener( const Reference< XContainerListener >& xListener ) @@ -308,7 +308,7 @@ void SAL_CALL NameContainer::removeContainerListener( const Reference< XContaine { throw RuntimeException(); } - maContainerListeners.removeInterface( xListener ); + maContainerListeners.removeInterface( Reference(xListener, UNO_QUERY) ); } // Methods XChangesNotifier @@ -319,7 +319,7 @@ void SAL_CALL NameContainer::addChangesListener( const Reference< XChangesListen { throw RuntimeException(); } - maChangesListeners.addInterface( xListener ); + maChangesListeners.addInterface( Reference(xListener, UNO_QUERY) ); } void SAL_CALL NameContainer::removeChangesListener( const Reference< XChangesListener >& xListener ) @@ -329,7 +329,7 @@ void SAL_CALL NameContainer::removeChangesListener( const Reference< XChangesLis { throw RuntimeException(); } - maChangesListeners.removeInterface( xListener ); + maChangesListeners.removeInterface( Reference(xListener, UNO_QUERY) ); } @@ -2988,7 +2988,7 @@ void SAL_CALL SfxLibraryContainer::broadcastVBAScriptEvent( sal_Int32 nIdentifie leaveMethod(); Reference< XModel > xModel = mxOwnerDocument; // weak-ref -> ref - vba::VBAScriptEvent aEvent( xModel, nIdentifier, rModuleName ); + vba::VBAScriptEvent aEvent( Reference(xModel, UNO_QUERY), nIdentifier, rModuleName ); maVBAScriptListeners.notify( aEvent ); } diff --git a/comphelper/source/processfactory/processfactory.cxx b/comphelper/source/processfactory/processfactory.cxx index 04c81cb3d7d7..211067a5e75f 100644 --- a/comphelper/source/processfactory/processfactory.cxx +++ b/comphelper/source/processfactory/processfactory.cxx @@ -79,14 +79,14 @@ Reference< XComponentContext > getComponentContext( catch (beans::UnknownPropertyException & e) { throw DeploymentException( "unknown service factory DefaultContext property: " + e.Message, - factory ); + Reference(factory, UNO_QUERY) ); } } if ( !xRet.is() ) { throw DeploymentException( "no service factory DefaultContext", - factory ); + Reference(factory, UNO_QUERY) ); } return xRet; } diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx index e9bdb9f104bd..13c2ef116015 100644 --- a/dbaccess/source/core/dataaccess/connection.cxx +++ b/dbaccess/source/core/dataaccess/connection.cxx @@ -657,7 +657,7 @@ Reference< XInterface > SAL_CALL OConnection::createInstance( const OUString& _s return aFind->second; } } - return xRet; + return Reference(xRet, UNO_QUERY); } Reference< XInterface > SAL_CALL OConnection::createInstanceWithArguments( const OUString& _sServiceSpecifier, const Sequence< Any >& /*Arguments*/ ) throw (Exception, RuntimeException, std::exception) diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index f04aed3e367b..1f1fe1d4d168 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -1213,7 +1213,7 @@ void SVGFilter::implExportTextShapeIndex() { OUString sTextShapeIdList = mTextShapeIdListMap[xDrawPage].trim(); - const OUString& rPageId = implGetValidIDFromInterface( xDrawPage ); + const OUString& rPageId = implGetValidIDFromInterface( Reference(xDrawPage, UNO_QUERY) ); if( !rPageId.isEmpty() && !sTextShapeIdList.isEmpty() ) { mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrSlide, rPageId ); @@ -1783,7 +1783,7 @@ bool SVGFilter::implExportShape( const Reference< XShape >& rxShape, } - const OUString& rShapeId = implGetValidIDFromInterface( rxShape ); + const OUString& rShapeId = implGetValidIDFromInterface( Reference(rxShape, UNO_QUERY) ); if( !rShapeId.isEmpty() ) { mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", rShapeId ); @@ -1976,7 +1976,7 @@ bool SVGFilter::implCreateObjectsFromShape( const Reference< XDrawPage > & rxPag { // We create a map of text shape ids. implRegisterInterface( rxShape ); - const OUString& rShapeId = implGetValidIDFromInterface( rxShape ); + const OUString& rShapeId = implGetValidIDFromInterface( Reference(rxShape, UNO_QUERY) ); if( !rShapeId.isEmpty() ) { mTextShapeIdListMap[rxPage] += rShapeId; diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 8b223c656231..c65dda2368dd 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -849,7 +849,7 @@ bool SVGTextWriter::createParagraphEnumeration() { if( mrTextShape.is() ) { - msShapeId = implGetValidIDFromInterface( mrTextShape ); + msShapeId = implGetValidIDFromInterface( Reference(mrTextShape, UNO_QUERY) ); Reference< XEnumerationAccess > xEnumerationAccess( mrTextShape, UNO_QUERY_THROW ); Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW ); @@ -1013,7 +1013,7 @@ bool SVGTextWriter::nextParagraph() return false; } - const OUString& rParagraphId = implGetValidIDFromInterface( xTextContent ); + const OUString& rParagraphId = implGetValidIDFromInterface( Reference(xTextContent, UNO_QUERY) ); if( !rParagraphId.isEmpty() ) { mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rParagraphId ); @@ -1121,7 +1121,7 @@ bool SVGTextWriter::nextTextPortion() { implRegisterInterface( xPortionTextRange ); - const OUString& rTextPortionId = implGetValidIDFromInterface( xPortionTextRange ); + const OUString& rTextPortionId = implGetValidIDFromInterface( Reference(xPortionTextRange, UNO_QUERY) ); if( !rTextPortionId.isEmpty() ) { msHyperlinkIdList += rTextPortionId; @@ -1573,7 +1573,7 @@ void SVGTextWriter::implWriteTextPortion( const Point& rPos, implRegisterInterface( mrCurrentTextParagraph ); // Add the needed info to the BulletListItemMap - OUString sId = implGetValidIDFromInterface( mrCurrentTextParagraph ); + OUString sId = implGetValidIDFromInterface( Reference(mrCurrentTextParagraph, UNO_QUERY) ); if( !sId.isEmpty() ) { sId += ".bp"; @@ -1592,7 +1592,7 @@ void SVGTextWriter::implWriteTextPortion( const Point& rPos, } } - const OUString& rTextPortionId = implGetValidIDFromInterface( mrCurrentTextPortion ); + const OUString& rTextPortionId = implGetValidIDFromInterface( Reference(mrCurrentTextPortion, UNO_QUERY) ); if( !rTextPortionId.isEmpty() ) { mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rTextPortionId ); diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx index e6f0bfd49b14..27b246d30ec4 100644 --- a/forms/source/misc/InterfaceContainer.cxx +++ b/forms/source/misc/InterfaceContainer.cxx @@ -254,7 +254,7 @@ void OInterfaceContainer::disposing() // revoke event knittings if ( m_xEventAttacher.is() ) { - m_xEventAttacher->detach( i - 1, xSet ); + m_xEventAttacher->detach( i - 1, Reference(xSet, UNO_QUERY) ); m_xEventAttacher->removeEntry( i - 1 ); } 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() ) diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx index 8e447d5230c4..6367e2cbfd9c 100644 --- a/scripting/source/dlgprov/dlgprov.cxx +++ b/scripting/source/dlgprov/dlgprov.cxx @@ -539,11 +539,11 @@ static OUString aResourceResolverPropName("ResourceResolver"); Reference< XInterface >* pObjects = aObjects.getArray(); for ( sal_Int32 i = 0; i < nControlCount; ++i ) { - pObjects[i] = pControls[i]; + pObjects[i] = Reference( pControls[i], UNO_QUERY ); } // also add the dialog control itself to the sequence - pObjects[nControlCount] = rxControl; + pObjects[nControlCount] = Reference( rxControl, UNO_QUERY ); Reference< XScriptEventsAttacher > xScriptEventsAttacher = new DialogEventsAttacherImpl ( m_xContext, m_xModel, rxControl, rxHandler, rxIntrospectionAccess, diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index c0b2e71b6d0f..3bf5a434b1ee 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -158,7 +158,7 @@ void StringResourceImpl::addModifyListener( const Reference< XModifyListener >& throw RuntimeException(); ::osl::MutexGuard aGuard( getMutex() ); - m_aListenerContainer.addInterface( aListener ); + m_aListenerContainer.addInterface( Reference( aListener, UNO_QUERY ) ); } void StringResourceImpl::removeModifyListener( const Reference< XModifyListener >& aListener ) @@ -168,7 +168,7 @@ void StringResourceImpl::removeModifyListener( const Reference< XModifyListener throw RuntimeException(); ::osl::MutexGuard aGuard( getMutex() ); - m_aListenerContainer.removeInterface( aListener ); + m_aListenerContainer.removeInterface( Reference( aListener, UNO_QUERY ) ); } diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx index 9d4a0272852b..933796038ae1 100644 --- a/sd/source/core/sdpage2.cxx +++ b/sd/source/core/sdpage2.cxx @@ -604,7 +604,7 @@ void SdPage::addAnnotation( const Reference< XAnnotation >& xAnnotation, int nIn if( pModel ) { pModel->SetChanged(); - NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), "OnAnnotationInserted" , xAnnotation ); + NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), "OnAnnotationInserted", Reference( xAnnotation, UNO_QUERY ) ); } } @@ -624,7 +624,7 @@ void SdPage::removeAnnotation( const Reference< XAnnotation >& xAnnotation ) if( pModel ) { pModel->SetChanged(); - NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), OUString( "OnAnnotationRemoved" ), xAnnotation ); + NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), "OnAnnotationRemoved", Reference( xAnnotation, UNO_QUERY ) ); } } diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 00d1b7afa3dd..e6a1cbb96b6e 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -971,7 +971,7 @@ OUString ImplRetrieveLabelFromCommand( const Reference< XFrame >& xFrame, const Reference< XModuleManager2 > xModuleManager( ModuleManager::create(xContext) ); - OUString aModuleIdentifier( xModuleManager->identify( xFrame ) ); + OUString aModuleIdentifier( xModuleManager->identify( Reference( xFrame, UNO_QUERY_THROW ) ) ); if( !aModuleIdentifier.isEmpty() ) { diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index 7f8cc17290f4..ed347e91bb6a 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -582,7 +582,7 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > } while ( nTokIndex >= 0 ); - return xDestContainer; + return Reference( xDestContainer, UNO_QUERY ); } diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 5c051c3358ba..8ecce62bacdc 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -2508,7 +2508,7 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn m_arrRelativeGridColumn.push_back(-1); // and for the formatted search... - pfmscContextInfo->arrFields.push_back(xControl); + pfmscContextInfo->arrFields.push_back(Reference( xControl, UNO_QUERY )); } } } @@ -2697,7 +2697,7 @@ void FmXFormShell::selectionChanged(const EventObject& rEvent) throw(::com::sun: Reference< XForm > xNewForm( GetForm( rEvent.Source ) ); InterfaceBag aNewSelection; - aNewSelection.insert( xSelObj ); + aNewSelection.insert( Reference( xSelObj, UNO_QUERY ) ); if ( setCurrentSelection( aNewSelection ) && IsPropBrwOpen() ) ShowSelectionProperties( true ); diff --git a/svx/source/form/fmtools.cxx b/svx/source/form/fmtools.cxx index aa17706b7d37..9e51d7295fd8 100644 --- a/svx/source/form/fmtools.cxx +++ b/svx/source/form/fmtools.cxx @@ -176,7 +176,7 @@ sal_Int32 getElementPos(const Reference< ::com::sun::star::container::XIndexAcce Reference< XInterface > xNormalized( xElement, UNO_QUERY ); - DBG_ASSERT( xElement.is(), "getElementPos: invalid element!" ); + DBG_ASSERT( xNormalized.is(), "getElementPos: invalid element!" ); if ( xNormalized.is() ) { // Feststellen an welcher Position sich das Kind befindet diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx index 28c9515d0728..de316e3a5c72 100644 --- a/svx/source/form/fmundo.cxx +++ b/svx/source/form/fmundo.cxx @@ -787,7 +787,7 @@ void SAL_CALL FmXUndoEnvironment::modified( const EventObject& /*aEvent*/ ) thro void FmXUndoEnvironment::AddForms(const Reference< XNameContainer > & rForms) { Lock(); - AddElement(rForms); + AddElement(Reference( rForms, UNO_QUERY )); UnLock(); } @@ -795,7 +795,7 @@ void FmXUndoEnvironment::AddForms(const Reference< XNameContainer > & rForms) void FmXUndoEnvironment::RemoveForms(const Reference< XNameContainer > & rForms) { Lock(); - RemoveElement(rForms); + RemoveElement(Reference( rForms, UNO_QUERY )); UnLock(); } diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index bef9eb2b65e6..d6b490568585 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -367,7 +367,7 @@ void FormViewPageWindowAdapter::setController(const Reference< XForm > & xForm, // attaching the events Reference< XEventAttacherManager > xEventManager( xForm->getParent(), UNO_QUERY ); - xEventManager->attach(m_aControllerList.size() - 1, xController, makeAny(xController) ); + xEventManager->attach(m_aControllerList.size() - 1, Reference( xController, UNO_QUERY ), makeAny(xController) ); } // jetzt die Subforms durchgehen diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index e46897a153d8..ca825ad03b65 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -1995,7 +1995,7 @@ void FormController::addToEventAttacher(const Reference< XControl > & xControl) m_xModelAsIndex->getByIndex(--nPos) >>= xTemp; if ((XFormComponent*)xComp.get() == (XFormComponent*)xTemp.get()) { - m_xModelAsManager->attach( nPos, xControl, makeAny(xControl) ); + m_xModelAsManager->attach( nPos, Reference( xControl, UNO_QUERY ), makeAny(xControl) ); break; } } @@ -2022,7 +2022,7 @@ void FormController::removeFromEventAttacher(const Reference< XControl > & xCont m_xModelAsIndex->getByIndex(--nPos) >>= xTemp; if ((XFormComponent*)xComp.get() == (XFormComponent*)xTemp.get()) { - m_xModelAsManager->detach( nPos, xControl ); + m_xModelAsManager->detach( nPos, Reference( xControl, UNO_QUERY ) ); break; } } @@ -3029,7 +3029,7 @@ void SAL_CALL FormController::addChildController( const Reference< XFormControll m_xModelAsIndex->getByIndex(--nPos) >>= xTemp; if ( xFormOfChild == xTemp ) { - m_xModelAsManager->attach( nPos, _ChildController, makeAny( _ChildController) ); + m_xModelAsManager->attach( nPos, Reference( _ChildController, UNO_QUERY ), makeAny( _ChildController) ); break; } } diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index 516ffe5bad88..c2890ca42f53 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -1369,7 +1369,7 @@ namespace svxform if( pFormShell ) { InterfaceBag aSelection; - aSelection.insert( xNewForm ); + aSelection.insert( Reference( xNewForm, UNO_QUERY ) ); pFormShell->GetImpl()->setCurrentSelection( aSelection ); pFormShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(SID_FM_PROPERTIES, true, true); diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx index 6d7bdcb7f7bb..54760b826e5a 100644 --- a/ucb/source/ucp/file/bc.cxx +++ b/ucb/source/ucp/file/bc.cxx @@ -728,7 +728,7 @@ BaseContent::getParent( try { - return m_pMyShell->m_pProvider->queryContent( Identifier ); + return Reference( m_pMyShell->m_pProvider->queryContent( Identifier ), UNO_QUERY ); } catch (const IllegalIdentifierException&) { diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx index 2d074c927ac9..4f8a2c19a9d5 100644 --- a/ucb/source/ucp/file/filglob.cxx +++ b/ucb/source/ucp/file/filglob.cxx @@ -554,7 +554,7 @@ namespace fileaccess { NameClashException excep; excep.Name = getTitle(aUncPath); excep.Classification = InteractionClassification_ERROR; - excep.Context = xComProc; + excep.Context = Reference( xComProc, UNO_QUERY ); excep.Message = "file exists and overwrite forbidden"; aAny <<= excep; cancelCommandExecution( aAny,xEnv ); @@ -576,7 +576,7 @@ namespace fileaccess { seq[0] <<= prop; excep.Arguments = seq; excep.Classification = InteractionClassification_ERROR; - excep.Context = xComProc; + excep.Context = Reference( xComProc, UNO_QUERY ); excep.Message = "the name contained invalid characters"; if(isHandled) throw excep; @@ -853,7 +853,7 @@ namespace fileaccess { NameClashException excep; excep.Name = getTitle(aUncPath); excep.Classification = InteractionClassification_ERROR; - excep.Context = xComProc; + excep.Context = Reference( xComProc, UNO_QUERY ); excep.Message = "name clash during copy or move"; aAny <<= excep; @@ -864,7 +864,7 @@ namespace fileaccess { { UnsupportedNameClashException excep; excep.NameClash = minorCode; - excep.Context = xComProc; + excep.Context = Reference( xComProc, UNO_QUERY ); excep.Message = "name clash value not supported during copy or move"; aAny <<= excep; diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx index fcd649daa37d..13c3fe2f9a11 100644 --- a/ucb/source/ucp/ftp/ftpcontent.cxx +++ b/ucb/source/ucp/ftp/ftpcontent.cxx @@ -695,7 +695,7 @@ FTPContent::getParent( ) { Reference xIdent(new FTPContentIdentifier(m_aFTPURL.parent(false))); - return m_xProvider->queryContent(xIdent); + return Reference( m_xProvider->queryContent(xIdent), UNO_QUERY ); } diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx index df0fa98194eb..854ad9ffcc90 100644 --- a/unotools/source/config/configitem.cxx +++ b/unotools/source/config/configitem.cxx @@ -382,7 +382,7 @@ Sequence< sal_Bool > ConfigItem::GetReadOnlyStates(const com::sun::star::uno::Se } else { - xNode = xHierarchyAccess; + xNode = Reference( xHierarchyAccess, UNO_QUERY ); } xSet = Reference< XPropertySet >(xNode, UNO_QUERY); diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx index 736064bc226c..5ab5c10b0c75 100644 --- a/xmloff/source/text/txtparai.cxx +++ b/xmloff/source/text/txtparai.cxx @@ -1962,7 +1962,7 @@ XMLParaContext::~XMLParaContext() { xIdCursor->gotoRange( xEnd, sal_True ); GetImport().getInterfaceToIdentifierMapper().registerReference( - m_sXmlId, xIdCursor); + m_sXmlId, Reference( xIdCursor, UNO_QUERY )); } } -- cgit