Kaydet (Commit) f3b44f63 authored tarafından Andreas Bille's avatar Andreas Bille

#98767# now using ucbhelper::cancelCommandExcecution;…

#98767# now using ucbhelper::cancelCommandExcecution; UnsupportedCommandException instead of CommandAborted
üst 5622d56f
......@@ -2,9 +2,9 @@
*
* $RCSfile: content.cxx,v $
*
* $Revision: 1.14 $
* $Revision: 1.15 $
*
* last change: $Author: vg $ $Date: 2001-10-02 11:48:26 $
* last change: $Author: abi $ $Date: 2002-10-30 09:59:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -89,6 +89,9 @@
#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_
#include <com/sun/star/io/XOutputStream.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_ILLEGALACCESSEXCEPTION_HPP_
#include <com/sun/star/lang/IllegalAccessException.hpp>
#endif
#ifndef _COM_SUN_STAR_UCB_UNSUPPORTEDDATASINKEXCEPTION_HPP_
#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp>
#endif
......@@ -107,7 +110,9 @@
#ifndef _UCBHELPER_PROPERTYVALUESET_HXX
#include <ucbhelper/propertyvalueset.hxx>
#endif
#ifndef _UCBHELPER_CANCELCOMMANDEXECUTION_HXX
#include <ucbhelper/cancelcommandexecution.hxx>
#endif
#ifndef _CONTENT_HXX
#include <provider/content.hxx>
#endif
......@@ -396,15 +401,34 @@ Any SAL_CALL Content::execute( const Command& aCommand,
Sequence< Property > Properties;
if ( !( aCommand.Argument >>= Properties ) )
{
VOS_ENSURE( sal_False, "Wrong argument type!" );
return aRet;
aRet <<= IllegalArgumentException();
ucbhelper::cancelCommandExecution(aRet,Environment);
}
aRet <<= getPropertyValues( Properties );
}
else if ( aCommand.Name.compareToAscii( "setPropertyValues" ) == 0 )
{
Sequence<PropertyValue> propertyValues;
if( ! ( aCommand.Argument >>= propertyValues ) ) {
aRet <<= IllegalArgumentException();
ucbhelper::cancelCommandExecution(aRet,Environment);
}
Sequence<Any> ret(propertyValues.getLength());
Sequence< Property > props(getProperties(Environment));
// No properties can be set
for(sal_Int32 i = 0; i < ret.getLength(); ++i) {
ret[i] <<= UnknownPropertyException();
for(sal_Int32 j = 0; j < props.getLength(); ++j)
if(props[j].Name == propertyValues[i].Name) {
ret[i] <<= IllegalAccessException();
break;
}
}
aRet <<= ret;
}
else if ( aCommand.Name.compareToAscii( "getPropertySetInfo" ) == 0 )
{
......@@ -421,47 +445,66 @@ Any SAL_CALL Content::execute( const Command& aCommand,
OpenCommandArgument2 aOpenCommand;
if ( !( aCommand.Argument >>= aOpenCommand ) )
{
VOS_ENSURE( sal_False,
"Content::execute - invalid parameter!" );
throw IllegalArgumentException();
aRet <<= IllegalArgumentException();
ucbhelper::cancelCommandExecution(aRet,Environment);
}
Reference< XActiveDataSink > xActiveDataSink( aOpenCommand.Sink,UNO_QUERY );
if( xActiveDataSink.is() )
m_aURLParameter.open( m_xSMgr,aCommand,CommandId,Environment,xActiveDataSink );
Reference< XActiveDataSink > xActiveDataSink(
aOpenCommand.Sink,UNO_QUERY);
if(xActiveDataSink.is())
m_aURLParameter.open(m_xSMgr,
aCommand,
CommandId,
Environment,
xActiveDataSink);
Reference< XActiveDataStreamer > activeDataStreamer( aOpenCommand.Sink,UNO_QUERY );
if( activeDataStreamer.is() )
throw UnsupportedDataSinkException();
Reference< XActiveDataStreamer > xActiveDataStreamer(
aOpenCommand.Sink,UNO_QUERY);
if(xActiveDataStreamer.is()) {
aRet <<= UnsupportedDataSinkException();
ucbhelper::cancelCommandExecution(aRet,Environment);
}
Reference< XOutputStream > xOutputStream( aOpenCommand.Sink,UNO_QUERY );
if( xOutputStream.is() )
m_aURLParameter.open( m_xSMgr,aCommand,CommandId,Environment,xOutputStream );
Reference< XOutputStream > xOutputStream(
aOpenCommand.Sink,UNO_QUERY);
if(xOutputStream.is() )
m_aURLParameter.open(m_xSMgr,
aCommand,
CommandId,
Environment,
xOutputStream);
if( m_aURLParameter.isRoot() )
{
Reference< XDynamicResultSet > xSet
= new DynamicResultSet( m_xSMgr,
= new DynamicResultSet(
m_xSMgr,
this,
aOpenCommand,
Environment,
new ResultSetForRootFactory( m_xSMgr,
new ResultSetForRootFactory(
m_xSMgr,
m_xProvider.getBodyPtr(),
aOpenCommand.Mode,
aOpenCommand.Properties,
aOpenCommand.SortingInfo,
m_aURLParameter,
m_pDatabases ) );
m_pDatabases));
aRet <<= xSet;
}
else if( m_aURLParameter.isQuery() )
{
Reference< XDynamicResultSet > xSet
= new DynamicResultSet( m_xSMgr,
= new DynamicResultSet(
m_xSMgr,
this,
aOpenCommand,
Environment,
new ResultSetForQueryFactory( m_xSMgr,
new ResultSetForQueryFactory(
m_xSMgr,
m_xProvider.getBodyPtr(),
aOpenCommand.Mode,
aOpenCommand.Properties,
......@@ -476,9 +519,8 @@ Any SAL_CALL Content::execute( const Command& aCommand,
//////////////////////////////////////////////////////////////////
// Unsupported command
//////////////////////////////////////////////////////////////////
// VOS_ENSURE( sal_False, "Content::execute - unsupported command!" );
throw CommandAbortedException();
aRet <<= UnsupportedCommandException();
ucbhelper::cancelCommandExecution(aRet,Environment);
}
return aRet;
......@@ -492,39 +534,55 @@ Reference< XRow > Content::getPropertyValues( const Sequence< Property >& rPrope
{
osl::MutexGuard aGuard( m_aMutex );
vos::ORef< ::ucb::PropertyValueSet > xRow = new ::ucb::PropertyValueSet( m_xSMgr );
vos::ORef< ::ucb::PropertyValueSet > xRow =
new ::ucb::PropertyValueSet( m_xSMgr );
for ( sal_Int32 n = 0; n < rProperties.getLength(); ++n )
{
const Property& rProp = rProperties[n];
if ( rProp.Name.compareToAscii( "ContentType" ) == 0 )
xRow->appendString( rProp,rtl::OUString::createFromAscii( "application/vnd.sun.star.help" ) );
xRow->appendString(
rProp,
rtl::OUString::createFromAscii(
"application/vnd.sun.star.help" ) );
else if( rProp.Name.compareToAscii( "Title" ) == 0 )
xRow->appendString ( rProp,m_aURLParameter.get_title() );
else if( rProp.Name.compareToAscii( "IsReadOnly" ) == 0 )
xRow->appendBoolean( rProp,true );
else if( rProp.Name.compareToAscii( "IsDocument" ) == 0 )
xRow->appendBoolean( rProp,m_aURLParameter.isFile() || m_aURLParameter.isRoot() );
xRow->appendBoolean(
rProp,
m_aURLParameter.isFile() || m_aURLParameter.isRoot() );
else if( rProp.Name.compareToAscii( "IsFolder" ) == 0 )
xRow->appendBoolean( rProp, ! m_aURLParameter.isFile() || m_aURLParameter.isRoot() );
xRow->appendBoolean(
rProp,
! m_aURLParameter.isFile() || m_aURLParameter.isRoot() );
else if( rProp.Name.compareToAscii( "IsErrorDocument" ) == 0 )
xRow->appendBoolean( rProp, m_aURLParameter.isErrorDocument() );
else if( rProp.Name.compareToAscii( "MediaType" ) == 0 )
if( m_aURLParameter.isPicture() )
xRow->appendString( rProp,rtl::OUString::createFromAscii( "image/gif" ) );
xRow->appendString(
rProp,
rtl::OUString::createFromAscii( "image/gif" ) );
else if( m_aURLParameter.isActive() )
xRow->appendString( rProp,rtl::OUString::createFromAscii( "text/plain" ) );
xRow->appendString(
rProp,
rtl::OUString::createFromAscii( "text/plain" ) );
else if( m_aURLParameter.isFile() )
xRow->appendString( rProp,rtl::OUString::createFromAscii( "text/html" ) );
xRow->appendString(
rProp,rtl::OUString::createFromAscii( "text/html" ) );
else if( m_aURLParameter.isRoot() )
xRow->appendString( rProp,rtl::OUString::createFromAscii( "text/css" ) );
xRow->appendString(
rProp,
rtl::OUString::createFromAscii( "text/css" ) );
else
xRow->appendVoid( rProp );
else if( m_aURLParameter.isModule() )
if( rProp.Name.compareToAscii( "KeywordList" ) == 0 )
{
KeywordInfo *inf = m_pDatabases->getKeyword( m_aURLParameter.get_module(),
KeywordInfo *inf =
m_pDatabases->getKeyword( m_aURLParameter.get_module(),
m_aURLParameter.get_language() );
Any aAny;
......@@ -534,7 +592,8 @@ Reference< XRow > Content::getPropertyValues( const Sequence< Property >& rPrope
}
else if( rProp.Name.compareToAscii( "KeywordRef" ) == 0 )
{
KeywordInfo *inf = m_pDatabases->getKeyword( m_aURLParameter.get_module(),
KeywordInfo *inf =
m_pDatabases->getKeyword( m_aURLParameter.get_module(),
m_aURLParameter.get_language() );
Any aAny;
......@@ -544,7 +603,8 @@ Reference< XRow > Content::getPropertyValues( const Sequence< Property >& rPrope
}
else if( rProp.Name.compareToAscii( "KeywordAnchorForRef" ) == 0 )
{
KeywordInfo *inf = m_pDatabases->getKeyword( m_aURLParameter.get_module(),
KeywordInfo *inf =
m_pDatabases->getKeyword( m_aURLParameter.get_module(),
m_aURLParameter.get_language() );
Any aAny;
......@@ -554,7 +614,8 @@ Reference< XRow > Content::getPropertyValues( const Sequence< Property >& rPrope
}
else if( rProp.Name.compareToAscii( "KeywordTitleForRef" ) == 0 )
{
KeywordInfo *inf = m_pDatabases->getKeyword( m_aURLParameter.get_module(),
KeywordInfo *inf =
m_pDatabases->getKeyword( m_aURLParameter.get_module(),
m_aURLParameter.get_language() );
Any aAny;
......@@ -573,7 +634,8 @@ Reference< XRow > Content::getPropertyValues( const Sequence< Property >& rPrope
}
else if( rProp.Name.compareToAscii( "Order" ) == 0 )
{
StaticModuleInformation *inf = m_pDatabases->getStaticInformationForModule(
StaticModuleInformation *inf =
m_pDatabases->getStaticInformationForModule(
m_aURLParameter.get_module(),
m_aURLParameter.get_language() );
......@@ -584,7 +646,8 @@ Reference< XRow > Content::getPropertyValues( const Sequence< Property >& rPrope
}
else
xRow->appendVoid( rProp );
else if( rProp.Name.compareToAscii( "AnchorName" ) == 0 && m_aURLParameter.isFile() )
else if( rProp.Name.compareToAscii( "AnchorName" ) == 0 &&
m_aURLParameter.isFile() )
xRow->appendString( rProp,m_aURLParameter.get_tag() );
else
xRow->appendVoid( rProp );
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: provider.cxx,v $
*
* $Revision: 1.13 $
* $Revision: 1.14 $
*
* last change: $Author: kso $ $Date: 2002-08-02 15:19:00 $
* last change: $Author: abi $ $Date: 2002-10-30 09:59:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -295,7 +295,7 @@ void ContentProvider::init()
aAny >>= m_xContainer;
if(m_xContainer.is())
m_xContainer->addContainerListener(this);
} catch(const com::sun::star::uno::Exception& e) {
} catch(const com::sun::star::uno::Exception&) {
}
/**
......@@ -367,10 +367,12 @@ Reference< XMultiServiceFactory > ContentProvider::getConfiguration() const
try
{
rtl::OUString sProviderService =
rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" );
rtl::OUString::createFromAscii(
"com.sun.star.configuration.ConfigurationProvider" );
sProvider =
Reference< XMultiServiceFactory >(
m_xSMgr->createInstanceWithArguments( sProviderService,seq ),
m_xSMgr->createInstanceWithArguments(
sProviderService,seq ),
UNO_QUERY );
}
catch( const com::sun::star::uno::Exception& )
......@@ -416,8 +418,9 @@ ContentProvider::getHierAccess( const Reference< XMultiServiceFactory >& sProvid
rtl::OUString
ContentProvider::getKey( const Reference< XHierarchicalNameAccess >& xHierAccess,
const char* key ) const
ContentProvider::getKey(const Reference<
XHierarchicalNameAccess >& xHierAccess,
const char* key) const
{
rtl::OUString instPath;
if( xHierAccess.is() )
......@@ -426,7 +429,8 @@ ContentProvider::getKey( const Reference< XHierarchicalNameAccess >& xHierAccess
try
{
aAny =
xHierAccess->getByHierarchicalName( rtl::OUString::createFromAscii( key ) );
xHierAccess->getByHierarchicalName(
rtl::OUString::createFromAscii(key));
}
catch( const com::sun::star::container::NoSuchElementException& )
{
......@@ -450,7 +454,7 @@ void ContentProvider::subst( rtl::OUString& instpath ) const
m_xSMgr->createInstance( rtl::OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" ) ),
UNO_QUERY );
}
catch( const com::sun::star::uno::Exception& e )
catch( const com::sun::star::uno::Exception&)
{
OSL_ENSURE( xCfgMgr.is()," cant instantiate the special config manager " );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment