fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / ucb / source / cacher / cacheddynamicresultsetstub.cxx
blob991f8eaa8d677c842cb317b7771c3be1760668cb
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 .
21 #include <cacheddynamicresultsetstub.hxx>
22 #include <com/sun/star/sdbc/XResultSet.hpp>
23 #include <cachedcontentresultsetstub.hxx>
24 #include <com/sun/star/ucb/ContentResultSetCapability.hpp>
25 #include <com/sun/star/ucb/SortedDynamicResultSetFactory.hpp>
26 #include <osl/diagnose.h>
27 #include <comphelper/processfactory.hxx>
29 using namespace com::sun::star::lang;
30 using namespace com::sun::star::sdbc;
31 using namespace com::sun::star::ucb;
32 using namespace com::sun::star::uno;
35 CachedDynamicResultSetStub::CachedDynamicResultSetStub(
36 Reference< XDynamicResultSet > xOrigin
37 , const Reference< XComponentContext > & rxContext )
38 : DynamicResultSetWrapper( xOrigin, rxContext )
40 OSL_ENSURE( m_xContext.is(), "need Multiservicefactory to create stub" );
41 impl_init();
44 CachedDynamicResultSetStub::~CachedDynamicResultSetStub()
46 impl_deinit();
49 //virtual
50 void SAL_CALL CachedDynamicResultSetStub
51 ::impl_InitResultSetOne( const Reference< XResultSet >& xResultSet )
53 DynamicResultSetWrapper::impl_InitResultSetOne( xResultSet );
54 OSL_ENSURE( m_xSourceResultOne.is(), "need source resultset" );
56 Reference< XResultSet > xStub(
57 new CachedContentResultSetStub( m_xSourceResultOne ) );
59 osl::Guard< osl::Mutex > aGuard( m_aMutex );
60 m_xMyResultOne = xStub;
63 //virtual
64 void SAL_CALL CachedDynamicResultSetStub
65 ::impl_InitResultSetTwo( const Reference< XResultSet >& xResultSet )
67 DynamicResultSetWrapper::impl_InitResultSetTwo( xResultSet );
68 OSL_ENSURE( m_xSourceResultTwo.is(), "need source resultset" );
70 Reference< XResultSet > xStub(
71 new CachedContentResultSetStub( m_xSourceResultTwo ) );
73 osl::Guard< osl::Mutex > aGuard( m_aMutex );
74 m_xMyResultTwo = xStub;
78 // XInterface methods.
79 void SAL_CALL CachedDynamicResultSetStub::acquire()
80 throw()
82 OWeakObject::acquire();
85 void SAL_CALL CachedDynamicResultSetStub::release()
86 throw()
88 OWeakObject::release();
91 Any SAL_CALL CachedDynamicResultSetStub
92 ::queryInterface( const Type& rType )
93 throw ( RuntimeException, std::exception )
95 //list all interfaces inclusive baseclasses of interfaces
97 Any aRet = DynamicResultSetWrapper::queryInterface( rType );
98 if( aRet.hasValue() )
99 return aRet;
101 aRet = cppu::queryInterface( rType,
102 static_cast< XTypeProvider* >( this )
103 , static_cast< XServiceInfo* >( this )
105 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
109 // XTypeProvider methods.
111 //list all interfaces exclusive baseclasses
112 XTYPEPROVIDER_IMPL_5( CachedDynamicResultSetStub
113 , XTypeProvider
114 , XServiceInfo
115 , XDynamicResultSet
116 , XDynamicResultSetListener
117 , XSourceInitialization
121 // XServiceInfo methods.
124 XSERVICEINFO_NOFACTORY_IMPL_1( CachedDynamicResultSetStub,
125 OUString( "com.sun.star.comp.ucb.CachedDynamicResultSetStub" ),
126 CACHED_DRS_STUB_SERVICE_NAME );
130 // class CachedDynamicResultSetStubFactory
134 CachedDynamicResultSetStubFactory::CachedDynamicResultSetStubFactory(
135 const Reference< XComponentContext > & rxContext )
137 m_xContext = rxContext;
140 CachedDynamicResultSetStubFactory::~CachedDynamicResultSetStubFactory()
145 // CachedDynamicResultSetStubFactory XInterface methods.
146 void SAL_CALL CachedDynamicResultSetStubFactory::acquire()
147 throw()
149 OWeakObject::acquire();
152 void SAL_CALL CachedDynamicResultSetStubFactory::release()
153 throw()
155 OWeakObject::release();
158 css::uno::Any SAL_CALL CachedDynamicResultSetStubFactory::queryInterface( const css::uno::Type & rType )
159 throw( css::uno::RuntimeException, std::exception )
161 css::uno::Any aRet = cppu::queryInterface( rType,
162 (static_cast< XTypeProvider* >(this)),
163 (static_cast< XServiceInfo* >(this)),
164 (static_cast< XCachedDynamicResultSetStubFactory* >(this))
166 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
169 // CachedDynamicResultSetStubFactory XTypeProvider methods.
172 XTYPEPROVIDER_IMPL_3( CachedDynamicResultSetStubFactory,
173 XTypeProvider,
174 XServiceInfo,
175 XCachedDynamicResultSetStubFactory );
178 // CachedDynamicResultSetStubFactory XServiceInfo methods.
181 XSERVICEINFO_IMPL_1_CTX( CachedDynamicResultSetStubFactory,
182 OUString( "com.sun.star.comp.ucb.CachedDynamicResultSetStubFactory" ),
183 CACHED_DRS_STUB_FACTORY_NAME );
186 // Service factory implementation.
189 ONE_INSTANCE_SERVICE_FACTORY_IMPL( CachedDynamicResultSetStubFactory );
192 // CachedDynamicResultSetStubFactory XCachedDynamicResultSetStubFactory methods.
195 //virtual
196 Reference< XDynamicResultSet > SAL_CALL CachedDynamicResultSetStubFactory
197 ::createCachedDynamicResultSetStub(
198 const Reference< XDynamicResultSet > & Source )
199 throw( RuntimeException, std::exception )
201 Reference< XDynamicResultSet > xRet;
202 xRet = new CachedDynamicResultSetStub( Source, m_xContext );
203 return xRet;
206 //virtual
207 void SAL_CALL CachedDynamicResultSetStubFactory
208 ::connectToCache(
209 const Reference< XDynamicResultSet > & Source
210 , const Reference< XDynamicResultSet > & TargetCache
211 , const Sequence< NumberedSortingInfo > & SortingInfo
212 , const Reference< XAnyCompareFactory > & CompareFactory
214 throw ( ListenerAlreadySetException
215 , AlreadyInitializedException
216 , RuntimeException, std::exception )
218 OSL_ENSURE( Source.is(), "a Source is needed" );
219 OSL_ENSURE( TargetCache.is(), "a TargetCache is needed" );
221 Reference< XDynamicResultSet > xSource( Source );
222 if( SortingInfo.getLength() &&
223 !( xSource->getCapabilities() & ContentResultSetCapability::SORTED )
226 Reference< XSortedDynamicResultSetFactory > xSortFactory;
229 xSortFactory = SortedDynamicResultSetFactory::create( m_xContext );
231 catch ( Exception const & )
235 if( xSortFactory.is() )
237 Reference< XDynamicResultSet > xSorted(
238 xSortFactory->createSortedDynamicResultSet(
239 Source, SortingInfo, CompareFactory ) );
240 if( xSorted.is() )
241 xSource = xSorted;
245 Reference< XDynamicResultSet > xStub(
246 new CachedDynamicResultSetStub( xSource, m_xContext ) );
248 Reference< XSourceInitialization > xTarget( TargetCache, UNO_QUERY );
249 OSL_ENSURE( xTarget.is(), "Target must have interface XSourceInitialization" );
251 xTarget->setSource( xStub );
254 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */