diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-26 12:01:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-27 09:05:39 +0200 |
commit | 467724410dc470ec259131f97abd836fe9b021a1 (patch) | |
tree | c4af76c0132cc6a4638eace0ccebe5ae1bd9e305 /ucb/source/ucp/tdoc | |
parent | e827d227c92c338fb75f076b6d3f3a7b52b9f767 (diff) |
loplugin:flatten in toolkit..vbahelper
Change-Id: I6d4be3e1cc29b2b91d5c39b757ff3b903c47112d
Reviewed-on: https://gerrit.libreoffice.org/42794
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucb/source/ucp/tdoc')
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_provider.cxx | 78 |
1 files changed, 37 insertions, 41 deletions
diff --git a/ucb/source/ucp/tdoc/tdoc_provider.cxx b/ucb/source/ucp/tdoc/tdoc_provider.cxx index dbcd58851012..4d972b4a6425 100644 --- a/ucb/source/ucp/tdoc/tdoc_provider.cxx +++ b/ucb/source/ucp/tdoc/tdoc_provider.cxx @@ -170,54 +170,50 @@ ContentProvider::createDocumentContent( const uno::Reference< frame::XModel >& Model ) { // model -> id -> content identifier -> queryContent - if ( m_xDocsMgr.is() ) + if ( !m_xDocsMgr.is() ) + { + throw lang::IllegalArgumentException( + "No Document Manager!", + static_cast< cppu::OWeakObject * >( this ), + 1 ); + } + + OUString aDocId = tdoc_ucp::OfficeDocumentsManager::queryDocumentId( Model ); + if ( aDocId.isEmpty() ) { - OUString aDocId = tdoc_ucp::OfficeDocumentsManager::queryDocumentId( Model ); - if ( !aDocId.isEmpty() ) - { - OUStringBuffer aBuffer; - aBuffer.append( TDOC_URL_SCHEME ":/" ); - aBuffer.append( aDocId ); + throw lang::IllegalArgumentException( + "Unable to obtain document id from model!", + static_cast< cppu::OWeakObject * >( this ), + 1 ); + } - uno::Reference< ucb::XContentIdentifier > xId - = new ::ucbhelper::ContentIdentifier( aBuffer.makeStringAndClear() ); + OUStringBuffer aBuffer; + aBuffer.append( TDOC_URL_SCHEME ":/" ); + aBuffer.append( aDocId ); - osl::MutexGuard aGuard( m_aMutex ); + uno::Reference< ucb::XContentIdentifier > xId + = new ::ucbhelper::ContentIdentifier( aBuffer.makeStringAndClear() ); - // Check, if a content with given id already exists... - uno::Reference< ucb::XContent > xContent - = queryExistingContent( xId ).get(); + osl::MutexGuard aGuard( m_aMutex ); - if ( !xContent.is() ) - { - // Create a new content. - xContent = Content::create( m_xContext, this, xId ); - } + // Check, if a content with given id already exists... + uno::Reference< ucb::XContent > xContent + = queryExistingContent( xId ).get(); - if ( xContent.is() ) - return xContent; + if ( !xContent.is() ) + { + // Create a new content. + xContent = Content::create( m_xContext, this, xId ); + } - // no content. - throw lang::IllegalArgumentException( - "Illegal Content Identifier!", - static_cast< cppu::OWeakObject * >( this ), - 1 ); - } - else - { - throw lang::IllegalArgumentException( - "Unable to obtain document id from model!", - static_cast< cppu::OWeakObject * >( this ), - 1 ); - } - } - else - { - throw lang::IllegalArgumentException( - "No Document Manager!", - static_cast< cppu::OWeakObject * >( this ), - 1 ); - } + if ( xContent.is() ) + return xContent; + + // no content. + throw lang::IllegalArgumentException( + "Illegal Content Identifier!", + static_cast< cppu::OWeakObject * >( this ), + 1 ); } |