summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-05-02 10:36:43 +0200
committerNoel Grandin <noelgrandin@gmail.com>2013-05-22 10:44:29 +0000
commit6a043e9c0acff20e1618ca8ec15c21d5d0fd0d37 (patch)
tree2746468845d6f1159e3759ee2cf7a620fca15b6e /basic
parent697a007c61b9cabceb9767fad87cd5822b300452 (diff)
Use the new type-checking Reference constructor to reduce code noise
Also create a Clang compiler plugin to detect such cases. Change-Id: I61ad1a1d6b1c017eeb51f226d2dde0e9bb7f1752 Reviewed-on: https://gerrit.libreoffice.org/4001 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/basmgr/basicmanagerrepository.cxx10
-rw-r--r--basic/source/uno/dlgcont.cxx2
-rw-r--r--basic/source/uno/namecont.cxx15
3 files changed, 10 insertions, 17 deletions
diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx
index 7b81631570a7..d7a7bf191d4d 100644
--- a/basic/source/basmgr/basicmanagerrepository.cxx
+++ b/basic/source/basmgr/basicmanagerrepository.cxx
@@ -381,10 +381,9 @@ namespace basic
//--------------------------------------------------------------------
BasicManagerPointer& ImplRepository::impl_getLocationForModel( const Reference< XModel >& _rxDocumentModel )
{
- Reference< XInterface > xNormalized( _rxDocumentModel, UNO_QUERY );
- DBG_ASSERT( xNormalized.is(), "ImplRepository::impl_getLocationForModel: invalid model!" );
+ DBG_ASSERT( _rxDocumentModel.is(), "ImplRepository::impl_getLocationForModel: invalid model!" );
- BasicManagerPointer& location = m_aStore[ xNormalized ];
+ BasicManagerPointer& location = m_aStore[ _rxDocumentModel ];
return location;
}
@@ -489,9 +488,8 @@ namespace basic
impl_notifyCreationListeners( _rxDocumentModel, *_out_rpBasicManager );
// register as listener for this model being disposed/closed
- Reference< XComponent > xDocumentComponent( _rxDocumentModel, UNO_QUERY );
- OSL_ENSURE( xDocumentComponent.is(), "ImplRepository::impl_createManagerForModel: the document must be an XComponent!" );
- startComponentListening( xDocumentComponent );
+ OSL_ENSURE( _rxDocumentModel.is(), "ImplRepository::impl_createManagerForModel: the document must be an XComponent!" );
+ startComponentListening( _rxDocumentModel );
// register as listener for the BasicManager being destroyed
StartListening( *_out_rpBasicManager );
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index 6ba2ff153f31..a20fd88c3223 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -240,7 +240,7 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e
Reference< awt::XUnoControlDialogModel > xDialogModel = awt::UnoControlDialogModel::create( mxContext );
::xmlscript::importDialogModel( xInput, xDialogModel, mxContext, mxOwnerDocument );
std::vector< OUString > vEmbeddedImageURLs;
- GraphicObject::InspectForGraphicObjectImageURL( Reference< XInterface >( xDialogModel, UNO_QUERY ), vEmbeddedImageURLs );
+ GraphicObject::InspectForGraphicObjectImageURL( xDialogModel, 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 69e8fbfbd9e8..4586bac3b3b3 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -295,8 +295,7 @@ void SAL_CALL NameContainer::addContainerListener( const Reference< XContainerLi
throw RuntimeException("addContainerListener called with null xListener",
static_cast< cppu::OWeakObject * >(this));
}
- Reference< XInterface > xIface( xListener, UNO_QUERY );
- maContainerListeners.addInterface( xIface );
+ maContainerListeners.addInterface( xListener );
}
void SAL_CALL NameContainer::removeContainerListener( const Reference< XContainerListener >& xListener )
@@ -306,8 +305,7 @@ void SAL_CALL NameContainer::removeContainerListener( const Reference< XContaine
{
throw RuntimeException();
}
- Reference< XInterface > xIface( xListener, UNO_QUERY );
- maContainerListeners.removeInterface( xIface );
+ maContainerListeners.removeInterface( xListener );
}
// Methods XChangesNotifier
@@ -318,8 +316,7 @@ void SAL_CALL NameContainer::addChangesListener( const Reference< XChangesListen
{
throw RuntimeException();
}
- Reference< XInterface > xIface( xListener, UNO_QUERY );
- maChangesListeners.addInterface( xIface );
+ maChangesListeners.addInterface( xListener );
}
void SAL_CALL NameContainer::removeChangesListener( const Reference< XChangesListener >& xListener )
@@ -329,8 +326,7 @@ void SAL_CALL NameContainer::removeChangesListener( const Reference< XChangesLis
{
throw RuntimeException();
}
- Reference< XInterface > xIface( xListener, UNO_QUERY );
- maChangesListeners.removeInterface( xIface );
+ maChangesListeners.removeInterface( xListener );
}
//============================================================================
@@ -2969,8 +2965,7 @@ void SAL_CALL SfxLibraryContainer::broadcastVBAScriptEvent( sal_Int32 nIdentifie
leaveMethod();
Reference< XModel > xModel = mxOwnerDocument; // weak-ref -> ref
- Reference< XInterface > xSender( xModel, UNO_QUERY_THROW );
- vba::VBAScriptEvent aEvent( xSender, nIdentifier, rModuleName );
+ vba::VBAScriptEvent aEvent( xModel, nIdentifier, rModuleName );
maVBAScriptListeners.notify( aEvent );
}