fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / ucb / source / cacher / cachedcontentresultset.hxx
blobd4de26951ed0cbd4b645c940a0aec82dc4f2bc04
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_CACHEDCONTENTRESULTSET_HXX
21 #define INCLUDED_UCB_SOURCE_CACHER_CACHEDCONTENTRESULTSET_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/FetchResult.hpp>
29 #include <com/sun/star/ucb/XContentIdentifierMapping.hpp>
30 #include <com/sun/star/ucb/XCachedContentResultSetFactory.hpp>
32 #define CACHED_CONTENT_RESULTSET_SERVICE_NAME "com.sun.star.ucb.CachedContentResultSet"
33 #define CACHED_CONTENT_RESULTSET_FACTORY_NAME "com.sun.star.ucb.CachedContentResultSetFactory"
37 namespace com { namespace sun { namespace star { namespace script {
38 class XTypeConverter;
39 } } } }
41 class CCRS_PropertySetInfo;
42 class CachedContentResultSet
43 : public ContentResultSetWrapper
44 , public com::sun::star::lang::XTypeProvider
45 , public com::sun::star::lang::XServiceInfo
48 // class CCRS_Cache
50 class CCRS_Cache
52 private:
53 com::sun::star::ucb::FetchResult* m_pResult;
54 com::sun::star::uno::Reference<
55 com::sun::star::ucb::XContentIdentifierMapping >
56 m_xContentIdentifierMapping;
57 com::sun::star::uno::Sequence< sal_Bool >* m_pMappedReminder;
59 private:
60 com::sun::star::uno::Any& SAL_CALL
61 getRowAny( sal_Int32 nRow )
62 throw( com::sun::star::sdbc::SQLException,
63 com::sun::star::uno::RuntimeException );
65 void SAL_CALL clear();
68 void SAL_CALL remindMapped( sal_Int32 nRow );
69 bool SAL_CALL isRowMapped( sal_Int32 nRow );
70 void SAL_CALL clearMappedReminder();
71 com::sun::star::uno::Sequence< sal_Bool >* SAL_CALL getMappedReminder();
73 public:
74 CCRS_Cache( const com::sun::star::uno::Reference<
75 com::sun::star::ucb::XContentIdentifierMapping > & xMapping );
76 ~CCRS_Cache();
78 void SAL_CALL loadData(
79 const com::sun::star::ucb::FetchResult& rResult );
81 bool SAL_CALL
82 hasRow( sal_Int32 nRow );
84 bool SAL_CALL
85 hasCausedException( sal_Int32 nRow );
87 sal_Int32 SAL_CALL
88 getMaxRow();
90 bool SAL_CALL
91 hasKnownLast();
94 const com::sun::star::uno::Any& SAL_CALL
95 getAny( sal_Int32 nRow, sal_Int32 nColumnIndex )
96 throw( com::sun::star::sdbc::SQLException,
97 com::sun::star::uno::RuntimeException );
99 const OUString& SAL_CALL
100 getContentIdentifierString( sal_Int32 nRow )
101 throw( com::sun::star::uno::RuntimeException );
103 const com::sun::star::uno::Reference<
104 com::sun::star::ucb::XContentIdentifier >& SAL_CALL
105 getContentIdentifier( sal_Int32 nRow )
106 throw( com::sun::star::uno::RuntimeException );
108 const com::sun::star::uno::Reference<
109 com::sun::star::ucb::XContent >& SAL_CALL
110 getContent( sal_Int32 nRow )
111 throw( com::sun::star::uno::RuntimeException );
114 //members
116 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
117 m_xContext;
119 //different Interfaces from Origin:
120 com::sun::star::uno::Reference< com::sun::star::ucb::XFetchProvider >
121 m_xFetchProvider; //XFetchProvider-interface from m_xOrigin
123 com::sun::star::uno::Reference< com::sun::star::ucb::XFetchProviderForContentAccess >
124 m_xFetchProviderForContentAccess; //XFetchProviderForContentAccess-interface from m_xOrigin
126 //my PropertySetInfo
127 com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo >
128 m_xMyPropertySetInfo;//holds m_pMyPropSetInfo alive
129 CCRS_PropertySetInfo* m_pMyPropSetInfo;
133 com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifierMapping >
134 m_xContentIdentifierMapping;// can be used for remote optimized ContentAccess
136 //some Properties and helping variables
137 sal_Int32 m_nRow;
138 bool m_bAfterLast; // TRUE, if m_nRow is after final count; can be TRUE without knowing the exact final count
140 sal_Int32 m_nLastAppliedPos;
141 bool m_bAfterLastApplied;
143 sal_Int32 m_nKnownCount; // count we know from the Origin
144 bool m_bFinalCount; // TRUE if the Origin has reached final count and we got that count in m_nKnownCount
146 sal_Int32 m_nFetchSize;
147 sal_Int32 m_nFetchDirection;
149 bool m_bLastReadWasFromCache;
150 bool m_bLastCachedReadWasNull;
152 //cache:
153 CCRS_Cache m_aCache;
154 CCRS_Cache m_aCacheContentIdentifierString;
155 CCRS_Cache m_aCacheContentIdentifier;
156 CCRS_Cache m_aCacheContent;
159 private:
161 //helping XPropertySet methods.
162 virtual void SAL_CALL impl_initPropertySetInfo() SAL_OVERRIDE;
166 bool SAL_CALL
167 applyPositionToOrigin( sal_Int32 nRow )
168 throw( com::sun::star::sdbc::SQLException,
169 com::sun::star::uno::RuntimeException );
171 void SAL_CALL
172 impl_fetchData( sal_Int32 nRow, sal_Int32 nCount
173 , sal_Int32 nFetchDirection )
174 throw( com::sun::star::uno::RuntimeException );
176 bool SAL_CALL
177 impl_isKnownValidPosition( sal_Int32 nRow );
179 bool SAL_CALL
180 impl_isKnownInvalidPosition( sal_Int32 nRow );
182 void SAL_CALL
183 impl_changeRowCount( sal_Int32 nOld, sal_Int32 nNew );
185 void SAL_CALL
186 impl_changeIsRowCountFinal( bool bOld, bool bNew );
188 public:
189 CachedContentResultSet(
190 const com::sun::star::uno::Reference<
191 com::sun::star::uno::XComponentContext > &
192 rxContext,
193 const com::sun::star::uno::Reference<
194 com::sun::star::sdbc::XResultSet > & xOrigin,
195 const com::sun::star::uno::Reference<
196 com::sun::star::ucb::XContentIdentifierMapping > &
197 xContentIdentifierMapping );
199 virtual ~CachedContentResultSet();
202 // XInterface
203 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
204 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
205 virtual void SAL_CALL acquire()
206 throw() SAL_OVERRIDE;
207 virtual void SAL_CALL release()
208 throw() SAL_OVERRIDE;
210 // XTypeProvider
212 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
213 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
214 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
215 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
217 // XServiceInfo
218 virtual OUString SAL_CALL getImplementationName()
219 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
220 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
221 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
222 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
223 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
225 static OUString getImplementationName_Static();
226 static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
228 // XPropertySet inherited
231 virtual void SAL_CALL
232 setPropertyValue( const OUString& aPropertyName,
233 const com::sun::star::uno::Any& aValue )
234 throw( com::sun::star::beans::UnknownPropertyException,
235 com::sun::star::beans::PropertyVetoException,
236 com::sun::star::lang::IllegalArgumentException,
237 com::sun::star::lang::WrappedTargetException,
238 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
240 virtual com::sun::star::uno::Any SAL_CALL
241 getPropertyValue( const OUString& PropertyName )
242 throw( com::sun::star::beans::UnknownPropertyException,
243 com::sun::star::lang::WrappedTargetException,
244 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
247 // own inherited
249 virtual void SAL_CALL
250 impl_disposing( const com::sun::star::lang::EventObject& Source )
251 throw( com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
253 virtual void SAL_CALL
254 impl_propertyChange( const com::sun::star::beans::PropertyChangeEvent& evt )
255 throw( com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
257 virtual void SAL_CALL
258 impl_vetoableChange( const com::sun::star::beans::PropertyChangeEvent& aEvent )
259 throw( com::sun::star::beans::PropertyVetoException,
260 com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
263 // XContentAccess inherited
265 virtual OUString SAL_CALL
266 queryContentIdentifierString()
267 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
269 virtual com::sun::star::uno::Reference<
270 com::sun::star::ucb::XContentIdentifier > SAL_CALL
271 queryContentIdentifier()
272 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
274 virtual com::sun::star::uno::Reference<
275 com::sun::star::ucb::XContent > SAL_CALL
276 queryContent()
277 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
280 // XResultSet inherited
282 virtual sal_Bool SAL_CALL
283 next()
284 throw( com::sun::star::sdbc::SQLException,
285 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
286 virtual sal_Bool SAL_CALL
287 isBeforeFirst()
288 throw( com::sun::star::sdbc::SQLException,
289 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
290 virtual sal_Bool SAL_CALL
291 isAfterLast()
292 throw( com::sun::star::sdbc::SQLException,
293 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
294 virtual sal_Bool SAL_CALL
295 isFirst()
296 throw( com::sun::star::sdbc::SQLException,
297 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
298 virtual sal_Bool SAL_CALL
299 isLast()
300 throw( com::sun::star::sdbc::SQLException,
301 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
302 virtual void SAL_CALL
303 beforeFirst()
304 throw( com::sun::star::sdbc::SQLException,
305 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
306 virtual void SAL_CALL
307 afterLast()
308 throw( com::sun::star::sdbc::SQLException,
309 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
310 virtual sal_Bool SAL_CALL
311 first()
312 throw( com::sun::star::sdbc::SQLException,
313 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
314 virtual sal_Bool SAL_CALL
315 last()
316 throw( com::sun::star::sdbc::SQLException,
317 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
318 virtual sal_Int32 SAL_CALL
319 getRow()
320 throw( com::sun::star::sdbc::SQLException,
321 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
322 virtual sal_Bool SAL_CALL
323 absolute( sal_Int32 row )
324 throw( com::sun::star::sdbc::SQLException,
325 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
326 virtual sal_Bool SAL_CALL
327 relative( sal_Int32 rows )
328 throw( com::sun::star::sdbc::SQLException,
329 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
330 virtual sal_Bool SAL_CALL
331 previous()
332 throw( com::sun::star::sdbc::SQLException,
333 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
334 virtual void SAL_CALL
335 refreshRow()
336 throw( com::sun::star::sdbc::SQLException,
337 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
338 virtual sal_Bool SAL_CALL
339 rowUpdated()
340 throw( com::sun::star::sdbc::SQLException,
341 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
342 virtual sal_Bool SAL_CALL
343 rowInserted()
344 throw( com::sun::star::sdbc::SQLException,
345 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
346 virtual sal_Bool SAL_CALL
347 rowDeleted()
348 throw( com::sun::star::sdbc::SQLException,
349 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
350 virtual com::sun::star::uno::Reference<
351 com::sun::star::uno::XInterface > SAL_CALL
352 getStatement()
353 throw( com::sun::star::sdbc::SQLException,
354 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
357 // XRow inherited
359 virtual sal_Bool SAL_CALL
360 wasNull()
361 throw( com::sun::star::sdbc::SQLException,
362 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
364 virtual OUString SAL_CALL
365 getString( sal_Int32 columnIndex )
366 throw( com::sun::star::sdbc::SQLException,
367 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
369 virtual sal_Bool SAL_CALL
370 getBoolean( sal_Int32 columnIndex )
371 throw( com::sun::star::sdbc::SQLException,
372 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
374 virtual sal_Int8 SAL_CALL
375 getByte( sal_Int32 columnIndex )
376 throw( com::sun::star::sdbc::SQLException,
377 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
379 virtual sal_Int16 SAL_CALL
380 getShort( sal_Int32 columnIndex )
381 throw( com::sun::star::sdbc::SQLException,
382 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
384 virtual sal_Int32 SAL_CALL
385 getInt( sal_Int32 columnIndex )
386 throw( com::sun::star::sdbc::SQLException,
387 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
389 virtual sal_Int64 SAL_CALL
390 getLong( sal_Int32 columnIndex )
391 throw( com::sun::star::sdbc::SQLException,
392 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
394 virtual float SAL_CALL
395 getFloat( sal_Int32 columnIndex )
396 throw( com::sun::star::sdbc::SQLException,
397 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
399 virtual double SAL_CALL
400 getDouble( sal_Int32 columnIndex )
401 throw( com::sun::star::sdbc::SQLException,
402 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
404 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
405 getBytes( sal_Int32 columnIndex )
406 throw( com::sun::star::sdbc::SQLException,
407 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
409 virtual com::sun::star::util::Date SAL_CALL
410 getDate( sal_Int32 columnIndex )
411 throw( com::sun::star::sdbc::SQLException,
412 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
414 virtual com::sun::star::util::Time SAL_CALL
415 getTime( sal_Int32 columnIndex )
416 throw( com::sun::star::sdbc::SQLException,
417 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
419 virtual com::sun::star::util::DateTime SAL_CALL
420 getTimestamp( sal_Int32 columnIndex )
421 throw( com::sun::star::sdbc::SQLException,
422 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
424 virtual com::sun::star::uno::Reference<
425 com::sun::star::io::XInputStream > SAL_CALL
426 getBinaryStream( sal_Int32 columnIndex )
427 throw( com::sun::star::sdbc::SQLException,
428 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
430 virtual com::sun::star::uno::Reference<
431 com::sun::star::io::XInputStream > SAL_CALL
432 getCharacterStream( sal_Int32 columnIndex )
433 throw( com::sun::star::sdbc::SQLException,
434 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
436 virtual com::sun::star::uno::Any SAL_CALL
437 getObject( sal_Int32 columnIndex,
438 const com::sun::star::uno::Reference<
439 com::sun::star::container::XNameAccess >& typeMap )
440 throw( com::sun::star::sdbc::SQLException,
441 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
443 virtual com::sun::star::uno::Reference<
444 com::sun::star::sdbc::XRef > SAL_CALL
445 getRef( sal_Int32 columnIndex )
446 throw( com::sun::star::sdbc::SQLException,
447 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
449 virtual com::sun::star::uno::Reference<
450 com::sun::star::sdbc::XBlob > SAL_CALL
451 getBlob( sal_Int32 columnIndex )
452 throw( com::sun::star::sdbc::SQLException,
453 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
455 virtual com::sun::star::uno::Reference<
456 com::sun::star::sdbc::XClob > SAL_CALL
457 getClob( sal_Int32 columnIndex )
458 throw( com::sun::star::sdbc::SQLException,
459 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
461 virtual com::sun::star::uno::Reference<
462 com::sun::star::sdbc::XArray > SAL_CALL
463 getArray( sal_Int32 columnIndex )
464 throw( com::sun::star::sdbc::SQLException,
465 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
468 // Type Converter support
471 private:
472 bool m_bTriedToGetTypeConverter;
473 com::sun::star::uno::Reference<
474 com::sun::star::script::XTypeConverter > m_xTypeConverter;
476 const com::sun::star::uno::Reference<
477 com::sun::star::script::XTypeConverter >& getTypeConverter();
479 template<typename T> T rowOriginGet(
480 T (SAL_CALL css::sdbc::XRow::* f)(sal_Int32), sal_Int32 columnIndex);
485 class CachedContentResultSetFactory
486 : public cppu::OWeakObject
487 , public com::sun::star::lang::XTypeProvider
488 , public com::sun::star::lang::XServiceInfo
489 , public com::sun::star::ucb::XCachedContentResultSetFactory
491 protected:
492 com::sun::star::uno::Reference<
493 com::sun::star::uno::XComponentContext > m_xContext;
495 public:
497 CachedContentResultSetFactory(
498 const com::sun::star::uno::Reference<
499 com::sun::star::uno::XComponentContext > & rxContext);
501 virtual ~CachedContentResultSetFactory();
504 // XInterface
505 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
506 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
507 virtual void SAL_CALL acquire()
508 throw() SAL_OVERRIDE;
509 virtual void SAL_CALL release()
510 throw() SAL_OVERRIDE;
512 // XTypeProvider
513 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
514 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
515 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
516 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
518 // XServiceInfo
519 virtual OUString SAL_CALL getImplementationName()
520 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
521 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
522 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
523 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
524 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
526 static OUString getImplementationName_Static();
527 static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
529 static css::uno::Reference< css::lang::XSingleServiceFactory >
530 createServiceFactory( const css::uno::Reference<
531 css::lang::XMultiServiceFactory >& rxServiceMgr );
533 // XCachedContentResultSetFactory
535 virtual com::sun::star::uno::Reference<
536 com::sun::star::sdbc::XResultSet > SAL_CALL
537 createCachedContentResultSet(
538 const com::sun::star::uno::Reference<
539 com::sun::star::sdbc::XResultSet > & xSource,
540 const com::sun::star::uno::Reference<
541 com::sun::star::ucb::XContentIdentifierMapping > & xMapping )
542 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
545 #endif
547 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */