1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_xmlhelp.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir /************************************************************************** 32*cdf0e10cSrcweir TODO 33*cdf0e10cSrcweir ************************************************************************** 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir *************************************************************************/ 36*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyAccess.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/sdbc/XRow.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/ucb/OpenCommandArgument2.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/ucb/OpenMode.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/ucb/XCommandInfo.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/io/XActiveDataSink.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/io/XOutputStream.hpp> 44*cdf0e10cSrcweir #include <com/sun/star/lang/IllegalAccessException.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/ucb/UnsupportedDataSinkException.hpp> 46*cdf0e10cSrcweir #include <com/sun/star/io/XActiveDataStreamer.hpp> 47*cdf0e10cSrcweir #include <com/sun/star/ucb/XPersistentPropertySet.hpp> 48*cdf0e10cSrcweir #ifndef _VOS_DIAGNOSE_HXX_ 49*cdf0e10cSrcweir #include <vos/diagnose.hxx> 50*cdf0e10cSrcweir #endif 51*cdf0e10cSrcweir #include <ucbhelper/contentidentifier.hxx> 52*cdf0e10cSrcweir #include <ucbhelper/propertyvalueset.hxx> 53*cdf0e10cSrcweir #ifndef _UCBHELPER_CANCELCOMMANDEXECUTION_HXX 54*cdf0e10cSrcweir #include <ucbhelper/cancelcommandexecution.hxx> 55*cdf0e10cSrcweir #endif 56*cdf0e10cSrcweir #include "content.hxx" 57*cdf0e10cSrcweir #include "provider.hxx" 58*cdf0e10cSrcweir #include "resultset.hxx" 59*cdf0e10cSrcweir #include "databases.hxx" 60*cdf0e10cSrcweir #include "resultsetfactory.hxx" 61*cdf0e10cSrcweir #include "resultsetbase.hxx" 62*cdf0e10cSrcweir #include "resultsetforroot.hxx" 63*cdf0e10cSrcweir #include "resultsetforquery.hxx" 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir using namespace com::sun::star; 66*cdf0e10cSrcweir using namespace chelp; 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir //========================================================================= 69*cdf0e10cSrcweir //========================================================================= 70*cdf0e10cSrcweir // 71*cdf0e10cSrcweir // Content Implementation. 72*cdf0e10cSrcweir // 73*cdf0e10cSrcweir //========================================================================= 74*cdf0e10cSrcweir //========================================================================= 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir Content::Content( const uno::Reference< lang::XMultiServiceFactory >& rxSMgr, 77*cdf0e10cSrcweir ::ucbhelper::ContentProviderImplHelper* pProvider, 78*cdf0e10cSrcweir const uno::Reference< ucb::XContentIdentifier >& 79*cdf0e10cSrcweir Identifier, 80*cdf0e10cSrcweir Databases* pDatabases ) 81*cdf0e10cSrcweir : ContentImplHelper( rxSMgr, pProvider, Identifier ), 82*cdf0e10cSrcweir m_aURLParameter( Identifier->getContentIdentifier(),pDatabases ), 83*cdf0e10cSrcweir m_pDatabases( pDatabases ) // not owner 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir } 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir //========================================================================= 88*cdf0e10cSrcweir // virtual 89*cdf0e10cSrcweir Content::~Content() 90*cdf0e10cSrcweir { 91*cdf0e10cSrcweir } 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir //========================================================================= 94*cdf0e10cSrcweir // 95*cdf0e10cSrcweir // XInterface methods. 96*cdf0e10cSrcweir // 97*cdf0e10cSrcweir //========================================================================= 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir // virtual 100*cdf0e10cSrcweir void SAL_CALL Content::acquire() 101*cdf0e10cSrcweir throw( ) 102*cdf0e10cSrcweir { 103*cdf0e10cSrcweir ContentImplHelper::acquire(); 104*cdf0e10cSrcweir } 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir //========================================================================= 107*cdf0e10cSrcweir // virtual 108*cdf0e10cSrcweir void SAL_CALL Content::release() 109*cdf0e10cSrcweir throw( ) 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir ContentImplHelper::release(); 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir //========================================================================= 115*cdf0e10cSrcweir // virtual 116*cdf0e10cSrcweir uno::Any SAL_CALL Content::queryInterface( const uno::Type & rType ) 117*cdf0e10cSrcweir throw ( uno::RuntimeException ) 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir uno::Any aRet; 120*cdf0e10cSrcweir return aRet.hasValue() ? aRet : ContentImplHelper::queryInterface( rType ); 121*cdf0e10cSrcweir } 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir //========================================================================= 124*cdf0e10cSrcweir // 125*cdf0e10cSrcweir // XTypeProvider methods. 126*cdf0e10cSrcweir // 127*cdf0e10cSrcweir //========================================================================= 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir XTYPEPROVIDER_COMMON_IMPL( Content ); 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir //========================================================================= 132*cdf0e10cSrcweir // virtual 133*cdf0e10cSrcweir uno::Sequence< uno::Type > SAL_CALL Content::getTypes() 134*cdf0e10cSrcweir throw( uno::RuntimeException ) 135*cdf0e10cSrcweir { 136*cdf0e10cSrcweir static cppu::OTypeCollection* pCollection = NULL; 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir if ( !pCollection ) 139*cdf0e10cSrcweir { 140*cdf0e10cSrcweir osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ); 141*cdf0e10cSrcweir if ( !pCollection ) 142*cdf0e10cSrcweir { 143*cdf0e10cSrcweir static cppu::OTypeCollection aCollection( 144*cdf0e10cSrcweir CPPU_TYPE_REF( lang::XTypeProvider ), 145*cdf0e10cSrcweir CPPU_TYPE_REF( lang::XServiceInfo ), 146*cdf0e10cSrcweir CPPU_TYPE_REF( lang::XComponent ), 147*cdf0e10cSrcweir CPPU_TYPE_REF( ucb::XContent ), 148*cdf0e10cSrcweir CPPU_TYPE_REF( ucb::XCommandProcessor ), 149*cdf0e10cSrcweir CPPU_TYPE_REF( beans::XPropertiesChangeNotifier ), 150*cdf0e10cSrcweir CPPU_TYPE_REF( ucb::XCommandInfoChangeNotifier ), 151*cdf0e10cSrcweir CPPU_TYPE_REF( beans::XPropertyContainer ), 152*cdf0e10cSrcweir CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ), 153*cdf0e10cSrcweir CPPU_TYPE_REF( container::XChild ) ); 154*cdf0e10cSrcweir pCollection = &aCollection; 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir } 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir return (*pCollection).getTypes(); 159*cdf0e10cSrcweir } 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir //========================================================================= 162*cdf0e10cSrcweir // 163*cdf0e10cSrcweir // XServiceInfo methods. 164*cdf0e10cSrcweir // 165*cdf0e10cSrcweir //========================================================================= 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir // virtual 168*cdf0e10cSrcweir rtl::OUString SAL_CALL Content::getImplementationName() 169*cdf0e10cSrcweir throw( uno::RuntimeException ) 170*cdf0e10cSrcweir { 171*cdf0e10cSrcweir return rtl::OUString::createFromAscii( "CHelpContent" ); 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir //========================================================================= 175*cdf0e10cSrcweir // virtual 176*cdf0e10cSrcweir uno::Sequence< rtl::OUString > SAL_CALL Content::getSupportedServiceNames() 177*cdf0e10cSrcweir throw( uno::RuntimeException ) 178*cdf0e10cSrcweir { 179*cdf0e10cSrcweir uno::Sequence< rtl::OUString > aSNS( 1 ); 180*cdf0e10cSrcweir aSNS.getArray()[ 0 ] 181*cdf0e10cSrcweir = rtl::OUString::createFromAscii( MYUCP_CONTENT_SERVICE_NAME ); 182*cdf0e10cSrcweir return aSNS; 183*cdf0e10cSrcweir } 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir //========================================================================= 186*cdf0e10cSrcweir // 187*cdf0e10cSrcweir // XContent methods. 188*cdf0e10cSrcweir // 189*cdf0e10cSrcweir //========================================================================= 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir // virtual 192*cdf0e10cSrcweir rtl::OUString SAL_CALL Content::getContentType() 193*cdf0e10cSrcweir throw( uno::RuntimeException ) 194*cdf0e10cSrcweir { 195*cdf0e10cSrcweir return rtl::OUString::createFromAscii( MYUCP_CONTENT_TYPE ); 196*cdf0e10cSrcweir } 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir //========================================================================= 199*cdf0e10cSrcweir // 200*cdf0e10cSrcweir // XCommandProcessor methods. 201*cdf0e10cSrcweir // 202*cdf0e10cSrcweir //========================================================================= 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir //virtual 205*cdf0e10cSrcweir void SAL_CALL Content::abort( sal_Int32 /*CommandId*/ ) 206*cdf0e10cSrcweir throw( uno::RuntimeException ) 207*cdf0e10cSrcweir { 208*cdf0e10cSrcweir } 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir class ResultSetForRootFactory 213*cdf0e10cSrcweir : public ResultSetFactory 214*cdf0e10cSrcweir { 215*cdf0e10cSrcweir private: 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > m_xSMgr; 218*cdf0e10cSrcweir uno::Reference< ucb::XContentProvider > m_xProvider; 219*cdf0e10cSrcweir sal_Int32 m_nOpenMode; 220*cdf0e10cSrcweir uno::Sequence< beans::Property > m_seq; 221*cdf0e10cSrcweir uno::Sequence< ucb::NumberedSortingInfo > m_seqSort; 222*cdf0e10cSrcweir URLParameter m_aURLParameter; 223*cdf0e10cSrcweir Databases* m_pDatabases; 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir public: 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir ResultSetForRootFactory( 229*cdf0e10cSrcweir const uno::Reference< lang::XMultiServiceFactory >& xSMgr, 230*cdf0e10cSrcweir const uno::Reference< ucb::XContentProvider >& xProvider, 231*cdf0e10cSrcweir sal_Int32 nOpenMode, 232*cdf0e10cSrcweir const uno::Sequence< beans::Property >& seq, 233*cdf0e10cSrcweir const uno::Sequence< ucb::NumberedSortingInfo >& seqSort, 234*cdf0e10cSrcweir URLParameter aURLParameter, 235*cdf0e10cSrcweir Databases* pDatabases ) 236*cdf0e10cSrcweir : m_xSMgr( xSMgr ), 237*cdf0e10cSrcweir m_xProvider( xProvider ), 238*cdf0e10cSrcweir m_nOpenMode( nOpenMode ), 239*cdf0e10cSrcweir m_seq( seq ), 240*cdf0e10cSrcweir m_seqSort( seqSort ), 241*cdf0e10cSrcweir m_aURLParameter( aURLParameter ), 242*cdf0e10cSrcweir m_pDatabases( pDatabases ) 243*cdf0e10cSrcweir { 244*cdf0e10cSrcweir } 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir ResultSetBase* createResultSet() 247*cdf0e10cSrcweir { 248*cdf0e10cSrcweir return new ResultSetForRoot( m_xSMgr, 249*cdf0e10cSrcweir m_xProvider, 250*cdf0e10cSrcweir m_nOpenMode, 251*cdf0e10cSrcweir m_seq, 252*cdf0e10cSrcweir m_seqSort, 253*cdf0e10cSrcweir m_aURLParameter, 254*cdf0e10cSrcweir m_pDatabases ); 255*cdf0e10cSrcweir } 256*cdf0e10cSrcweir }; 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir class ResultSetForQueryFactory 261*cdf0e10cSrcweir : public ResultSetFactory 262*cdf0e10cSrcweir { 263*cdf0e10cSrcweir private: 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > m_xSMgr; 266*cdf0e10cSrcweir uno::Reference< ucb::XContentProvider > m_xProvider; 267*cdf0e10cSrcweir sal_Int32 m_nOpenMode; 268*cdf0e10cSrcweir uno::Sequence< beans::Property > m_seq; 269*cdf0e10cSrcweir uno::Sequence< ucb::NumberedSortingInfo > m_seqSort; 270*cdf0e10cSrcweir URLParameter m_aURLParameter; 271*cdf0e10cSrcweir Databases* m_pDatabases; 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir public: 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir ResultSetForQueryFactory( 277*cdf0e10cSrcweir const uno::Reference< lang::XMultiServiceFactory >& xSMgr, 278*cdf0e10cSrcweir const uno::Reference< ucb::XContentProvider >& xProvider, 279*cdf0e10cSrcweir sal_Int32 nOpenMode, 280*cdf0e10cSrcweir const uno::Sequence< beans::Property >& seq, 281*cdf0e10cSrcweir const uno::Sequence< ucb::NumberedSortingInfo >& seqSort, 282*cdf0e10cSrcweir URLParameter aURLParameter, 283*cdf0e10cSrcweir Databases* pDatabases ) 284*cdf0e10cSrcweir : m_xSMgr( xSMgr ), 285*cdf0e10cSrcweir m_xProvider( xProvider ), 286*cdf0e10cSrcweir m_nOpenMode( nOpenMode ), 287*cdf0e10cSrcweir m_seq( seq ), 288*cdf0e10cSrcweir m_seqSort( seqSort ), 289*cdf0e10cSrcweir m_aURLParameter( aURLParameter ), 290*cdf0e10cSrcweir m_pDatabases( pDatabases ) 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir } 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir ResultSetBase* createResultSet() 295*cdf0e10cSrcweir { 296*cdf0e10cSrcweir return new ResultSetForQuery( m_xSMgr, 297*cdf0e10cSrcweir m_xProvider, 298*cdf0e10cSrcweir m_nOpenMode, 299*cdf0e10cSrcweir m_seq, 300*cdf0e10cSrcweir m_seqSort, 301*cdf0e10cSrcweir m_aURLParameter, 302*cdf0e10cSrcweir m_pDatabases ); 303*cdf0e10cSrcweir } 304*cdf0e10cSrcweir }; 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir // virtual 309*cdf0e10cSrcweir uno::Any SAL_CALL Content::execute( 310*cdf0e10cSrcweir const ucb::Command& aCommand, 311*cdf0e10cSrcweir sal_Int32 CommandId, 312*cdf0e10cSrcweir const uno::Reference< ucb::XCommandEnvironment >& Environment ) 313*cdf0e10cSrcweir throw( uno::Exception, 314*cdf0e10cSrcweir ucb::CommandAbortedException, 315*cdf0e10cSrcweir uno::RuntimeException ) 316*cdf0e10cSrcweir { 317*cdf0e10cSrcweir uno::Any aRet; 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir if ( aCommand.Name.compareToAscii( "getPropertyValues" ) == 0 ) 320*cdf0e10cSrcweir { 321*cdf0e10cSrcweir uno::Sequence< beans::Property > Properties; 322*cdf0e10cSrcweir if ( !( aCommand.Argument >>= Properties ) ) 323*cdf0e10cSrcweir { 324*cdf0e10cSrcweir aRet <<= lang::IllegalArgumentException(); 325*cdf0e10cSrcweir ucbhelper::cancelCommandExecution(aRet,Environment); 326*cdf0e10cSrcweir } 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir aRet <<= getPropertyValues( Properties ); 329*cdf0e10cSrcweir } 330*cdf0e10cSrcweir else if ( aCommand.Name.compareToAscii( "setPropertyValues" ) == 0 ) 331*cdf0e10cSrcweir { 332*cdf0e10cSrcweir uno::Sequence<beans::PropertyValue> propertyValues; 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir if( ! ( aCommand.Argument >>= propertyValues ) ) { 335*cdf0e10cSrcweir aRet <<= lang::IllegalArgumentException(); 336*cdf0e10cSrcweir ucbhelper::cancelCommandExecution(aRet,Environment); 337*cdf0e10cSrcweir } 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir uno::Sequence< uno::Any > ret(propertyValues.getLength()); 340*cdf0e10cSrcweir uno::Sequence< beans::Property > props(getProperties(Environment)); 341*cdf0e10cSrcweir // No properties can be set 342*cdf0e10cSrcweir for(sal_Int32 i = 0; i < ret.getLength(); ++i) { 343*cdf0e10cSrcweir ret[i] <<= beans::UnknownPropertyException(); 344*cdf0e10cSrcweir for(sal_Int32 j = 0; j < props.getLength(); ++j) 345*cdf0e10cSrcweir if(props[j].Name == propertyValues[i].Name) { 346*cdf0e10cSrcweir ret[i] <<= lang::IllegalAccessException(); 347*cdf0e10cSrcweir break; 348*cdf0e10cSrcweir } 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir aRet <<= ret; 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir else if ( aCommand.Name.compareToAscii( "getPropertySetInfo" ) == 0 ) 354*cdf0e10cSrcweir { 355*cdf0e10cSrcweir // Note: Implemented by base class. 356*cdf0e10cSrcweir aRet <<= getPropertySetInfo( Environment ); 357*cdf0e10cSrcweir } 358*cdf0e10cSrcweir else if ( aCommand.Name.compareToAscii( "getCommandInfo" ) == 0 ) 359*cdf0e10cSrcweir { 360*cdf0e10cSrcweir // Note: Implemented by base class. 361*cdf0e10cSrcweir aRet <<= getCommandInfo( Environment ); 362*cdf0e10cSrcweir } 363*cdf0e10cSrcweir else if ( aCommand.Name.compareToAscii( "open" ) == 0 ) 364*cdf0e10cSrcweir { 365*cdf0e10cSrcweir ucb::OpenCommandArgument2 aOpenCommand; 366*cdf0e10cSrcweir if ( !( aCommand.Argument >>= aOpenCommand ) ) 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir aRet <<= lang::IllegalArgumentException(); 369*cdf0e10cSrcweir ucbhelper::cancelCommandExecution(aRet,Environment); 370*cdf0e10cSrcweir } 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir uno::Reference< io::XActiveDataSink > xActiveDataSink( 373*cdf0e10cSrcweir aOpenCommand.Sink, uno::UNO_QUERY); 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir if(xActiveDataSink.is()) 376*cdf0e10cSrcweir m_aURLParameter.open(m_xSMgr, 377*cdf0e10cSrcweir aCommand, 378*cdf0e10cSrcweir CommandId, 379*cdf0e10cSrcweir Environment, 380*cdf0e10cSrcweir xActiveDataSink); 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir uno::Reference< io::XActiveDataStreamer > xActiveDataStreamer( 383*cdf0e10cSrcweir aOpenCommand.Sink, uno::UNO_QUERY); 384*cdf0e10cSrcweir 385*cdf0e10cSrcweir if(xActiveDataStreamer.is()) { 386*cdf0e10cSrcweir aRet <<= ucb::UnsupportedDataSinkException(); 387*cdf0e10cSrcweir ucbhelper::cancelCommandExecution(aRet,Environment); 388*cdf0e10cSrcweir } 389*cdf0e10cSrcweir 390*cdf0e10cSrcweir uno::Reference< io::XOutputStream > xOutputStream( 391*cdf0e10cSrcweir aOpenCommand.Sink, uno::UNO_QUERY); 392*cdf0e10cSrcweir 393*cdf0e10cSrcweir if(xOutputStream.is() ) 394*cdf0e10cSrcweir m_aURLParameter.open(m_xSMgr, 395*cdf0e10cSrcweir aCommand, 396*cdf0e10cSrcweir CommandId, 397*cdf0e10cSrcweir Environment, 398*cdf0e10cSrcweir xOutputStream); 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir if( m_aURLParameter.isRoot() ) 401*cdf0e10cSrcweir { 402*cdf0e10cSrcweir uno::Reference< ucb::XDynamicResultSet > xSet 403*cdf0e10cSrcweir = new DynamicResultSet( 404*cdf0e10cSrcweir m_xSMgr, 405*cdf0e10cSrcweir this, 406*cdf0e10cSrcweir aOpenCommand, 407*cdf0e10cSrcweir Environment, 408*cdf0e10cSrcweir new ResultSetForRootFactory( 409*cdf0e10cSrcweir m_xSMgr, 410*cdf0e10cSrcweir m_xProvider.get(), 411*cdf0e10cSrcweir aOpenCommand.Mode, 412*cdf0e10cSrcweir aOpenCommand.Properties, 413*cdf0e10cSrcweir aOpenCommand.SortingInfo, 414*cdf0e10cSrcweir m_aURLParameter, 415*cdf0e10cSrcweir m_pDatabases)); 416*cdf0e10cSrcweir aRet <<= xSet; 417*cdf0e10cSrcweir } 418*cdf0e10cSrcweir else if( m_aURLParameter.isQuery() ) 419*cdf0e10cSrcweir { 420*cdf0e10cSrcweir uno::Reference< ucb::XDynamicResultSet > xSet 421*cdf0e10cSrcweir = new DynamicResultSet( 422*cdf0e10cSrcweir m_xSMgr, 423*cdf0e10cSrcweir this, 424*cdf0e10cSrcweir aOpenCommand, 425*cdf0e10cSrcweir Environment, 426*cdf0e10cSrcweir new ResultSetForQueryFactory( 427*cdf0e10cSrcweir m_xSMgr, 428*cdf0e10cSrcweir m_xProvider.get(), 429*cdf0e10cSrcweir aOpenCommand.Mode, 430*cdf0e10cSrcweir aOpenCommand.Properties, 431*cdf0e10cSrcweir aOpenCommand.SortingInfo, 432*cdf0e10cSrcweir m_aURLParameter, 433*cdf0e10cSrcweir m_pDatabases ) ); 434*cdf0e10cSrcweir aRet <<= xSet; 435*cdf0e10cSrcweir } 436*cdf0e10cSrcweir } 437*cdf0e10cSrcweir else 438*cdf0e10cSrcweir { 439*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////// 440*cdf0e10cSrcweir // Unsupported command 441*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////// 442*cdf0e10cSrcweir aRet <<= ucb::UnsupportedCommandException(); 443*cdf0e10cSrcweir ucbhelper::cancelCommandExecution(aRet,Environment); 444*cdf0e10cSrcweir } 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir return aRet; 447*cdf0e10cSrcweir } 448*cdf0e10cSrcweir 449*cdf0e10cSrcweir 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir //========================================================================= 453*cdf0e10cSrcweir uno::Reference< sdbc::XRow > Content::getPropertyValues( 454*cdf0e10cSrcweir const uno::Sequence< beans::Property >& rProperties ) 455*cdf0e10cSrcweir { 456*cdf0e10cSrcweir osl::MutexGuard aGuard( m_aMutex ); 457*cdf0e10cSrcweir 458*cdf0e10cSrcweir rtl::Reference< ::ucbhelper::PropertyValueSet > xRow = 459*cdf0e10cSrcweir new ::ucbhelper::PropertyValueSet( m_xSMgr ); 460*cdf0e10cSrcweir 461*cdf0e10cSrcweir for ( sal_Int32 n = 0; n < rProperties.getLength(); ++n ) 462*cdf0e10cSrcweir { 463*cdf0e10cSrcweir const beans::Property& rProp = rProperties[n]; 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir if ( rProp.Name.compareToAscii( "ContentType" ) == 0 ) 466*cdf0e10cSrcweir xRow->appendString( 467*cdf0e10cSrcweir rProp, 468*cdf0e10cSrcweir rtl::OUString::createFromAscii( 469*cdf0e10cSrcweir "application/vnd.sun.star.help" ) ); 470*cdf0e10cSrcweir else if( rProp.Name.compareToAscii( "Title" ) == 0 ) 471*cdf0e10cSrcweir xRow->appendString ( rProp,m_aURLParameter.get_title() ); 472*cdf0e10cSrcweir else if( rProp.Name.compareToAscii( "IsReadOnly" ) == 0 ) 473*cdf0e10cSrcweir xRow->appendBoolean( rProp,true ); 474*cdf0e10cSrcweir else if( rProp.Name.compareToAscii( "IsDocument" ) == 0 ) 475*cdf0e10cSrcweir xRow->appendBoolean( 476*cdf0e10cSrcweir rProp, 477*cdf0e10cSrcweir m_aURLParameter.isFile() || m_aURLParameter.isRoot() ); 478*cdf0e10cSrcweir else if( rProp.Name.compareToAscii( "IsFolder" ) == 0 ) 479*cdf0e10cSrcweir xRow->appendBoolean( 480*cdf0e10cSrcweir rProp, 481*cdf0e10cSrcweir ! m_aURLParameter.isFile() || m_aURLParameter.isRoot() ); 482*cdf0e10cSrcweir else if( rProp.Name.compareToAscii( "IsErrorDocument" ) == 0 ) 483*cdf0e10cSrcweir xRow->appendBoolean( rProp, m_aURLParameter.isErrorDocument() ); 484*cdf0e10cSrcweir else if( rProp.Name.compareToAscii( "MediaType" ) == 0 ) 485*cdf0e10cSrcweir if( m_aURLParameter.isPicture() ) 486*cdf0e10cSrcweir xRow->appendString( 487*cdf0e10cSrcweir rProp, 488*cdf0e10cSrcweir rtl::OUString::createFromAscii( "image/gif" ) ); 489*cdf0e10cSrcweir else if( m_aURLParameter.isActive() ) 490*cdf0e10cSrcweir xRow->appendString( 491*cdf0e10cSrcweir rProp, 492*cdf0e10cSrcweir rtl::OUString::createFromAscii( "text/plain" ) ); 493*cdf0e10cSrcweir else if( m_aURLParameter.isFile() ) 494*cdf0e10cSrcweir xRow->appendString( 495*cdf0e10cSrcweir rProp,rtl::OUString::createFromAscii( "text/html" ) ); 496*cdf0e10cSrcweir else if( m_aURLParameter.isRoot() ) 497*cdf0e10cSrcweir xRow->appendString( 498*cdf0e10cSrcweir rProp, 499*cdf0e10cSrcweir rtl::OUString::createFromAscii( "text/css" ) ); 500*cdf0e10cSrcweir else 501*cdf0e10cSrcweir xRow->appendVoid( rProp ); 502*cdf0e10cSrcweir else if( m_aURLParameter.isModule() ) 503*cdf0e10cSrcweir if( rProp.Name.compareToAscii( "KeywordList" ) == 0 ) 504*cdf0e10cSrcweir { 505*cdf0e10cSrcweir KeywordInfo *inf = 506*cdf0e10cSrcweir m_pDatabases->getKeyword( m_aURLParameter.get_module(), 507*cdf0e10cSrcweir m_aURLParameter.get_language() ); 508*cdf0e10cSrcweir 509*cdf0e10cSrcweir uno::Any aAny; 510*cdf0e10cSrcweir if( inf ) 511*cdf0e10cSrcweir aAny <<= inf->getKeywordList(); 512*cdf0e10cSrcweir xRow->appendObject( rProp,aAny ); 513*cdf0e10cSrcweir } 514*cdf0e10cSrcweir else if( rProp.Name.compareToAscii( "KeywordRef" ) == 0 ) 515*cdf0e10cSrcweir { 516*cdf0e10cSrcweir KeywordInfo *inf = 517*cdf0e10cSrcweir m_pDatabases->getKeyword( m_aURLParameter.get_module(), 518*cdf0e10cSrcweir m_aURLParameter.get_language() ); 519*cdf0e10cSrcweir 520*cdf0e10cSrcweir uno::Any aAny; 521*cdf0e10cSrcweir if( inf ) 522*cdf0e10cSrcweir aAny <<= inf->getIdList(); 523*cdf0e10cSrcweir xRow->appendObject( rProp,aAny ); 524*cdf0e10cSrcweir } 525*cdf0e10cSrcweir else if( rProp.Name.compareToAscii( "KeywordAnchorForRef" ) == 0 ) 526*cdf0e10cSrcweir { 527*cdf0e10cSrcweir KeywordInfo *inf = 528*cdf0e10cSrcweir m_pDatabases->getKeyword( m_aURLParameter.get_module(), 529*cdf0e10cSrcweir m_aURLParameter.get_language() ); 530*cdf0e10cSrcweir 531*cdf0e10cSrcweir uno::Any aAny; 532*cdf0e10cSrcweir if( inf ) 533*cdf0e10cSrcweir aAny <<= inf->getAnchorList(); 534*cdf0e10cSrcweir xRow->appendObject( rProp,aAny ); 535*cdf0e10cSrcweir } 536*cdf0e10cSrcweir else if( rProp.Name.compareToAscii( "KeywordTitleForRef" ) == 0 ) 537*cdf0e10cSrcweir { 538*cdf0e10cSrcweir KeywordInfo *inf = 539*cdf0e10cSrcweir m_pDatabases->getKeyword( m_aURLParameter.get_module(), 540*cdf0e10cSrcweir m_aURLParameter.get_language() ); 541*cdf0e10cSrcweir 542*cdf0e10cSrcweir uno::Any aAny; 543*cdf0e10cSrcweir if( inf ) 544*cdf0e10cSrcweir aAny <<= inf->getTitleList(); 545*cdf0e10cSrcweir xRow->appendObject( rProp,aAny ); 546*cdf0e10cSrcweir } 547*cdf0e10cSrcweir else if( rProp.Name.compareToAscii( "SearchScopes" ) == 0 ) 548*cdf0e10cSrcweir { 549*cdf0e10cSrcweir uno::Sequence< rtl::OUString > seq( 2 ); 550*cdf0e10cSrcweir seq[0] = rtl::OUString::createFromAscii( "Heading" ); 551*cdf0e10cSrcweir seq[1] = rtl::OUString::createFromAscii( "FullText" ); 552*cdf0e10cSrcweir uno::Any aAny; 553*cdf0e10cSrcweir aAny <<= seq; 554*cdf0e10cSrcweir xRow->appendObject( rProp,aAny ); 555*cdf0e10cSrcweir } 556*cdf0e10cSrcweir else if( rProp.Name.compareToAscii( "Order" ) == 0 ) 557*cdf0e10cSrcweir { 558*cdf0e10cSrcweir StaticModuleInformation *inf = 559*cdf0e10cSrcweir m_pDatabases->getStaticInformationForModule( 560*cdf0e10cSrcweir m_aURLParameter.get_module(), 561*cdf0e10cSrcweir m_aURLParameter.get_language() ); 562*cdf0e10cSrcweir 563*cdf0e10cSrcweir uno::Any aAny; 564*cdf0e10cSrcweir if( inf ) 565*cdf0e10cSrcweir aAny <<= sal_Int32( inf->get_order() ); 566*cdf0e10cSrcweir xRow->appendObject( rProp,aAny ); 567*cdf0e10cSrcweir } 568*cdf0e10cSrcweir else 569*cdf0e10cSrcweir xRow->appendVoid( rProp ); 570*cdf0e10cSrcweir else if( rProp.Name.compareToAscii( "AnchorName" ) == 0 && 571*cdf0e10cSrcweir m_aURLParameter.isFile() ) 572*cdf0e10cSrcweir xRow->appendString( rProp,m_aURLParameter.get_tag() ); 573*cdf0e10cSrcweir else 574*cdf0e10cSrcweir xRow->appendVoid( rProp ); 575*cdf0e10cSrcweir } 576*cdf0e10cSrcweir 577*cdf0e10cSrcweir return uno::Reference< sdbc::XRow >( xRow.get() ); 578*cdf0e10cSrcweir } 579