diff options
author | Andreas Bille <abi@openoffice.org> | 2001-07-19 11:52:39 +0000 |
---|---|---|
committer | Andreas Bille <abi@openoffice.org> | 2001-07-19 11:52:39 +0000 |
commit | d00ec94d2f23f7ff25c2f0f2e901c27cea24f32d (patch) | |
tree | 91be26ca3b14f45603ea665c84fa733f64918e16 /xmlhelp | |
parent | 5c5c6d0ef72df69570161097e8ccf807539e9f7b (diff) |
#89939#
Problem: The help content provider has not thrown an UnsupportedDataSinkException
in case of an XActiveDataStreamer, which is used by sfx to decide to retry opening
with XActiveDataSink.
Diffstat (limited to 'xmlhelp')
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/content.cxx | 187 |
1 files changed, 102 insertions, 85 deletions
diff --git a/xmlhelp/source/cxxhelp/provider/content.cxx b/xmlhelp/source/cxxhelp/provider/content.cxx index 2ed69ac9373f..13e929b72b92 100644 --- a/xmlhelp/source/cxxhelp/provider/content.cxx +++ b/xmlhelp/source/cxxhelp/provider/content.cxx @@ -2,9 +2,9 @@ * * $RCSfile: content.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: abi $ $Date: 2001-07-02 08:08:24 $ + * last change: $Author: abi $ $Date: 2001-07-19 12:52:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,6 +86,15 @@ #ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HPP_ #include <com/sun/star/io/XActiveDataSink.hpp> #endif +#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_ +#include <com/sun/star/io/XOutputStream.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_UNSUPPORTEDDATASINKEXCEPTION_HPP_ +#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XACTIVEDATASTREAMER_HPP_ +#include <com/sun/star/io/XActiveDataStreamer.hpp> +#endif #ifndef _COM_SUN_STAR_UCB_XPERSISTENTPROPERTYSET_HPP_ #include <com/sun/star/ucb/XPersistentPropertySet.hpp> #endif @@ -375,112 +384,120 @@ public: // virtual Any SAL_CALL Content::execute( const Command& aCommand, - sal_Int32 CommandId, - const Reference< - XCommandEnvironment >& Environment ) - throw( Exception, CommandAbortedException, RuntimeException ) + sal_Int32 CommandId, + const Reference< + XCommandEnvironment >& Environment ) + throw( Exception, CommandAbortedException, RuntimeException ) { - Any aRet; + Any aRet; - if ( aCommand.Name.compareToAscii( "getPropertyValues" ) == 0 ) + if ( aCommand.Name.compareToAscii( "getPropertyValues" ) == 0 ) { - Sequence< Property > Properties; - if ( !( aCommand.Argument >>= Properties ) ) - { - VOS_ENSURE( sal_False, "Wrong argument type!" ); - return aRet; - } + Sequence< Property > Properties; + if ( !( aCommand.Argument >>= Properties ) ) + { + VOS_ENSURE( sal_False, "Wrong argument type!" ); + return aRet; + } - aRet <<= getPropertyValues( Properties ); + aRet <<= getPropertyValues( Properties ); } - else if ( aCommand.Name.compareToAscii( "setPropertyValues" ) == 0 ) + else if ( aCommand.Name.compareToAscii( "setPropertyValues" ) == 0 ) { - // No properties can be set + // No properties can be set } - else if ( aCommand.Name.compareToAscii( "getPropertySetInfo" ) == 0 ) + else if ( aCommand.Name.compareToAscii( "getPropertySetInfo" ) == 0 ) { - // Note: Implemented by base class. - aRet <<= getPropertySetInfo( Environment ); + // Note: Implemented by base class. + aRet <<= getPropertySetInfo( Environment ); } - else if ( aCommand.Name.compareToAscii( "getCommandInfo" ) == 0 ) + else if ( aCommand.Name.compareToAscii( "getCommandInfo" ) == 0 ) { - // Note: Implemented by base class. - aRet <<= getCommandInfo( Environment ); + // Note: Implemented by base class. + aRet <<= getCommandInfo( Environment ); } - else if ( aCommand.Name.compareToAscii( "open" ) == 0 ) + else if ( aCommand.Name.compareToAscii( "open" ) == 0 ) { - OpenCommandArgument2 aOpenCommand; - if ( !( aCommand.Argument >>= aOpenCommand ) ) - { - VOS_ENSURE( sal_False, - "Content::execute - invalid parameter!" ); - throw CommandAbortedException(); - } + OpenCommandArgument2 aOpenCommand; + if ( !( aCommand.Argument >>= aOpenCommand ) ) + { + VOS_ENSURE( sal_False, + "Content::execute - invalid parameter!" ); + throw CommandAbortedException(); + } + Reference< XActiveDataSink > xActiveDataSink( aOpenCommand.Sink,UNO_QUERY ); + if( xActiveDataSink.is() ) + { + Reference< XInputStream > xInputStream; + + // Necessary to avoid closing the fileinputstream + if( ! m_aURLParameter.isRoot() ) + xInputStream = m_pDatabases->getFromURL( m_aURLParameter.get_url() ); - Reference< XActiveDataSink > xActiveDataSink( aOpenCommand.Sink,UNO_QUERY ); - if( xActiveDataSink.is() ) + if( ! xInputStream.is() ) { - Reference< XInputStream > xInputStream; + m_aURLParameter.open( m_xSMgr,aCommand,CommandId,Environment,xActiveDataSink ); + m_pDatabases->setFromURL( m_aURLParameter.get_url(), + xActiveDataSink->getInputStream() ); + } + else + xActiveDataSink->setInputStream( xInputStream ); + } - // Necessary to avoid closing the fileinputstream - if( ! m_aURLParameter.isRoot() ) - xInputStream = m_pDatabases->getFromURL( m_aURLParameter.get_url() ); + Reference< XActiveDataStreamer > activeDataStreamer( aOpenCommand.Sink,UNO_QUERY ); + if( activeDataStreamer.is() ) + throw UnsupportedDataSinkException(); - if( ! xInputStream.is() ) - { - m_aURLParameter.open( m_xSMgr,aCommand,CommandId,Environment,xActiveDataSink ); - m_pDatabases->setFromURL( m_aURLParameter.get_url(), - xActiveDataSink->getInputStream() ); - } - else - xActiveDataSink->setInputStream( xInputStream ); - } + Reference< XOutputStream > outputStream( aOpenCommand.Sink,UNO_QUERY ); + if( outputStream.is() ) + throw UnsupportedDataSinkException(); - if( m_aURLParameter.isRoot() ) - { - Reference< XDynamicResultSet > xSet - = new DynamicResultSet( m_xSMgr, - this, - aOpenCommand, - Environment, - new ResultSetForRootFactory( m_xSMgr, - m_xProvider.getBodyPtr(), - aOpenCommand.Mode, - aOpenCommand.Properties, - aOpenCommand.SortingInfo, - m_aURLParameter, - m_pDatabases ) ); - aRet <<= xSet; - } - else if( m_aURLParameter.isQuery() ) - { - Reference< XDynamicResultSet > xSet - = new DynamicResultSet( m_xSMgr, - this, - aOpenCommand, - Environment, - new ResultSetForQueryFactory( m_xSMgr, - m_xProvider.getBodyPtr(), - aOpenCommand.Mode, - aOpenCommand.Properties, - aOpenCommand.SortingInfo, - m_aURLParameter, - m_pDatabases ) ); - aRet <<= xSet; - } + + if( m_aURLParameter.isRoot() ) + { + Reference< XDynamicResultSet > xSet + = new DynamicResultSet( m_xSMgr, + this, + aOpenCommand, + Environment, + new ResultSetForRootFactory( m_xSMgr, + m_xProvider.getBodyPtr(), + aOpenCommand.Mode, + aOpenCommand.Properties, + aOpenCommand.SortingInfo, + m_aURLParameter, + m_pDatabases ) ); + aRet <<= xSet; + } + else if( m_aURLParameter.isQuery() ) + { + Reference< XDynamicResultSet > xSet + = new DynamicResultSet( m_xSMgr, + this, + aOpenCommand, + Environment, + new ResultSetForQueryFactory( m_xSMgr, + m_xProvider.getBodyPtr(), + aOpenCommand.Mode, + aOpenCommand.Properties, + aOpenCommand.SortingInfo, + m_aURLParameter, + m_pDatabases ) ); + aRet <<= xSet; + } } - else + else { - ////////////////////////////////////////////////////////////////// - // Unsupported command - ////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////// + // Unsupported command + ////////////////////////////////////////////////////////////////// - VOS_ENSURE( sal_False, "Content::execute - unsupported command!" ); - throw CommandAbortedException(); + VOS_ENSURE( sal_False, "Content::execute - unsupported command!" ); + throw CommandAbortedException(); } - return aRet; + return aRet; } |