summaryrefslogtreecommitdiff
path: root/embeddedobj/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-02-14 16:10:56 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-02-15 14:18:47 +0000
commit5ce42c21654db41544d831ac18c1388dde64d122 (patch)
treee85bf95ebf62c88b12d2f77107702feb3e295362 /embeddedobj/source
parent32cb8a544d25bc2a5150cd6818f505f5d5fa3687 (diff)
Some simplifications, using UNO_QUERY_THROW
Change-Id: Ieee649609a7f01b4d51ed6ed78a8ae809ca61d9e Reviewed-on: https://gerrit.libreoffice.org/34268 Tested-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'embeddedobj/source')
-rw-r--r--embeddedobj/source/commonembedding/embedobj.cxx12
-rw-r--r--embeddedobj/source/commonembedding/persistence.cxx41
-rw-r--r--embeddedobj/source/commonembedding/visobj.cxx4
-rw-r--r--embeddedobj/source/commonembedding/xfactory.cxx41
-rw-r--r--embeddedobj/source/general/docholder.cxx8
-rw-r--r--embeddedobj/source/general/xcreator.cxx20
-rw-r--r--embeddedobj/source/msole/olepersist.cxx44
-rw-r--r--embeddedobj/source/msole/olevisual.cxx4
-rw-r--r--embeddedobj/source/msole/xdialogcreator.cxx6
-rw-r--r--embeddedobj/source/msole/xolefactory.cxx46
10 files changed, 55 insertions, 171 deletions
diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx
index 304c7cc4f508..c70a7ba40bd6 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -237,9 +237,7 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
{
xInplaceClient->activatingInplace();
- uno::Reference< embed::XWindowSupplier > xClientWindowSupplier( xInplaceClient, uno::UNO_QUERY );
- if ( !xClientWindowSupplier.is() )
- throw uno::RuntimeException(); // TODO: the inplace client implementation must support XWinSupp
+ uno::Reference< embed::XWindowSupplier > xClientWindowSupplier( xInplaceClient, uno::UNO_QUERY_THROW );
m_xClientWindow = xClientWindowSupplier->getWindow();
m_aOwnRectangle = xInplaceClient->getPlacement();
@@ -248,9 +246,7 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
// create own window based on the client window
// place and resize the window according to the rectangles
- uno::Reference< awt::XWindowPeer > xClientWindowPeer( m_xClientWindow, uno::UNO_QUERY );
- if ( !xClientWindowPeer.is() )
- throw uno::RuntimeException(); // TODO: the container window must support the interface
+ uno::Reference< awt::XWindowPeer > xClientWindowPeer( m_xClientWindow, uno::UNO_QUERY_THROW );
// dispatch provider may not be provided
uno::Reference< frame::XDispatchProvider > xContainerDP = xInplaceClient->getInplaceDispatchProvider();
@@ -287,9 +283,7 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
{
if ( nNextState == embed::EmbedStates::RUNNING )
{
- uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY );
- if ( !xInplaceClient.is() )
- throw uno::RuntimeException();
+ uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY_THROW );
m_xClientSite->visibilityChanged( true );
diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx
index 26faa84e853c..2984036e46b3 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -134,9 +134,7 @@ uno::Reference< io::XInputStream > createTempInpStreamFromStor(
aArgs[0] <<= xTempStream;
aArgs[1] <<= embed::ElementModes::READWRITE;
uno::Reference< embed::XStorage > xTempStorage( xStorageFactory->createInstanceWithArguments( aArgs ),
- uno::UNO_QUERY );
- if ( !xTempStorage.is() )
- throw uno::RuntimeException(); // TODO:
+ uno::UNO_QUERY_THROW );
try
{
@@ -316,9 +314,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::InitNewDocument_Impl()
m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) );
uno::Reference< frame::XModel > xModel( xDocument, uno::UNO_QUERY );
- uno::Reference< frame::XLoadable > xLoadable( xModel, uno::UNO_QUERY );
- if ( !xLoadable.is() )
- throw uno::RuntimeException();
+ uno::Reference< frame::XLoadable > xLoadable( xModel, uno::UNO_QUERY_THROW );
try
{
@@ -375,9 +371,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl()
uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xContext, GetDocumentServiceName(),
m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) );
- uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY );
- if ( !xLoadable.is() )
- throw uno::RuntimeException();
+ uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY_THROW );
sal_Int32 nLen = 2;
uno::Sequence< beans::PropertyValue > aArgs( nLen );
@@ -576,10 +570,7 @@ uno::Reference< io::XInputStream > OCommonEmbeddedObject::StoreDocumentToTempStr
uno::Reference < io::XOutputStream > xTempOut(
io::TempFile::create(m_xContext),
uno::UNO_QUERY_THROW );
- uno::Reference< io::XInputStream > aResult( xTempOut, uno::UNO_QUERY );
-
- if ( !aResult.is() )
- throw uno::RuntimeException(); // TODO:
+ uno::Reference< io::XInputStream > aResult( xTempOut, uno::UNO_QUERY_THROW );
uno::Reference< frame::XStorable > xStorable;
{
@@ -811,9 +802,7 @@ void OCommonEmbeddedObject::StoreDocToStorage_Impl(
uno::Sequence< uno::Any > aArgs(1);
aArgs[0] <<= xTempIn;
uno::Reference< embed::XStorage > xTempStorage( xStorageFactory->createInstanceWithArguments( aArgs ),
- uno::UNO_QUERY );
- if ( !xTempStorage.is() )
- throw uno::RuntimeException(); // TODO:
+ uno::UNO_QUERY_THROW );
// object storage must be committed automatically
xTempStorage->copyToStorage( xStorage );
@@ -827,9 +816,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::CreateDocFromMediaDesc
uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xContext, GetDocumentServiceName(),
m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) );
- uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY );
- if ( !xLoadable.is() )
- throw uno::RuntimeException();
+ uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY_THROW );
try
{
@@ -998,9 +985,7 @@ void SAL_CALL OCommonEmbeddedObject::setPersistentEntry(
return;
}
- uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY );
- if ( !xNameAccess.is() )
- throw uno::RuntimeException(); //TODO
+ uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY_THROW );
// detect entry existence
bool bElExists = xNameAccess->hasByName( sEntName );
@@ -1573,9 +1558,7 @@ void SAL_CALL OCommonEmbeddedObject::storeOwn()
if ( m_bIsLink )
{
// TODO: just store the document to its location
- uno::Reference< frame::XStorable > xStorable( m_xDocHolder->GetComponent(), uno::UNO_QUERY );
- if ( !xStorable.is() )
- throw uno::RuntimeException(); // TODO
+ uno::Reference< frame::XStorable > xStorable( m_xDocHolder->GetComponent(), uno::UNO_QUERY_THROW );
// free the main mutex for the storing time
aGuard.clear();
@@ -1820,9 +1803,7 @@ void SAL_CALL OCommonEmbeddedObject::breakLink( const uno::Reference< embed::XSt
"The object waits for saveCompleted() call!",
static_cast< ::cppu::OWeakObject* >(this) );
- uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY );
- if ( !xNameAccess.is() )
- throw uno::RuntimeException(); //TODO
+ uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY_THROW );
m_bReadOnly = false;
@@ -1835,9 +1816,7 @@ void SAL_CALL OCommonEmbeddedObject::breakLink( const uno::Reference< embed::XSt
// TODO/LATER: handle the case when temp doc can not be created
// the document is a new embedded object so it must be marked as modified
uno::Reference< util::XCloseable > xDocument = CreateTempDocFromLink_Impl();
- uno::Reference< util::XModifiable > xModif( m_xDocHolder->GetComponent(), uno::UNO_QUERY );
- if ( !xModif.is() )
- throw uno::RuntimeException();
+ uno::Reference< util::XModifiable > xModif( m_xDocHolder->GetComponent(), uno::UNO_QUERY_THROW );
try
{
xModif->setModified( true );
diff --git a/embeddedobj/source/commonembedding/visobj.cxx b/embeddedobj/source/commonembedding/visobj.cxx
index 8862590d49fc..de4d61700f05 100644
--- a/embeddedobj/source/commonembedding/visobj.cxx
+++ b/embeddedobj/source/commonembedding/visobj.cxx
@@ -184,9 +184,7 @@ embed::VisualRepresentation SAL_CALL OCommonEmbeddedObject::getPreferredVisualRe
}
else
{
- uno::Reference< datatransfer::XTransferable > xTransferable( m_xDocHolder->GetComponent(), uno::UNO_QUERY );
- if (!xTransferable.is() )
- throw uno::RuntimeException();
+ uno::Reference< datatransfer::XTransferable > xTransferable( m_xDocHolder->GetComponent(), uno::UNO_QUERY_THROW );
datatransfer::DataFlavor aDataFlavor(
"application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"",
diff --git a/embeddedobj/source/commonembedding/xfactory.cxx b/embeddedobj/source/commonembedding/xfactory.cxx
index 89477128ef72..a361190c580f 100644
--- a/embeddedobj/source/commonembedding/xfactory.cxx
+++ b/embeddedobj/source/commonembedding/xfactory.cxx
@@ -71,9 +71,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta
static_cast< ::cppu::OWeakObject* >(this),
2 );
- uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY );
- if ( !xNameAccess.is() )
- throw uno::RuntimeException(); //TODO
+ uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY_THROW );
// detect entry existence
if ( !xNameAccess->hasByName( sEntName ) )
@@ -86,9 +84,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta
uno::Reference< embed::XStorage > xSubStorage =
xStorage->openStorageElement( sEntName, embed::ElementModes::READ );
- uno::Reference< beans::XPropertySet > xPropSet( xSubStorage, uno::UNO_QUERY );
- if ( !xPropSet.is() )
- throw uno::RuntimeException();
+ uno::Reference< beans::XPropertySet > xPropSet( xSubStorage, uno::UNO_QUERY_THROW );
OUString aMediaType;
try {
@@ -129,10 +125,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta
throw io::IOException(); // TODO:
}
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
-
- if ( !xPersist.is() )
- throw uno::RuntimeException(); // TODO: the interface must be supported by own document objects
+ uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY_THROW );
xPersist->setPersistentEntry( xStorage,
sEntName,
@@ -185,10 +178,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta
throw io::IOException(); // TODO:
}
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
-
- if ( !xPersist.is() )
- throw uno::RuntimeException(); // TODO: the interface must be supported ( what about applets? )
+ uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY_THROW );
xPersist->setPersistentEntry( xStorage,
sEntName,
@@ -228,10 +218,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta
uno::UNO_QUERY );
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
-
- if ( !xPersist.is() )
- throw uno::RuntimeException(); // TODO: the interface must be supported by own document objects
+ uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY_THROW );
xPersist->setPersistentEntry( xStorage,
sEntName,
@@ -281,18 +268,12 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta
aObject ) ),
uno::UNO_QUERY );
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
- if ( xPersist.is() )
- {
- xPersist->setPersistentEntry( xStorage,
- sEntName,
- nEntryConnectionMode,
- aTempMedDescr,
- lObjArgs );
-
- }
- else
- throw uno::RuntimeException(); // TODO:
+ uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY_THROW );
+ xPersist->setPersistentEntry( xStorage,
+ sEntName,
+ nEntryConnectionMode,
+ aTempMedDescr,
+ lObjArgs );
return xResult;
}
diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx
index 73ba0e138326..8626b51e41ec 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -416,9 +416,7 @@ bool DocumentHolder::ShowInplace( const uno::Reference< awt::XWindowPeer >& xPar
awt::Size( HATCH_BORDER_WIDTH, HATCH_BORDER_WIDTH ) );
uno::Reference< awt::XWindowPeer > xHatchWinPeer( xHatchWindow, uno::UNO_QUERY );
- xHWindow.set( xHatchWinPeer, uno::UNO_QUERY );
- if ( !xHWindow.is() )
- throw uno::RuntimeException(); // TODO: can not create own window
+ xHWindow.set( xHatchWinPeer, uno::UNO_QUERY_THROW );
xHatchWindow->setController( uno::Reference< embed::XHatchWindowController >(
static_cast< embed::XHatchWindowController* >( this ) ) );
@@ -441,9 +439,7 @@ bool DocumentHolder::ShowInplace( const uno::Reference< awt::XWindowPeer >& xPar
uno::Reference< awt::XToolkit2 > xToolkit = awt::Toolkit::create(m_xContext);
uno::Reference< awt::XWindowPeer > xNewWinPeer = xToolkit->createWindow( aOwnWinDescriptor );
- uno::Reference< awt::XWindow > xOwnWindow( xNewWinPeer, uno::UNO_QUERY );
- if ( !xOwnWindow.is() )
- throw uno::RuntimeException(); // TODO: can not create own window
+ uno::Reference< awt::XWindow > xOwnWindow( xNewWinPeer, uno::UNO_QUERY_THROW );
// create a frame based on the specified window
uno::Reference< lang::XSingleServiceFactory > xFrameFact = frame::TaskCreator::create(m_xContext);
diff --git a/embeddedobj/source/general/xcreator.cxx b/embeddedobj/source/general/xcreator.cxx
index 3dc498c1269d..06227f00a834 100644
--- a/embeddedobj/source/general/xcreator.cxx
+++ b/embeddedobj/source/general/xcreator.cxx
@@ -94,9 +94,7 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta
if ( xEmbCreator.is() )
return xEmbCreator->createInstanceInitNew( aClassID, aClassName, xStorage, sEntName, lObjArgs );
- uno::Reference < embed::XEmbedObjectFactory > xEmbFact( xFact, uno::UNO_QUERY );
- if ( !xEmbFact.is() )
- throw uno::RuntimeException();
+ uno::Reference < embed::XEmbedObjectFactory > xEmbFact( xFact, uno::UNO_QUERY_THROW );
return xEmbFact->createInstanceUserInit( aClassID, aClassName, xStorage, sEntName, embed::EntryInitModes::TRUNCATE_INIT, uno::Sequence < beans::PropertyValue >(), lObjArgs);
}
@@ -117,9 +115,7 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta
static_cast< ::cppu::OWeakObject* >(this),
2 );
- uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY );
- if ( !xNameAccess.is() )
- throw uno::RuntimeException(); //TODO
+ uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY_THROW );
// detect entry existence
if ( !xNameAccess->hasByName( sEntName ) )
@@ -133,9 +129,7 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta
uno::Reference< embed::XStorage > xSubStorage =
xStorage->openStorageElement( sEntName, embed::ElementModes::READ );
- uno::Reference< beans::XPropertySet > xPropSet( xSubStorage, uno::UNO_QUERY );
- if ( !xPropSet.is() )
- throw uno::RuntimeException();
+ uno::Reference< beans::XPropertySet > xPropSet( xSubStorage, uno::UNO_QUERY_THROW );
try {
uno::Any aAny = xPropSet->getPropertyValue("MediaType");
@@ -165,9 +159,7 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta
uno::Reference< io::XStream > xSubStream =
xStorage->openStreamElement( sEntName, embed::ElementModes::READ );
- uno::Reference< beans::XPropertySet > xPropSet( xSubStream, uno::UNO_QUERY );
- if ( !xPropSet.is() )
- throw uno::RuntimeException();
+ uno::Reference< beans::XPropertySet > xPropSet( xSubStream, uno::UNO_QUERY_THROW );
try {
uno::Any aAny = xPropSet->getPropertyValue("MediaType");
@@ -300,9 +292,7 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta
OUString aEmbedFactory = m_aConfigHelper.GetFactoryNameByClassID( aClassID );
uno::Reference< embed::XEmbedObjectFactory > xEmbFactory(
m_xContext->getServiceManager()->createInstanceWithContext(aEmbedFactory, m_xContext),
- uno::UNO_QUERY );
- if ( !xEmbFactory.is() )
- throw uno::RuntimeException(); // TODO:
+ uno::UNO_QUERY_THROW );
return xEmbFactory->createInstanceUserInit( aClassID,
sClassName,
diff --git a/embeddedobj/source/msole/olepersist.cxx b/embeddedobj/source/msole/olepersist.cxx
index 30095d175760..82fb981c5afc 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -191,20 +191,14 @@ OUString GetNewFilledTempFile_Impl( const uno::Reference< embed::XOptimizedStora
void SetStreamMediaType_Impl( const uno::Reference< io::XStream >& xStream, const OUString& aMediaType )
{
- uno::Reference< beans::XPropertySet > xPropSet( xStream, uno::UNO_QUERY );
- if ( !xPropSet.is() )
- throw uno::RuntimeException(); // TODO: all the storage streams must support XPropertySet
-
+ uno::Reference< beans::XPropertySet > xPropSet( xStream, uno::UNO_QUERY_THROW );
xPropSet->setPropertyValue("MediaType", uno::makeAny( aMediaType ) );
}
#endif
void LetCommonStoragePassBeUsed_Impl( const uno::Reference< io::XStream >& xStream )
{
- uno::Reference< beans::XPropertySet > xPropSet( xStream, uno::UNO_QUERY );
- if ( !xPropSet.is() )
- throw uno::RuntimeException(); // Only StorageStreams must be provided here, they must implement the interface
-
+ uno::Reference< beans::XPropertySet > xPropSet( xStream, uno::UNO_QUERY_THROW );
xPropSet->setPropertyValue("UseCommonStoragePasswordEncryption",
uno::makeAny( true ) );
}
@@ -382,10 +376,7 @@ void OleEmbeddedObject::InsertVisualCache_Impl( const uno::Reference< io::XStrea
m_xFactory->createInstanceWithArguments(
"com.sun.star.embed.OLESimpleStorage",
aArgs ),
- uno::UNO_QUERY );
-
- if ( !xNameContainer.is() )
- throw uno::RuntimeException();
+ uno::UNO_QUERY_THROW );
uno::Reference< io::XSeekable > xCachedSeek( xCachedVisualRepresentation, uno::UNO_QUERY_THROW );
if ( xCachedSeek.is() )
@@ -509,10 +500,7 @@ void OleEmbeddedObject::InsertVisualCache_Impl( const uno::Reference< io::XStrea
else
xNameContainer->insertByName( aCacheName, uno::makeAny( xTempFile ) );
- uno::Reference< embed::XTransactedObject > xTransacted( xNameContainer, uno::UNO_QUERY );
- if ( !xTransacted.is() )
- throw uno::RuntimeException();
-
+ uno::Reference< embed::XTransactedObject > xTransacted( xNameContainer, uno::UNO_QUERY_THROW );
xTransacted->commit();
}
@@ -530,10 +518,7 @@ void OleEmbeddedObject::RemoveVisualCache_Impl( const uno::Reference< io::XStrea
m_xFactory->createInstanceWithArguments(
"com.sun.star.embed.OLESimpleStorage",
aArgs ),
- uno::UNO_QUERY );
-
- if ( !xNameContainer.is() )
- throw uno::RuntimeException();
+ uno::UNO_QUERY_THROW );
for ( sal_uInt8 nInd = 0; nInd < 10; nInd++ )
{
@@ -542,10 +527,7 @@ void OleEmbeddedObject::RemoveVisualCache_Impl( const uno::Reference< io::XStrea
xNameContainer->removeByName( aStreamName );
}
- uno::Reference< embed::XTransactedObject > xTransacted( xNameContainer, uno::UNO_QUERY );
- if ( !xTransacted.is() )
- throw uno::RuntimeException();
-
+ uno::Reference< embed::XTransactedObject > xTransacted( xNameContainer, uno::UNO_QUERY_THROW );
xTransacted->commit();
}
@@ -1014,10 +996,7 @@ uno::Reference< io::XOutputStream > OleEmbeddedObject::GetStreamForSaving()
if ( !xOutStream.is() )
throw io::IOException(); //TODO: access denied
- uno::Reference< io::XTruncate > xTruncate( xOutStream, uno::UNO_QUERY );
- if ( !xTruncate.is() )
- throw uno::RuntimeException(); //TODO:
-
+ uno::Reference< io::XTruncate > xTruncate( xOutStream, uno::UNO_QUERY_THROW );
xTruncate->truncate();
return xOutStream;
@@ -1046,10 +1025,7 @@ void OleEmbeddedObject::StoreObjectToStream( uno::Reference< io::XOutputStream >
if ( xTempInStream.is() )
{
// write all the contents to XOutStream
- uno::Reference< io::XTruncate > xTrunc( xOutStream, uno::UNO_QUERY );
- if ( !xTrunc.is() )
- throw uno::RuntimeException(); //TODO:
-
+ uno::Reference< io::XTruncate > xTrunc( xOutStream, uno::UNO_QUERY_THROW );
xTrunc->truncate();
::comphelper::OStorageHelper::CopyInputToOutput( xTempInStream, xOutStream );
@@ -1336,9 +1312,7 @@ void SAL_CALL OleEmbeddedObject::setPersistentEntry(
static_cast< ::cppu::OWeakObject* >(this) );
}
- uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY );
- if ( !xNameAccess.is() )
- throw uno::RuntimeException(); //TODO
+ uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY_THROW );
// detect entry existence
bool bElExists = xNameAccess->hasByName( sEntName );
diff --git a/embeddedobj/source/msole/olevisual.cxx b/embeddedobj/source/msole/olevisual.cxx
index 0676d4dba68b..329c4fa17457 100644
--- a/embeddedobj/source/msole/olevisual.cxx
+++ b/embeddedobj/source/msole/olevisual.cxx
@@ -45,9 +45,9 @@ embed::VisualRepresentation OleEmbeddedObject::GetVisualRepresentationInNativeFo
// TODO: detect the format in the future for now use workaround
uno::Reference< io::XInputStream > xInStream = xCachedVisRepr->getInputStream();
- uno::Reference< io::XSeekable > xSeekable( xCachedVisRepr, uno::UNO_QUERY );
- if ( !xInStream.is() || !xSeekable.is() )
+ if ( !xInStream.is() )
throw uno::RuntimeException();
+ uno::Reference< io::XSeekable > xSeekable( xCachedVisRepr, uno::UNO_QUERY_THROW );
uno::Sequence< sal_Int8 > aSeq( 2 );
xInStream->readBytes( aSeq, 2 );
diff --git a/embeddedobj/source/msole/xdialogcreator.cxx b/embeddedobj/source/msole/xdialogcreator.cxx
index 5d5f7b3ebe5b..847e48e6f0b3 100644
--- a/embeddedobj/source/msole/xdialogcreator.cxx
+++ b/embeddedobj/source/msole/xdialogcreator.cxx
@@ -297,11 +297,7 @@ embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceInitF
static_cast< ::cppu::OWeakObject* > ( new OleEmbeddedObject( m_xFactory ) ),
uno::UNO_QUERY );
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
-
- if ( !xPersist.is() )
- throw uno::RuntimeException(); // TODO: the interface must be supported by own document objects
-
+ uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY_THROW );
xPersist->setPersistentEntry( xStorage,
sEntryName,
embed::EntryInitModes::DEFAULT_INIT,
diff --git a/embeddedobj/source/msole/xolefactory.cxx b/embeddedobj/source/msole/xolefactory.cxx
index 9f726d39e243..deb9cfc4d7ee 100644
--- a/embeddedobj/source/msole/xolefactory.cxx
+++ b/embeddedobj/source/msole/xolefactory.cxx
@@ -73,9 +73,7 @@ uno::Reference< uno::XInterface > SAL_CALL OleEmbeddedObjectFactory::createInsta
static_cast< ::cppu::OWeakObject* >(this),
2 );
- uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY );
- if ( !xNameAccess.is() )
- throw uno::RuntimeException(); //TODO
+ uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY_THROW );
// detect entry existence
if ( !xNameAccess->hasByName( sEntName ) )
@@ -91,11 +89,7 @@ uno::Reference< uno::XInterface > SAL_CALL OleEmbeddedObjectFactory::createInsta
static_cast< ::cppu::OWeakObject* > ( new OleEmbeddedObject( m_xFactory, false ) ),
uno::UNO_QUERY );
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
-
- if ( !xPersist.is() )
- throw uno::RuntimeException(); // TODO: the interface must be supported by own document objects
-
+ uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY_THROW );
xPersist->setPersistentEntry( xStorage,
sEntName,
embed::EntryInitModes::DEFAULT_INIT,
@@ -143,11 +137,7 @@ uno::Reference< uno::XInterface > SAL_CALL OleEmbeddedObjectFactory::createInsta
static_cast< ::cppu::OWeakObject* > ( new OleEmbeddedObject( m_xFactory, false ) ),
uno::UNO_QUERY );
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
-
- if ( !xPersist.is() )
- throw uno::RuntimeException(); // TODO: the interface must be supported ( what about applets? )
-
+ uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY_THROW );
xPersist->setPersistentEntry( xStorage,
sEntName,
embed::EntryInitModes::MEDIA_DESCRIPTOR_INIT,
@@ -179,11 +169,7 @@ uno::Reference< uno::XInterface > SAL_CALL OleEmbeddedObjectFactory::createInsta
static_cast< ::cppu::OWeakObject* > ( new OleEmbeddedObject( m_xFactory, aClassID, aClassName ) ),
uno::UNO_QUERY );
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
-
- if ( !xPersist.is() )
- throw uno::RuntimeException(); // TODO: the interface must be supported by own document objects
-
+ uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY_THROW );
xPersist->setPersistentEntry( xStorage,
sEntName,
embed::EntryInitModes::TRUNCATE_INIT,
@@ -214,11 +200,7 @@ uno::Reference< uno::XInterface > SAL_CALL OleEmbeddedObjectFactory::createInsta
static_cast< ::cppu::OWeakObject* > ( new OleEmbeddedObject( m_xFactory, true ) ),
uno::UNO_QUERY );
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
-
- if ( !xPersist.is() )
- throw uno::RuntimeException(); // TODO: the interface must be supported by own document objects
-
+ uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY_THROW );
xPersist->setPersistentEntry( xStorage,
sEntName,
embed::EntryInitModes::MEDIA_DESCRIPTOR_INIT,
@@ -253,18 +235,12 @@ uno::Reference< uno::XInterface > SAL_CALL OleEmbeddedObjectFactory::createInsta
static_cast< ::cppu::OWeakObject* > ( new OleEmbeddedObject( m_xFactory, aClassID, aClassName ) ),
uno::UNO_QUERY );
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
- if ( xPersist.is() )
- {
- xPersist->setPersistentEntry( xStorage,
- sEntName,
- embed::EntryInitModes::DEFAULT_INIT,
- uno::Sequence< beans::PropertyValue >(),
- lObjArgs );
-
- }
- else
- throw uno::RuntimeException(); // TODO:
+ uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY_THROW );
+ xPersist->setPersistentEntry( xStorage,
+ sEntName,
+ embed::EntryInitModes::DEFAULT_INIT,
+ uno::Sequence< beans::PropertyValue >(),
+ lObjArgs );
return xResult;
}