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 _CACHED_CONTENT_RESULTSET_STUB_HXX
21 #define _CACHED_CONTENT_RESULTSET_STUB_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"
33 //=========================================================================
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 sal_Bool m_bColumnCountCached
;
46 //members to propagate fetchsize and direction:
47 sal_Bool m_bNeedToPropagateFetchSize
;
48 sal_Bool m_bFirstFetchSizePropagationDone
;
49 sal_Int32 m_nLastFetchSize
;
50 sal_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
, sal_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();
98 //-----------------------------------------------------------------
99 // XInterface inherited
100 //-----------------------------------------------------------------
102 //-----------------------------------------------------------------
104 //-----------------------------------------------------------------
105 virtual void SAL_CALL
106 impl_propertyChange( const com::sun::star::beans::PropertyChangeEvent
& evt
)
107 throw( com::sun::star::uno::RuntimeException
);
109 virtual void SAL_CALL
110 impl_vetoableChange( const com::sun::star::beans::PropertyChangeEvent
& aEvent
)
111 throw( com::sun::star::beans::PropertyVetoException
,
112 com::sun::star::uno::RuntimeException
);
113 //-----------------------------------------------------------------
115 //-----------------------------------------------------------------
117 //-----------------------------------------------------------------
119 //-----------------------------------------------------------------
120 XSERVICEINFO_NOFACTORY_DECL()
122 //-----------------------------------------------------------------
124 //-----------------------------------------------------------------
126 virtual com::sun::star::ucb::FetchResult SAL_CALL
127 fetch( sal_Int32 nRowStartPosition
128 , sal_Int32 nRowCount
, sal_Bool bDirection
)
129 throw( com::sun::star::uno::RuntimeException
);
131 //-----------------------------------------------------------------
132 // XFetchProviderForContentAccess
133 //-----------------------------------------------------------------
134 virtual com::sun::star::ucb::FetchResult SAL_CALL
135 fetchContentIdentifierStrings( sal_Int32 nRowStartPosition
136 , sal_Int32 nRowCount
, sal_Bool bDirection
)
137 throw( com::sun::star::uno::RuntimeException
);
139 virtual com::sun::star::ucb::FetchResult SAL_CALL
140 fetchContentIdentifiers( sal_Int32 nRowStartPosition
141 , sal_Int32 nRowCount
, sal_Bool bDirection
)
142 throw( com::sun::star::uno::RuntimeException
);
144 virtual com::sun::star::ucb::FetchResult SAL_CALL
145 fetchContents( sal_Int32 nRowStartPosition
146 , sal_Int32 nRowCount
, sal_Bool bDirection
)
147 throw( com::sun::star::uno::RuntimeException
);
150 //=========================================================================
152 class CachedContentResultSetStubFactory
153 : public cppu::OWeakObject
154 , public com::sun::star::lang::XTypeProvider
155 , public com::sun::star::lang::XServiceInfo
156 , public com::sun::star::ucb::XCachedContentResultSetStubFactory
159 com::sun::star::uno::Reference
<
160 com::sun::star::lang::XMultiServiceFactory
> m_xSMgr
;
164 CachedContentResultSetStubFactory(
165 const com::sun::star::uno::Reference
<
166 com::sun::star::lang::XMultiServiceFactory
> & rSMgr
);
168 virtual ~CachedContentResultSetStubFactory();
170 //-----------------------------------------------------------------
174 //-----------------------------------------------------------------
178 //-----------------------------------------------------------------
182 //-----------------------------------------------------------------
183 // XCachedContentResultSetStubFactory
185 virtual com::sun::star::uno::Reference
<
186 com::sun::star::sdbc::XResultSet
> SAL_CALL
187 createCachedContentResultSetStub(
188 const com::sun::star::uno::Reference
<
189 com::sun::star::sdbc::XResultSet
> & xSource
)
190 throw( com::sun::star::uno::RuntimeException
);
195 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */