1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_UCB_SOURCE_CACHER_CACHEDCONTENTRESULTSETSTUB_HXX
21 #define INCLUDED_UCB_SOURCE_CACHER_CACHEDCONTENTRESULTSETSTUB_HXX
23 #include <contentresultsetwrapper.hxx>
24 #include <com/sun/star/lang/XTypeProvider.hpp>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/ucb/XFetchProvider.hpp>
27 #include <com/sun/star/ucb/XFetchProviderForContentAccess.hpp>
28 #include <com/sun/star/ucb/XCachedContentResultSetStubFactory.hpp>
30 #define CACHED_CRS_STUB_SERVICE_NAME "com.sun.star.ucb.CachedContentResultSetStub"
31 #define CACHED_CRS_STUB_FACTORY_NAME "com.sun.star.ucb.CachedContentResultSetStubFactory"
35 class CachedContentResultSetStub
36 : public ContentResultSetWrapper
37 , public com::sun::star::lang::XTypeProvider
38 , public com::sun::star::lang::XServiceInfo
39 , public com::sun::star::ucb::XFetchProvider
40 , public com::sun::star::ucb::XFetchProviderForContentAccess
43 sal_Int32 m_nColumnCount
;
44 bool m_bColumnCountCached
;
46 //members to propagate fetchsize and direction:
47 bool m_bNeedToPropagateFetchSize
;
48 bool m_bFirstFetchSizePropagationDone
;
49 sal_Int32 m_nLastFetchSize
;
50 bool m_bLastFetchDirection
;
51 const OUString m_aPropertyNameForFetchSize
;
52 const OUString m_aPropertyNameForFetchDirection
;
56 impl_getCurrentRowContent(
57 com::sun::star::uno::Any
& rRowContent
,
58 com::sun::star::uno::Reference
<
59 com::sun::star::sdbc::XRow
> xRow
)
60 throw ( com::sun::star::sdbc::SQLException
61 , com::sun::star::uno::RuntimeException
);
64 impl_getColumnCount();
67 impl_getCurrentContentIdentifierString(
68 com::sun::star::uno::Any
& rAny
69 , com::sun::star::uno::Reference
<
70 com::sun::star::ucb::XContentAccess
> xContentAccess
)
71 throw ( com::sun::star::uno::RuntimeException
);
74 impl_getCurrentContentIdentifier(
75 com::sun::star::uno::Any
& rAny
76 , com::sun::star::uno::Reference
<
77 com::sun::star::ucb::XContentAccess
> xContentAccess
)
78 throw ( com::sun::star::uno::RuntimeException
);
81 impl_getCurrentContent(
82 com::sun::star::uno::Any
& rAny
83 , com::sun::star::uno::Reference
<
84 com::sun::star::ucb::XContentAccess
> xContentAccess
)
85 throw ( com::sun::star::uno::RuntimeException
);
88 impl_propagateFetchSizeAndDirection( sal_Int32 nFetchSize
, bool bFetchDirection
)
89 throw ( com::sun::star::uno::RuntimeException
);
92 CachedContentResultSetStub( com::sun::star::uno::Reference
<
93 com::sun::star::sdbc::XResultSet
> xOrigin
);
95 virtual ~CachedContentResultSetStub();
100 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
)
101 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
102 virtual void SAL_CALL
acquire()
103 throw() SAL_OVERRIDE
;
104 virtual void SAL_CALL
release()
105 throw() SAL_OVERRIDE
;
109 virtual void SAL_CALL
110 impl_propertyChange( const com::sun::star::beans::PropertyChangeEvent
& evt
)
111 throw( com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
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
) SAL_OVERRIDE
;
120 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
121 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
122 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes()
123 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
126 virtual OUString SAL_CALL
getImplementationName()
127 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
128 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
129 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
130 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
131 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
133 static OUString
getImplementationName_Static();
134 static css::uno::Sequence
< OUString
> getSupportedServiceNames_Static();
139 virtual com::sun::star::ucb::FetchResult SAL_CALL
140 fetch( sal_Int32 nRowStartPosition
141 , sal_Int32 nRowCount
, sal_Bool bDirection
)
142 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
145 // XFetchProviderForContentAccess
147 virtual com::sun::star::ucb::FetchResult SAL_CALL
148 fetchContentIdentifierStrings( sal_Int32 nRowStartPosition
149 , sal_Int32 nRowCount
, sal_Bool bDirection
)
150 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
152 virtual com::sun::star::ucb::FetchResult SAL_CALL
153 fetchContentIdentifiers( sal_Int32 nRowStartPosition
154 , sal_Int32 nRowCount
, sal_Bool bDirection
)
155 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
157 virtual com::sun::star::ucb::FetchResult SAL_CALL
158 fetchContents( sal_Int32 nRowStartPosition
159 , sal_Int32 nRowCount
, sal_Bool bDirection
)
160 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
165 class CachedContentResultSetStubFactory
166 : public cppu::OWeakObject
167 , public com::sun::star::lang::XTypeProvider
168 , public com::sun::star::lang::XServiceInfo
169 , public com::sun::star::ucb::XCachedContentResultSetStubFactory
172 com::sun::star::uno::Reference
<
173 com::sun::star::lang::XMultiServiceFactory
> m_xSMgr
;
177 CachedContentResultSetStubFactory(
178 const com::sun::star::uno::Reference
<
179 com::sun::star::lang::XMultiServiceFactory
> & rSMgr
);
181 virtual ~CachedContentResultSetStubFactory();
185 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
)
186 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
187 virtual void SAL_CALL
acquire()
188 throw() SAL_OVERRIDE
;
189 virtual void SAL_CALL
release()
190 throw() SAL_OVERRIDE
;
193 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
194 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
195 virtual css::uno::Sequence
< com::sun::star::uno::Type
> SAL_CALL
getTypes()
196 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
200 virtual OUString SAL_CALL
getImplementationName()
201 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
202 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
203 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
204 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
205 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
207 static OUString
getImplementationName_Static();
208 static css::uno::Sequence
< OUString
> getSupportedServiceNames_Static();
210 static css::uno::Reference
< css::lang::XSingleServiceFactory
>
211 createServiceFactory( const css::uno::Reference
<
212 css::lang::XMultiServiceFactory
>& rxServiceMgr
);
214 // XCachedContentResultSetStubFactory
216 virtual com::sun::star::uno::Reference
<
217 com::sun::star::sdbc::XResultSet
> SAL_CALL
218 createCachedContentResultSetStub(
219 const com::sun::star::uno::Reference
<
220 com::sun::star::sdbc::XResultSet
> & xSource
)
221 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
226 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */