Kaydet (Commit) edb2dcff authored tarafından Norbert Thiebaud's avatar Norbert Thiebaud

de-macroize ucb sortdynres

Change-Id: I292875fde0be3f838ad838233df11d765e4affd1
üst 864afb34
......@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <vector>
#include <sortdynres.hxx>
#include <cppuhelper/interfacecontainer.hxx>
......@@ -27,7 +26,6 @@
#include <com/sun/star/ucb/CachedDynamicResultSetStubFactory.hpp>
#include <com/sun/star/ucb/XSourceInitialization.hpp>
using namespace com::sun::star::beans;
using namespace com::sun::star::lang;
using namespace com::sun::star::sdbc;
......@@ -36,8 +34,6 @@ using namespace com::sun::star::uno;
using namespace cppu;
// The mutex to synchronize access to containers.
static osl::Mutex& getContainerMutex()
{
......@@ -56,11 +52,8 @@ static osl::Mutex& getContainerMutex()
}
// SortedDynamicResultSet
SortedDynamicResultSet::SortedDynamicResultSet(
const Reference < XDynamicResultSet > &xOriginal,
const Sequence < NumberedSortingInfo > &aOptions,
......@@ -101,48 +94,37 @@ SortedDynamicResultSet::~SortedDynamicResultSet()
mpTwo = NULL;
}
// XServiceInfo methods.
// XInterface methods.
void SAL_CALL SortedDynamicResultSet::acquire()
throw()
OUString SAL_CALL SortedDynamicResultSet::getImplementationName()
throw( css::uno::RuntimeException, std::exception )
{
OWeakObject::acquire();
return getImplementationName_Static();
}
void SAL_CALL SortedDynamicResultSet::release()
throw()
OUString SortedDynamicResultSet::getImplementationName_Static()
{
OWeakObject::release();
return OUString( "com.sun.star.comp.ucb.SortedDynamicResultSet" );
}
css::uno::Any SAL_CALL SortedDynamicResultSet::queryInterface( const css::uno::Type & rType )
sal_Bool SAL_CALL SortedDynamicResultSet::supportsService( const OUString& ServiceName )
throw( css::uno::RuntimeException, std::exception )
{
css::uno::Any aRet = cppu::queryInterface( rType,
(static_cast< XTypeProvider* >(this)),
(static_cast< XServiceInfo* >(this)),
(static_cast< XComponent* >(this)),
(static_cast< XDynamicResultSet* >(this))
);
return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
return cppu::supportsService( this, ServiceName );
}
// XTypeProvider methods.
XTYPEPROVIDER_IMPL_3( SortedDynamicResultSet,
XTypeProvider,
XServiceInfo,
XDynamicResultSet );
// XServiceInfo methods.
XSERVICEINFO_NOFACTORY_IMPL_1( SortedDynamicResultSet,
OUString( "com.sun.star.comp.ucb.SortedDynamicResultSet" ),
OUString( DYNAMIC_RESULTSET_SERVICE_NAME ) );
css::uno::Sequence< OUString > SAL_CALL SortedDynamicResultSet::getSupportedServiceNames()
throw( css::uno::RuntimeException, std::exception )
{
return getSupportedServiceNames_Static();
}
css::uno::Sequence< OUString > SortedDynamicResultSet::getSupportedServiceNames_Static()
{
css::uno::Sequence< OUString > aSNS( 1 );
aSNS.getArray()[ 0 ] = OUString( DYNAMIC_RESULTSET_SERVICE_NAME );
return aSNS;
}
// XComponent methods.
......@@ -167,7 +149,6 @@ void SAL_CALL SortedDynamicResultSet::dispose()
mbUseOne = sal_True;
}
void SAL_CALL SortedDynamicResultSet::addEventListener(
const Reference< XEventListener >& Listener )
throw( RuntimeException, std::exception )
......@@ -181,7 +162,6 @@ void SAL_CALL SortedDynamicResultSet::addEventListener(
mpDisposeEventListeners->addInterface( Listener );
}
void SAL_CALL SortedDynamicResultSet::removeEventListener(
const Reference< XEventListener >& Listener )
throw( RuntimeException, std::exception )
......@@ -236,8 +216,7 @@ SortedDynamicResultSet::setListener( const Reference< XDynamicResultSetListener
void SAL_CALL
SortedDynamicResultSet::connectToCache(
const Reference< XDynamicResultSet > & xCache )
SortedDynamicResultSet::connectToCache( const Reference< XDynamicResultSet > & xCache )
throw( ListenerAlreadySetException,
AlreadyInitializedException,
ServiceNotFoundException,
......@@ -272,8 +251,7 @@ SortedDynamicResultSet::connectToCache(
}
sal_Int16 SAL_CALL
SortedDynamicResultSet::getCapabilities()
sal_Int16 SAL_CALL SortedDynamicResultSet::getCapabilities()
throw( RuntimeException, std::exception )
{
osl::Guard< osl::Mutex > aGuard( maMutex );
......@@ -307,8 +285,7 @@ SortedDynamicResultSet::getCapabilities()
update call at once is, while he disposes his broadcaster or while he is
removing himsef as listener (otherwise you deadlock)!!!
*/
void SAL_CALL
SortedDynamicResultSet::impl_notify( const ListEvent& Changes )
void SAL_CALL SortedDynamicResultSet::impl_notify( const ListEvent& Changes )
throw( RuntimeException )
{
osl::Guard< osl::Mutex > aGuard( maMutex );
......@@ -436,18 +413,15 @@ SortedDynamicResultSet::impl_notify( const ListEvent& Changes )
pCurSet->CheckProperties( nOldCount, bWasFinal );
}
// XEventListener
void SAL_CALL
SortedDynamicResultSet::impl_disposing( const EventObject& )
void SAL_CALL SortedDynamicResultSet::impl_disposing( const EventObject& )
throw( RuntimeException )
{
mxListener.clear();
mxOriginal.clear();
}
// private methods
void SortedDynamicResultSet::SendNotify()
......@@ -474,11 +448,8 @@ void SortedDynamicResultSet::SendNotify()
maActions.Clear();
}
// SortedDynamicResultSetFactory
SortedDynamicResultSetFactory::SortedDynamicResultSetFactory(
const Reference< XComponentContext > & rxContext )
{
......@@ -491,52 +462,60 @@ SortedDynamicResultSetFactory::~SortedDynamicResultSetFactory()
}
// XInterface methods.
void SAL_CALL SortedDynamicResultSetFactory::acquire()
throw()
// XServiceInfo methods.
OUString SAL_CALL SortedDynamicResultSetFactory::getImplementationName()
throw( css::uno::RuntimeException, std::exception )
{
OWeakObject::acquire();
return getImplementationName_Static();
}
void SAL_CALL SortedDynamicResultSetFactory::release()
throw()
OUString SortedDynamicResultSetFactory::getImplementationName_Static()
{
OWeakObject::release();
return OUString( "com.sun.star.comp.ucb.SortedDynamicResultSetFactory" );
}
css::uno::Any SAL_CALL SortedDynamicResultSetFactory::queryInterface( const css::uno::Type & rType )
sal_Bool SAL_CALL SortedDynamicResultSetFactory::supportsService( const OUString& ServiceName )
throw( css::uno::RuntimeException, std::exception )
{
css::uno::Any aRet = cppu::queryInterface( rType,
(static_cast< XTypeProvider* >(this)),
(static_cast< XServiceInfo* >(this)),
(static_cast< XSortedDynamicResultSetFactory* >(this))
);
return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
return cppu::supportsService( this, ServiceName );
}
// XTypeProvider methods.
XTYPEPROVIDER_IMPL_3( SortedDynamicResultSetFactory,
XTypeProvider,
XServiceInfo,
XSortedDynamicResultSetFactory );
// XServiceInfo methods.
css::uno::Sequence< OUString > SAL_CALL SortedDynamicResultSetFactory::getSupportedServiceNames()
throw( css::uno::RuntimeException, std::exception )
{
return getSupportedServiceNames_Static();
}
static css::uno::Reference< css::uno::XInterface > SAL_CALL
SortedDynamicResultSetFactory_CreateInstance( const css::uno::Reference<
css::lang::XMultiServiceFactory> & rSMgr )
throw( css::uno::Exception )
{
css::lang::XServiceInfo* pX = (css::lang::XServiceInfo*)
new SortedDynamicResultSetFactory( ucbhelper::getComponentContext(rSMgr) );
return css::uno::Reference< css::uno::XInterface >::query( pX );
}
XSERVICEINFO_IMPL_1_CTX( SortedDynamicResultSetFactory,
OUString( "com.sun.star.comp.ucb.SortedDynamicResultSetFactory" ),
OUString( DYNAMIC_RESULTSET_FACTORY_NAME ) );
css::uno::Sequence< OUString > SortedDynamicResultSetFactory::getSupportedServiceNames_Static()
{
com::sun::star::uno::Sequence< OUString > aSNS( 1 );
aSNS.getArray()[ 0 ] = OUString( DYNAMIC_RESULTSET_FACTORY_NAME );
return aSNS;
}
// Service factory implementation.
ONE_INSTANCE_SERVICE_FACTORY_IMPL( SortedDynamicResultSetFactory );
css::uno::Reference< css::lang::XSingleServiceFactory >
SortedDynamicResultSetFactory::createServiceFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& rxServiceMgr )
{
return css::uno::Reference< css::lang::XSingleServiceFactory >(
cppu::createOneInstanceFactory(
rxServiceMgr,
SortedDynamicResultSetFactory::getImplementationName_Static(),
SortedDynamicResultSetFactory_CreateInstance,
SortedDynamicResultSetFactory::getSupportedServiceNames_Static() ) );
}
// SortedDynamicResultSetFactory methods.
......@@ -552,12 +531,8 @@ SortedDynamicResultSetFactory::createSortedDynamicResultSet(
return xRet;
}
// EventList
void EventList::Clear()
{
for ( std::deque< ListAction* >::size_type i = 0;
......@@ -569,7 +544,6 @@ void EventList::Clear()
maData.clear();
}
void EventList::AddEvent( sal_IntPtr nType, sal_IntPtr nPos, sal_IntPtr nCount )
{
ListAction *pAction = new ListAction;
......@@ -580,12 +554,8 @@ void EventList::AddEvent( sal_IntPtr nType, sal_IntPtr nPos, sal_IntPtr nCount )
Insert( pAction );
}
// SortedDynamicResultSetListener
SortedDynamicResultSetListener::SortedDynamicResultSetListener(
SortedDynamicResultSet *mOwner )
{
......@@ -597,31 +567,6 @@ SortedDynamicResultSetListener::~SortedDynamicResultSetListener()
{
}
// XInterface methods.
void SAL_CALL SortedDynamicResultSetListener::acquire()
throw()
{
OWeakObject::acquire();
}
void SAL_CALL SortedDynamicResultSetListener::release()
throw()
{
OWeakObject::release();
}
css::uno::Any SAL_CALL SortedDynamicResultSetListener::queryInterface( const css::uno::Type & rType )
throw( css::uno::RuntimeException, std::exception )
{
css::uno::Any aRet = cppu::queryInterface( rType,
(static_cast< XEventListener* >(this)),
(static_cast< XDynamicResultSetListener* >(this))
);
return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
}
// XEventListener ( base of XDynamicResultSetListener )
void SAL_CALL
......@@ -647,7 +592,6 @@ SortedDynamicResultSetListener::notify( const ListEvent& Changes )
mpOwner->impl_notify( Changes );
}
// own methods:
void SAL_CALL
......
......@@ -20,38 +20,29 @@
#ifndef _SORTDYNRES_HXX
#define _SORTDYNRES_HXX
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/ucb/NumberedSortingInfo.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/ucb/XDynamicResultSet.hpp>
#include <com/sun/star/ucb/XDynamicResultSetListener.hpp>
#include <com/sun/star/ucb/ListenerAlreadySetException.hpp>
#include <com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp>
#include <cppuhelper/weak.hxx>
#include <osl/mutex.hxx>
#include <ucbhelper/macros.hxx>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
#include "sortresult.hxx"
namespace cppu {
class OInterfaceContainerHelper;
}
#define DYNAMIC_RESULTSET_SERVICE_NAME "com.sun.star.ucb.SortedDynamicResultSet"
#define DYNAMIC_RESULTSET_FACTORY_NAME "com.sun.star.ucb.SortedDynamicResultSetFactory"
class SortedDynamicResultSetListener;
class SortedDynamicResultSet:
public cppu::OWeakObject,
public css::lang::XTypeProvider,
public css::lang::XServiceInfo,
public css::ucb::XDynamicResultSet
class SortedDynamicResultSet: public cppu::WeakImplHelper2 <
css::lang::XServiceInfo,
css::ucb::XDynamicResultSet >
{
cppu::OInterfaceContainerHelper *mpDisposeEventListeners;
......@@ -71,12 +62,11 @@ class SortedDynamicResultSet:
EventList maActions;
osl::Mutex maMutex;
sal_Bool mbGotWelcome :1;
sal_Bool mbUseOne :1;
sal_Bool mbStatic :1;
sal_Bool mbGotWelcome:1;
sal_Bool mbUseOne:1;
sal_Bool mbStatic:1;
private:
void SendNotify();
public:
......@@ -88,28 +78,20 @@ public:
~SortedDynamicResultSet();
// XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
throw( css::uno::RuntimeException, std::exception );
virtual void SAL_CALL acquire()
throw();
virtual void SAL_CALL release()
throw();
// XTypeProvider
XTYPEPROVIDER_DECL()
// XServiceInfo
XSERVICEINFO_NOFACTORY_DECL()
virtual OUString SAL_CALL getImplementationName()
throw( css::uno::RuntimeException, std::exception );
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
throw( css::uno::RuntimeException, std::exception );
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
throw( css::uno::RuntimeException, std::exception );
static OUString getImplementationName_Static();
static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
// XComponent
virtual void SAL_CALL
dispose() throw( css::uno::RuntimeException, std::exception );
virtual void SAL_CALL dispose() throw( css::uno::RuntimeException, std::exception );
virtual void SAL_CALL
addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener )
......@@ -122,8 +104,7 @@ public:
// XDynamicResultSet
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL
getStaticResultSet( )
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getStaticResultSet()
throw( css::ucb::ListenerAlreadySetException, css::uno::RuntimeException, std::exception );
virtual void SAL_CALL
......@@ -144,20 +125,15 @@ public:
// own methods:
virtual void SAL_CALL
impl_disposing( const css::lang::EventObject& Source )
virtual void SAL_CALL impl_disposing( const css::lang::EventObject& Source )
throw( css::uno::RuntimeException );
virtual void SAL_CALL
impl_notify( const css::ucb::ListEvent& Changes )
virtual void SAL_CALL impl_notify( const css::ucb::ListEvent& Changes )
throw( css::uno::RuntimeException );
};
class SortedDynamicResultSetListener:
public cppu::OWeakObject,
public css::ucb::XDynamicResultSetListener
class SortedDynamicResultSetListener: public cppu::WeakImplHelper1 <
css::ucb::XDynamicResultSetListener >
{
SortedDynamicResultSet *mpOwner;
osl::Mutex maMutex;
......@@ -166,29 +142,17 @@ public:
SortedDynamicResultSetListener( SortedDynamicResultSet *mOwner );
~SortedDynamicResultSetListener();
// XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
throw( css::uno::RuntimeException, std::exception );
virtual void SAL_CALL acquire()
throw();
virtual void SAL_CALL release()
throw();
// XEventListener ( base of XDynamicResultSetListener )
virtual void SAL_CALL
disposing( const css::lang::EventObject& Source )
throw( css::uno::RuntimeException, std::exception );
// XDynamicResultSetListener
virtual void SAL_CALL
notify( const css::ucb::ListEvent& Changes )
virtual void SAL_CALL notify( const css::ucb::ListEvent& Changes )
throw( css::uno::RuntimeException, std::exception );
// own methods:
void SAL_CALL impl_OwnerDies();
......@@ -196,43 +160,36 @@ public:
class SortedDynamicResultSetFactory:
public cppu::OWeakObject,
public css::lang::XTypeProvider,
public css::lang::XServiceInfo,
public css::ucb::XSortedDynamicResultSetFactory
class SortedDynamicResultSetFactory: public cppu::WeakImplHelper2 <
css::lang::XServiceInfo,
css::ucb::XSortedDynamicResultSetFactory >
{
css::uno::Reference< css::uno::XComponentContext > m_xContext;
public:
SortedDynamicResultSetFactory(
const css::uno::Reference< css::uno::XComponentContext > & rxContext);
~SortedDynamicResultSetFactory();
// XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
throw( css::uno::RuntimeException, std::exception );
virtual void SAL_CALL acquire()
throw();
virtual void SAL_CALL release()
throw();
// XTypeProvider
XTYPEPROVIDER_DECL()
// XServiceInfo
XSERVICEINFO_DECL()
static css::uno::Reference< css::lang::XSingleServiceFactory > createServiceFactory(
const css::uno::Reference< css::lang::XMultiServiceFactory >& rxServiceMgr );
// XSortedDynamicResultSetFactory
virtual OUString SAL_CALL getImplementationName()
throw( css::uno::RuntimeException, std::exception );
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
throw( css::uno::RuntimeException, std::exception );
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
throw( css::uno::RuntimeException, std::exception );
static OUString getImplementationName_Static();
static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
virtual css::uno::Reference< css::ucb::XDynamicResultSet > SAL_CALL
createSortedDynamicResultSet(
const css::uno::Reference< css::ucb::XDynamicResultSet > & Source,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment