fdo#54938 Convert comphelper and vcl to cppu::supportsService

Change-Id: I391a7324bf92208fe632dac17874943343b1f65a
Reviewed-on: https://gerrit.libreoffice.org/7757
Reviewed-by: Marcos Souza <marcos.souza.org@gmail.com>
Tested-by: Marcos Souza <marcos.souza.org@gmail.com>
This commit is contained in:
Alexandre Vicenzi
2014-01-31 03:39:50 -02:00
committed by Marcos Souza
parent a7395942ae
commit e17cf91032
6 changed files with 273 additions and 390 deletions

View File

@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include "comphelper_module.hxx" #include "comphelper_module.hxx"
#include <com/sun/star/ucb/XAnyCompareFactory.hpp> #include <com/sun/star/ucb/XAnyCompareFactory.hpp>
@@ -27,21 +26,18 @@
#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp>
#include <cppuhelper/implbase3.hxx> #include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase1.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <map> #include <map>
using namespace com::sun::star::uno; using namespace com::sun::star::uno;
using namespace com::sun::star::ucb; using namespace com::sun::star::ucb;
using namespace com::sun::star::lang; using namespace com::sun::star::lang;
using namespace com::sun::star::i18n; using namespace com::sun::star::i18n;
//=============================================================================
class AnyCompare : public ::cppu::WeakImplHelper1< XAnyCompare > class AnyCompare : public ::cppu::WeakImplHelper1< XAnyCompare >
{ {
Reference< XCollator > m_rCollator; Reference< XCollator > m_rCollator;
@@ -57,8 +53,6 @@ public:
virtual sal_Int16 SAL_CALL compare( const Any& any1, const Any& any2 ) throw(RuntimeException); virtual sal_Int16 SAL_CALL compare( const Any& any1, const Any& any2 ) throw(RuntimeException);
}; };
//=============================================================================
class AnyCompareFactory : public cppu::WeakImplHelper3< XAnyCompareFactory, XInitialization, XServiceInfo > class AnyCompareFactory : public cppu::WeakImplHelper3< XAnyCompareFactory, XInitialization, XServiceInfo >
{ {
Reference< XAnyCompare > m_rAnyCompare; Reference< XAnyCompare > m_rAnyCompare;
@@ -87,8 +81,6 @@ public:
static Reference< XInterface > SAL_CALL Create( const Reference< XComponentContext >& ); static Reference< XInterface > SAL_CALL Create( const Reference< XComponentContext >& );
}; };
//===========================================================================================
sal_Int16 SAL_CALL AnyCompare::compare( const Any& any1, const Any& any2 ) throw(::com::sun::star::uno::RuntimeException) sal_Int16 SAL_CALL AnyCompare::compare( const Any& any1, const Any& any2 ) throw(::com::sun::star::uno::RuntimeException)
{ {
sal_Int16 aResult = 0; sal_Int16 aResult = 0;
@@ -104,8 +96,6 @@ sal_Int16 SAL_CALL AnyCompare::compare( const Any& any1, const Any& any2 ) throw
return aResult; return aResult;
} }
//===========================================================================================
Reference< XAnyCompare > SAL_CALL AnyCompareFactory::createAnyCompareByName( const OUString& aPropertyName ) throw(::com::sun::star::uno::RuntimeException) Reference< XAnyCompare > SAL_CALL AnyCompareFactory::createAnyCompareByName( const OUString& aPropertyName ) throw(::com::sun::star::uno::RuntimeException)
{ {
// for now only OUString properties compare is implemented // for now only OUString properties compare is implemented
@@ -127,7 +117,6 @@ void SAL_CALL AnyCompareFactory::initialize( const Sequence< Any >& aArguments )
return; return;
} }
} }
} }
OUString SAL_CALL AnyCompareFactory::getImplementationName( ) throw( RuntimeException ) OUString SAL_CALL AnyCompareFactory::getImplementationName( ) throw( RuntimeException )
@@ -142,8 +131,7 @@ OUString SAL_CALL AnyCompareFactory::getImplementationName_static( )
sal_Bool SAL_CALL AnyCompareFactory::supportsService( const OUString& ServiceName ) throw(RuntimeException) sal_Bool SAL_CALL AnyCompareFactory::supportsService( const OUString& ServiceName ) throw(RuntimeException)
{ {
OUString aServiceName( "com.sun.star.ucb.AnyCompareFactory" ); return cppu::supportsService(this, ServiceName);
return aServiceName == ServiceName;
} }
Sequence< OUString > SAL_CALL AnyCompareFactory::getSupportedServiceNames( ) throw(RuntimeException) Sequence< OUString > SAL_CALL AnyCompareFactory::getSupportedServiceNames( ) throw(RuntimeException)

