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_STUB_HXX
29 #define _CACHED_DYNAMIC_RESULTSET_STUB_HXX
30 
31 #include <dynamicresultsetwrapper.hxx>
32 #include <com/sun/star/ucb/XCachedDynamicResultSetStubFactory.hpp>
33 
34 #define CACHED_DRS_STUB_SERVICE_NAME "com.sun.star.ucb.CachedDynamicResultSetStub"
35 #define CACHED_DRS_STUB_FACTORY_NAME "com.sun.star.ucb.CachedDynamicResultSetStubFactory"
36 
37 //=========================================================================
38 
39 class CachedDynamicResultSetStub
40 				: public DynamicResultSetWrapper
41 				, public com::sun::star::lang::XTypeProvider
42 				, public com::sun::star::lang::XServiceInfo
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 	CachedDynamicResultSetStub( com::sun::star::uno::Reference<
54 						com::sun::star::ucb::XDynamicResultSet > xOrigin
55 		, const com::sun::star::uno::Reference<
56 						com::sun::star::lang::XMultiServiceFactory > & xSMgr );
57 
58 	virtual ~CachedDynamicResultSetStub();
59 
60 
61 	//-----------------------------------------------------------------
62 	// XInterface inherited
63 	//-----------------------------------------------------------------
64 	XINTERFACE_DECL()
65 	//-----------------------------------------------------------------
66 	// XTypeProvider
67 	//-----------------------------------------------------------------
68 	XTYPEPROVIDER_DECL()
69 	//-----------------------------------------------------------------
70     // XServiceInfo
71 	//-----------------------------------------------------------------
72 	XSERVICEINFO_NOFACTORY_DECL()
73 };
74 
75 //=========================================================================
76 
77 class CachedDynamicResultSetStubFactory
78 				: public cppu::OWeakObject
79 				, public com::sun::star::lang::XTypeProvider
80 				, public com::sun::star::lang::XServiceInfo
81 				, public com::sun::star::ucb::XCachedDynamicResultSetStubFactory
82 {
83 protected:
84 	com::sun::star::uno::Reference<
85 		com::sun::star::lang::XMultiServiceFactory >	m_xSMgr;
86 
87 public:
88 
89 	CachedDynamicResultSetStubFactory(
90 		const com::sun::star::uno::Reference<
91 		com::sun::star::lang::XMultiServiceFactory > & rSMgr);
92 
93 	virtual ~CachedDynamicResultSetStubFactory();
94 
95 	//-----------------------------------------------------------------
96 	// XInterface
97 	XINTERFACE_DECL()
98 
99 	//-----------------------------------------------------------------
100 	// XTypeProvider
101 	XTYPEPROVIDER_DECL()
102 
103 	//-----------------------------------------------------------------
104     // XServiceInfo
105 	XSERVICEINFO_DECL()
106 
107 	//-----------------------------------------------------------------
108     // XCachedDynamicResultSetStubFactory
109 
110 	virtual com::sun::star::uno::Reference<
111 		com::sun::star::ucb::XDynamicResultSet > SAL_CALL
112 	createCachedDynamicResultSetStub(
113 				const com::sun::star::uno::Reference<
114 					com::sun::star::ucb::XDynamicResultSet > & Source )
115 				throw( com::sun::star::uno::RuntimeException );
116 
117 
118 	virtual void SAL_CALL connectToCache(
119 				  const com::sun::star::uno::Reference<
120 						com::sun::star::ucb::XDynamicResultSet > & Source
121 				, const com::sun::star::uno::Reference<
122 						com::sun::star::ucb::XDynamicResultSet > & TargetCache
123 				, const com::sun::star::uno::Sequence<
124 						com::sun::star::ucb::NumberedSortingInfo > & SortingInfo
125 				, const com::sun::star::uno::Reference<
126 						com::sun::star::ucb::XAnyCompareFactory > & CompareFactory
127 				)
128 				throw (
129 				  com::sun::star::ucb::ListenerAlreadySetException
130 				, com::sun::star::ucb::AlreadyInitializedException
131 				, com::sun::star::uno::RuntimeException
132 				 );
133 };
134 
135 #endif
136 
137