Kaydet (Commit) e17cf910 authored tarafından Alexandre Vicenzi's avatar Alexandre Vicenzi Kaydeden (comit) Marcos Souza

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

Change-Id: I391a7324bf92208fe632dac17874943343b1f65a
Reviewed-on: https://gerrit.libreoffice.org/7757Reviewed-by: 's avatarMarcos Souza <marcos.souza.org@gmail.com>
Tested-by: 's avatarMarcos Souza <marcos.souza.org@gmail.com>
üst a7395942
...@@ -17,7 +17,6 @@ ...@@ -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 @@ ...@@ -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: ...@@ -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: ...@@ -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 ...@@ -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 ) ...@@ -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( ) ...@@ -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)
......
...@@ -17,7 +17,6 @@ ...@@ -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 @@ ...@@ -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( ...@@ -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)
......
...@@ -25,7 +25,7 @@ ...@@ -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( ) ...@@ -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& ...@@ -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" );
......
...@@ -25,6 +25,7 @@ ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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(): ...@@ -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() ...@@ -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) ...@@ -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, ...@@ -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) ...@@ -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 ...@@ -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: */
This diff is collapsed.
...@@ -24,7 +24,7 @@ ...@@ -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; ...@@ -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() ...@@ -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)
...@@ -88,82 +86,80 @@ AquaClipboard::AquaClipboard(NSPasteboard* pasteboard, bool bUseSystemPasteboard ...@@ -88,82 +86,80 @@ AquaClipboard::AquaClipboard(NSPasteboard* pasteboard, bool bUseSystemPasteboard
mrXMimeCntFactory = MimeContentTypeFactory::create(xContext); mrXMimeCntFactory = MimeContentTypeFactory::create(xContext);
mpDataFlavorMapper = DataFlavorMapperPtr_t(new DataFlavorMapper()); mpDataFlavorMapper = DataFlavorMapperPtr_t(new DataFlavorMapper());
if (pasteboard != NULL) if (pasteboard != NULL)
{ {
mPasteboard = pasteboard; mPasteboard = pasteboard;
mIsSystemPasteboard = false; mIsSystemPasteboard = false;
} }
else else
{ {
mPasteboard = bUseSystemPasteboard ? [NSPasteboard generalPasteboard] : mPasteboard = bUseSystemPasteboard ? [NSPasteboard generalPasteboard] :
[NSPasteboard pasteboardWithName: NSDragPboard]; [NSPasteboard pasteboardWithName: NSDragPboard];
if (mPasteboard == nil) if (mPasteboard == nil)
{ {
throw RuntimeException("AquaClipboard: Cannot create Cocoa pasteboard", throw RuntimeException("AquaClipboard: Cannot create Cocoa pasteboard",
static_cast<XClipboardEx*>(this)); static_cast<XClipboardEx*>(this));
} }
} }
[mPasteboard retain]; [mPasteboard retain];
mEventListener = [[EventListener alloc] initWithAquaClipboard: this]; mEventListener = [[EventListener alloc] initWithAquaClipboard: this];
if (mEventListener == nil) if (mEventListener == nil)
{ {
[mPasteboard release]; [mPasteboard release];
throw RuntimeException( throw RuntimeException(
OUString("AquaClipboard: Cannot create pasteboard change listener"), OUString("AquaClipboard: Cannot create pasteboard change listener"),
static_cast<XClipboardEx*>(this)); static_cast<XClipboardEx*>(this));
} }
if (mIsSystemPasteboard) if (mIsSystemPasteboard)
{ {
NSNotificationCenter* notificationCenter = [NSNotificationCenter defaultCenter]; NSNotificationCenter* notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver: mEventListener [notificationCenter addObserver: mEventListener
selector: @selector(applicationDidBecomeActive:) selector: @selector(applicationDidBecomeActive:)
name: @"NSApplicationDidBecomeActiveNotification" name: @"NSApplicationDidBecomeActiveNotification"
object: [NSApplication sharedApplication]]; object: [NSApplication sharedApplication]];
} }
mPasteboardChangeCount = [mPasteboard changeCount]; mPasteboardChangeCount = [mPasteboard changeCount];
} }
AquaClipboard::~AquaClipboard() AquaClipboard::~AquaClipboard()
{ {
if (mIsSystemPasteboard) if (mIsSystemPasteboard)
{ {
[[NSNotificationCenter defaultCenter] removeObserver: mEventListener]; [[NSNotificationCenter defaultCenter] removeObserver: mEventListener];
} }
[mEventListener disposing]; [mEventListener disposing];
[mEventListener release]; [mEventListener release];
[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);
// Shortcut: If we are clipboard owner already we don't need // Shortcut: If we are clipboard owner already we don't need
// to drag the data through the system clipboard // to drag the data through the system clipboard
if (mXClipboardContent.is()) if (mXClipboardContent.is())
{ {
return mXClipboardContent; return mXClipboardContent;
} }
return Reference<XTransferable>(new OSXTransferable(mrXMimeCntFactory, return Reference<XTransferable>(new OSXTransferable(mrXMimeCntFactory,
mpDataFlavorMapper, mpDataFlavorMapper,
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 ...@@ -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 ...@@ -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 ...@@ -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*) ...@@ -263,7 +254,6 @@ void AquaClipboard::applicationDidBecomeActive(NSNotification*)
} }
} }
void AquaClipboard::fireClipboardChangedEvent() void AquaClipboard::fireClipboardChangedEvent()
{ {
ClearableMutexGuard aGuard(m_aMutex); ClearableMutexGuard aGuard(m_aMutex);
...@@ -272,33 +262,31 @@ void AquaClipboard::fireClipboardChangedEvent() ...@@ -272,33 +262,31 @@ void AquaClipboard::fireClipboardChangedEvent()
ClipboardEvent aEvent; ClipboardEvent aEvent;
if (listeners.begin() != listeners.end()) if (listeners.begin() != listeners.end())
{ {
aEvent = ClipboardEvent(static_cast<OWeakObject*>(this), getContents()); aEvent = ClipboardEvent(static_cast<OWeakObject*>(this), getContents());
} }
aGuard.clear(); aGuard.clear();
while (listeners.begin() != listeners.end()) while (listeners.begin() != listeners.end())
{ {
if (listeners.front().is()) if (listeners.front().is())
{ {
try { listeners.front()->changedContents(aEvent); } try { listeners.front()->changedContents(aEvent); }
catch (RuntimeException&) { } catch (RuntimeException&) { }
} }
listeners.pop_front(); listeners.pop_front();
} }
} }
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());
try { oldOwner->lostOwnership(static_cast<XClipboardEx*>(this), oldContent); } try { oldOwner->lostOwnership(static_cast<XClipboardEx*>(this), oldContent); }
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,17 +302,12 @@ void AquaClipboard::provideDataForType(NSPasteboard* sender, const NSString* typ ...@@ -314,17 +302,12 @@ void AquaClipboard::provideDataForType(NSPasteboard* sender, const NSString* typ
} }
} }
//------------------------------------------------
// XFlushableClipboard
//------------------------------------------------
void SAL_CALL AquaClipboard::flushClipboard() void SAL_CALL AquaClipboard::flushClipboard()
throw(RuntimeException) throw(RuntimeException)
{ {
if (mXClipboardContent.is()) if (mXClipboardContent.is())
{ {
Sequence<DataFlavor> flavorList = mXClipboardContent->getTransferDataFlavors(); Sequence<DataFlavor> flavorList = mXClipboardContent->getTransferDataFlavors();
sal_uInt32 nFlavors = flavorList.getLength(); sal_uInt32 nFlavors = flavorList.getLength();
bool bInternal(false); bool bInternal(false);
...@@ -341,32 +324,24 @@ void SAL_CALL AquaClipboard::flushClipboard() ...@@ -341,32 +324,24 @@ 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();
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
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