View File

@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include "comphelper_module.hxx" #include "comphelper_module.hxx"
#include <com/sun/star/container/XIndexContainer.hpp> #include <com/sun/star/container/XIndexContainer.hpp>
@@ -25,6 +24,7 @@
#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp>
#include <cppuhelper/implbase2.hxx> #include <cppuhelper/implbase2.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <vector> #include <vector>
@@ -226,8 +226,7 @@ OUString SAL_CALL IndexedPropertyValuesContainer::getImplementationName_static(
sal_Bool SAL_CALL IndexedPropertyValuesContainer::supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException) sal_Bool SAL_CALL IndexedPropertyValuesContainer::supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException)
{ {
OUString aServiceName( "com.sun.star.document.IndexedPropertyValues" ); return cppu::supportsService(this, ServiceName);
return aServiceName == ServiceName;
} }
::com::sun::star::uno::Sequence< OUString > SAL_CALL IndexedPropertyValuesContainer::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) ::com::sun::star::uno::Sequence< OUString > SAL_CALL IndexedPropertyValuesContainer::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)

View File

@@ -25,7 +25,7 @@
#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp>
#include <cppuhelper/implbase2.hxx> #include <cppuhelper/implbase2.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <map> #include <map>
@@ -197,8 +197,7 @@ OUString SAL_CALL NamedPropertyValuesContainer::getImplementationName_static( )
sal_Bool SAL_CALL NamedPropertyValuesContainer::supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException) sal_Bool SAL_CALL NamedPropertyValuesContainer::supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException)
{ {
OUString aServiceName( "com.sun.star.document.NamedPropertyValues" ); return cppu::supportsService(this, ServiceName);
return aServiceName == ServiceName;
} }
::com::sun::star::uno::Sequence< OUString > SAL_CALL NamedPropertyValuesContainer::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) ::com::sun::star::uno::Sequence< OUString > SAL_CALL NamedPropertyValuesContainer::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
@@ -206,7 +205,6 @@ sal_Bool SAL_CALL NamedPropertyValuesContainer::supportsService( const OUString&
return getSupportedServiceNames_static(); return getSupportedServiceNames_static();
} }
::com::sun::star::uno::Sequence< OUString > SAL_CALL NamedPropertyValuesContainer::getSupportedServiceNames_static( ) ::com::sun::star::uno::Sequence< OUString > SAL_CALL NamedPropertyValuesContainer::getSupportedServiceNames_static( )
{ {
const OUString aServiceName( "com.sun.star.document.NamedPropertyValues" ); const OUString aServiceName( "com.sun.star.document.NamedPropertyValues" );

View File

@@ -25,6 +25,7 @@
#include "rtl/ustring.hxx" #include "rtl/ustring.hxx"
#include "comphelper/makesequence.hxx" #include "comphelper/makesequence.hxx"
#include <cppuhelper/supportsservice.hxx>
#include "DragSource.hxx" #include "DragSource.hxx"
#include "DragSourceContext.hxx" #include "DragSourceContext.hxx"
@@ -69,7 +70,6 @@ Sequence<OUString> dragSource_getSupportedServiceNames()
return makeSequence(OUString("com.sun.star.datatransfer.dnd.OleDragSource")); return makeSequence(OUString("com.sun.star.datatransfer.dnd.OleDragSource"));
} }
@implementation DragSourceHelper; @implementation DragSourceHelper;
-(DragSourceHelper*)initWithDragSource: (DragSource*) pds -(DragSourceHelper*)initWithDragSource: (DragSource*) pds
@@ -84,25 +84,21 @@ Sequence<OUString> dragSource_getSupportedServiceNames()
return self; return self;
} }
-(void)mouseDown: (NSEvent*)theEvent -(void)mouseDown: (NSEvent*)theEvent
{ {
mDragSource->saveMouseEvent(theEvent); mDragSource->saveMouseEvent(theEvent);
} }
-(void)mouseDragged: (NSEvent*)theEvent -(void)mouseDragged: (NSEvent*)theEvent
{ {
mDragSource->saveMouseEvent(theEvent); mDragSource->saveMouseEvent(theEvent);
} }
-(unsigned int)draggingSourceOperationMaskForLocal: (BOOL)isLocal -(unsigned int)draggingSourceOperationMaskForLocal: (BOOL)isLocal
{ {
return mDragSource->getSupportedDragOperations(isLocal); return mDragSource->getSupportedDragOperations(isLocal);
} }
-(void)draggedImage:(NSImage*)anImage beganAt:(NSPoint)aPoint -(void)draggedImage:(NSImage*)anImage beganAt:(NSPoint)aPoint
{ {
(void)anImage; (void)anImage;
@@ -116,7 +112,6 @@ Sequence<OUString> dragSource_getSupportedServiceNames()
mDragSource->mXDragSrcListener->dragEnter(dsde); mDragSource->mXDragSrcListener->dragEnter(dsde);
} }
-(void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation -(void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
{ {
(void)anImage; (void)anImage;
@@ -137,7 +132,6 @@ Sequence<OUString> dragSource_getSupportedServiceNames()
mDragSource->mXDragSrcListener = uno::Reference<XDragSourceListener>(); mDragSource->mXDragSrcListener = uno::Reference<XDragSourceListener>();
} }
-(void)draggedImage:(NSImage *)draggedImage movedTo:(NSPoint)screenPoint -(void)draggedImage:(NSImage *)draggedImage movedTo:(NSPoint)screenPoint
{ {
(void)draggedImage; (void)draggedImage;
@@ -153,7 +147,6 @@ Sequence<OUString> dragSource_getSupportedServiceNames()
@end @end
DragSource::DragSource(): DragSource::DragSource():
WeakComponentImplHelper3<XDragSource, XInitialization, XServiceInfo>(m_aMutex), WeakComponentImplHelper3<XDragSource, XInitialization, XServiceInfo>(m_aMutex),
mView(NULL), mView(NULL),
@@ -163,7 +156,6 @@ DragSource::DragSource():
{ {
} }
DragSource::~DragSource() DragSource::~DragSource()
{ {
if( mpFrame && AquaSalFrame::isAlive( mpFrame ) ) if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
@@ -171,7 +163,6 @@ DragSource::~DragSource()
[mDragSourceHelper release]; [mDragSourceHelper release];
} }
void SAL_CALL DragSource::initialize(const Sequence< Any >& aArguments) void SAL_CALL DragSource::initialize(const Sequence< Any >& aArguments)
throw(Exception) throw(Exception)
{ {
@@ -217,25 +208,18 @@ void SAL_CALL DragSource::initialize(const Sequence< Any >& aArguments)
[(id <MouseEventListener>)mView registerMouseEventListener: mDragSourceHelper]; [(id <MouseEventListener>)mView registerMouseEventListener: mDragSourceHelper];
} }
//----------------------------------------------------
// XDragSource
//----------------------------------------------------
sal_Bool SAL_CALL DragSource::isDragImageSupported( ) sal_Bool SAL_CALL DragSource::isDragImageSupported( )
throw(RuntimeException) throw(RuntimeException)
{ {
return true; return true;
} }
sal_Int32 SAL_CALL DragSource::getDefaultCursor( sal_Int8 /*dragAction*/ ) sal_Int32 SAL_CALL DragSource::getDefaultCursor( sal_Int8 /*dragAction*/ )
throw( IllegalArgumentException, RuntimeException) throw( IllegalArgumentException, RuntimeException)
{ {
return 0; return 0;
} }
void SAL_CALL DragSource::startDrag(const DragGestureEvent& trigger, void SAL_CALL DragSource::startDrag(const DragGestureEvent& trigger,
sal_Int8 sourceActions, sal_Int8 sourceActions,
sal_Int32 /*cursor*/, sal_Int32 /*cursor*/,
@@ -303,7 +287,6 @@ void SAL_CALL DragSource::startDrag(const DragGestureEvent& trigger,
g_DropSuccess = false; g_DropSuccess = false;
} }
// In order to initiate a D&D operation we need to // In order to initiate a D&D operation we need to
// provide the triggering mouse event which we get // provide the triggering mouse event which we get
// from the SalFrameView that is associated with // from the SalFrameView that is associated with
@@ -318,7 +301,6 @@ void DragSource::saveMouseEvent(NSEvent* theEvent)
mLastMouseEventBeforeStartDrag = theEvent; mLastMouseEventBeforeStartDrag = theEvent;
} }
/* isLocal indicates whether or not the DnD operation is OOo /* isLocal indicates whether or not the DnD operation is OOo
internal. internal.
*/ */
@@ -344,29 +326,19 @@ unsigned int DragSource::getSupportedDragOperations(bool isLocal) const
return srcActions; return srcActions;
} }
//################################
// XServiceInfo
//################################
OUString SAL_CALL DragSource::getImplementationName( ) throw (RuntimeException) OUString SAL_CALL DragSource::getImplementationName( ) throw (RuntimeException)
{ {
return dragSource_getImplementationName(); return dragSource_getImplementationName();
} }
sal_Bool SAL_CALL DragSource::supportsService( const OUString& ServiceName ) throw (RuntimeException) sal_Bool SAL_CALL DragSource::supportsService( const OUString& ServiceName ) throw (RuntimeException)
{ {
return ServiceName == "com.sun.star.datatransfer.dnd.OleDragSource"; return cppu::supportsService(this, ServiceName);
} }
Sequence< OUString > SAL_CALL DragSource::getSupportedServiceNames() throw (RuntimeException) Sequence< OUString > SAL_CALL DragSource::getSupportedServiceNames() throw (RuntimeException)
{ {
return dragSource_getSupportedServiceNames(); return dragSource_getSupportedServiceNames();
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -20,25 +20,20 @@
#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
#include <com/sun/star/datatransfer/XTransferable.hpp> #include <com/sun/star/datatransfer/XTransferable.hpp>
#include <com/sun/star/datatransfer/dnd/DropTargetDragEnterEvent.hpp> #include <com/sun/star/datatransfer/dnd/DropTargetDragEnterEvent.hpp>
#include "comphelper/makesequence.hxx" #include "comphelper/makesequence.hxx"
#include <cppuhelper/interfacecontainer.hxx> #include <cppuhelper/interfacecontainer.hxx>
#include "clipboard.hxx" #include "clipboard.hxx"
#include "DropTarget.hxx" #include "DropTarget.hxx"
#include "DragActionConversion.hxx" #include "DragActionConversion.hxx"
#include "DragSource.hxx" #include "DragSource.hxx"
#include <rtl/ustring.h> #include <rtl/ustring.h>
#include <stdio.h> #include <stdio.h>
#include <premac.h> #include <premac.h>
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#include <postmac.h> #include <postmac.h>
#include <osx/salframe.h> #include <osx/salframe.h>
#include <osx/salframeview.h> #include <osx/salframeview.h>
#include <cppuhelper/supportsservice.hxx>
using namespace cppu; using namespace cppu;
using namespace osl; using namespace osl;
@@ -57,13 +52,11 @@ OUString dropTarget_getImplementationName()
return OUString("com.sun.star.comp.datatransfer.dnd.OleDropTarget_V1"); return OUString("com.sun.star.comp.datatransfer.dnd.OleDropTarget_V1");
} }
Sequence<OUString> dropTarget_getSupportedServiceNames() Sequence<OUString> dropTarget_getSupportedServiceNames()
{ {
return makeSequence(OUString("com.sun.star.datatransfer.dnd.OleDropTarget")); return makeSequence(OUString("com.sun.star.datatransfer.dnd.OleDropTarget"));
} }
namespace /* private */ namespace /* private */
{ {
// Cocoa's coordinate system has its origin lower-left, VCL's // Cocoa's coordinate system has its origin lower-left, VCL's
@@ -98,40 +91,33 @@ namespace /* private */
return mDropTarget->draggingEntered(sender); return mDropTarget->draggingEntered(sender);
} }
-(NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender -(NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender
{ {
return mDropTarget->draggingUpdated(sender); return mDropTarget->draggingUpdated(sender);
} }
-(void)draggingExited:(id <NSDraggingInfo>)sender -(void)draggingExited:(id <NSDraggingInfo>)sender
{ {
mDropTarget->draggingExited(sender); mDropTarget->draggingExited(sender);
} }
-(BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender -(BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
{ {
return mDropTarget->prepareForDragOperation(sender); return mDropTarget->prepareForDragOperation(sender);
} }
-(BOOL)performDragOperation:(id <NSDraggingInfo>)sender -(BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{ {
return mDropTarget->performDragOperation(sender); return mDropTarget->performDragOperation(sender);
} }
-(void)concludeDragOperation:(id <NSDraggingInfo>)sender -(void)concludeDragOperation:(id <NSDraggingInfo>)sender
{ {
mDropTarget->concludeDragOperation(sender); mDropTarget->concludeDragOperation(sender);
} }
@end @end
DropTarget::DropTarget() : DropTarget::DropTarget() :
WeakComponentImplHelper5<XInitialization, XDropTarget, XDropTargetDragContext, XDropTargetDropContext, XServiceInfo>(m_aMutex), WeakComponentImplHelper5<XInitialization, XDropTarget, XDropTargetDragContext, XDropTargetDropContext, XServiceInfo>(m_aMutex),
mView(nil), mView(nil),
@@ -145,7 +131,6 @@ DropTarget::DropTarget() :
mDataFlavorMapper = DataFlavorMapperPtr_t(new DataFlavorMapper()); mDataFlavorMapper = DataFlavorMapperPtr_t(new DataFlavorMapper());
} }
DropTarget::~DropTarget() DropTarget::~DropTarget()
{ {
if( AquaSalFrame::isAlive( mpFrame ) ) if( AquaSalFrame::isAlive( mpFrame ) )
@@ -153,7 +138,6 @@ DropTarget::~DropTarget()
[mDropTargetHelper release]; [mDropTargetHelper release];
} }
sal_Int8 DropTarget::determineDropAction(sal_Int8 dropActions, id sender) const sal_Int8 DropTarget::determineDropAction(sal_Int8 dropActions, id sender) const
{ {
sal_Int8 dropAct = dropActions; sal_Int8 dropAct = dropActions;
@@ -205,7 +189,6 @@ sal_Int8 DropTarget::determineDropAction(sal_Int8 dropActions, id sender) const
return dropAct; return dropAct;
} }
NSDragOperation DropTarget::draggingEntered(id sender) NSDragOperation DropTarget::draggingEntered(id sender)
{ {
// Initially when DnD will be started no modifier key can be pressed yet // Initially when DnD will be started no modifier key can be pressed yet
@@ -249,7 +232,6 @@ NSDragOperation DropTarget::draggingEntered(id sender)
return OfficeToSystemDragActions(mSelectedDropAction); return OfficeToSystemDragActions(mSelectedDropAction);
} }
NSDragOperation DropTarget::draggingUpdated(id sender) NSDragOperation DropTarget::draggingUpdated(id sender)
{ {
sal_Int8 currentDragSourceActions = sal_Int8 currentDragSourceActions =
@@ -295,7 +277,6 @@ NSDragOperation DropTarget::draggingUpdated(id sender)
return dragOp; return dragOp;
} }
void DropTarget::draggingExited(id /*sender*/) void DropTarget::draggingExited(id /*sender*/)
{ {
DropTargetEvent dte(static_cast<OWeakObject*>(this), 0); DropTargetEvent dte(static_cast<OWeakObject*>(this), 0);
@@ -305,13 +286,11 @@ void DropTarget::draggingExited(id /*sender*/)
[[NSCursor arrowCursor] set]; [[NSCursor arrowCursor] set];
} }
BOOL DropTarget::prepareForDragOperation(id /*sender*/) BOOL DropTarget::prepareForDragOperation(id /*sender*/)
{ {
return 1; return 1;
} }
BOOL DropTarget::performDragOperation(id sender) BOOL DropTarget::performDragOperation(id sender)
{ {
bool bSuccess = false; bool bSuccess = false;
@@ -350,7 +329,6 @@ BOOL DropTarget::performDragOperation(id sender)
return bSuccess; return bSuccess;
} }
void DropTarget::concludeDragOperation(id /*sender*/) void DropTarget::concludeDragOperation(id /*sender*/)
{ {
mDragSourceSupportedActions = DNDConstants::ACTION_NONE; mDragSourceSupportedActions = DNDConstants::ACTION_NONE;
@@ -359,7 +337,6 @@ void DropTarget::concludeDragOperation(id /*sender*/)
[[NSCursor arrowCursor] set]; [[NSCursor arrowCursor] set];
} }
// called from WeakComponentImplHelperX::dispose // called from WeakComponentImplHelperX::dispose
// WeakComponentImplHelper calls disposing before it destroys // WeakComponentImplHelper calls disposing before it destroys
// itself. // itself.
@@ -367,7 +344,6 @@ void DropTarget::concludeDragOperation(id /*sender*/)
{ {
} }
void SAL_CALL DropTarget::initialize(const Sequence< Any >& aArguments) void SAL_CALL DropTarget::initialize(const Sequence< Any >& aArguments)
throw(Exception) throw(Exception)
{ {
@@ -400,74 +376,59 @@ void DropTarget::concludeDragOperation(id /*sender*/)
} }
} }
void SAL_CALL DropTarget::addDropTargetListener(const uno::Reference<XDropTargetListener>& dtl) void SAL_CALL DropTarget::addDropTargetListener(const uno::Reference<XDropTargetListener>& dtl)
throw(RuntimeException) throw(RuntimeException)
{ {
rBHelper.addListener(::getCppuType(&dtl), dtl); rBHelper.addListener(::getCppuType(&dtl), dtl);
} }
void SAL_CALL DropTarget::removeDropTargetListener(const uno::Reference<XDropTargetListener>& dtl) void SAL_CALL DropTarget::removeDropTargetListener(const uno::Reference<XDropTargetListener>& dtl)
throw(RuntimeException) throw(RuntimeException)
{ {
rBHelper.removeListener(::getCppuType(&dtl), dtl); rBHelper.removeListener(::getCppuType(&dtl), dtl);
} }
sal_Bool SAL_CALL DropTarget::isActive( ) throw(RuntimeException) sal_Bool SAL_CALL DropTarget::isActive( ) throw(RuntimeException)
{ {
return mbActive; return mbActive;
} }
void SAL_CALL DropTarget::setActive(sal_Bool active) throw(RuntimeException) void SAL_CALL DropTarget::setActive(sal_Bool active) throw(RuntimeException)
{ {
mbActive = active; mbActive = active;
} }
sal_Int8 SAL_CALL DropTarget::getDefaultActions() throw(RuntimeException) sal_Int8 SAL_CALL DropTarget::getDefaultActions() throw(RuntimeException)
{ {
return mDefaultActions; return mDefaultActions;
} }
void SAL_CALL DropTarget::setDefaultActions(sal_Int8 actions) throw(RuntimeException) void SAL_CALL DropTarget::setDefaultActions(sal_Int8 actions) throw(RuntimeException)
{ {
OSL_ENSURE( actions < 8, "No valid default actions"); OSL_ENSURE( actions < 8, "No valid default actions");
mDefaultActions= actions; mDefaultActions= actions;
} }
// XDropTargetDragContext
void SAL_CALL DropTarget::acceptDrag(sal_Int8 dragOperation) throw (RuntimeException) void SAL_CALL DropTarget::acceptDrag(sal_Int8 dragOperation) throw (RuntimeException)
{ {
mSelectedDropAction = dragOperation; mSelectedDropAction = dragOperation;
} }
void SAL_CALL DropTarget::rejectDrag() throw (RuntimeException) void SAL_CALL DropTarget::rejectDrag() throw (RuntimeException)
{ {
mSelectedDropAction = DNDConstants::ACTION_NONE; mSelectedDropAction = DNDConstants::ACTION_NONE;
} }
//XDropTargetDropContext
void SAL_CALL DropTarget::acceptDrop(sal_Int8 dropOperation) throw( RuntimeException) void SAL_CALL DropTarget::acceptDrop(sal_Int8 dropOperation) throw( RuntimeException)
{ {
mSelectedDropAction = dropOperation; mSelectedDropAction = dropOperation;
} }
void SAL_CALL DropTarget::rejectDrop() throw (RuntimeException) void SAL_CALL DropTarget::rejectDrop() throw (RuntimeException)
{ {
mSelectedDropAction = DNDConstants::ACTION_NONE; mSelectedDropAction = DNDConstants::ACTION_NONE;
} }
void SAL_CALL DropTarget::dropComplete(sal_Bool success) throw (RuntimeException) void SAL_CALL DropTarget::dropComplete(sal_Bool success) throw (RuntimeException)
{ {
// Reset the internal transferable used as shortcut in case this is // Reset the internal transferable used as shortcut in case this is
@@ -477,7 +438,6 @@ void DropTarget::concludeDragOperation(id /*sender*/)
DragSource::g_DropSuccess = success; DragSource::g_DropSuccess = success;
} }
void DropTarget::fire_drop( const DropTargetDropEvent& dte) void DropTarget::fire_drop( const DropTargetDropEvent& dte)
{ {
OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (uno::Reference<XDropTargetListener>* )0 ) ); OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (uno::Reference<XDropTargetListener>* )0 ) );
@@ -494,7 +454,6 @@ void DropTarget::concludeDragOperation(id /*sender*/)
} }
} }
void DropTarget::fire_dragEnter(const DropTargetDragEnterEvent& e) void DropTarget::fire_dragEnter(const DropTargetDragEnterEvent& e)
{ {
OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (uno::Reference<XDropTargetListener>* )0 ) ); OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (uno::Reference<XDropTargetListener>* )0 ) );
@@ -511,7 +470,6 @@ void DropTarget::concludeDragOperation(id /*sender*/)
} }
} }
void DropTarget::fire_dragExit(const DropTargetEvent& dte) void DropTarget::fire_dragExit(const DropTargetEvent& dte)
{ {
OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (uno::Reference<XDropTargetListener>* )0 ) ); OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (uno::Reference<XDropTargetListener>* )0 ) );
@@ -529,7 +487,6 @@ void DropTarget::concludeDragOperation(id /*sender*/)
} }
} }
void DropTarget::fire_dragOver(const DropTargetDragEvent& dtde) void DropTarget::fire_dragOver(const DropTargetDragEvent& dtde)
{ {
OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (uno::Reference<XDropTargetListener>* )0 ) ); OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (uno::Reference<XDropTargetListener>* )0 ) );
@@ -546,7 +503,6 @@ void DropTarget::concludeDragOperation(id /*sender*/)
} }
} }
void DropTarget::fire_dropActionChanged(const DropTargetDragEvent& dtde) void DropTarget::fire_dropActionChanged(const DropTargetDragEvent& dtde)
{ {
OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (uno::Reference<XDropTargetListener>* )0 ) ); OInterfaceContainerHelper* pContainer= rBHelper.getContainer( getCppuType( (uno::Reference<XDropTargetListener>* )0 ) );
@@ -563,21 +519,16 @@ void DropTarget::concludeDragOperation(id /*sender*/)
} }
} }
// XServiceInfo
OUString SAL_CALL DropTarget::getImplementationName() throw (RuntimeException) OUString SAL_CALL DropTarget::getImplementationName() throw (RuntimeException)
{ {
return dropTarget_getImplementationName(); return dropTarget_getImplementationName();
} }
sal_Bool SAL_CALL DropTarget::supportsService( const OUString& ServiceName ) throw (RuntimeException) sal_Bool SAL_CALL DropTarget::supportsService( const OUString& ServiceName ) throw (RuntimeException)
{ {
return ServiceName == "com.sun.star.datatransfer.dnd.OleDropTarget"; return cppu::supportsService(this, ServiceName);
} }
Sequence< OUString > SAL_CALL DropTarget::getSupportedServiceNames( ) throw (RuntimeException) Sequence< OUString > SAL_CALL DropTarget::getSupportedServiceNames( ) throw (RuntimeException)
{ {
return dropTarget_getSupportedServiceNames(); return dropTarget_getSupportedServiceNames();

View File

@@ -24,7 +24,7 @@
#include <com/sun/star/datatransfer/MimeContentTypeFactory.hpp> #include <com/sun/star/datatransfer/MimeContentTypeFactory.hpp>
#include "comphelper/makesequence.hxx" #include "comphelper/makesequence.hxx"
#include "comphelper/processfactory.hxx" #include "comphelper/processfactory.hxx"
#include <cppuhelper/supportsservice.hxx>
#include <boost/assert.hpp> #include <boost/assert.hpp>
using namespace com::sun::star::datatransfer; using namespace com::sun::star::datatransfer;
@@ -68,7 +68,6 @@ using namespace comphelper;
@end @end
OUString clipboard_getImplementationName() OUString clipboard_getImplementationName()
{ {
return OUString("com.sun.star.datatransfer.clipboard.AquaClipboard"); return OUString("com.sun.star.datatransfer.clipboard.AquaClipboard");
@@ -79,7 +78,6 @@ Sequence<OUString> clipboard_getSupportedServiceNames()
return makeSequence(OUString("com.sun.star.datatransfer.clipboard.SystemClipboard")); return makeSequence(OUString("com.sun.star.datatransfer.clipboard.SystemClipboard"));
} }
AquaClipboard::AquaClipboard(NSPasteboard* pasteboard, bool bUseSystemPasteboard) : AquaClipboard::AquaClipboard(NSPasteboard* pasteboard, bool bUseSystemPasteboard) :
WeakComponentImplHelper3<XSystemClipboard, XFlushableClipboard, XServiceInfo>(m_aMutex), WeakComponentImplHelper3<XSystemClipboard, XFlushableClipboard, XServiceInfo>(m_aMutex),
mIsSystemPasteboard(bUseSystemPasteboard) mIsSystemPasteboard(bUseSystemPasteboard)
@@ -146,7 +144,6 @@ AquaClipboard::~AquaClipboard()
[mPasteboard release]; [mPasteboard release];
} }
Reference<XTransferable> SAL_CALL AquaClipboard::getContents() throw(RuntimeException) Reference<XTransferable> SAL_CALL AquaClipboard::getContents() throw(RuntimeException)
{ {
MutexGuard aGuard(m_aMutex); MutexGuard aGuard(m_aMutex);
@@ -163,7 +160,6 @@ Reference<XTransferable> SAL_CALL AquaClipboard::getContents() throw(RuntimeExce
mPasteboard)); mPasteboard));
} }
void SAL_CALL AquaClipboard::setContents(const Reference<XTransferable>& xTransferable, void SAL_CALL AquaClipboard::setContents(const Reference<XTransferable>& xTransferable,
const Reference<XClipboardOwner>& xClipboardOwner) const Reference<XClipboardOwner>& xClipboardOwner)
throw( RuntimeException ) throw( RuntimeException )
@@ -194,19 +190,16 @@ void SAL_CALL AquaClipboard::setContents(const Reference<XTransferable>& xTransf
fireClipboardChangedEvent(); fireClipboardChangedEvent();
} }
OUString SAL_CALL AquaClipboard::getName() throw( RuntimeException ) OUString SAL_CALL AquaClipboard::getName() throw( RuntimeException )
{ {
return OUString(); return OUString();
} }
sal_Int8 SAL_CALL AquaClipboard::getRenderingCapabilities() throw( RuntimeException ) sal_Int8 SAL_CALL AquaClipboard::getRenderingCapabilities() throw( RuntimeException )
{ {
return 0; return 0;
} }
void SAL_CALL AquaClipboard::addClipboardListener(const Reference< XClipboardListener >& listener) void SAL_CALL AquaClipboard::addClipboardListener(const Reference< XClipboardListener >& listener)
throw( RuntimeException ) throw( RuntimeException )
{ {
@@ -219,7 +212,6 @@ void SAL_CALL AquaClipboard::addClipboardListener(const Reference< XClipboardLis
mClipboardListeners.push_back(listener); mClipboardListeners.push_back(listener);
} }
void SAL_CALL AquaClipboard::removeClipboardListener(const Reference< XClipboardListener >& listener) void SAL_CALL AquaClipboard::removeClipboardListener(const Reference< XClipboardListener >& listener)
throw( RuntimeException ) throw( RuntimeException )
{ {
@@ -232,7 +224,6 @@ void SAL_CALL AquaClipboard::removeClipboardListener(const Reference< XClipboard
mClipboardListeners.remove(listener); mClipboardListeners.remove(listener);
} }
void AquaClipboard::applicationDidBecomeActive(NSNotification*) void AquaClipboard::applicationDidBecomeActive(NSNotification*)
{ {
ClearableMutexGuard aGuard(m_aMutex); ClearableMutexGuard aGuard(m_aMutex);
@@ -263,7 +254,6 @@ void AquaClipboard::applicationDidBecomeActive(NSNotification*)
} }
} }
void AquaClipboard::fireClipboardChangedEvent() void AquaClipboard::fireClipboardChangedEvent()
{ {
ClearableMutexGuard aGuard(m_aMutex); ClearableMutexGuard aGuard(m_aMutex);
@@ -289,7 +279,6 @@ void AquaClipboard::fireClipboardChangedEvent()
} }
} }
void AquaClipboard::fireLostClipboardOwnershipEvent(Reference<XClipboardOwner> oldOwner, Reference<XTransferable> oldContent) void AquaClipboard::fireLostClipboardOwnershipEvent(Reference<XClipboardOwner> oldOwner, Reference<XTransferable> oldContent)
{ {
BOOST_ASSERT(oldOwner.is()); BOOST_ASSERT(oldOwner.is());
@@ -298,7 +287,6 @@ void AquaClipboard::fireLostClipboardOwnershipEvent(Reference<XClipboardOwner> o
catch(RuntimeException&) { } catch(RuntimeException&) { }
} }
void AquaClipboard::provideDataForType(NSPasteboard* sender, const NSString* type) void AquaClipboard::provideDataForType(NSPasteboard* sender, const NSString* type)
{ {
if( mXClipboardContent.is() ) if( mXClipboardContent.is() )
@@ -314,11 +302,6 @@ void AquaClipboard::provideDataForType(NSPasteboard* sender, const NSString* typ
} }
} }
//------------------------------------------------
// XFlushableClipboard
//------------------------------------------------
void SAL_CALL AquaClipboard::flushClipboard() void SAL_CALL AquaClipboard::flushClipboard()
throw(RuntimeException) throw(RuntimeException)
{ {
@@ -341,29 +324,21 @@ void SAL_CALL AquaClipboard::flushClipboard()
} }
} }
NSPasteboard* AquaClipboard::getPasteboard() const NSPasteboard* AquaClipboard::getPasteboard() const
{ {
return mPasteboard; return mPasteboard;
} }
//-------------------------------------------------
// XServiceInfo
//-------------------------------------------------
OUString SAL_CALL AquaClipboard::getImplementationName() throw( RuntimeException ) OUString SAL_CALL AquaClipboard::getImplementationName() throw( RuntimeException )
{ {
return clipboard_getImplementationName(); return clipboard_getImplementationName();
} }
sal_Bool SAL_CALL AquaClipboard::supportsService( const OUString& /*ServiceName*/ ) throw( RuntimeException ) sal_Bool SAL_CALL AquaClipboard::supportsService( const OUString& /*ServiceName*/ ) throw( RuntimeException )
{ {
return sal_False; return sal_False;
} }
Sequence< OUString > SAL_CALL AquaClipboard::getSupportedServiceNames() throw( RuntimeException ) Sequence< OUString > SAL_CALL AquaClipboard::getSupportedServiceNames() throw( RuntimeException )
{ {
return clipboard_getSupportedServiceNames(); return clipboard_getSupportedServiceNames();