de-macroize ucbhelper commandenvironment

Change-Id: I39c7ca30d483dab3eae0f39be15ef9586aef7851
This commit is contained in:
Norbert Thiebaud
2014-03-08 14:22:13 -06:00
parent a14e1cb35b
commit b4ab8df0a4
2 changed files with 18 additions and 98 deletions

View File

@@ -20,27 +20,21 @@
#ifndef INCLUDED_UCBHELPER_COMMANDENVIRONMENT_HXX
#define INCLUDED_UCBHELPER_COMMANDENVIRONMENT_HXX
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <cppuhelper/weak.hxx>
#include <ucbhelper/macros.hxx>
#include <ucbhelper/ucbhelperdllapi.h>
#include <cppuhelper/implbase1.hxx>
namespace ucbhelper
{
struct CommandEnvironment_Impl;
/**
* This class implements the interface
* com::sun::star::ucb::XCommandEnvironement. Instances of this class can
* be used to supply environments to commands executed by UCB contents.
*/
class UCBHELPER_DLLPUBLIC CommandEnvironment : public cppu::OWeakObject,
public com::sun::star::lang::XTypeProvider,
public com::sun::star::ucb::XCommandEnvironment
class UCBHELPER_DLLPUBLIC CommandEnvironment :
public cppu::WeakImplHelper1< css::ucb::XCommandEnvironment >
{
CommandEnvironment_Impl* m_pImpl;
@@ -57,39 +51,21 @@ public:
* @param rxProgressHandler is the implementation of a Progress
* Handler or an empty reference.
*/
CommandEnvironment(
const com::sun::star::uno::Reference<
com::sun::star::task::XInteractionHandler >&
rxInteractionHandler,
const com::sun::star::uno::Reference<
com::sun::star::ucb::XProgressHandler >&
rxProgressHandler );
CommandEnvironment( const css::uno::Reference< css::task::XInteractionHandler >& rxInteractionHandler,
const css::uno::Reference< css::ucb::XProgressHandler >& rxProgressHandler );
/**
* Destructor.
*/
virtual ~CommandEnvironment();
// 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()
// XCommandEnvironemnt
virtual com::sun::star::uno::Reference<
com::sun::star::task::XInteractionHandler > SAL_CALL
getInteractionHandler()
throw ( com::sun::star::uno::RuntimeException, std::exception );
virtual css::uno::Reference< css::task::XInteractionHandler > SAL_CALL getInteractionHandler()
throw ( css::uno::RuntimeException,
std::exception );
virtual com::sun::star::uno::Reference<
com::sun::star::ucb::XProgressHandler > SAL_CALL
getProgressHandler()
throw ( com::sun::star::uno::RuntimeException, std::exception );
virtual css::uno::Reference< css::ucb::XProgressHandler > SAL_CALL getProgressHandler()
throw ( css::uno::RuntimeException,
std::exception );
};
} /* namespace ucbhelper */

View File

@@ -37,35 +37,21 @@ using namespace com::sun::star::uno;
namespace ucbhelper
{
// struct CommandEnvironment_Impl.
struct CommandEnvironment_Impl
{
Reference< XInteractionHandler > m_xInteractionHandler;
Reference< XProgressHandler > m_xProgressHandler;
Reference< XProgressHandler > m_xProgressHandler;
CommandEnvironment_Impl(
const Reference< XInteractionHandler >& rxInteractionHandler,
const Reference< XProgressHandler >& rxProgressHandler )
: m_xInteractionHandler( rxInteractionHandler ),
m_xProgressHandler( rxProgressHandler ) {}
CommandEnvironment_Impl( const Reference< XInteractionHandler >& rxInteractionHandler,
const Reference< XProgressHandler >& rxProgressHandler )
: m_xInteractionHandler( rxInteractionHandler )
, m_xProgressHandler( rxProgressHandler ) {}
};
// CommandEnvironment Implementation.
CommandEnvironment::CommandEnvironment(
const Reference< XInteractionHandler >& rxInteractionHandler,
const Reference< XProgressHandler >& rxProgressHandler )
@@ -74,65 +60,23 @@ CommandEnvironment::CommandEnvironment(
rxProgressHandler );
}
// virtual
CommandEnvironment::~CommandEnvironment()
{
delete m_pImpl;
}
// XInterface methods
void SAL_CALL CommandEnvironment::acquire()
throw()
{
OWeakObject::acquire();
}
void SAL_CALL CommandEnvironment::release()
throw()
{
OWeakObject::release();
}
css::uno::Any SAL_CALL CommandEnvironment::queryInterface( const css::uno::Type & rType )
throw( css::uno::RuntimeException, std::exception )
{
css::uno::Any aRet = cppu::queryInterface( rType,
(static_cast< XTypeProvider* >(this)),
(static_cast< XCommandEnvironment* >(this))
);
return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
}
// XTypeProvider methods
XTYPEPROVIDER_IMPL_2( CommandEnvironment,
XTypeProvider,
XCommandEnvironment );
// XCommandEnvironemnt methods.
// virtual
Reference< XInteractionHandler > SAL_CALL
CommandEnvironment::getInteractionHandler()
Reference< XInteractionHandler > SAL_CALL CommandEnvironment::getInteractionHandler()
throw ( RuntimeException, std::exception )
{
return m_pImpl->m_xInteractionHandler;
}
// virtual
Reference< XProgressHandler > SAL_CALL
CommandEnvironment::getProgressHandler()
Reference< XProgressHandler > SAL_CALL CommandEnvironment::getProgressHandler()
throw ( RuntimeException, std::exception )
{
return m_pImpl->m_xProgressHandler;