diff options
Diffstat (limited to 'ucb/source/ucp/tdoc/tdoc_provider.cxx')
-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 ); } |