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_DYNAMIC_RESULTSET_HXX
25 #define _CACHED_DYNAMIC_RESULTSET_HXX
26 
27 #include <dynamicresultsetwrapper.hxx>
28 #include <com/sun/star/ucb/XContentIdentifierMapping.hpp>
29 #include <com/sun/star/ucb/XCachedDynamicResultSetFactory.hpp>
30 
31 #define CACHED_DRS_SERVICE_NAME "com.sun.star.ucb.CachedDynamicResultSet"
32 #define CACHED_DRS_FACTORY_NAME "com.sun.star.ucb.CachedDynamicResultSetFactory"
33 
34 //=========================================================================
35 
36 class CachedDynamicResultSet
37 				: public DynamicResultSetWrapper
38 				, public com::sun::star::lang::XTypeProvider
39 				, public com::sun::star::lang::XServiceInfo
40 {
41 	com::sun::star::uno::Reference<	com::sun::star::ucb::XContentIdentifierMapping >
42 							m_xContentIdentifierMapping;
43 
44 protected:
45 	virtual void SAL_CALL
46 	impl_InitResultSetOne( const com::sun::star::uno::Reference<
47 				com::sun::star::sdbc::XResultSet >& xResultSet );
48 	virtual void SAL_CALL
49 	impl_InitResultSetTwo( const com::sun::star::uno::Reference<
50 				com::sun::star::sdbc::XResultSet >& xResultSet );
51 
52 public:
53 	CachedDynamicResultSet(	com::sun::star::uno::Reference<
54 						com::sun::star::ucb::XDynamicResultSet > xOrigin
55 		, const com::sun::star::uno::Reference<
56 						com::sun::star::ucb::XContentIdentifierMapping > & xContentMapping
57 		, const com::sun::star::uno::Reference<
58 						com::sun::star::lang::XMultiServiceFactory > & xSMgr );
59 
60 	virtual ~CachedDynamicResultSet();
61 
62 
63 	//-----------------------------------------------------------------
64 	// XInterface inherited
65 	//-----------------------------------------------------------------
66 	XINTERFACE_DECL()
67 	//-----------------------------------------------------------------
68 	// XTypeProvider
69 	//-----------------------------------------------------------------
70 	XTYPEPROVIDER_DECL()
71 	//-----------------------------------------------------------------
72     // XServiceInfo
73 	//-----------------------------------------------------------------
74 	XSERVICEINFO_NOFACTORY_DECL()
75 
76 	//-----------------------------------------------------------------
77 	// own methods ( inherited )
78 	//-----------------------------------------------------------------
79     virtual void SAL_CALL
80 	impl_disposing( const com::sun::star::lang::EventObject& Source )
81 		throw( com::sun::star::uno::RuntimeException );
82 };
83 
84 //=========================================================================
85 
86 class CachedDynamicResultSetFactory
87 				: public cppu::OWeakObject
88 				, public com::sun::star::lang::XTypeProvider
89 				, public com::sun::star::lang::XServiceInfo
90 				, public com::sun::star::ucb::XCachedDynamicResultSetFactory
91 {
92 protected:
93 	com::sun::star::uno::Reference<
94 		com::sun::star::lang::XMultiServiceFactory >	m_xSMgr;
95 
96 public:
97 
98 	CachedDynamicResultSetFactory(
99 		const com::sun::star::uno::Reference<
100 		com::sun::star::lang::XMultiServiceFactory > & rSMgr);
101 
102 	virtual ~CachedDynamicResultSetFactory();
103 
104 	//-----------------------------------------------------------------
105 	// XInterface
106 	XINTERFACE_DECL()
107 
108 	//-----------------------------------------------------------------
109 	// XTypeProvider
110 	XTYPEPROVIDER_DECL()
111 
112 	//-----------------------------------------------------------------
113     // XServiceInfo
114 	XSERVICEINFO_DECL()
115 
116 	//-----------------------------------------------------------------
117     // XCachedDynamicResultSetFactory
118 
119 	virtual com::sun::star::uno::Reference<
120 				com::sun::star::ucb::XDynamicResultSet > SAL_CALL
121 	createCachedDynamicResultSet(
122 				  const com::sun::star::uno::Reference<
123 					com::sun::star::ucb::XDynamicResultSet > &
124 						SourceStub
125 				, const com::sun::star::uno::Reference<
126 					com::sun::star::ucb::XContentIdentifierMapping > &
127 						ContentIdentifierMapping
128 				)
129 			throw( com::sun::star::uno::RuntimeException );
130 };
131 
132 #endif
133 
134