fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / ucb / source / cacher / cacheddynamicresultset.cxx
blobfd6d93c9307ff64cf012af45a932fe515eae4db0
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 <cacheddynamicresultset.hxx>
22 #include <com/sun/star/sdbc/XResultSet.hpp>
23 #include <cachedcontentresultset.hxx>
24 #include <osl/diagnose.h>
25 #include <comphelper/processfactory.hxx>
27 using namespace com::sun::star::lang;
28 using namespace com::sun::star::sdbc;
29 using namespace com::sun::star::ucb;
30 using namespace com::sun::star::uno;
33 CachedDynamicResultSet::CachedDynamicResultSet(
34 Reference< XDynamicResultSet > xOrigin
35 , const Reference< XContentIdentifierMapping > & xContentMapping
36 , const Reference< XComponentContext > & xContext )
37 : DynamicResultSetWrapper( xOrigin, xContext )
38 , m_xContentIdentifierMapping( xContentMapping )
40 impl_init();
43 CachedDynamicResultSet::~CachedDynamicResultSet()
45 impl_deinit();
48 //virtual
49 void SAL_CALL CachedDynamicResultSet
50 ::impl_InitResultSetOne( const Reference< XResultSet >& xResultSet )
52 DynamicResultSetWrapper::impl_InitResultSetOne( xResultSet );
53 OSL_ENSURE( m_xSourceResultOne.is(), "need source resultset" );
55 Reference< XResultSet > xCache(
56 new CachedContentResultSet( m_xContext, m_xSourceResultOne, m_xContentIdentifierMapping ) );
58 osl::Guard< osl::Mutex > aGuard( m_aMutex );
59 m_xMyResultOne = xCache;
62 //virtual
63 void SAL_CALL CachedDynamicResultSet
64 ::impl_InitResultSetTwo( const Reference< XResultSet >& xResultSet )
66 DynamicResultSetWrapper::impl_InitResultSetTwo( xResultSet );
67 OSL_ENSURE( m_xSourceResultTwo.is(), "need source resultset" );
69 Reference< XResultSet > xCache(
70 new CachedContentResultSet( m_xContext, m_xSourceResultTwo, m_xContentIdentifierMapping ) );
72 osl::Guard< osl::Mutex > aGuard( m_aMutex );
73 m_xMyResultTwo = xCache;
77 // XInterface methods.
78 void SAL_CALL CachedDynamicResultSet::acquire()
79 throw()
81 OWeakObject::acquire();
84 void SAL_CALL CachedDynamicResultSet::release()
85 throw()
87 OWeakObject::release();
90 Any SAL_CALL CachedDynamicResultSet
91 ::queryInterface( const Type& rType )
92 throw ( RuntimeException, std::exception )
94 //list all interfaces inclusive baseclasses of interfaces
96 Any aRet = DynamicResultSetWrapper::queryInterface( rType );
97 if( aRet.hasValue() )
98 return aRet;
100 aRet = cppu::queryInterface( rType,
101 static_cast< XTypeProvider* >( this )
102 , static_cast< XServiceInfo* >( this )
104 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
108 // XTypeProvider methods.
110 //list all interfaces exclusive baseclasses
111 XTYPEPROVIDER_IMPL_4( CachedDynamicResultSet
112 , XTypeProvider
113 , XServiceInfo
114 , XDynamicResultSet
115 , XSourceInitialization
119 // XServiceInfo methods.
122 XSERVICEINFO_NOFACTORY_IMPL_1( CachedDynamicResultSet,
123 OUString( "com.sun.star.comp.ucb.CachedDynamicResultSet" ),
124 CACHED_DRS_SERVICE_NAME );
127 // own methds. ( inherited )
129 //virtual
130 void SAL_CALL CachedDynamicResultSet
131 ::impl_disposing( const EventObject& Source )
132 throw( RuntimeException )
134 DynamicResultSetWrapper::impl_disposing( Source );
135 m_xContentIdentifierMapping.clear();
140 // class CachedDynamicResultSetFactory
144 CachedDynamicResultSetFactory::CachedDynamicResultSetFactory(
145 const Reference< XComponentContext > & xContext )
147 m_xContext = xContext;
150 CachedDynamicResultSetFactory::~CachedDynamicResultSetFactory()
155 // CachedDynamicResultSetFactory XInterface methods.
156 void SAL_CALL CachedDynamicResultSetFactory::acquire()
157 throw()
159 OWeakObject::acquire();
162 void SAL_CALL CachedDynamicResultSetFactory::release()
163 throw()
165 OWeakObject::release();
168 css::uno::Any SAL_CALL CachedDynamicResultSetFactory::queryInterface( const css::uno::Type & rType )
169 throw( css::uno::RuntimeException, std::exception )
171 css::uno::Any aRet = cppu::queryInterface( rType,
172 (static_cast< XTypeProvider* >(this)),
173 (static_cast< XServiceInfo* >(this)),
174 (static_cast< XCachedDynamicResultSetFactory* >(this))
176 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
179 // CachedDynamicResultSetFactory XTypeProvider methods.
182 XTYPEPROVIDER_IMPL_3( CachedDynamicResultSetFactory,
183 XTypeProvider,
184 XServiceInfo,
185 XCachedDynamicResultSetFactory );
188 // CachedDynamicResultSetFactory XServiceInfo methods.
191 XSERVICEINFO_IMPL_1_CTX( CachedDynamicResultSetFactory,
192 OUString( "com.sun.star.comp.ucb.CachedDynamicResultSetFactory" ),
193 CACHED_DRS_FACTORY_NAME );
196 // Service factory implementation.
199 ONE_INSTANCE_SERVICE_FACTORY_IMPL( CachedDynamicResultSetFactory );
202 // CachedDynamicResultSetFactory XCachedDynamicResultSetFactory methods.
205 //virtual
206 Reference< XDynamicResultSet > SAL_CALL CachedDynamicResultSetFactory
207 ::createCachedDynamicResultSet(
208 const Reference< XDynamicResultSet > & SourceStub
209 , const Reference< XContentIdentifierMapping > & ContentIdentifierMapping )
210 throw( RuntimeException, std::exception )
212 Reference< XDynamicResultSet > xRet;
213 xRet = new CachedDynamicResultSet( SourceStub, ContentIdentifierMapping, m_xContext );
214 return xRet;
218 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */