LibreOffice Module ucb (master)  1
cachedcontentresultsetstub.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_UCB_SOURCE_CACHER_CACHEDCONTENTRESULTSETSTUB_HXX
21 #define INCLUDED_UCB_SOURCE_CACHER_CACHEDCONTENTRESULTSETSTUB_HXX
22 
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>
29 
30 #define CACHED_CRS_STUB_SERVICE_NAME "com.sun.star.ucb.CachedContentResultSetStub"
31 #define CACHED_CRS_STUB_FACTORY_NAME "com.sun.star.ucb.CachedContentResultSetStubFactory"
32 
33 
36  , public css::lang::XTypeProvider
37  , public css::lang::XServiceInfo
38  , public css::ucb::XFetchProvider
39  , public css::ucb::XFetchProviderForContentAccess
40 {
41 private:
42  sal_Int32 m_nColumnCount;
44 
45  //members to propagate fetchsize and direction:
48  sal_Int32 m_nLastFetchSize;
52 
55  void
57  css::uno::Any& rRowContent,
58  const css::uno::Reference< css::sdbc::XRow >& xRow );
59 
60  sal_Int32
62 
64  static void
66  css::uno::Any& rAny
67  , const css::uno::Reference< css::ucb::XContentAccess >& xContentAccess );
68 
70  static void
72  css::uno::Any& rAny
73  , const css::uno::Reference< css::ucb::XContentAccess >& xContentAccess );
74 
76  static void
78  css::uno::Any& rAny
79  , const css::uno::Reference< css::ucb::XContentAccess >& xContentAccess );
80 
82  void
83  impl_propagateFetchSizeAndDirection( sal_Int32 nFetchSize, bool bFetchDirection );
84 
85  css::ucb::FetchResult impl_fetchHelper(sal_Int32 nRowStartPosition, sal_Int32 nRowCount, bool bDirection,
86  std::function<void(css::uno::Any& rRowContent)> impl_loadRow);
87 
88 public:
89  CachedContentResultSetStub( css::uno::Reference< css::sdbc::XResultSet > const & xOrigin );
90 
91  virtual ~CachedContentResultSetStub() override;
92 
93 
94  // XInterface
95  virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
96  virtual void SAL_CALL acquire()
97  throw() override;
98  virtual void SAL_CALL release()
99  throw() override;
100 
101  // own inherited
102 
103  virtual void
104  impl_propertyChange( const css::beans::PropertyChangeEvent& evt ) override;
105 
106  virtual void
107  impl_vetoableChange( const css::beans::PropertyChangeEvent& aEvent ) override;
108 
109  // XTypeProvider
110 
111  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
112  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
113 
114  // XServiceInfo
115  virtual OUString SAL_CALL getImplementationName() override;
116  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
117  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
118 
119  // XFetchProvider
120 
121 
122  virtual css::ucb::FetchResult SAL_CALL
123  fetch( sal_Int32 nRowStartPosition
124  , sal_Int32 nRowCount, sal_Bool bDirection ) override;
125 
126 
127  // XFetchProviderForContentAccess
128 
129  virtual css::ucb::FetchResult SAL_CALL
130  fetchContentIdentifierStrings( sal_Int32 nRowStartPosition
131  , sal_Int32 nRowCount, sal_Bool bDirection ) override;
132 
133  virtual css::ucb::FetchResult SAL_CALL
134  fetchContentIdentifiers( sal_Int32 nRowStartPosition
135  , sal_Int32 nRowCount, sal_Bool bDirection ) override;
136 
137  virtual css::ucb::FetchResult SAL_CALL
138  fetchContents( sal_Int32 nRowStartPosition
139  , sal_Int32 nRowCount, sal_Bool bDirection ) override;
140 };
141 
142 
144  : public cppu::OWeakObject
145  , public css::lang::XTypeProvider
146  , public css::lang::XServiceInfo
147  , public css::ucb::XCachedContentResultSetStubFactory
148 {
149 public:
150 
152 
153  virtual ~CachedContentResultSetStubFactory() override;
154 
155 
156  // XInterface
157  virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
158  virtual void SAL_CALL acquire()
159  throw() override;
160  virtual void SAL_CALL release()
161  throw() override;
162 
163  // XTypeProvider
164  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
165  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
166 
167 
168  // XServiceInfo
169  virtual OUString SAL_CALL getImplementationName() override;
170  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
171  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
172 
173  static OUString getImplementationName_Static();
174  static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
175 
176  static css::uno::Reference< css::lang::XSingleServiceFactory >
177  createServiceFactory( const css::uno::Reference<
178  css::lang::XMultiServiceFactory >& rxServiceMgr );
179 
180  // XCachedContentResultSetStubFactory
181 
182  virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL
183  createCachedContentResultSetStub(
184  const css::uno::Reference< css::sdbc::XResultSet > & xSource ) override;
185 };
186 
187 #endif
188 
189 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Type
virtual css::ucb::FetchResult SAL_CALL fetch(sal_Int32 nRowStartPosition, sal_Int32 nRowCount, sal_Bool bDirection) override
CachedContentResultSetStub(css::uno::Reference< css::sdbc::XResultSet > const &xOrigin)
signed char sal_Int8
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual void impl_vetoableChange(const css::beans::PropertyChangeEvent &aEvent) override
virtual css::ucb::FetchResult SAL_CALL fetchContents(sal_Int32 nRowStartPosition, sal_Int32 nRowCount, sal_Bool bDirection) override
css::ucb::FetchResult impl_fetchHelper(sal_Int32 nRowStartPosition, sal_Int32 nRowCount, bool bDirection, std::function< void(css::uno::Any &rRowContent)> impl_loadRow)
static void impl_getCurrentContentIdentifierString(css::uno::Any &rAny, const css::uno::Reference< css::ucb::XContentAccess > &xContentAccess)
void impl_getCurrentRowContent(css::uno::Any &rRowContent, const css::uno::Reference< css::sdbc::XRow > &xRow)
static void impl_getCurrentContent(css::uno::Any &rAny, const css::uno::Reference< css::ucb::XContentAccess > &xContentAccess)
virtual void impl_propertyChange(const css::beans::PropertyChangeEvent &evt) override
unsigned char sal_Bool
virtual OUString SAL_CALL getImplementationName() override
void impl_propagateFetchSizeAndDirection(sal_Int32 nFetchSize, bool bFetchDirection)
virtual void SAL_CALL release() override
static void impl_getCurrentContentIdentifier(css::uno::Any &rAny, const css::uno::Reference< css::ucb::XContentAccess > &xContentAccess)
virtual css::ucb::FetchResult SAL_CALL fetchContentIdentifierStrings(sal_Int32 nRowStartPosition, sal_Int32 nRowCount, sal_Bool bDirection) override
virtual void SAL_CALL acquire() override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual css::ucb::FetchResult SAL_CALL fetchContentIdentifiers(sal_Int32 nRowStartPosition, sal_Int32 nRowCount, sal_Bool bDirection) override