xref: /AOO41X/main/ucb/source/cacher/cachedcontentresultsetstub.hxx (revision 6df1ea1f75e32b7bdb9b43f28f6c06e1fbd0c5ce)
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         throw ( com::sun::star::sdbc::SQLException
65               , com::sun::star::uno::RuntimeException );
66 
67     sal_Int32 SAL_CALL
68     impl_getColumnCount();
69 
70     void SAL_CALL
71     impl_getCurrentContentIdentifierString(
72             com::sun::star::uno::Any& rAny
73             , com::sun::star::uno::Reference<
74                 com::sun::star::ucb::XContentAccess > xContentAccess )
75             throw ( com::sun::star::uno::RuntimeException );
76 
77     void SAL_CALL
78     impl_getCurrentContentIdentifier(
79             com::sun::star::uno::Any& rAny
80             , com::sun::star::uno::Reference<
81                 com::sun::star::ucb::XContentAccess > xContentAccess )
82             throw ( com::sun::star::uno::RuntimeException );
83 
84     void SAL_CALL
85     impl_getCurrentContent(
86             com::sun::star::uno::Any& rAny
87             , com::sun::star::uno::Reference<
88                 com::sun::star::ucb::XContentAccess > xContentAccess )
89             throw ( com::sun::star::uno::RuntimeException );
90 
91     void SAL_CALL
92     impl_propagateFetchSizeAndDirection( sal_Int32 nFetchSize, sal_Bool bFetchDirection )
93         throw ( com::sun::star::uno::RuntimeException );
94 
95 public:
96     CachedContentResultSetStub( com::sun::star::uno::Reference<
97                         com::sun::star::sdbc::XResultSet > xOrigin );
98 
99     virtual ~CachedContentResultSetStub();
100 
101 
102     //-----------------------------------------------------------------
103     // XInterface inherited
104     //-----------------------------------------------------------------
105     XINTERFACE_DECL()
106     //-----------------------------------------------------------------
107     // own inherited
108     //-----------------------------------------------------------------
109     virtual void SAL_CALL
110     impl_propertyChange( const com::sun::star::beans::PropertyChangeEvent& evt )
111         throw( com::sun::star::uno::RuntimeException );
112 
113     virtual void SAL_CALL
114     impl_vetoableChange( const com::sun::star::beans::PropertyChangeEvent& aEvent )
115         throw( com::sun::star::beans::PropertyVetoException,
116                com::sun::star::uno::RuntimeException );
117     //-----------------------------------------------------------------
118     // XTypeProvider
119     //-----------------------------------------------------------------
120     XTYPEPROVIDER_DECL()
121     //-----------------------------------------------------------------
122     // XServiceInfo
123     //-----------------------------------------------------------------
124     XSERVICEINFO_NOFACTORY_DECL()
125 
126     //-----------------------------------------------------------------
127     // XFetchProvider
128     //-----------------------------------------------------------------
129 
130     virtual com::sun::star::ucb::FetchResult SAL_CALL
131     fetch( sal_Int32 nRowStartPosition
132         , sal_Int32 nRowCount, sal_Bool bDirection )
133         throw( com::sun::star::uno::RuntimeException );
134 
135     //-----------------------------------------------------------------
136     // XFetchProviderForContentAccess
137     //-----------------------------------------------------------------
138     virtual com::sun::star::ucb::FetchResult SAL_CALL
139          fetchContentIdentifierStrings( sal_Int32 nRowStartPosition
140         , sal_Int32 nRowCount, sal_Bool bDirection )
141         throw( com::sun::star::uno::RuntimeException );
142 
143     virtual com::sun::star::ucb::FetchResult SAL_CALL
144          fetchContentIdentifiers( sal_Int32 nRowStartPosition
145         , sal_Int32 nRowCount, sal_Bool bDirection )
146         throw( com::sun::star::uno::RuntimeException );
147 
148     virtual com::sun::star::ucb::FetchResult SAL_CALL
149          fetchContents( sal_Int32 nRowStartPosition
150         , sal_Int32 nRowCount, sal_Bool bDirection )
151         throw( com::sun::star::uno::RuntimeException );
152 };
153 
154 //=========================================================================
155 
156 class CachedContentResultSetStubFactory
157                 : public cppu::OWeakObject
158                 , public com::sun::star::lang::XTypeProvider
159                 , public com::sun::star::lang::XServiceInfo
160                 , public com::sun::star::ucb::XCachedContentResultSetStubFactory
161 {
162 protected:
163     com::sun::star::uno::Reference<
164         com::sun::star::lang::XMultiServiceFactory >    m_xSMgr;
165 
166 public:
167 
168     CachedContentResultSetStubFactory(
169         const com::sun::star::uno::Reference<
170         com::sun::star::lang::XMultiServiceFactory > & rSMgr);
171 
172     virtual ~CachedContentResultSetStubFactory();
173 
174     //-----------------------------------------------------------------
175     // XInterface
176     XINTERFACE_DECL()
177 
178     //-----------------------------------------------------------------
179     // XTypeProvider
180     XTYPEPROVIDER_DECL()
181 
182     //-----------------------------------------------------------------
183     // XServiceInfo
184     XSERVICEINFO_DECL()
185 
186     //-----------------------------------------------------------------
187     // XCachedContentResultSetStubFactory
188 
189     virtual com::sun::star::uno::Reference<
190                 com::sun::star::sdbc::XResultSet > SAL_CALL
191     createCachedContentResultSetStub(
192                 const com::sun::star::uno::Reference<
193                     com::sun::star::sdbc::XResultSet > & xSource )
194             throw( com::sun::star::uno::RuntimeException );
195 };
196 
197 #endif
198 
199