diff options
author | Noel Grandin <noel@peralex.com> | 2014-05-26 15:26:03 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-05-27 08:20:11 +0200 |
commit | 9af0abebfd61641c9d028505caa864cdf898e35b (patch) | |
tree | aff469b96f89daf093271d95f790250147ea9c0d /embeddedobj/source/general | |
parent | 9b791f9c31165b82ec0fa3760a8af18c5af21294 (diff) |
remove unnecessary use of Reference constructor in throw
Convert code like this:
throw IOException("xx",
Reference< XInterface >(static_cast<OWeakObject*>(this)) );
to this:
throw IOException("xx",
static_cast<OWeakObject*>(this) );
Change-Id: Ife9f645f0f1810a8e80219126193015502c43dbb
Diffstat (limited to 'embeddedobj/source/general')
-rw-r--r-- | embeddedobj/source/general/dummyobject.cxx | 40 | ||||
-rw-r--r-- | embeddedobj/source/general/xcreator.cxx | 24 |
2 files changed, 31 insertions, 33 deletions
diff --git a/embeddedobj/source/general/dummyobject.cxx b/embeddedobj/source/general/dummyobject.cxx index 76f982f20d84..603b8f3c8b21 100644 --- a/embeddedobj/source/general/dummyobject.cxx +++ b/embeddedobj/source/general/dummyobject.cxx @@ -45,7 +45,7 @@ void ODummyEmbeddedObject::CheckInit_WrongState() if ( m_nObjectState == -1 ) throw embed::WrongStateException( "The object has no persistence!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); + static_cast< ::cppu::OWeakObject* >(this) ); } void ODummyEmbeddedObject::CheckInit_Runtime() @@ -55,7 +55,7 @@ void ODummyEmbeddedObject::CheckInit_Runtime() if ( m_nObjectState == -1 ) throw uno::RuntimeException( "The object has no persistence!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); + static_cast< ::cppu::OWeakObject* >(this) ); } void ODummyEmbeddedObject::PostEvent_Impl( const OUString& aEventName ) { @@ -237,7 +237,7 @@ void SAL_CALL ODummyEmbeddedObject::setVisualAreaSize( sal_Int64 nAspect, const if ( nAspect == embed::Aspects::MSOLE_ICON ) // no representation can be retrieved throw embed::WrongStateException( "Illegal call!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); + static_cast< ::cppu::OWeakObject* >(this) ); m_nCachedAspect = nAspect; m_aCachedSize = aSize; @@ -258,12 +258,12 @@ awt::Size SAL_CALL ODummyEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect ) if ( nAspect == embed::Aspects::MSOLE_ICON ) // no representation can be retrieved throw embed::WrongStateException( "Illegal call!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); + static_cast< ::cppu::OWeakObject* >(this) ); if ( !m_bHasCachedSize || m_nCachedAspect != nAspect ) throw embed::NoVisualAreaSizeException( "No size available!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); + static_cast< ::cppu::OWeakObject* >(this) ); return m_aCachedSize; } @@ -280,7 +280,7 @@ sal_Int32 SAL_CALL ODummyEmbeddedObject::getMapUnit( sal_Int64 nAspect ) if ( nAspect == embed::Aspects::MSOLE_ICON ) // no representation can be retrieved throw embed::WrongStateException( "Illegal call!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); + static_cast< ::cppu::OWeakObject* >(this) ); return embed::EmbedMapUnits::ONE_100TH_MM; } @@ -297,7 +297,7 @@ embed::VisualRepresentation SAL_CALL ODummyEmbeddedObject::getPreferredVisualRep // no representation can be retrieved throw embed::WrongStateException( "Illegal call!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); + static_cast< ::cppu::OWeakObject* >(this) ); } @@ -319,12 +319,12 @@ void SAL_CALL ODummyEmbeddedObject::setPersistentEntry( if ( !xStorage.is() ) throw lang::IllegalArgumentException( "No parent storage is provided!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), + static_cast< ::cppu::OWeakObject* >(this), 1 ); if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( "Empty element name is provided!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), + static_cast< ::cppu::OWeakObject* >(this), 2 ); if ( ( m_nObjectState != -1 || nEntryConnectionMode == embed::EntryInitModes::NO_INIT ) @@ -332,7 +332,7 @@ void SAL_CALL ODummyEmbeddedObject::setPersistentEntry( { throw embed::WrongStateException( "Can't change persistent representation of activated object!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); + static_cast< ::cppu::OWeakObject* >(this) ); } if ( m_bWaitSaveCompleted ) @@ -342,7 +342,7 @@ void SAL_CALL ODummyEmbeddedObject::setPersistentEntry( else throw embed::WrongStateException( "The object waits for saveCompleted() call!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); + static_cast< ::cppu::OWeakObject* >(this) ); } if ( nEntryConnectionMode == embed::EntryInitModes::DEFAULT_INIT @@ -357,13 +357,13 @@ void SAL_CALL ODummyEmbeddedObject::setPersistentEntry( } else throw lang::IllegalArgumentException( "Wrong entry is provided!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), + static_cast< ::cppu::OWeakObject* >(this), 2 ); } else throw lang::IllegalArgumentException( "Wrong connection mode is provided!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), + static_cast< ::cppu::OWeakObject* >(this), 3 ); } @@ -384,7 +384,7 @@ void SAL_CALL ODummyEmbeddedObject::storeToEntry( const uno::Reference< embed::X if ( m_bWaitSaveCompleted ) throw embed::WrongStateException( "The object waits for saveCompleted() call!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); + static_cast< ::cppu::OWeakObject* >(this) ); m_xParentStorage->copyElementTo( m_aEntryName, xStorage, sEntName ); } @@ -406,7 +406,7 @@ void SAL_CALL ODummyEmbeddedObject::storeAsEntry( const uno::Reference< embed::X if ( m_bWaitSaveCompleted ) throw embed::WrongStateException( "The object waits for saveCompleted() call!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); + static_cast< ::cppu::OWeakObject* >(this) ); PostEvent_Impl( OUString( "OnSaveAs" ) ); @@ -462,7 +462,7 @@ sal_Bool SAL_CALL ODummyEmbeddedObject::hasEntry() if ( m_bWaitSaveCompleted ) throw embed::WrongStateException( "The object waits for saveCompleted() call!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); + static_cast< ::cppu::OWeakObject* >(this) ); if ( !m_aEntryName.isEmpty() ) return sal_True; @@ -481,7 +481,7 @@ OUString SAL_CALL ODummyEmbeddedObject::getEntryName() if ( m_bWaitSaveCompleted ) throw embed::WrongStateException( "The object waits for saveCompleted() call!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); + static_cast< ::cppu::OWeakObject* >(this) ); return m_aEntryName; } @@ -499,7 +499,7 @@ void SAL_CALL ODummyEmbeddedObject::storeOwn() if ( m_bWaitSaveCompleted ) throw embed::WrongStateException( "The object waits for saveCompleted() call!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); + static_cast< ::cppu::OWeakObject* >(this) ); // the object can not be activated or changed return; @@ -516,7 +516,7 @@ sal_Bool SAL_CALL ODummyEmbeddedObject::isReadonly() if ( m_bWaitSaveCompleted ) throw embed::WrongStateException( "The object waits for saveCompleted() call!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); + static_cast< ::cppu::OWeakObject* >(this) ); // this object can not be changed return sal_True; @@ -538,7 +538,7 @@ void SAL_CALL ODummyEmbeddedObject::reload( if ( m_bWaitSaveCompleted ) throw embed::WrongStateException( "The object waits for saveCompleted() call!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); + static_cast< ::cppu::OWeakObject* >(this) ); // nothing to reload } diff --git a/embeddedobj/source/general/xcreator.cxx b/embeddedobj/source/general/xcreator.cxx index df2625630581..b3db0f04ef27 100644 --- a/embeddedobj/source/general/xcreator.cxx +++ b/embeddedobj/source/general/xcreator.cxx @@ -77,12 +77,12 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta if ( !xStorage.is() ) throw lang::IllegalArgumentException( "No parent storage is provided!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), + static_cast< ::cppu::OWeakObject* >(this), 3 ); if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( "Empty element name is provided!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), + static_cast< ::cppu::OWeakObject* >(this), 4 ); OUString aEmbedFactory = m_aConfigHelper.GetFactoryNameByClassID( aClassID ); @@ -118,12 +118,12 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta { if ( !xStorage.is() ) throw lang::IllegalArgumentException( "No parent storage is provided!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), + static_cast< ::cppu::OWeakObject* >(this), 1 ); if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( "Empty element name is provided!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), + static_cast< ::cppu::OWeakObject* >(this), 2 ); uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY ); @@ -237,12 +237,12 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta if ( !xStorage.is() ) throw lang::IllegalArgumentException( "No parent storage is provided!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), + static_cast< ::cppu::OWeakObject* >(this), 1 ); if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( "Empty element name is provided!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), + static_cast< ::cppu::OWeakObject* >(this), 2 ); uno::Reference< uno::XInterface > xResult; @@ -300,12 +300,12 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta if ( !xStorage.is() ) throw lang::IllegalArgumentException( "No parent storage is provided!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), + static_cast< ::cppu::OWeakObject* >(this), 3 ); if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( "Empty element name is provided!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), + static_cast< ::cppu::OWeakObject* >(this), 4 ); OUString aEmbedFactory = m_aConfigHelper.GetFactoryNameByClassID( aClassID ); @@ -347,7 +347,7 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta if ( aURL.isEmpty() ) throw lang::IllegalArgumentException( "No URL for the link is provided!", - uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), + static_cast< ::cppu::OWeakObject* >(this), 3 ); OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, false ); @@ -376,14 +376,12 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta if ( !xStorage.is() ) throw lang::IllegalArgumentException( "No parent storage is provided!", - uno::Reference< uno::XInterface >( - static_cast< ::cppu::OWeakObject* >(this) ), + static_cast< ::cppu::OWeakObject* >(this), 3 ); if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( "Empty element name is provided!", - uno::Reference< uno::XInterface >( - static_cast< ::cppu::OWeakObject* >(this) ), + static_cast< ::cppu::OWeakObject* >(this), 4 ); uno::Reference< embed::XEmbeddedObjectCreator > xLinkCreator = |