| File: | ucbhelper/source/provider/resultsethelper.cxx |
| Location: | line 212, column 5 |
| Description: | Called C++ object pointer is null |
| 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | |||
| 2 | /* | |||
| 3 | * This file is part of the LibreOffice project. | |||
| 4 | * | |||
| 5 | * This Source Code Form is subject to the terms of the Mozilla Public | |||
| 6 | * License, v. 2.0. If a copy of the MPL was not distributed with this | |||
| 7 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. | |||
| 8 | * | |||
| 9 | * This file incorporates work covered by the following license notice: | |||
| 10 | * | |||
| 11 | * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| 12 | * contributor license agreements. See the NOTICE file distributed | |||
| 13 | * with this work for additional information regarding copyright | |||
| 14 | * ownership. The ASF licenses this file to you under the Apache | |||
| 15 | * License, Version 2.0 (the "License"); you may not use this file | |||
| 16 | * except in compliance with the License. You may obtain a copy of | |||
| 17 | * the License at http://www.apache.org/licenses/LICENSE-2.0 . | |||
| 18 | */ | |||
| 19 | ||||
| 20 | ||||
| 21 | /************************************************************************** | |||
| 22 | TODO | |||
| 23 | ************************************************************************** | |||
| 24 | ||||
| 25 | - This implementation is far away from completion. It has no interface | |||
| 26 | for changes notifications etc. | |||
| 27 | ||||
| 28 | *************************************************************************/ | |||
| 29 | #include <com/sun/star/ucb/ListActionType.hpp> | |||
| 30 | #include <com/sun/star/ucb/WelcomeDynamicResultSetStruct.hpp> | |||
| 31 | #include <com/sun/star/ucb/XCachedDynamicResultSetStubFactory.hpp> | |||
| 32 | #include <com/sun/star/ucb/XSourceInitialization.hpp> | |||
| 33 | #include <cppuhelper/interfacecontainer.hxx> | |||
| 34 | #include <ucbhelper/resultsethelper.hxx> | |||
| 35 | ||||
| 36 | #include "osl/diagnose.h" | |||
| 37 | ||||
| 38 | using namespace com::sun::star; | |||
| 39 | ||||
| 40 | //========================================================================= | |||
| 41 | //========================================================================= | |||
| 42 | // | |||
| 43 | // ResultSetImplHelper Implementation. | |||
| 44 | // | |||
| 45 | //========================================================================= | |||
| 46 | //========================================================================= | |||
| 47 | ||||
| 48 | namespace ucbhelper { | |||
| 49 | ||||
| 50 | //========================================================================= | |||
| 51 | ResultSetImplHelper::ResultSetImplHelper( | |||
| 52 | const uno::Reference< lang::XMultiServiceFactory >& rxSMgr, | |||
| 53 | const com::sun::star::ucb::OpenCommandArgument2& rCommand ) | |||
| 54 | : m_pDisposeEventListeners( 0 ), | |||
| 55 | m_bStatic( sal_False((sal_Bool)0) ), | |||
| 56 | m_bInitDone( sal_False((sal_Bool)0) ), | |||
| 57 | m_aCommand( rCommand ), | |||
| 58 | m_xSMgr( rxSMgr ) | |||
| 59 | { | |||
| 60 | } | |||
| 61 | ||||
| 62 | //========================================================================= | |||
| 63 | // virtual | |||
| 64 | ResultSetImplHelper::~ResultSetImplHelper() | |||
| 65 | { | |||
| 66 | delete m_pDisposeEventListeners; | |||
| 67 | } | |||
| 68 | ||||
| 69 | //========================================================================= | |||
| 70 | // | |||
| 71 | // XInterface methods. | |||
| 72 | // | |||
| 73 | //========================================================================= | |||
| 74 | ||||
| 75 | XINTERFACE_IMPL_4( ResultSetImplHelper,void ResultSetImplHelper::acquire() throw() { OWeakObject::acquire (); } void ResultSetImplHelper::release() throw() { OWeakObject ::release(); } com::sun::star::uno::Any ResultSetImplHelper:: queryInterface( const com::sun::star::uno::Type & rType ) throw( com::sun::star::uno::RuntimeException ) { com::sun::star ::uno::Any aRet = cppu::queryInterface( rType, (static_cast< lang::XTypeProvider* >(this)), (static_cast< lang::XServiceInfo * >(this)), (static_cast< lang::XComponent* >(this)) , (static_cast< com::sun::star::ucb::XDynamicResultSet* > (this)) ); return aRet.hasValue() ? aRet : OWeakObject::queryInterface ( rType ); } | |||
| 76 | lang::XTypeProvider,void ResultSetImplHelper::acquire() throw() { OWeakObject::acquire (); } void ResultSetImplHelper::release() throw() { OWeakObject ::release(); } com::sun::star::uno::Any ResultSetImplHelper:: queryInterface( const com::sun::star::uno::Type & rType ) throw( com::sun::star::uno::RuntimeException ) { com::sun::star ::uno::Any aRet = cppu::queryInterface( rType, (static_cast< lang::XTypeProvider* >(this)), (static_cast< lang::XServiceInfo * >(this)), (static_cast< lang::XComponent* >(this)) , (static_cast< com::sun::star::ucb::XDynamicResultSet* > (this)) ); return aRet.hasValue() ? aRet : OWeakObject::queryInterface ( rType ); } | |||
| 77 | lang::XServiceInfo,void ResultSetImplHelper::acquire() throw() { OWeakObject::acquire (); } void ResultSetImplHelper::release() throw() { OWeakObject ::release(); } com::sun::star::uno::Any ResultSetImplHelper:: queryInterface( const com::sun::star::uno::Type & rType ) throw( com::sun::star::uno::RuntimeException ) { com::sun::star ::uno::Any aRet = cppu::queryInterface( rType, (static_cast< lang::XTypeProvider* >(this)), (static_cast< lang::XServiceInfo * >(this)), (static_cast< lang::XComponent* >(this)) , (static_cast< com::sun::star::ucb::XDynamicResultSet* > (this)) ); return aRet.hasValue() ? aRet : OWeakObject::queryInterface ( rType ); } | |||
| 78 | lang::XComponent, /* base of XDynamicResultSet */void ResultSetImplHelper::acquire() throw() { OWeakObject::acquire (); } void ResultSetImplHelper::release() throw() { OWeakObject ::release(); } com::sun::star::uno::Any ResultSetImplHelper:: queryInterface( const com::sun::star::uno::Type & rType ) throw( com::sun::star::uno::RuntimeException ) { com::sun::star ::uno::Any aRet = cppu::queryInterface( rType, (static_cast< lang::XTypeProvider* >(this)), (static_cast< lang::XServiceInfo * >(this)), (static_cast< lang::XComponent* >(this)) , (static_cast< com::sun::star::ucb::XDynamicResultSet* > (this)) ); return aRet.hasValue() ? aRet : OWeakObject::queryInterface ( rType ); } | |||
| 79 | com::sun::star::ucb::XDynamicResultSet )void ResultSetImplHelper::acquire() throw() { OWeakObject::acquire (); } void ResultSetImplHelper::release() throw() { OWeakObject ::release(); } com::sun::star::uno::Any ResultSetImplHelper:: queryInterface( const com::sun::star::uno::Type & rType ) throw( com::sun::star::uno::RuntimeException ) { com::sun::star ::uno::Any aRet = cppu::queryInterface( rType, (static_cast< lang::XTypeProvider* >(this)), (static_cast< lang::XServiceInfo * >(this)), (static_cast< lang::XComponent* >(this)) , (static_cast< com::sun::star::ucb::XDynamicResultSet* > (this)) ); return aRet.hasValue() ? aRet : OWeakObject::queryInterface ( rType ); }; | |||
| 80 | ||||
| 81 | //========================================================================= | |||
| 82 | // | |||
| 83 | // XTypeProvider methods. | |||
| 84 | // | |||
| 85 | //========================================================================= | |||
| 86 | ||||
| 87 | XTYPEPROVIDER_IMPL_3( ResultSetImplHelper,com::sun::star::uno::Sequence< sal_Int8 > ResultSetImplHelper ::getImplementationId() throw( com::sun::star::uno::RuntimeException ) { static cppu::OImplementationId* pId = __null; if ( !pId ) { osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex () ); if ( !pId ) { static cppu::OImplementationId id( ((sal_Bool )0) ); pId = &id; } } return (*pId).getImplementationId() ; } com::sun::star::uno::Sequence< com::sun::star::uno::Type > ResultSetImplHelper::getTypes() throw( com::sun::star:: uno::RuntimeException ) { static cppu::OTypeCollection* pCollection = __null; if ( !pCollection ) { osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); if ( !pCollection ) { static cppu::OTypeCollection collection( getCppuType( static_cast < com::sun::star::uno::Reference< lang::XTypeProvider > * >( 0 ) ), getCppuType( static_cast< com::sun::star:: uno::Reference< lang::XServiceInfo > * >( 0 ) ), getCppuType ( static_cast< com::sun::star::uno::Reference< com::sun ::star::ucb::XDynamicResultSet > * >( 0 ) ) ); pCollection = &collection; } } return (*pCollection).getTypes(); } | |||
| 88 | lang::XTypeProvider,com::sun::star::uno::Sequence< sal_Int8 > ResultSetImplHelper ::getImplementationId() throw( com::sun::star::uno::RuntimeException ) { static cppu::OImplementationId* pId = __null; if ( !pId ) { osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex () ); if ( !pId ) { static cppu::OImplementationId id( ((sal_Bool )0) ); pId = &id; } } return (*pId).getImplementationId() ; } com::sun::star::uno::Sequence< com::sun::star::uno::Type > ResultSetImplHelper::getTypes() throw( com::sun::star:: uno::RuntimeException ) { static cppu::OTypeCollection* pCollection = __null; if ( !pCollection ) { osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); if ( !pCollection ) { static cppu::OTypeCollection collection( getCppuType( static_cast < com::sun::star::uno::Reference< lang::XTypeProvider > * >( 0 ) ), getCppuType( static_cast< com::sun::star:: uno::Reference< lang::XServiceInfo > * >( 0 ) ), getCppuType ( static_cast< com::sun::star::uno::Reference< com::sun ::star::ucb::XDynamicResultSet > * >( 0 ) ) ); pCollection = &collection; } } return (*pCollection).getTypes(); } | |||
| 89 | lang::XServiceInfo,com::sun::star::uno::Sequence< sal_Int8 > ResultSetImplHelper ::getImplementationId() throw( com::sun::star::uno::RuntimeException ) { static cppu::OImplementationId* pId = __null; if ( !pId ) { osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex () ); if ( !pId ) { static cppu::OImplementationId id( ((sal_Bool )0) ); pId = &id; } } return (*pId).getImplementationId() ; } com::sun::star::uno::Sequence< com::sun::star::uno::Type > ResultSetImplHelper::getTypes() throw( com::sun::star:: uno::RuntimeException ) { static cppu::OTypeCollection* pCollection = __null; if ( !pCollection ) { osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); if ( !pCollection ) { static cppu::OTypeCollection collection( getCppuType( static_cast < com::sun::star::uno::Reference< lang::XTypeProvider > * >( 0 ) ), getCppuType( static_cast< com::sun::star:: uno::Reference< lang::XServiceInfo > * >( 0 ) ), getCppuType ( static_cast< com::sun::star::uno::Reference< com::sun ::star::ucb::XDynamicResultSet > * >( 0 ) ) ); pCollection = &collection; } } return (*pCollection).getTypes(); } | |||
| 90 | com::sun::star::ucb::XDynamicResultSet )com::sun::star::uno::Sequence< sal_Int8 > ResultSetImplHelper ::getImplementationId() throw( com::sun::star::uno::RuntimeException ) { static cppu::OImplementationId* pId = __null; if ( !pId ) { osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex () ); if ( !pId ) { static cppu::OImplementationId id( ((sal_Bool )0) ); pId = &id; } } return (*pId).getImplementationId() ; } com::sun::star::uno::Sequence< com::sun::star::uno::Type > ResultSetImplHelper::getTypes() throw( com::sun::star:: uno::RuntimeException ) { static cppu::OTypeCollection* pCollection = __null; if ( !pCollection ) { osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); if ( !pCollection ) { static cppu::OTypeCollection collection( getCppuType( static_cast < com::sun::star::uno::Reference< lang::XTypeProvider > * >( 0 ) ), getCppuType( static_cast< com::sun::star:: uno::Reference< lang::XServiceInfo > * >( 0 ) ), getCppuType ( static_cast< com::sun::star::uno::Reference< com::sun ::star::ucb::XDynamicResultSet > * >( 0 ) ) ); pCollection = &collection; } } return (*pCollection).getTypes(); }; | |||
| 91 | ||||
| 92 | //========================================================================= | |||
| 93 | // | |||
| 94 | // XServiceInfo methods. | |||
| 95 | // | |||
| 96 | //========================================================================= | |||
| 97 | ||||
| 98 | XSERVICEINFO_NOFACTORY_IMPL_1( ResultSetImplHelper,rtl::OUString ResultSetImplHelper::getImplementationName() throw ( com::sun::star::uno::RuntimeException ) { return getImplementationName_Static (); } rtl::OUString ResultSetImplHelper::getImplementationName_Static () { return rtl::OUString( "ResultSetImplHelper" ); } sal_Bool ResultSetImplHelper::supportsService( const rtl::OUString& ServiceName ) throw( com::sun::star::uno::RuntimeException ) { com::sun::star::uno::Sequence< rtl::OUString > aSNL = getSupportedServiceNames(); const rtl::OUString* pArray = aSNL .getArray(); for( sal_Int32 i = 0; i < aSNL.getLength(); i ++ ) { if( pArray[ i ] == ServiceName ) return ((sal_Bool)1); } return ((sal_Bool)0); } com::sun::star::uno::Sequence< rtl ::OUString > ResultSetImplHelper::getSupportedServiceNames () throw( com::sun::star::uno::RuntimeException ) { return getSupportedServiceNames_Static (); } com::sun::star::uno::Sequence< rtl::OUString > ResultSetImplHelper ::getSupportedServiceNames_Static() { com::sun::star::uno::Sequence < rtl::OUString > aSNS( 1 ); aSNS.getArray()[ 0 ] = rtl ::OUString( "com.sun.star.ucb.DynamicResultSet" ); return aSNS ; } | |||
| 99 | rtl::OUString(rtl::OUString ResultSetImplHelper::getImplementationName() throw ( com::sun::star::uno::RuntimeException ) { return getImplementationName_Static (); } rtl::OUString ResultSetImplHelper::getImplementationName_Static () { return rtl::OUString( "ResultSetImplHelper" ); } sal_Bool ResultSetImplHelper::supportsService( const rtl::OUString& ServiceName ) throw( com::sun::star::uno::RuntimeException ) { com::sun::star::uno::Sequence< rtl::OUString > aSNL = getSupportedServiceNames(); const rtl::OUString* pArray = aSNL .getArray(); for( sal_Int32 i = 0; i < aSNL.getLength(); i ++ ) { if( pArray[ i ] == ServiceName ) return ((sal_Bool)1); } return ((sal_Bool)0); } com::sun::star::uno::Sequence< rtl ::OUString > ResultSetImplHelper::getSupportedServiceNames () throw( com::sun::star::uno::RuntimeException ) { return getSupportedServiceNames_Static (); } com::sun::star::uno::Sequence< rtl::OUString > ResultSetImplHelper ::getSupportedServiceNames_Static() { com::sun::star::uno::Sequence < rtl::OUString > aSNS( 1 ); aSNS.getArray()[ 0 ] = rtl ::OUString( "com.sun.star.ucb.DynamicResultSet" ); return aSNS ; } | |||
| 100 | "ResultSetImplHelper" ),rtl::OUString ResultSetImplHelper::getImplementationName() throw ( com::sun::star::uno::RuntimeException ) { return getImplementationName_Static (); } rtl::OUString ResultSetImplHelper::getImplementationName_Static () { return rtl::OUString( "ResultSetImplHelper" ); } sal_Bool ResultSetImplHelper::supportsService( const rtl::OUString& ServiceName ) throw( com::sun::star::uno::RuntimeException ) { com::sun::star::uno::Sequence< rtl::OUString > aSNL = getSupportedServiceNames(); const rtl::OUString* pArray = aSNL .getArray(); for( sal_Int32 i = 0; i < aSNL.getLength(); i ++ ) { if( pArray[ i ] == ServiceName ) return ((sal_Bool)1); } return ((sal_Bool)0); } com::sun::star::uno::Sequence< rtl ::OUString > ResultSetImplHelper::getSupportedServiceNames () throw( com::sun::star::uno::RuntimeException ) { return getSupportedServiceNames_Static (); } com::sun::star::uno::Sequence< rtl::OUString > ResultSetImplHelper ::getSupportedServiceNames_Static() { com::sun::star::uno::Sequence < rtl::OUString > aSNS( 1 ); aSNS.getArray()[ 0 ] = rtl ::OUString( "com.sun.star.ucb.DynamicResultSet" ); return aSNS ; } | |||
| 101 | rtl::OUString(rtl::OUString ResultSetImplHelper::getImplementationName() throw ( com::sun::star::uno::RuntimeException ) { return getImplementationName_Static (); } rtl::OUString ResultSetImplHelper::getImplementationName_Static () { return rtl::OUString( "ResultSetImplHelper" ); } sal_Bool ResultSetImplHelper::supportsService( const rtl::OUString& ServiceName ) throw( com::sun::star::uno::RuntimeException ) { com::sun::star::uno::Sequence< rtl::OUString > aSNL = getSupportedServiceNames(); const rtl::OUString* pArray = aSNL .getArray(); for( sal_Int32 i = 0; i < aSNL.getLength(); i ++ ) { if( pArray[ i ] == ServiceName ) return ((sal_Bool)1); } return ((sal_Bool)0); } com::sun::star::uno::Sequence< rtl ::OUString > ResultSetImplHelper::getSupportedServiceNames () throw( com::sun::star::uno::RuntimeException ) { return getSupportedServiceNames_Static (); } com::sun::star::uno::Sequence< rtl::OUString > ResultSetImplHelper ::getSupportedServiceNames_Static() { com::sun::star::uno::Sequence < rtl::OUString > aSNS( 1 ); aSNS.getArray()[ 0 ] = rtl ::OUString( "com.sun.star.ucb.DynamicResultSet" ); return aSNS ; } | |||
| 102 | DYNAMICRESULTSET_SERVICE_NAME ) )rtl::OUString ResultSetImplHelper::getImplementationName() throw ( com::sun::star::uno::RuntimeException ) { return getImplementationName_Static (); } rtl::OUString ResultSetImplHelper::getImplementationName_Static () { return rtl::OUString( "ResultSetImplHelper" ); } sal_Bool ResultSetImplHelper::supportsService( const rtl::OUString& ServiceName ) throw( com::sun::star::uno::RuntimeException ) { com::sun::star::uno::Sequence< rtl::OUString > aSNL = getSupportedServiceNames(); const rtl::OUString* pArray = aSNL .getArray(); for( sal_Int32 i = 0; i < aSNL.getLength(); i ++ ) { if( pArray[ i ] == ServiceName ) return ((sal_Bool)1); } return ((sal_Bool)0); } com::sun::star::uno::Sequence< rtl ::OUString > ResultSetImplHelper::getSupportedServiceNames () throw( com::sun::star::uno::RuntimeException ) { return getSupportedServiceNames_Static (); } com::sun::star::uno::Sequence< rtl::OUString > ResultSetImplHelper ::getSupportedServiceNames_Static() { com::sun::star::uno::Sequence < rtl::OUString > aSNS( 1 ); aSNS.getArray()[ 0 ] = rtl ::OUString( "com.sun.star.ucb.DynamicResultSet" ); return aSNS ; }; | |||
| 103 | ||||
| 104 | //========================================================================= | |||
| 105 | // | |||
| 106 | // XComponent methods. | |||
| 107 | // | |||
| 108 | //========================================================================= | |||
| 109 | ||||
| 110 | // virtual | |||
| 111 | void SAL_CALL ResultSetImplHelper::dispose() | |||
| 112 | throw( uno::RuntimeException ) | |||
| 113 | { | |||
| 114 | osl::MutexGuard aGuard( m_aMutex ); | |||
| 115 | ||||
| 116 | if ( m_pDisposeEventListeners && m_pDisposeEventListeners->getLength() ) | |||
| 117 | { | |||
| 118 | lang::EventObject aEvt; | |||
| 119 | aEvt.Source = static_cast< lang::XComponent * >( this ); | |||
| 120 | m_pDisposeEventListeners->disposeAndClear( aEvt ); | |||
| 121 | } | |||
| 122 | } | |||
| 123 | ||||
| 124 | //========================================================================= | |||
| 125 | // virtual | |||
| 126 | void SAL_CALL ResultSetImplHelper::addEventListener( | |||
| 127 | const uno::Reference< lang::XEventListener >& Listener ) | |||
| 128 | throw( uno::RuntimeException ) | |||
| 129 | { | |||
| 130 | osl::MutexGuard aGuard( m_aMutex ); | |||
| 131 | ||||
| 132 | if ( !m_pDisposeEventListeners ) | |||
| 133 | m_pDisposeEventListeners | |||
| 134 | = new cppu::OInterfaceContainerHelper( m_aMutex ); | |||
| 135 | ||||
| 136 | m_pDisposeEventListeners->addInterface( Listener ); | |||
| 137 | } | |||
| 138 | ||||
| 139 | //========================================================================= | |||
| 140 | // virtual | |||
| 141 | void SAL_CALL ResultSetImplHelper::removeEventListener( | |||
| 142 | const uno::Reference< lang::XEventListener >& Listener ) | |||
| 143 | throw( uno::RuntimeException ) | |||
| 144 | { | |||
| 145 | osl::MutexGuard aGuard( m_aMutex ); | |||
| 146 | ||||
| 147 | if ( m_pDisposeEventListeners ) | |||
| 148 | m_pDisposeEventListeners->removeInterface( Listener ); | |||
| 149 | } | |||
| 150 | ||||
| 151 | //========================================================================= | |||
| 152 | // | |||
| 153 | // XDynamicResultSet methods. | |||
| 154 | // | |||
| 155 | //========================================================================= | |||
| 156 | ||||
| 157 | // virtual | |||
| 158 | uno::Reference< sdbc::XResultSet > SAL_CALL | |||
| 159 | ResultSetImplHelper::getStaticResultSet() | |||
| 160 | throw( com::sun::star::ucb::ListenerAlreadySetException, | |||
| 161 | uno::RuntimeException ) | |||
| 162 | { | |||
| 163 | osl::MutexGuard aGuard( m_aMutex ); | |||
| 164 | ||||
| 165 | if ( m_xListener.is() ) | |||
| 166 | throw com::sun::star::ucb::ListenerAlreadySetException(); | |||
| 167 | ||||
| 168 | init( sal_True((sal_Bool)1) ); | |||
| 169 | return m_xResultSet1; | |||
| 170 | } | |||
| 171 | ||||
| 172 | //========================================================================= | |||
| 173 | // virtual | |||
| 174 | void SAL_CALL ResultSetImplHelper::setListener( | |||
| 175 | const uno::Reference< com::sun::star::ucb::XDynamicResultSetListener >& | |||
| 176 | Listener ) | |||
| 177 | throw( com::sun::star::ucb::ListenerAlreadySetException, | |||
| 178 | uno::RuntimeException ) | |||
| 179 | { | |||
| 180 | osl::ClearableMutexGuard aGuard( m_aMutex ); | |||
| 181 | ||||
| 182 | if ( m_bStatic || m_xListener.is() ) | |||
| ||||
| 183 | throw com::sun::star::ucb::ListenerAlreadySetException(); | |||
| 184 | ||||
| 185 | m_xListener = Listener; | |||
| 186 | ||||
| 187 | ////////////////////////////////////////////////////////////////////// | |||
| 188 | // Create "welcome event" and send it to listener. | |||
| 189 | ////////////////////////////////////////////////////////////////////// | |||
| 190 | ||||
| 191 | // Note: We only have the implementation for a static result set at the | |||
| 192 | // moment (src590). The dynamic result sets passed to the listener | |||
| 193 | // are a fake. This implementation will never call "notify" at the | |||
| 194 | // listener to propagate any changes!!! | |||
| 195 | ||||
| 196 | init( sal_False((sal_Bool)0) ); | |||
| 197 | ||||
| 198 | uno::Any aInfo; | |||
| 199 | aInfo <<= com::sun::star::ucb::WelcomeDynamicResultSetStruct( | |||
| 200 | m_xResultSet1 /* "old" */, | |||
| 201 | m_xResultSet2 /* "new" */ ); | |||
| 202 | ||||
| 203 | uno::Sequence< com::sun::star::ucb::ListAction > aActions( 1 ); | |||
| 204 | aActions.getArray()[ 0 ] | |||
| 205 | = com::sun::star::ucb::ListAction( | |||
| 206 | 0, // Position; not used | |||
| 207 | 0, // Count; not used | |||
| 208 | com::sun::star::ucb::ListActionType::WELCOME, | |||
| 209 | aInfo ); | |||
| 210 | aGuard.clear(); | |||
| 211 | ||||
| 212 | Listener->notify( | |||
| ||||
| 213 | com::sun::star::ucb::ListEvent( | |||
| 214 | static_cast< cppu::OWeakObject * >( this ), aActions ) ); | |||
| 215 | } | |||
| 216 | ||||
| 217 | //========================================================================= | |||
| 218 | // virtual | |||
| 219 | sal_Int16 SAL_CALL ResultSetImplHelper::getCapabilities() | |||
| 220 | throw( uno::RuntimeException ) | |||
| 221 | { | |||
| 222 | // ! com::sun::star::ucb::ContentResultSetCapability::SORTED | |||
| 223 | return 0; | |||
| 224 | } | |||
| 225 | ||||
| 226 | //========================================================================= | |||
| 227 | // virtual | |||
| 228 | void SAL_CALL ResultSetImplHelper::connectToCache( | |||
| 229 | const uno::Reference< com::sun::star::ucb::XDynamicResultSet > & | |||
| 230 | xCache ) | |||
| 231 | throw( com::sun::star::ucb::ListenerAlreadySetException, | |||
| 232 | com::sun::star::ucb::AlreadyInitializedException, | |||
| 233 | com::sun::star::ucb::ServiceNotFoundException, | |||
| 234 | uno::RuntimeException ) | |||
| 235 | { | |||
| 236 | if ( m_xListener.is() ) | |||
| 237 | throw com::sun::star::ucb::ListenerAlreadySetException(); | |||
| 238 | ||||
| 239 | if ( m_bStatic ) | |||
| 240 | throw com::sun::star::ucb::ListenerAlreadySetException(); | |||
| 241 | ||||
| 242 | uno::Reference< com::sun::star::ucb::XSourceInitialization > | |||
| 243 | xTarget( xCache, uno::UNO_QUERY ); | |||
| 244 | if ( xTarget.is() ) | |||
| 245 | { | |||
| 246 | uno::Reference< | |||
| 247 | com::sun::star::ucb::XCachedDynamicResultSetStubFactory > | |||
| 248 | xStubFactory; | |||
| 249 | try | |||
| 250 | { | |||
| 251 | xStubFactory | |||
| 252 | = uno::Reference< | |||
| 253 | com::sun::star::ucb::XCachedDynamicResultSetStubFactory >( | |||
| 254 | m_xSMgr->createInstance( | |||
| 255 | rtl::OUString( | |||
| 256 | "com.sun.star.ucb.CachedDynamicResultSetStubFactory" ) ), | |||
| 257 | uno::UNO_QUERY ); | |||
| 258 | } | |||
| 259 | catch ( uno::Exception const & ) | |||
| 260 | { | |||
| 261 | } | |||
| 262 | ||||
| 263 | if ( xStubFactory.is() ) | |||
| 264 | { | |||
| 265 | xStubFactory->connectToCache( | |||
| 266 | this, xCache, m_aCommand.SortingInfo, 0 ); | |||
| 267 | return; | |||
| 268 | } | |||
| 269 | } | |||
| 270 | throw com::sun::star::ucb::ServiceNotFoundException(); | |||
| 271 | } | |||
| 272 | ||||
| 273 | //========================================================================= | |||
| 274 | // | |||
| 275 | // Non-interface methods. | |||
| 276 | // | |||
| 277 | //========================================================================= | |||
| 278 | ||||
| 279 | void ResultSetImplHelper::init( sal_Bool bStatic ) | |||
| 280 | { | |||
| 281 | osl::MutexGuard aGuard( m_aMutex ); | |||
| 282 | ||||
| 283 | if ( !m_bInitDone ) | |||
| 284 | { | |||
| 285 | if ( bStatic ) | |||
| 286 | { | |||
| 287 | // virtual... derived class fills m_xResultSet1 | |||
| 288 | initStatic(); | |||
| 289 | ||||
| 290 | OSL_ENSURE( m_xResultSet1.is(),do { if (true && (!(m_xResultSet1.is()))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/ucbhelper/source/provider/resultsethelper.cxx" ":" "291" ": "), "%s", "ResultSetImplHelper::init - No 1st result set!" ); } } while (false) | |||
| 291 | "ResultSetImplHelper::init - No 1st result set!" )do { if (true && (!(m_xResultSet1.is()))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/ucbhelper/source/provider/resultsethelper.cxx" ":" "291" ": "), "%s", "ResultSetImplHelper::init - No 1st result set!" ); } } while (false); | |||
| 292 | m_bStatic = sal_True((sal_Bool)1); | |||
| 293 | } | |||
| 294 | else | |||
| 295 | { | |||
| 296 | // virtual... derived class fills m_xResultSet1 and m_xResultSet2 | |||
| 297 | initDynamic(); | |||
| 298 | ||||
| 299 | OSL_ENSURE( m_xResultSet1.is(),do { if (true && (!(m_xResultSet1.is()))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/ucbhelper/source/provider/resultsethelper.cxx" ":" "300" ": "), "%s", "ResultSetImplHelper::init - No 1st result set!" ); } } while (false) | |||
| 300 | "ResultSetImplHelper::init - No 1st result set!" )do { if (true && (!(m_xResultSet1.is()))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/ucbhelper/source/provider/resultsethelper.cxx" ":" "300" ": "), "%s", "ResultSetImplHelper::init - No 1st result set!" ); } } while (false); | |||
| 301 | OSL_ENSURE( m_xResultSet2.is(),do { if (true && (!(m_xResultSet2.is()))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/ucbhelper/source/provider/resultsethelper.cxx" ":" "302" ": "), "%s", "ResultSetImplHelper::init - No 2nd result set!" ); } } while (false) | |||
| 302 | "ResultSetImplHelper::init - No 2nd result set!" )do { if (true && (!(m_xResultSet2.is()))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/ucbhelper/source/provider/resultsethelper.cxx" ":" "302" ": "), "%s", "ResultSetImplHelper::init - No 2nd result set!" ); } } while (false); | |||
| 303 | m_bStatic = sal_False((sal_Bool)0); | |||
| 304 | } | |||
| 305 | m_bInitDone = sal_True((sal_Bool)1); | |||
| 306 | } | |||
| 307 | } | |||
| 308 | ||||
| 309 | } // namespace ucbhelper | |||
| 310 | ||||
| 311 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |