diff options
author | Oliver Braun <obr@openoffice.org> | 2001-02-21 14:24:30 +0000 |
---|---|---|
committer | Oliver Braun <obr@openoffice.org> | 2001-02-21 14:24:30 +0000 |
commit | 3c2840a5a4e3ec3300c6e10c59bdd825346248ef (patch) | |
tree | 330e0bfddb479df77de191608ef585483fd33808 /toolkit | |
parent | 7080f9174a8c456b15e60ba8fa6d26384e8bcde6 (diff) |
added datatransfer api
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/inc/toolkit/awt/vclxtoolkit.hxx | 17 | ||||
-rw-r--r-- | toolkit/source/awt/vclxtoolkit.cxx | 70 |
2 files changed, 83 insertions, 4 deletions
diff --git a/toolkit/inc/toolkit/awt/vclxtoolkit.hxx b/toolkit/inc/toolkit/awt/vclxtoolkit.hxx index 271f2b9f491f..48ad85733ad5 100644 --- a/toolkit/inc/toolkit/awt/vclxtoolkit.hxx +++ b/toolkit/inc/toolkit/awt/vclxtoolkit.hxx @@ -2,9 +2,9 @@ * * $RCSfile: vclxtoolkit.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * last change: $Author: obr $ $Date: 2001-02-21 15:23:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -66,6 +66,9 @@ #ifndef _COM_SUN_STAR_AWT_XTOOLKIT_HPP_ #include <com/sun/star/awt/XToolkit.hpp> #endif +#ifndef _COM_SUN_STAR_AWT_XDATATRANSFER_HPP_ +#include <com/sun/star/awt/XDataTransfer.hpp> +#endif #ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ #include <com/sun/star/lang/XTypeProvider.hpp> #endif @@ -93,12 +96,16 @@ namespace awt { // ---------------------------------------------------- class VCLXToolkit : public ::com::sun::star::awt::XToolkit, + public ::com::sun::star::awt::XDataTransfer, public ::com::sun::star::lang::XTypeProvider, public ::cppu::OWeakObject { private: ::osl::Mutex maMutex; + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > mxClipboard; + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > mxSelection; + protected: ::osl::Mutex& GetMutex() { return maMutex; } @@ -124,6 +131,12 @@ public: ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > > SAL_CALL createWindows( const ::com::sun::star::uno::Sequence< ::com::sun::star::awt::WindowDescriptor >& Descriptors ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL createScreenCompatibleDevice( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion > SAL_CALL createRegion( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XDataTransfer + virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer > SAL_CALL getDragGestureRecognizer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource > SAL_CALL getDragSource( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget > SAL_CALL getDropTarget( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > SAL_CALL getClipboard( const ::rtl::OUString& clipboardName ) throw(::com::sun::star::uno::RuntimeException); }; diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index c896ad95c7f7..7abd5586beeb 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -2,9 +2,9 @@ * * $RCSfile: vclxtoolkit.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: ts $ $Date: 2001-02-05 09:33:16 $ + * last change: $Author: obr $ $Date: 2001-02-21 15:24:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,6 +74,9 @@ #ifndef _COM_SUN_STAR_AWT_WINDOWCLASS_HPP_ #include <com/sun/star/awt/WindowClass.hpp> #endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif #ifndef _COM_SUN_STAR_LANG_SYSTEMDEPENDENT_HPP_ #include <com/sun/star/lang/SystemDependent.hpp> #endif @@ -131,6 +134,10 @@ #include <tools/debug.hxx> +#ifndef _COMPHELPER_PROCESSFACTORY_HXX_ +#include <comphelper/processfactory.hxx> +#endif + #define VCLWINDOW_FRAMEWINDOW 0x1000 @@ -345,6 +352,7 @@ sal_uInt16 ImplGetComponentType( const String& rServiceName ) { ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( ::com::sun::star::awt::XToolkit*, this ), + static_cast < ::com::sun::star::awt::XDataTransfer * > (this), SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); } @@ -800,4 +808,62 @@ Window* VCLXToolkit::CreateComponent( VCLXWindow** ppNewComp, } +::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer > SAL_CALL VCLXToolkit::getDragGestureRecognizer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException) +{ + Window * pWindow = VCLUnoHelper::GetWindow( window ); + + if( pWindow ) + return pWindow->GetDragGestureRecognizer(); + + return ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer >(); +} + +::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource > SAL_CALL VCLXToolkit::getDragSource( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException) +{ + Window * pWindow = VCLUnoHelper::GetWindow( window ); + + if( pWindow ) + return pWindow->GetDragSource(); + + return ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource >(); +} + +::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget > SAL_CALL VCLXToolkit::getDropTarget( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException) +{ + Window * pWindow = VCLUnoHelper::GetWindow( window ); + + if( pWindow ) + return pWindow->GetDropTarget(); + + return ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget >(); +} + +::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > SAL_CALL VCLXToolkit::getClipboard( const ::rtl::OUString& clipboardName ) throw(::com::sun::star::uno::RuntimeException) +{ + if( clipboardName.getLength() == 0 ) + { + if( !mxClipboard.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + if ( xFactory.is() ) + { + // remember clipboard here + mxClipboard = ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > ( + xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ) ), ::com::sun::star::uno::UNO_QUERY ); + } + } + + return mxClipboard; + } + + else if( clipboardName.equals( ::rtl::OUString::createFromAscii("Selection") ) ) + { + if( !mxSelection.is() ) + ; + + return mxSelection; + } + + return ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >(); +} |