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

View File

@@ -37,35 +37,21 @@ using namespace com::sun::star::uno;
namespace ucbhelper namespace ucbhelper
{ {
// struct CommandEnvironment_Impl. // struct CommandEnvironment_Impl.
struct CommandEnvironment_Impl struct CommandEnvironment_Impl
{ {
Reference< XInteractionHandler > m_xInteractionHandler; Reference< XInteractionHandler > m_xInteractionHandler;
Reference< XProgressHandler > m_xProgressHandler; Reference< XProgressHandler > m_xProgressHandler;
CommandEnvironment_Impl( CommandEnvironment_Impl( const Reference< XInteractionHandler >& rxInteractionHandler,
const Reference< XInteractionHandler >& rxInteractionHandler, const Reference< XProgressHandler >& rxProgressHandler )
const Reference< XProgressHandler >& rxProgressHandler ) : m_xInteractionHandler( rxInteractionHandler )
: m_xInteractionHandler( rxInteractionHandler ), , m_xProgressHandler( rxProgressHandler ) {}
m_xProgressHandler( rxProgressHandler ) {}
}; };
// CommandEnvironment Implementation. // CommandEnvironment Implementation.
CommandEnvironment::CommandEnvironment( CommandEnvironment::CommandEnvironment(
const Reference< XInteractionHandler >& rxInteractionHandler, const Reference< XInteractionHandler >& rxInteractionHandler,
const Reference< XProgressHandler >& rxProgressHandler ) const Reference< XProgressHandler >& rxProgressHandler )
@@ -74,65 +60,23 @@ CommandEnvironment::CommandEnvironment(
rxProgressHandler ); rxProgressHandler );
} }
// virtual // virtual
CommandEnvironment::~CommandEnvironment() CommandEnvironment::~CommandEnvironment()
{ {
delete m_pImpl; 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. // XCommandEnvironemnt methods.
// virtual // virtual
Reference< XInteractionHandler > SAL_CALL Reference< XInteractionHandler > SAL_CALL CommandEnvironment::getInteractionHandler()
CommandEnvironment::getInteractionHandler()
throw ( RuntimeException, std::exception ) throw ( RuntimeException, std::exception )
{ {
return m_pImpl->m_xInteractionHandler; return m_pImpl->m_xInteractionHandler;
} }
// virtual // virtual
Reference< XProgressHandler > SAL_CALL Reference< XProgressHandler > SAL_CALL CommandEnvironment::getProgressHandler()
CommandEnvironment::getProgressHandler()
throw ( RuntimeException, std::exception ) throw ( RuntimeException, std::exception )
{ {
return m_pImpl->m_xProgressHandler; return m_pImpl->m_xProgressHandler;