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 #ifndef _CACHED_CONTENT_RESULTSET_STUB_HXX 29*cdf0e10cSrcweir #define _CACHED_CONTENT_RESULTSET_STUB_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <contentresultsetwrapper.hxx> 32*cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/ucb/XFetchProvider.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/ucb/XFetchProviderForContentAccess.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/ucb/XCachedContentResultSetStubFactory.hpp> 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir #define CACHED_CRS_STUB_SERVICE_NAME "com.sun.star.ucb.CachedContentResultSetStub" 39*cdf0e10cSrcweir #define CACHED_CRS_STUB_FACTORY_NAME "com.sun.star.ucb.CachedContentResultSetStubFactory" 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir //========================================================================= 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir class CachedContentResultSetStub 44*cdf0e10cSrcweir : public ContentResultSetWrapper 45*cdf0e10cSrcweir , public com::sun::star::lang::XTypeProvider 46*cdf0e10cSrcweir , public com::sun::star::lang::XServiceInfo 47*cdf0e10cSrcweir , public com::sun::star::ucb::XFetchProvider 48*cdf0e10cSrcweir , public com::sun::star::ucb::XFetchProviderForContentAccess 49*cdf0e10cSrcweir { 50*cdf0e10cSrcweir private: 51*cdf0e10cSrcweir sal_Int32 m_nColumnCount; 52*cdf0e10cSrcweir sal_Bool m_bColumnCountCached; 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir //members to propagate fetchsize and direction: 55*cdf0e10cSrcweir sal_Bool m_bNeedToPropagateFetchSize; 56*cdf0e10cSrcweir sal_Bool m_bFirstFetchSizePropagationDone; 57*cdf0e10cSrcweir sal_Int32 m_nLastFetchSize; 58*cdf0e10cSrcweir sal_Bool m_bLastFetchDirection; 59*cdf0e10cSrcweir const rtl::OUString m_aPropertyNameForFetchSize; 60*cdf0e10cSrcweir const rtl::OUString m_aPropertyNameForFetchDirection; 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir void SAL_CALL 64*cdf0e10cSrcweir impl_getCurrentRowContent( 65*cdf0e10cSrcweir com::sun::star::uno::Any& rRowContent, 66*cdf0e10cSrcweir com::sun::star::uno::Reference< 67*cdf0e10cSrcweir com::sun::star::sdbc::XRow > xRow ) 68*cdf0e10cSrcweir throw ( com::sun::star::sdbc::SQLException 69*cdf0e10cSrcweir , com::sun::star::uno::RuntimeException ); 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir sal_Int32 SAL_CALL 72*cdf0e10cSrcweir impl_getColumnCount(); 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir void SAL_CALL 75*cdf0e10cSrcweir impl_getCurrentContentIdentifierString( 76*cdf0e10cSrcweir com::sun::star::uno::Any& rAny 77*cdf0e10cSrcweir , com::sun::star::uno::Reference< 78*cdf0e10cSrcweir com::sun::star::ucb::XContentAccess > xContentAccess ) 79*cdf0e10cSrcweir throw ( com::sun::star::uno::RuntimeException ); 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir void SAL_CALL 82*cdf0e10cSrcweir impl_getCurrentContentIdentifier( 83*cdf0e10cSrcweir com::sun::star::uno::Any& rAny 84*cdf0e10cSrcweir , com::sun::star::uno::Reference< 85*cdf0e10cSrcweir com::sun::star::ucb::XContentAccess > xContentAccess ) 86*cdf0e10cSrcweir throw ( com::sun::star::uno::RuntimeException ); 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir void SAL_CALL 89*cdf0e10cSrcweir impl_getCurrentContent( 90*cdf0e10cSrcweir com::sun::star::uno::Any& rAny 91*cdf0e10cSrcweir , com::sun::star::uno::Reference< 92*cdf0e10cSrcweir com::sun::star::ucb::XContentAccess > xContentAccess ) 93*cdf0e10cSrcweir throw ( com::sun::star::uno::RuntimeException ); 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir void SAL_CALL 96*cdf0e10cSrcweir impl_propagateFetchSizeAndDirection( sal_Int32 nFetchSize, sal_Bool bFetchDirection ) 97*cdf0e10cSrcweir throw ( com::sun::star::uno::RuntimeException ); 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir public: 100*cdf0e10cSrcweir CachedContentResultSetStub( com::sun::star::uno::Reference< 101*cdf0e10cSrcweir com::sun::star::sdbc::XResultSet > xOrigin ); 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir virtual ~CachedContentResultSetStub(); 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir //----------------------------------------------------------------- 107*cdf0e10cSrcweir // XInterface inherited 108*cdf0e10cSrcweir //----------------------------------------------------------------- 109*cdf0e10cSrcweir XINTERFACE_DECL() 110*cdf0e10cSrcweir //----------------------------------------------------------------- 111*cdf0e10cSrcweir // own inherited 112*cdf0e10cSrcweir //----------------------------------------------------------------- 113*cdf0e10cSrcweir virtual void SAL_CALL 114*cdf0e10cSrcweir impl_propertyChange( const com::sun::star::beans::PropertyChangeEvent& evt ) 115*cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir virtual void SAL_CALL 118*cdf0e10cSrcweir impl_vetoableChange( const com::sun::star::beans::PropertyChangeEvent& aEvent ) 119*cdf0e10cSrcweir throw( com::sun::star::beans::PropertyVetoException, 120*cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 121*cdf0e10cSrcweir //----------------------------------------------------------------- 122*cdf0e10cSrcweir // XTypeProvider 123*cdf0e10cSrcweir //----------------------------------------------------------------- 124*cdf0e10cSrcweir XTYPEPROVIDER_DECL() 125*cdf0e10cSrcweir //----------------------------------------------------------------- 126*cdf0e10cSrcweir // XServiceInfo 127*cdf0e10cSrcweir //----------------------------------------------------------------- 128*cdf0e10cSrcweir XSERVICEINFO_NOFACTORY_DECL() 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir //----------------------------------------------------------------- 131*cdf0e10cSrcweir // XFetchProvider 132*cdf0e10cSrcweir //----------------------------------------------------------------- 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir virtual com::sun::star::ucb::FetchResult SAL_CALL 135*cdf0e10cSrcweir fetch( sal_Int32 nRowStartPosition 136*cdf0e10cSrcweir , sal_Int32 nRowCount, sal_Bool bDirection ) 137*cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir //----------------------------------------------------------------- 140*cdf0e10cSrcweir // XFetchProviderForContentAccess 141*cdf0e10cSrcweir //----------------------------------------------------------------- 142*cdf0e10cSrcweir virtual com::sun::star::ucb::FetchResult SAL_CALL 143*cdf0e10cSrcweir fetchContentIdentifierStrings( sal_Int32 nRowStartPosition 144*cdf0e10cSrcweir , sal_Int32 nRowCount, sal_Bool bDirection ) 145*cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir virtual com::sun::star::ucb::FetchResult SAL_CALL 148*cdf0e10cSrcweir fetchContentIdentifiers( sal_Int32 nRowStartPosition 149*cdf0e10cSrcweir , sal_Int32 nRowCount, sal_Bool bDirection ) 150*cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir virtual com::sun::star::ucb::FetchResult SAL_CALL 153*cdf0e10cSrcweir fetchContents( sal_Int32 nRowStartPosition 154*cdf0e10cSrcweir , sal_Int32 nRowCount, sal_Bool bDirection ) 155*cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 156*cdf0e10cSrcweir }; 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir //========================================================================= 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir class CachedContentResultSetStubFactory 161*cdf0e10cSrcweir : public cppu::OWeakObject 162*cdf0e10cSrcweir , public com::sun::star::lang::XTypeProvider 163*cdf0e10cSrcweir , public com::sun::star::lang::XServiceInfo 164*cdf0e10cSrcweir , public com::sun::star::ucb::XCachedContentResultSetStubFactory 165*cdf0e10cSrcweir { 166*cdf0e10cSrcweir protected: 167*cdf0e10cSrcweir com::sun::star::uno::Reference< 168*cdf0e10cSrcweir com::sun::star::lang::XMultiServiceFactory > m_xSMgr; 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir public: 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir CachedContentResultSetStubFactory( 173*cdf0e10cSrcweir const com::sun::star::uno::Reference< 174*cdf0e10cSrcweir com::sun::star::lang::XMultiServiceFactory > & rSMgr); 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir virtual ~CachedContentResultSetStubFactory(); 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir //----------------------------------------------------------------- 179*cdf0e10cSrcweir // XInterface 180*cdf0e10cSrcweir XINTERFACE_DECL() 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir //----------------------------------------------------------------- 183*cdf0e10cSrcweir // XTypeProvider 184*cdf0e10cSrcweir XTYPEPROVIDER_DECL() 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir //----------------------------------------------------------------- 187*cdf0e10cSrcweir // XServiceInfo 188*cdf0e10cSrcweir XSERVICEINFO_DECL() 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir //----------------------------------------------------------------- 191*cdf0e10cSrcweir // XCachedContentResultSetStubFactory 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir virtual com::sun::star::uno::Reference< 194*cdf0e10cSrcweir com::sun::star::sdbc::XResultSet > SAL_CALL 195*cdf0e10cSrcweir createCachedContentResultSetStub( 196*cdf0e10cSrcweir const com::sun::star::uno::Reference< 197*cdf0e10cSrcweir com::sun::star::sdbc::XResultSet > & xSource ) 198*cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 199*cdf0e10cSrcweir }; 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir #endif 202*cdf0e10cSrcweir 203