1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _CACHED_CONTENT_RESULTSET_STUB_HXX 25 #define _CACHED_CONTENT_RESULTSET_STUB_HXX 26 27 #include <contentresultsetwrapper.hxx> 28 #include <com/sun/star/lang/XTypeProvider.hpp> 29 #include <com/sun/star/lang/XServiceInfo.hpp> 30 #include <com/sun/star/ucb/XFetchProvider.hpp> 31 #include <com/sun/star/ucb/XFetchProviderForContentAccess.hpp> 32 #include <com/sun/star/ucb/XCachedContentResultSetStubFactory.hpp> 33 34 #define CACHED_CRS_STUB_SERVICE_NAME "com.sun.star.ucb.CachedContentResultSetStub" 35 #define CACHED_CRS_STUB_FACTORY_NAME "com.sun.star.ucb.CachedContentResultSetStubFactory" 36 37 //========================================================================= 38 39 class CachedContentResultSetStub 40 : public ContentResultSetWrapper 41 , public com::sun::star::lang::XTypeProvider 42 , public com::sun::star::lang::XServiceInfo 43 , public com::sun::star::ucb::XFetchProvider 44 , public com::sun::star::ucb::XFetchProviderForContentAccess 45 { 46 private: 47 sal_Int32 m_nColumnCount; 48 sal_Bool m_bColumnCountCached; 49 50 //members to propagate fetchsize and direction: 51 sal_Bool m_bNeedToPropagateFetchSize; 52 sal_Bool m_bFirstFetchSizePropagationDone; 53 sal_Int32 m_nLastFetchSize; 54 sal_Bool m_bLastFetchDirection; 55 const rtl::OUString m_aPropertyNameForFetchSize; 56 const rtl::OUString m_aPropertyNameForFetchDirection; 57 58 59 void SAL_CALL 60 impl_getCurrentRowContent( 61 com::sun::star::uno::Any& rRowContent, 62 com::sun::star::uno::Reference< 63 com::sun::star::sdbc::XRow > xRow ); 64 65 sal_Int32 SAL_CALL 66 impl_getColumnCount(); 67 68 void SAL_CALL 69 impl_getCurrentContentIdentifierString( 70 com::sun::star::uno::Any& rAny 71 , com::sun::star::uno::Reference< 72 com::sun::star::ucb::XContentAccess > xContentAccess ); 73 74 void SAL_CALL 75 impl_getCurrentContentIdentifier( 76 com::sun::star::uno::Any& rAny 77 , com::sun::star::uno::Reference< 78 com::sun::star::ucb::XContentAccess > xContentAccess ); 79 80 void SAL_CALL 81 impl_getCurrentContent( 82 com::sun::star::uno::Any& rAny 83 , com::sun::star::uno::Reference< 84 com::sun::star::ucb::XContentAccess > xContentAccess ); 85 86 void SAL_CALL 87 impl_propagateFetchSizeAndDirection( sal_Int32 nFetchSize, sal_Bool bFetchDirection ); 88 89 public: 90 CachedContentResultSetStub( com::sun::star::uno::Reference< 91 com::sun::star::sdbc::XResultSet > xOrigin ); 92 93 virtual ~CachedContentResultSetStub(); 94 95 96 //----------------------------------------------------------------- 97 // XInterface inherited 98 //----------------------------------------------------------------- 99 XINTERFACE_DECL() 100 //----------------------------------------------------------------- 101 // own inherited 102 //----------------------------------------------------------------- 103 virtual void SAL_CALL 104 impl_propertyChange( const com::sun::star::beans::PropertyChangeEvent& evt ); 105 106 virtual void SAL_CALL 107 impl_vetoableChange( const com::sun::star::beans::PropertyChangeEvent& aEvent ); 108 //----------------------------------------------------------------- 109 // XTypeProvider 110 //----------------------------------------------------------------- 111 XTYPEPROVIDER_DECL() 112 //----------------------------------------------------------------- 113 // XServiceInfo 114 //----------------------------------------------------------------- 115 XSERVICEINFO_NOFACTORY_DECL() 116 117 //----------------------------------------------------------------- 118 // XFetchProvider 119 //----------------------------------------------------------------- 120 121 virtual com::sun::star::ucb::FetchResult SAL_CALL 122 fetch( sal_Int32 nRowStartPosition 123 , sal_Int32 nRowCount, sal_Bool bDirection ); 124 125 //----------------------------------------------------------------- 126 // XFetchProviderForContentAccess 127 //----------------------------------------------------------------- 128 virtual com::sun::star::ucb::FetchResult SAL_CALL 129 fetchContentIdentifierStrings( sal_Int32 nRowStartPosition 130 , sal_Int32 nRowCount, sal_Bool bDirection ); 131 132 virtual com::sun::star::ucb::FetchResult SAL_CALL 133 fetchContentIdentifiers( sal_Int32 nRowStartPosition 134 , sal_Int32 nRowCount, sal_Bool bDirection ); 135 136 virtual com::sun::star::ucb::FetchResult SAL_CALL 137 fetchContents( sal_Int32 nRowStartPosition 138 , sal_Int32 nRowCount, sal_Bool bDirection ); 139 }; 140 141 //========================================================================= 142 143 class CachedContentResultSetStubFactory 144 : public cppu::OWeakObject 145 , public com::sun::star::lang::XTypeProvider 146 , public com::sun::star::lang::XServiceInfo 147 , public com::sun::star::ucb::XCachedContentResultSetStubFactory 148 { 149 protected: 150 com::sun::star::uno::Reference< 151 com::sun::star::lang::XMultiServiceFactory > m_xSMgr; 152 153 public: 154 155 CachedContentResultSetStubFactory( 156 const com::sun::star::uno::Reference< 157 com::sun::star::lang::XMultiServiceFactory > & rSMgr); 158 159 virtual ~CachedContentResultSetStubFactory(); 160 161 //----------------------------------------------------------------- 162 // XInterface 163 XINTERFACE_DECL() 164 165 //----------------------------------------------------------------- 166 // XTypeProvider 167 XTYPEPROVIDER_DECL() 168 169 //----------------------------------------------------------------- 170 // XServiceInfo 171 XSERVICEINFO_DECL() 172 173 //----------------------------------------------------------------- 174 // XCachedContentResultSetStubFactory 175 176 virtual com::sun::star::uno::Reference< 177 com::sun::star::sdbc::XResultSet > SAL_CALL 178 createCachedContentResultSetStub( 179 const com::sun::star::uno::Reference< 180 com::sun::star::sdbc::XResultSet > & xSource ); 181 }; 182 183 #endif 184