1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cachedcontentresultsetstub.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _CACHED_CONTENT_RESULTSET_STUB_HXX
32 #define _CACHED_CONTENT_RESULTSET_STUB_HXX
34 #include <contentresultsetwrapper.hxx>
35 #include <com/sun/star/lang/XTypeProvider.hpp>
36 #include <com/sun/star/lang/XServiceInfo.hpp>
37 #include <com/sun/star/ucb/XFetchProvider.hpp>
38 #include <com/sun/star/ucb/XFetchProviderForContentAccess.hpp>
39 #include <com/sun/star/ucb/XCachedContentResultSetStubFactory.hpp>
41 #define CACHED_CRS_STUB_SERVICE_NAME "com.sun.star.ucb.CachedContentResultSetStub"
42 #define CACHED_CRS_STUB_FACTORY_NAME "com.sun.star.ucb.CachedContentResultSetStubFactory"
44 //=========================================================================
46 class CachedContentResultSetStub
47 : public ContentResultSetWrapper
48 , public com::sun::star::lang::XTypeProvider
49 , public com::sun::star::lang::XServiceInfo
50 , public com::sun::star::ucb::XFetchProvider
51 , public com::sun::star::ucb::XFetchProviderForContentAccess
54 sal_Int32 m_nColumnCount
;
55 sal_Bool m_bColumnCountCached
;
57 //members to propagate fetchsize and direction:
58 sal_Bool m_bNeedToPropagateFetchSize
;
59 sal_Bool m_bFirstFetchSizePropagationDone
;
60 sal_Int32 m_nLastFetchSize
;
61 sal_Bool m_bLastFetchDirection
;
62 const rtl::OUString m_aPropertyNameForFetchSize
;
63 const rtl::OUString m_aPropertyNameForFetchDirection
;
67 impl_getCurrentRowContent(
68 com::sun::star::uno::Any
& rRowContent
,
69 com::sun::star::uno::Reference
<
70 com::sun::star::sdbc::XRow
> xRow
)
71 throw ( com::sun::star::sdbc::SQLException
72 , com::sun::star::uno::RuntimeException
);
75 impl_getColumnCount();
78 impl_getCurrentContentIdentifierString(
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
);
85 impl_getCurrentContentIdentifier(
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
);
92 impl_getCurrentContent(
93 com::sun::star::uno::Any
& rAny
94 , com::sun::star::uno::Reference
<
95 com::sun::star::ucb::XContentAccess
> xContentAccess
)
96 throw ( com::sun::star::uno::RuntimeException
);
99 impl_propagateFetchSizeAndDirection( sal_Int32 nFetchSize
, sal_Bool bFetchDirection
)
100 throw ( com::sun::star::uno::RuntimeException
);
103 CachedContentResultSetStub( com::sun::star::uno::Reference
<
104 com::sun::star::sdbc::XResultSet
> xOrigin
);
106 virtual ~CachedContentResultSetStub();
109 //-----------------------------------------------------------------
110 // XInterface inherited
111 //-----------------------------------------------------------------
113 //-----------------------------------------------------------------
115 //-----------------------------------------------------------------
116 virtual void SAL_CALL
117 impl_propertyChange( const com::sun::star::beans::PropertyChangeEvent
& evt
)
118 throw( com::sun::star::uno::RuntimeException
);
120 virtual void SAL_CALL
121 impl_vetoableChange( const com::sun::star::beans::PropertyChangeEvent
& aEvent
)
122 throw( com::sun::star::beans::PropertyVetoException
,
123 com::sun::star::uno::RuntimeException
);
124 //-----------------------------------------------------------------
126 //-----------------------------------------------------------------
128 //-----------------------------------------------------------------
130 //-----------------------------------------------------------------
131 XSERVICEINFO_NOFACTORY_DECL()
133 //-----------------------------------------------------------------
135 //-----------------------------------------------------------------
137 virtual com::sun::star::ucb::FetchResult SAL_CALL
138 fetch( sal_Int32 nRowStartPosition
139 , sal_Int32 nRowCount
, sal_Bool bDirection
)
140 throw( com::sun::star::uno::RuntimeException
);
142 //-----------------------------------------------------------------
143 // XFetchProviderForContentAccess
144 //-----------------------------------------------------------------
145 virtual com::sun::star::ucb::FetchResult SAL_CALL
146 fetchContentIdentifierStrings( sal_Int32 nRowStartPosition
147 , sal_Int32 nRowCount
, sal_Bool bDirection
)
148 throw( com::sun::star::uno::RuntimeException
);
150 virtual com::sun::star::ucb::FetchResult SAL_CALL
151 fetchContentIdentifiers( sal_Int32 nRowStartPosition
152 , sal_Int32 nRowCount
, sal_Bool bDirection
)
153 throw( com::sun::star::uno::RuntimeException
);
155 virtual com::sun::star::ucb::FetchResult SAL_CALL
156 fetchContents( sal_Int32 nRowStartPosition
157 , sal_Int32 nRowCount
, sal_Bool bDirection
)
158 throw( com::sun::star::uno::RuntimeException
);
161 //=========================================================================
163 class CachedContentResultSetStubFactory
164 : public cppu::OWeakObject
165 , public com::sun::star::lang::XTypeProvider
166 , public com::sun::star::lang::XServiceInfo
167 , public com::sun::star::ucb::XCachedContentResultSetStubFactory
170 com::sun::star::uno::Reference
<
171 com::sun::star::lang::XMultiServiceFactory
> m_xSMgr
;
175 CachedContentResultSetStubFactory(
176 const com::sun::star::uno::Reference
<
177 com::sun::star::lang::XMultiServiceFactory
> & rSMgr
);
179 virtual ~CachedContentResultSetStubFactory();
181 //-----------------------------------------------------------------
185 //-----------------------------------------------------------------
189 //-----------------------------------------------------------------
193 //-----------------------------------------------------------------
194 // XCachedContentResultSetStubFactory
196 virtual com::sun::star::uno::Reference
<
197 com::sun::star::sdbc::XResultSet
> SAL_CALL
198 createCachedContentResultSetStub(
199 const com::sun::star::uno::Reference
<
200 com::sun::star::sdbc::XResultSet
> & xSource
)
201 throw( com::sun::star::uno::RuntimeException
);