1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _CACHED_DYNAMIC_RESULTSET_HXX
29 #define _CACHED_DYNAMIC_RESULTSET_HXX
30 
31 #include <dynamicresultsetwrapper.hxx>
32 #include <com/sun/star/ucb/XContentIdentifierMapping.hpp>
33 #include <com/sun/star/ucb/XCachedDynamicResultSetFactory.hpp>
34 
35 #define CACHED_DRS_SERVICE_NAME "com.sun.star.ucb.CachedDynamicResultSet"
36 #define CACHED_DRS_FACTORY_NAME "com.sun.star.ucb.CachedDynamicResultSetFactory"
37 
38 //=========================================================================
39 
40 class CachedDynamicResultSet
41 				: public DynamicResultSetWrapper
42 				, public com::sun::star::lang::XTypeProvider
43 				, public com::sun::star::lang::XServiceInfo
44 {
45 	com::sun::star::uno::Reference<	com::sun::star::ucb::XContentIdentifierMapping >
46 							m_xContentIdentifierMapping;
47 
48 protected:
49 	virtual void SAL_CALL
50 	impl_InitResultSetOne( const com::sun::star::uno::Reference<
51 				com::sun::star::sdbc::XResultSet >& xResultSet );
52 	virtual void SAL_CALL
53 	impl_InitResultSetTwo( const com::sun::star::uno::Reference<
54 				com::sun::star::sdbc::XResultSet >& xResultSet );
55 
56 public:
57 	CachedDynamicResultSet(	com::sun::star::uno::Reference<
58 						com::sun::star::ucb::XDynamicResultSet > xOrigin
59 		, const com::sun::star::uno::Reference<
60 						com::sun::star::ucb::XContentIdentifierMapping > & xContentMapping
61 		, const com::sun::star::uno::Reference<
62 						com::sun::star::lang::XMultiServiceFactory > & xSMgr );
63 
64 	virtual ~CachedDynamicResultSet();
65 
66 
67 	//-----------------------------------------------------------------
68 	// XInterface inherited
69 	//-----------------------------------------------------------------
70 	XINTERFACE_DECL()
71 	//-----------------------------------------------------------------
72 	// XTypeProvider
73 	//-----------------------------------------------------------------
74 	XTYPEPROVIDER_DECL()
75 	//-----------------------------------------------------------------
76     // XServiceInfo
77 	//-----------------------------------------------------------------
78 	XSERVICEINFO_NOFACTORY_DECL()
79 
80 	//-----------------------------------------------------------------
81 	// own methods ( inherited )
82 	//-----------------------------------------------------------------
83     virtual void SAL_CALL
84 	impl_disposing( const com::sun::star::lang::EventObject& Source )
85 		throw( com::sun::star::uno::RuntimeException );
86 };
87 
88 //=========================================================================
89 
90 class CachedDynamicResultSetFactory
91 				: public cppu::OWeakObject
92 				, public com::sun::star::lang::XTypeProvider
93 				, public com::sun::star::lang::XServiceInfo
94 				, public com::sun::star::ucb::XCachedDynamicResultSetFactory
95 {
96 protected:
97 	com::sun::star::uno::Reference<
98 		com::sun::star::lang::XMultiServiceFactory >	m_xSMgr;
99 
100 public:
101 
102 	CachedDynamicResultSetFactory(
103 		const com::sun::star::uno::Reference<
104 		com::sun::star::lang::XMultiServiceFactory > & rSMgr);
105 
106 	virtual ~CachedDynamicResultSetFactory();
107 
108 	//-----------------------------------------------------------------
109 	// XInterface
110 	XINTERFACE_DECL()
111 
112 	//-----------------------------------------------------------------
113 	// XTypeProvider
114 	XTYPEPROVIDER_DECL()
115 
116 	//-----------------------------------------------------------------
117     // XServiceInfo
118 	XSERVICEINFO_DECL()
119 
120 	//-----------------------------------------------------------------
121     // XCachedDynamicResultSetFactory
122 
123 	virtual com::sun::star::uno::Reference<
124 				com::sun::star::ucb::XDynamicResultSet > SAL_CALL
125 	createCachedDynamicResultSet(
126 				  const com::sun::star::uno::Reference<
127 					com::sun::star::ucb::XDynamicResultSet > &
128 						SourceStub
129 				, const com::sun::star::uno::Reference<
130 					com::sun::star::ucb::XContentIdentifierMapping > &
131 						ContentIdentifierMapping
132 				)
133 			throw( com::sun::star::uno::RuntimeException );
134 };
135 
136 #endif
137 
138