diff options
author | Oliver Braun <obr@openoffice.org> | 2001-05-07 10:07:24 +0000 |
---|---|---|
committer | Oliver Braun <obr@openoffice.org> | 2001-05-07 10:07:24 +0000 |
commit | 11bfd677f29903a7d1fdc4f97abb7de270e61fdc (patch) | |
tree | 9b65dde4e4b6c78acdeca18c16b29d07f7c16b9d /vcl/source | |
parent | 1efcd98593ad92427992be7ed2988cd653b078c1 (diff) |
added support for selection
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/window/window.cxx | 57 |
1 files changed, 50 insertions, 7 deletions
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index ba84ad671073..26896bfec7b5 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -2,9 +2,9 @@ * * $RCSfile: window.cxx,v $ * - * $Revision: 1.20 $ + * $Revision: 1.21 $ * - * last change: $Author: mt $ $Date: 2001-04-20 07:34:29 $ + * last change: $Author: obr $ $Date: 2001-05-07 11:07:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -165,6 +165,9 @@ #ifndef _COM_SUN_STAR_AWT_XDISPLAYCONNECTION_HPP_ #include <com/sun/star/awt/XDisplayConnection.hpp> #endif +#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_ +#include <com/sun/star/lang/XInitialization.hpp> +#endif #ifdef REMOTE_APPSERVER #include "rmwindow.hxx" @@ -563,9 +566,6 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, const ::com::sun::star:: Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); if ( xFactory.is() ) { - // remember clipboard here - mpFrameData->mxClipboard = Reference< XClipboard > ( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ) ), UNO_QUERY ); - /* * IMHO this belongs in the platform dependend part of vcl, but the vcl guys say it * is better to implement it here to reduce dependencies on the other ports like Mac etc. @@ -575,21 +575,35 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, const ::com::sun::star:: if( pEnvData ) { + Sequence< Any > aClipboardAL, aSelectionAL; + OUString aClipboardSN, aSelectionSN; + Sequence< Any > aDragSourceAL( 2 ), aDropTargetAL( 2 ); OUString aDragSourceSN, aDropTargetSN; #if defined WNT + aClipboardSN = OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ); + aDragSourceSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.OleDragSource" ); aDropTargetSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.OleDropTarget" ); aDragSourceAL[ 1 ] = makeAny( (sal_uInt32) pEnvData->hWnd ); aDropTargetAL[ 0 ] = makeAny( (sal_uInt32) pEnvData->hWnd ); #elif defined UNX + + aClipboardSN = OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ); + aSelectionSN = OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ); + aDragSourceSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.X11DragSource" ); aDropTargetSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.X11DropTarget" ); - // need second parameter for drop target -// aDropTargetAL.realloc( 2 ); + aClipboardAL.realloc( 2 ); + aClipboardAL[ 0 ] = makeAny( Application::GetDisplayConnection() ); + aClipboardAL[ 1 ] = makeAny( OUString::createFromAscii( "CLIPBOARD" ) ); + + aSelectionAL.realloc( 2 ); + aSelectionAL[ 0 ] = makeAny( Application::GetDisplayConnection() ); + aSelectionAL[ 1 ] = makeAny( OUString::createFromAscii( "PRIMARY" ) ); aDragSourceAL[ 0 ] = makeAny( Application::GetDisplayConnection() ); aDropTargetAL[ 0 ] = makeAny( Application::GetDisplayConnection() ); @@ -597,6 +611,35 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, const ::com::sun::star:: #endif // FIXME: add service names for macos etc. here + // remember clipboard instance here + if( aClipboardSN.getLength() ) + { + mpFrameData->mxClipboard = Reference< XClipboard > ( xFactory->createInstance( aClipboardSN ), UNO_QUERY ); + + if( mpFrameData->mxClipboard.is() && aClipboardAL.getLength() ) + { + Reference< XInitialization > xInit = Reference< XInitialization >( mpFrameData->mxClipboard, UNO_QUERY ); + + if( xInit.is() ) + xInit->initialize( aClipboardAL ); + } + } + + // remember primary selection here + if( aSelectionSN.getLength() ) + { + mpFrameData->mxSelection = Reference< XClipboard > ( xFactory->createInstance( aSelectionSN ), UNO_QUERY ); + + if( mpFrameData->mxSelection.is() && aSelectionAL.getLength() ) + { + Reference< XInitialization > xInit = Reference< XInitialization >( mpFrameData->mxSelection, UNO_QUERY ); + + if( xInit.is() ) + xInit->initialize( aSelectionAL ); + } + } + + if( aDragSourceSN.getLength() ) mpFrameData->mxDragSource = Reference< XDragSource > ( xFactory->createInstanceWithArguments( aDragSourceSN, aDragSourceAL ), UNO_QUERY ); |