diff options
-rw-r--r-- | dtrans/prj/build.lst | 2 | ||||
-rw-r--r-- | dtrans/prj/d.lst | 1 | ||||
-rw-r--r-- | dtrans/source/X11/X11_service.cxx | 303 | ||||
-rw-r--r-- | dtrans/source/X11/dtransX11.xml | 50 | ||||
-rw-r--r-- | dtrans/source/X11/exports.map | 10 | ||||
-rw-r--r-- | dtrans/source/aqua/dtransaqua.xml | 47 | ||||
-rw-r--r-- | dtrans/source/aqua/service_entry.cxx | 210 | ||||
-rw-r--r-- | padmin/source/makefile.mk | 3 | ||||
-rw-r--r-- | toolkit/util/makefile.mk | 16 | ||||
-rw-r--r-- | vcl/aqua/inc/saldata.hxx | 5 | ||||
-rw-r--r-- | vcl/aqua/inc/salinst.h | 6 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/DataFlavorMapping.cxx (renamed from dtrans/source/aqua/DataFlavorMapping.cxx) | 15 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/DataFlavorMapping.hxx (renamed from dtrans/source/aqua/DataFlavorMapping.hxx) | 3 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/DragActionConversion.cxx (renamed from dtrans/source/aqua/DragActionConversion.cxx) | 0 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/DragActionConversion.hxx (renamed from dtrans/source/aqua/DragActionConversion.hxx) | 0 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/DragSource.cxx (renamed from dtrans/source/aqua/DragSource.cxx) | 12 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/DragSource.hxx (renamed from dtrans/source/aqua/DragSource.hxx) | 4 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/DragSourceContext.cxx (renamed from dtrans/source/aqua/DragSourceContext.cxx) | 8 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/DragSourceContext.hxx (renamed from dtrans/source/aqua/DragSourceContext.hxx) | 0 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/DropTarget.cxx (renamed from dtrans/source/aqua/DropTarget.cxx) | 13 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/DropTarget.hxx (renamed from dtrans/source/aqua/DropTarget.hxx) | 3 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/HtmlFmtFlt.cxx (renamed from dtrans/source/aqua/HtmlFmtFlt.cxx) | 0 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/HtmlFmtFlt.hxx (renamed from dtrans/source/aqua/HtmlFmtFlt.hxx) | 0 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/OSXTransferable.cxx (renamed from dtrans/source/aqua/OSXTransferable.cxx) | 6 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/OSXTransferable.hxx (renamed from dtrans/source/aqua/OSXTransferable.hxx) | 4 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/PictToBmpFlt.cxx (renamed from dtrans/source/aqua/PictToBmpFlt.cxx) | 0 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/PictToBmpFlt.hxx (renamed from dtrans/source/aqua/PictToBmpFlt.hxx) | 0 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/aqua_clipboard.cxx (renamed from dtrans/source/aqua/aqua_clipboard.cxx) | 20 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/aqua_clipboard.hxx (renamed from dtrans/source/aqua/aqua_clipboard.hxx) | 4 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/aqua_service.cxx (renamed from dtrans/source/aqua/aqua_service.cxx) | 2 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/makefile.mk (renamed from dtrans/source/aqua/makefile.mk) | 40 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/service_entry.cxx | 67 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/test_aquacb.cxx (renamed from dtrans/source/aqua/test_aquacb.cxx) | 2 | ||||
-rw-r--r-- | vcl/inc/vcl/salinst.hxx | 8 | ||||
-rw-r--r-- | vcl/prj/build.lst | 5 | ||||
-rw-r--r-- | vcl/prj/d.lst | 4 | ||||
-rw-r--r-- | vcl/source/components/dtranscomp.cxx | 556 | ||||
-rw-r--r-- | vcl/source/components/factory.cxx | 52 | ||||
-rw-r--r-- | vcl/source/components/makefile.mk | 1 | ||||
-rw-r--r-- | vcl/unx/gtk/app/gtkinst.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/inc/salinst.h | 5 | ||||
-rw-r--r-- | vcl/unx/kde/kdedata.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/kde4/main.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/source/app/salinst.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/source/desktopdetect/desktopdetector.cxx | 346 | ||||
-rw-r--r-- | vcl/unx/source/desktopdetect/makefile.mk | 61 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/X11_clipboard.cxx (renamed from dtrans/source/X11/X11_clipboard.cxx) | 4 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/X11_clipboard.hxx (renamed from dtrans/source/X11/X11_clipboard.hxx) | 0 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/X11_dndcontext.cxx (renamed from dtrans/source/X11/X11_dndcontext.cxx) | 2 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/X11_dndcontext.hxx (renamed from dtrans/source/X11/X11_dndcontext.hxx) | 0 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/X11_droptarget.cxx (renamed from dtrans/source/X11/X11_droptarget.cxx) | 2 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/X11_selection.cxx (renamed from dtrans/source/X11/X11_selection.cxx) | 40 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/X11_selection.hxx (renamed from dtrans/source/X11/X11_selection.hxx) | 0 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/X11_service.cxx | 138 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/X11_transferable.cxx (renamed from dtrans/source/X11/X11_transferable.cxx) | 2 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/X11_transferable.hxx (renamed from dtrans/source/X11/X11_transferable.hxx) | 0 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/bmp.cxx (renamed from dtrans/source/X11/bmp.cxx) | 2 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/bmp.hxx (renamed from dtrans/source/X11/bmp.hxx) | 0 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/config.cxx (renamed from dtrans/source/X11/config.cxx) | 2 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/copydata_curs.h (renamed from dtrans/source/X11/copydata_curs.h) | 0 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/copydata_mask.h (renamed from dtrans/source/X11/copydata_mask.h) | 0 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/linkdata_curs.h (renamed from dtrans/source/X11/linkdata_curs.h) | 0 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/linkdata_mask.h (renamed from dtrans/source/X11/linkdata_mask.h) | 0 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/makefile.mk (renamed from dtrans/source/X11/makefile.mk) | 28 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/movedata_curs.h (renamed from dtrans/source/X11/movedata_curs.h) | 0 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/movedata_mask.h (renamed from dtrans/source/X11/movedata_mask.h) | 0 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/nodrop_curs.h (renamed from dtrans/source/X11/nodrop_curs.h) | 0 | ||||
-rw-r--r-- | vcl/unx/source/dtrans/nodrop_mask.h (renamed from dtrans/source/X11/nodrop_mask.h) | 0 | ||||
-rw-r--r-- | vcl/unx/source/plugadapt/salplug.cxx | 328 | ||||
-rw-r--r-- | vcl/util/makefile.mk | 29 |
70 files changed, 1396 insertions, 1115 deletions
diff --git a/dtrans/prj/build.lst b/dtrans/prj/build.lst index 95d697d6ebd3..bd9c73582361 100644 --- a/dtrans/prj/build.lst +++ b/dtrans/prj/build.lst @@ -10,8 +10,6 @@ dr dtrans\source\win32\dnd nmake - w dr_win32_dnd dr_cnttype dr_win32_misc.w dr dtrans\source\win32\dtobj nmake - w dr_win32_dtobj dr_win32_clipb.w dr_win32_misc.w dr_win32_ftransl.w dr_inc NULL dr dtrans\source\os2\clipb nmake - p dr_os2_clipb dr_inc NULL dr dtrans\util nmake - all dr_util dr_cnttype dr_win32_misc.w dr_win32_mtaole.w dr_win32_ftransl.w dr_win32_clipb.w dr_win32_dnd.w dr_win32_dtobj.w dr_inc NULL -dr dtrans\source\X11 nmake - u dr_X11 dr_inc NULL -dr dtrans\source\aqua nmake - u dr_aqua dr_inc NULL dr dtrans\source\generic nmake - all dr_generic dr_inc NULL diff --git a/dtrans/prj/d.lst b/dtrans/prj/d.lst index bfa7e3b86d6d..a1a7c2e95480 100644 --- a/dtrans/prj/d.lst +++ b/dtrans/prj/d.lst @@ -5,6 +5,5 @@ ..\source\win32\clipb\sysdtrans.xml %_DEST%\xml%_EXT%\sysdtrans.xml ..\source\win32\dnd\dnd.xml %_DEST%\xml%_EXT%\dnd.xml ..\source\win32\ftransl\ftransl.xml %_DEST%\xml%_EXT%\ftransl.xml -..\source\X11\dtransX11.xml %_DEST%\xml%_EXT%\dtransX11.xml ..\source\cnttype\mcnttype.xml %_DEST%\xml%_EXT%\mcnttype.xml ..\source\generic\dtrans.xml %_DEST%\xml%_EXT%\dtrans.xml diff --git a/dtrans/source/X11/X11_service.cxx b/dtrans/source/X11/X11_service.cxx deleted file mode 100644 index b288d74a0513..000000000000 --- a/dtrans/source/X11/X11_service.cxx +++ /dev/null @@ -1,303 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: X11_service.cxx,v $ - * $Revision: 1.11 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" - -#include <X11_clipboard.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/registry/XRegistryKey.hpp> -#include <uno/dispatcher.h> // declaration of generic uno interface -#include <uno/mapping.hxx> // mapping stuff -#include <cppuhelper/factory.hxx> -#include <cppuhelper/compbase1.hxx> - -using namespace rtl; -using namespace cppu; -using namespace com::sun::star::lang; -using namespace com::sun::star::datatransfer::clipboard; -using namespace com::sun::star::awt; -using namespace x11; - -namespace x11 { - -class X11ClipboardFactory : public ::cppu::WeakComponentImplHelper1 < - ::com::sun::star::lang::XSingleServiceFactory -> -{ - ::osl::Mutex m_aMutex; - ::std::hash_map< OUString, ::std::hash_map< Atom, Reference< XClipboard > >, ::rtl::OUStringHash > m_aInstances; -public: - X11ClipboardFactory(); - virtual ~X11ClipboardFactory(); - - /* - * XSingleServiceFactory - */ - virtual Reference< XInterface > createInstance() throw(); - virtual Reference< XInterface > createInstanceWithArguments( const Sequence< Any >& rArgs ) throw(); -}; - -// ------------------------------------------------------------------------ - -X11ClipboardFactory::X11ClipboardFactory() : - ::cppu::WeakComponentImplHelper1< - ::com::sun::star::lang::XSingleServiceFactory ->( m_aMutex ) -{ -} - -// ------------------------------------------------------------------------ - -X11ClipboardFactory::~X11ClipboardFactory() -{ -} - -// ------------------------------------------------------------------------ - -Reference< XInterface > X11ClipboardFactory::createInstance() throw() -{ - return createInstanceWithArguments( Sequence< Any >() ); -} - -// ------------------------------------------------------------------------ - -Reference< XInterface > X11ClipboardFactory::createInstanceWithArguments( const Sequence< Any >& arguments ) throw() -{ - OUString aDisplayName; - Atom nSelection; - - // extract display name from connection argument. An exception is thrown - // by SelectionManager.initialize() if no display connection is given. - if( arguments.getLength() > 0 ) - { - Reference< XDisplayConnection > xConn; - arguments.getConstArray()[0] >>= xConn; - - if( xConn.is() ) - { - Any aIdentifier = xConn->getIdentifier(); - aIdentifier >>= aDisplayName; - } - } - - SelectionManager& rManager = SelectionManager::get( aDisplayName ); - rManager.initialize( arguments ); - - // check if any other selection than clipboard selection is specified - if( arguments.getLength() > 1 ) - { - OUString aSelectionName; - - arguments.getConstArray()[1] >>= aSelectionName; - nSelection = rManager.getAtom( aSelectionName ); - } - else - { - // default atom is clipboard selection - nSelection = rManager.getAtom( OUString::createFromAscii( "CLIPBOARD" ) ); - } - - ::std::hash_map< Atom, Reference< XClipboard > >& rMap( m_aInstances[ aDisplayName ] ); - ::std::hash_map< Atom, Reference< XClipboard > >::iterator it = rMap.find( nSelection ); - if( it != rMap.end() ) - return it->second; - - X11Clipboard* pClipboard = new X11Clipboard( rManager, nSelection ); - rMap[ nSelection ] = pClipboard; - - return static_cast<OWeakObject*>(pClipboard); -} - -// ------------------------------------------------------------------------ - -Sequence< OUString > SAL_CALL X11Clipboard_getSupportedServiceNames() -{ - Sequence< OUString > aRet(1); - aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.clipboard.SystemClipboard"); - return aRet; -} - -// ------------------------------------------------------------------------ - -Sequence< OUString > SAL_CALL Xdnd_getSupportedServiceNames() -{ - Sequence< OUString > aRet(1); - aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.dnd.X11DragSource"); - return aRet; -} - -// ------------------------------------------------------------------------ - -Reference< XInterface > SAL_CALL Xdnd_createInstance( - const Reference< XMultiServiceFactory > & ) -{ - return Reference < XInterface >( ( OWeakObject * ) new SelectionManagerHolder() ); -} - -// ------------------------------------------------------------------------ - -Sequence< OUString > SAL_CALL Xdnd_dropTarget_getSupportedServiceNames() -{ - Sequence< OUString > aRet(1); - aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.dnd.X11DropTarget"); - return aRet; -} - -// ------------------------------------------------------------------------ - -Reference< XInterface > SAL_CALL Xdnd_dropTarget_createInstance( - const Reference< XMultiServiceFactory > & ) -{ - return Reference < XInterface >( ( OWeakObject * ) new DropTarget() ); -} - -} - -static const OUString& getClipboardImplementationName() -{ - static OUString aImpl = OUString::createFromAscii(X11_CLIPBOARD_IMPLEMENTATION_NAME); - return aImpl; -} - -static const OUString& getClipboardServiceName() -{ - static OUString aImpl = OUString::createFromAscii("com.sun.star.datatransfer.clipboard.SystemClipboard" ); - return aImpl; -} - -static const OUString& getXdndImplementationName() -{ - static OUString aImpl = OUString::createFromAscii(XDND_IMPLEMENTATION_NAME ); - return aImpl; -} - -static const OUString& getXdndServiceName() -{ - static OUString aImpl = OUString::createFromAscii("com.sun.star.datatransfer.dnd.X11DragSource" ); - return aImpl; -} - -static const OUString& getXdndDropTargetImplementationName() -{ - static OUString aImpl = OUString::createFromAscii(XDND_DROPTARGET_IMPLEMENTATION_NAME); - return aImpl; -} - -static const OUString& getXdndDropTargetServiceName() -{ - static OUString aImpl = OUString::createFromAscii("com.sun.star.datatransfer.dnd.X11DropTarget" ); - return aImpl; -} - -extern "C" { - void SAL_CALL component_getImplementationEnvironment( - const sal_Char** ppEnvTypeName, - uno_Environment** ) - { - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; - } - - sal_Bool SAL_CALL component_writeInfo( void*, void* pXUnoKey ) - { - if( pXUnoKey ) - { - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey( reinterpret_cast< ::com::sun::star::registry::XRegistryKey* >( pXUnoKey ) ); - - OUString aImplName = OUString::createFromAscii( "/" ); - aImplName += getClipboardImplementationName(); - aImplName += ::rtl::OUString::createFromAscii( "/UNO/SERVICES/" ); - aImplName += getClipboardServiceName(); - xKey->createKey( aImplName ); - - aImplName = OUString::createFromAscii( "/" ); - aImplName += getXdndImplementationName(); - aImplName += ::rtl::OUString::createFromAscii( "/UNO/SERVICES/" ); - aImplName += getXdndServiceName(); - xKey->createKey( aImplName ); - - aImplName = OUString::createFromAscii( "/" ); - aImplName += getXdndDropTargetImplementationName(); - aImplName += ::rtl::OUString::createFromAscii( "/UNO/SERVICES/" ); - aImplName += getXdndDropTargetServiceName(); - xKey->createKey( aImplName ); - - return sal_True; - } - catch( ::com::sun::star::registry::InvalidRegistryException& ) - { - } - } - return sal_False; - } - - void* SAL_CALL component_getFactory( - const sal_Char* pImplementationName, - void* pXUnoSMgr, - void* - ) - { - void* pRet = 0; - - ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplementationName ) ); - - if( pXUnoSMgr ) - { - Reference< ::com::sun::star::lang::XMultiServiceFactory > xMgr( - reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pXUnoSMgr ) - ); - Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory; - if( aImplName.equals( getClipboardImplementationName() ) ) - xFactory = new X11ClipboardFactory(); - else if( aImplName.equals( getXdndImplementationName() ) ) - { - xFactory = ::cppu::createSingleFactory( - xMgr, aImplName, Xdnd_createInstance, - Xdnd_getSupportedServiceNames() ); - } - else if( aImplName.equals( getXdndDropTargetImplementationName() ) ) - { - xFactory = ::cppu::createSingleFactory( - xMgr, aImplName, Xdnd_dropTarget_createInstance, - Xdnd_dropTarget_getSupportedServiceNames() ); - } - if( xFactory.is() ) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - } - return pRet; - } - -} /* extern "C" */ diff --git a/dtrans/source/X11/dtransX11.xml b/dtrans/source/X11/dtransX11.xml deleted file mode 100644 index 77994d5287b5..000000000000 --- a/dtrans/source/X11/dtransX11.xml +++ /dev/null @@ -1,50 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> -<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> - <module-name> dtransX11 </module-name> - <component-description> - <author> Tino Rachui </author> - <name> com.sun.star.comp.datatransfer.X11 </name> - <description> - The X11 implementation of the datatransfer service. -</description> - <loader-name> com.sun.star.loader.SharedLibrary </loader-name> - <language> c++ </language> - <status value="beta"/> - <supported-service> com.sun.star.datatransfer.clipboard.SystemClipboard </supported-service> - <supported-service> com.sun.star.datatransfer.dnd.X11DragSource </supported-service> - <supported-service> com.sun.star.datatransfer.dnd.X11DropTarget </supported-service> - <service-dependency> ... </service-dependency> - <type> com.sun.star.datatransfer.clipboard.XClipboardEx </type> - <type> com.sun.star.datatransfer.XTransferable </type> - <type> com.sun.star.datatransfer.clipboard.RenderingCapabilities </type> - <type> com.sun.star.datatransfer.clipboard.XClipboardOwner </type> - <type> com.sun.star.datatransfer.clipboard.XClipboardListener </type> - <type> com.sun.star.datatransfer.clipboard.XClipboardNotifier </type> - <type> com.sun.star.datatransfer.dnd.XDropTargetDropContext </type> - <type> com.sun.star.datatransfer.dnd.XDropTargetDragContext </type> - <type> com.sun.star.datatransfer.dnd.XDropTarget </type> - <type> com.sun.star.datatransfer.dnd.DNDConstants </type> - <type> com.sun.star.datatransfer.dnd.XDragSource </type> - <type> com.sun.star.datatransfer.dnd.XDragSourceContext </type> - <type> com.sun.star.awt.XDisplayConnection </type> - <type> com.sun.star.lang.DisposedException </type> - <type> com.sun.star.lang.IllegalArgumentException </type> - <type> com.sun.star.lang.XComponent </type> - <type> com.sun.star.lang.XMultiServiceFactory </type> - <type> com.sun.star.lang.XSingleServiceFactory </type> - <type> com.sun.star.lang.XServiceInfo </type> - <type> com.sun.star.lang.XTypeProvider </type> - <type> com.sun.star.uno.TypeClass </type> - <type> com.sun.star.uno.XWeak </type> - <type> com.sun.star.uno.XAggregation </type> - <type> com.sun.star.registry.XRegistryKey </type> - <type> com.sun.star.container.XSet </type> - </component-description> - <project-build-dependency> cppuhelper </project-build-dependency> - <project-build-dependency> cppu </project-build-dependency> - <project-build-dependency> sal </project-build-dependency> - <runtime-module-dependency> cppuhelper </runtime-module-dependency> - <runtime-module-dependency> cppu2 </runtime-module-dependency> - <runtime-module-dependency> sal2 </runtime-module-dependency> -</module-description> diff --git a/dtrans/source/X11/exports.map b/dtrans/source/X11/exports.map deleted file mode 100644 index 7c56baa9bd73..000000000000 --- a/dtrans/source/X11/exports.map +++ /dev/null @@ -1,10 +0,0 @@ -UDK_3_0_0 { - global: - GetVersionInfo; - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; diff --git a/dtrans/source/aqua/dtransaqua.xml b/dtrans/source/aqua/dtransaqua.xml deleted file mode 100644 index 2a901134bf19..000000000000 --- a/dtrans/source/aqua/dtransaqua.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> -<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> - <module-name> dtransaqua </module-name> - <component-description> - <author> Tino Rachui </author> - <name> com.sun.star.comp.datatransfer.aqua </name> - <description> - The aqua implementation of the datatransfer service. -</description> - <loader-name> com.sun.star.loader.SharedLibrary </loader-name> - <language> c++ </language> - <status value="beta"/> - <supported-service> com.sun.star.datatransfer.clipboard.SystemClipboard </supported-service> - <service-dependency> ... </service-dependency> - <type> com.sun.star.datatransfer.clipboard.XClipboardEx </type> - <type> com.sun.star.datatransfer.XTransferable </type> - <type> com.sun.star.datatransfer.clipboard.RenderingCapabilities </type> - <type> com.sun.star.datatransfer.clipboard.XClipboardOwner </type> - <type> com.sun.star.datatransfer.clipboard.XClipboardListener </type> - <type> com.sun.star.datatransfer.clipboard.XClipboardNotifier </type> - <type> com.sun.star.datatransfer.dnd.XDropTargetDropContext </type> - <type> com.sun.star.datatransfer.dnd.XDropTargetDragContext </type> - <type> com.sun.star.datatransfer.dnd.XDropTarget </type> - <type> com.sun.star.datatransfer.dnd.DNDConstants </type> - <type> com.sun.star.datatransfer.dnd.XDragSource </type> - <type> com.sun.star.datatransfer.dnd.XDragSourceContext </type> - <type> com.sun.star.lang.DisposedException </type> - <type> com.sun.star.lang.IllegalArgumentException </type> - <type> com.sun.star.lang.XComponent </type> - <type> com.sun.star.lang.XMultiServiceFactory </type> - <type> com.sun.star.lang.XSingleServiceFactory </type> - <type> com.sun.star.lang.XServiceInfo </type> - <type> com.sun.star.lang.XTypeProvider </type> - <type> com.sun.star.uno.TypeClass </type> - <type> com.sun.star.uno.XWeak </type> - <type> com.sun.star.uno.XAggregation </type> - <type> com.sun.star.registry.XRegistryKey </type> - <type> com.sun.star.container.XSet </type> - </component-description> - <project-build-dependency> cppuhelper </project-build-dependency> - <project-build-dependency> cppu </project-build-dependency> - <project-build-dependency> sal </project-build-dependency> - <runtime-module-dependency> cppuhelper </runtime-module-dependency> - <runtime-module-dependency> cppu2 </runtime-module-dependency> - <runtime-module-dependency> sal2 </runtime-module-dependency> -</module-description> diff --git a/dtrans/source/aqua/service_entry.cxx b/dtrans/source/aqua/service_entry.cxx deleted file mode 100644 index 66f133e74dbe..000000000000 --- a/dtrans/source/aqua/service_entry.cxx +++ /dev/null @@ -1,210 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: service_entry.cxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" - -#include "DragSource.hxx" -#include "DropTarget.hxx" -#include "aqua_clipboard.hxx" -#include <com/sun/star/lang/XSingleComponentFactory.hpp> -#include <cppuhelper/factory.hxx> -#include <cppuhelper/compbase1.hxx> -#include <osl/diagnose.h> - -#include "cppuhelper/implementationentry.hxx" - -using namespace ::osl; -using namespace ::rtl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::registry; -using namespace ::cppu; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::datatransfer::clipboard; - - -rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT; - - -extern rtl::OUString dragSource_getImplementationName(); -extern com::sun::star::uno::Sequence<rtl::OUString> dragSource_getSupportedServiceNames(); -extern rtl::OUString dropTarget_getImplementationName(); -extern com::sun::star::uno::Sequence<rtl::OUString> dropTarget_getSupportedServiceNames(); -extern rtl::OUString clipboard_getImplementationName(); -extern com::sun::star::uno::Sequence<rtl::OUString> clipboard_getSupportedServiceNames(); - - -Reference<XInterface> SAL_CALL createDragSource(const Reference<XComponentContext>& rComponentContext); -Reference<XInterface> SAL_CALL createDropTarget(const Reference<XComponentContext>& rComponentContext); -Reference<XInterface> SAL_CALL createClipboard(const Reference<XComponentContext>& rComponentContext); - - -cppu::ImplementationEntry entries[] = { - { createDragSource, - dragSource_getImplementationName, - dragSource_getSupportedServiceNames, - cppu::createSingleComponentFactory, 0, 0 }, - { createDropTarget, - dropTarget_getImplementationName, - dropTarget_getSupportedServiceNames, - cppu::createSingleComponentFactory, 0, 0 }, - { createClipboard, - clipboard_getImplementationName, - clipboard_getSupportedServiceNames, - cppu::createSingleComponentFactory, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } -}; - - -class AquaClipboardFactory : public WeakComponentImplHelper1<XSingleComponentFactory> -{ -public: - AquaClipboardFactory(); - virtual ~AquaClipboardFactory(); - - /* - * XSingleComponentFactory - */ - virtual Reference<XInterface> createInstanceWithContext(const Reference<XComponentContext>& Context) - throw (Exception); - - virtual Reference<XInterface> createInstanceWithArgumentsAndContext(const Sequence<Any>& rArgs, - const Reference<XComponentContext>& Context) - throw(Exception); - - private: - static Mutex m_aMutex; - static Reference<XInterface> mSingleInstance; -}; - -Reference<XInterface> AquaClipboardFactory::mSingleInstance; -Mutex AquaClipboardFactory::m_aMutex; - -// ------------------------------------------------------------------------ - -AquaClipboardFactory::AquaClipboardFactory() : - WeakComponentImplHelper1<XSingleComponentFactory>(m_aMutex) -{ -} - -// ------------------------------------------------------------------------ - -AquaClipboardFactory::~AquaClipboardFactory() -{ -} - -// ------------------------------------------------------------------------ - -Reference<XInterface> AquaClipboardFactory::createInstanceWithContext(const Reference<XComponentContext>& Context) throw(Exception) -{ - return createInstanceWithArgumentsAndContext(Sequence<Any>(), Context); -} - -// ------------------------------------------------------------------------ - -Reference< XInterface > AquaClipboardFactory::createInstanceWithArgumentsAndContext(const Sequence<Any>& arguments, - const Reference<XComponentContext>& Context) throw(Exception) -{ - MutexGuard aGuard(m_aMutex); - - if (!mSingleInstance.is()) - { - AquaClipboardFactory::mSingleInstance = createClipboard(Context); - } - - return AquaClipboardFactory::mSingleInstance; -} - - -Reference<XInterface> SAL_CALL createDragSource( const Reference< XComponentContext >& rComponentContext) -{ - return Reference<XInterface>(static_cast< XInitialization* >(new DragSource(rComponentContext)), UNO_QUERY); -} - -Reference<XInterface> SAL_CALL createDropTarget( const Reference< XComponentContext >& rComponentContext) -{ - return Reference<XInterface>(static_cast< XInitialization* >(new DropTarget(rComponentContext)), UNO_QUERY); -} - -Reference< XInterface > SAL_CALL createClipboard( const Reference< XComponentContext >& rComponentContext) -{ - return Reference<XInterface>(static_cast< XClipboard* >(new AquaClipboard(rComponentContext)), UNO_QUERY); -} - - -extern "C" sal_Bool SAL_CALL component_writeInfo( - void * serviceManager, void * registryKey) -{ - return cppu::component_writeInfoHelper( - serviceManager, registryKey, entries); -} - - -extern "C" void * SAL_CALL component_getFactory( - char const * implName, void * serviceManager, void * registryKey) -{ - void* pRet = NULL; - OUString iName = OUString::createFromAscii(implName); - Reference<XSingleComponentFactory> xFac; - - if (iName.equalsIgnoreAsciiCase(clipboard_getImplementationName())) - { - xFac = new AquaClipboardFactory(); - } - else - { - return component_getFactoryHelper(implName, - serviceManager, - registryKey, - entries); - } - - if (xFac.is()) - { - xFac->acquire(); - pRet = xFac.get(); - } - - return pRet; -} - - -extern "C" void SAL_CALL component_getImplementationEnvironment( - char const ** envTypeName, uno_Environment **) -{ - *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - - -extern "C" sal_Bool SAL_CALL component_canUnload( TimeValue *pTime ) -{ - return g_moduleCount.canUnload( &g_moduleCount , pTime ); -} - diff --git a/padmin/source/makefile.mk b/padmin/source/makefile.mk index 336631f1ceaa..91e4ca2a25f4 100644 --- a/padmin/source/makefile.mk +++ b/padmin/source/makefile.mk @@ -105,8 +105,7 @@ APP1STDLIBS= \ $(COMPHELPERLIB) \ $(CPPUHELPERLIB) \ $(CPPULIB) \ - $(SALLIB) \ - -lXext -lX11 + $(SALLIB) UNIXTEXT = $(MISC)$/spadmin.sh diff --git a/toolkit/util/makefile.mk b/toolkit/util/makefile.mk index a04bdcbdf801..3c5da82d0dd9 100644 --- a/toolkit/util/makefile.mk +++ b/toolkit/util/makefile.mk @@ -80,22 +80,6 @@ DEF1DEPN =$(LIB1TARGET) DEF1DES =TK DEFLIB1NAME =tk -.IF "$(OS)"=="MACOSX" - -# [ed] 6/16/02 Add in X libraries if we're building X - -.IF "$(GUIBASE)"=="unx" -SHL1STDLIBS +=\ - -lX11 -lXt -lXmu -.ENDIF - -.ELSE -.IF "$(GUI)"=="UNX" -SHL1STDLIBS +=\ - -lX11 -.ENDIF -.ENDIF - RESLIB1IMAGES=$(PRJ)$/source$/awt RES1FILELIST=$(SRS)$/awt.srs RESLIB1NAME=$(TARGET) diff --git a/vcl/aqua/inc/saldata.hxx b/vcl/aqua/inc/saldata.hxx index dc629b9a3b8c..a84be1fc2c25 100644 --- a/vcl/aqua/inc/saldata.hxx +++ b/vcl/aqua/inc/saldata.hxx @@ -35,6 +35,8 @@ #include <Cocoa/Cocoa.h> #include "postmac.h" +#include "com/sun/star/uno/Reference.hxx" + #include "vcl/sv.h" #include "vcl/svdata.hxx" #include "vcl/salwtype.hxx" @@ -112,6 +114,9 @@ struct SalData long mnDPIX; // #i100617# read DPI only once per office life long mnDPIY; // #i100617# read DPI only once per office life + com::sun::star::uno::Reference< com::sun::star::uno::XInterface > + mxClipboard; + SalData(); ~SalData(); diff --git a/vcl/aqua/inc/salinst.h b/vcl/aqua/inc/salinst.h index b2cbc83d9f79..82ac5b6f4ffd 100644 --- a/vcl/aqua/inc/salinst.h +++ b/vcl/aqua/inc/salinst.h @@ -146,6 +146,12 @@ public: virtual void SetEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ); virtual void SetErrorEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ); + // dtrans implementation + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > + CreateClipboard( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& i_rArguments ); + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDragSource(); + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget(); + static void handleAppDefinedEvent( NSEvent* pEvent ); // check whether a particular string is passed on the command line diff --git a/dtrans/source/aqua/DataFlavorMapping.cxx b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx index ce042e15b4d8..af05f084a97e 100644 --- a/dtrans/source/aqua/DataFlavorMapping.cxx +++ b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx @@ -28,11 +28,13 @@ * ************************************************************************/ +#include "vcl/unohelp.hxx" #include <DataFlavorMapping.hxx> #include "HtmlFmtFlt.hxx" #include "PictToBmpFlt.hxx" -#include <com/sun/star/datatransfer/UnsupportedFlavorException.hpp> -#include <com/sun/star/datatransfer/XMimeContentType.hpp> +#include "com/sun/star/datatransfer/UnsupportedFlavorException.hpp" +#include "com/sun/star/datatransfer/XMimeContentType.hpp" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/uno/Sequence.hxx" #include <rtl/ustring.hxx> @@ -513,12 +515,11 @@ Any FileListDataProvider::getOOoData() //########################### -DataFlavorMapper::DataFlavorMapper(const Reference<XComponentContext>& context) : - mXComponentContext(context) +DataFlavorMapper::DataFlavorMapper() { - Reference<XMultiComponentFactory> mrServiceManager = mXComponentContext->getServiceManager(); - mrXMimeCntFactory = Reference<XMimeContentTypeFactory>(mrServiceManager->createInstanceWithContext( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.MimeContentTypeFactory")), mXComponentContext), UNO_QUERY); + Reference<XMultiServiceFactory> mrServiceManager = vcl::unohelper::GetMultiServiceFactory(); + mrXMimeCntFactory = Reference<XMimeContentTypeFactory>(mrServiceManager->createInstance( + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.MimeContentTypeFactory"))), UNO_QUERY); if (!mrXMimeCntFactory.is()) throw RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM("AquaClipboard: Cannot create com.sun.star.datatransfer.MimeContentTypeFactory")), NULL); diff --git a/dtrans/source/aqua/DataFlavorMapping.hxx b/vcl/aqua/source/dtrans/DataFlavorMapping.hxx index 6243032d5051..03cb77e319f7 100644 --- a/dtrans/source/aqua/DataFlavorMapping.hxx +++ b/vcl/aqua/source/dtrans/DataFlavorMapping.hxx @@ -75,7 +75,7 @@ public: /* Initialialize a DataFavorMapper instance. Throws a RuntimeException in case the XMimeContentTypeFactory service cannot be created. */ - DataFlavorMapper(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& context); + DataFlavorMapper(); /* Map a system data flavor to an OpenOffice data flavor. @@ -133,7 +133,6 @@ private: bool isValidMimeContentType(const rtl::OUString& contentType) const; private: - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> mXComponentContext; ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory> mrXMimeCntFactory; }; diff --git a/dtrans/source/aqua/DragActionConversion.cxx b/vcl/aqua/source/dtrans/DragActionConversion.cxx index 793dcca503a0..793dcca503a0 100644 --- a/dtrans/source/aqua/DragActionConversion.cxx +++ b/vcl/aqua/source/dtrans/DragActionConversion.cxx diff --git a/dtrans/source/aqua/DragActionConversion.hxx b/vcl/aqua/source/dtrans/DragActionConversion.hxx index 137e2af30be1..137e2af30be1 100644 --- a/dtrans/source/aqua/DragActionConversion.hxx +++ b/vcl/aqua/source/dtrans/DragActionConversion.hxx diff --git a/dtrans/source/aqua/DragSource.cxx b/vcl/aqua/source/dtrans/DragSource.cxx index c0e7bd6ece94..074ce5c6c318 100644 --- a/dtrans/source/aqua/DragSource.cxx +++ b/vcl/aqua/source/dtrans/DragSource.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> #include <com/sun/star/datatransfer/XTransferable.hpp> #include <com/sun/star/awt/MouseButton.hpp> @@ -61,9 +61,6 @@ using namespace comphelper; using namespace std; -extern rtl_StandardModuleCount g_moduleCount; - - // For OOo internal D&D we provide the Transferable without NSDragPboard // interference as a shortcut Reference<XTransferable> DragSource::g_XTransferable = Reference<XTransferable>(); @@ -161,14 +158,12 @@ Sequence<OUString> dragSource_getSupportedServiceNames() @end -DragSource::DragSource( const Reference<XComponentContext>& context): +DragSource::DragSource(): WeakComponentImplHelper3<XDragSource, XInitialization, XServiceInfo>(m_aMutex), - mXComponentContext(context), mView(NULL), mLastMouseEventBeforeStartDrag(nil), m_MouseButton(0) { - g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt); } @@ -176,7 +171,6 @@ DragSource::~DragSource() { [(id <MouseEventListener>)mView unregisterMouseEventListener: mDragSourceHelper]; [mDragSourceHelper release]; - g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); } @@ -254,7 +248,7 @@ void SAL_CALL DragSource::startDrag(const DragGestureEvent& trigger, m_MouseButton= mMouseEvent.Buttons; mXDragSrcListener = listener; mXCurrentContext = static_cast<XDragSourceContext*>(new DragSourceContext(this)); - auto_ptr<AquaClipboard> clipb(new AquaClipboard(this->mXComponentContext, NULL, false)); + auto_ptr<AquaClipboard> clipb(new AquaClipboard(NULL, false)); g_XTransferable = transferable; clipb->setContents(g_XTransferable, Reference<XClipboardOwner>()); mDragSourceActions = sourceActions; diff --git a/dtrans/source/aqua/DragSource.hxx b/vcl/aqua/source/dtrans/DragSource.hxx index 252b63fee41d..1268a466adf3 100644 --- a/dtrans/source/aqua/DragSource.hxx +++ b/vcl/aqua/source/dtrans/DragSource.hxx @@ -89,7 +89,7 @@ class DragSource : public ::cppu::BaseMutex, private ::boost::noncopyable { public: - DragSource(const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext>& context); + DragSource(); virtual ~DragSource(); // XInitialization @@ -119,8 +119,6 @@ public: virtual unsigned int getSupportedDragOperations(bool isLocal) const; public: - com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> mXComponentContext; - // The context notifies the XDragSourceListeners com::sun::star::uno::Reference< com::sun::star::datatransfer::dnd::XDragSourceContext > mXCurrentContext; diff --git a/dtrans/source/aqua/DragSourceContext.cxx b/vcl/aqua/source/dtrans/DragSourceContext.cxx index f0496a297052..cd657a6147e9 100644 --- a/dtrans/source/aqua/DragSourceContext.cxx +++ b/vcl/aqua/source/dtrans/DragSourceContext.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> @@ -43,20 +43,14 @@ using namespace com::sun::star::datatransfer::dnd::DNDConstants; using namespace com::sun::star::uno; using namespace cppu; - -extern rtl_StandardModuleCount g_moduleCount; - - DragSourceContext::DragSourceContext( DragSource* pSource) : WeakComponentImplHelper1<XDragSourceContext>(m_aMutex), m_pDragSource( pSource) { - g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt ); } DragSourceContext::~DragSourceContext() { - g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); } sal_Int32 SAL_CALL DragSourceContext::getCurrentCursor( ) diff --git a/dtrans/source/aqua/DragSourceContext.hxx b/vcl/aqua/source/dtrans/DragSourceContext.hxx index 3526ec846fd6..3526ec846fd6 100644 --- a/dtrans/source/aqua/DragSourceContext.hxx +++ b/vcl/aqua/source/dtrans/DragSourceContext.hxx diff --git a/dtrans/source/aqua/DropTarget.cxx b/vcl/aqua/source/dtrans/DropTarget.cxx index f2bc61e2ecf8..88ffc1e51d02 100644 --- a/dtrans/source/aqua/DropTarget.cxx +++ b/vcl/aqua/source/dtrans/DropTarget.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> #include <com/sun/star/datatransfer/XTransferable.hpp> #include <com/sun/star/datatransfer/dnd/DropTargetDragEnterEvent.hpp> @@ -65,8 +65,6 @@ using namespace com::sun::star::lang; using namespace com::sun::star::uno; using namespace comphelper; -extern rtl_StandardModuleCount g_moduleCount; - OUString dropTarget_getImplementationName() { return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.datatransfer.dnd.OleDropTarget_V1")); @@ -152,17 +150,15 @@ namespace /* private */ @end -DropTarget::DropTarget( const Reference<XComponentContext>& context) : +DropTarget::DropTarget() : WeakComponentImplHelper5<XInitialization, XDropTarget, XDropTargetDragContext, XDropTargetDropContext, XServiceInfo>(m_aMutex), - mXComponentContext(context), mDropTargetHelper(nil), mbActive(false), mDragSourceSupportedActions(DNDConstants::ACTION_NONE), mSelectedDropAction(DNDConstants::ACTION_NONE), mDefaultActions(DNDConstants::ACTION_COPY_OR_MOVE | DNDConstants::ACTION_LINK | DNDConstants::ACTION_DEFAULT) { - g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt ); - mDataFlavorMapper = DataFlavorMapperPtr_t(new DataFlavorMapper(mXComponentContext)); + mDataFlavorMapper = DataFlavorMapperPtr_t(new DataFlavorMapper()); } @@ -170,7 +166,6 @@ DropTarget::~DropTarget() { [(id <DraggingDestinationHandler>)mView unregisterDraggingDestinationHandler:mDropTargetHelper]; [mDropTargetHelper release]; - g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); } @@ -249,7 +244,7 @@ NSDragOperation DropTarget::draggingEntered(id sender) sal_Int32 posY = static_cast<sal_Int32>(dragLocation.y); NSPasteboard* dragPboard = [sender draggingPasteboard]; - mXCurrentDragClipboard = new AquaClipboard(mXComponentContext, dragPboard, false); + mXCurrentDragClipboard = new AquaClipboard(dragPboard, false); Reference<XTransferable> xTransferable = DragSource::g_XTransferable.is() ? DragSource::g_XTransferable : mXCurrentDragClipboard->getContents(); diff --git a/dtrans/source/aqua/DropTarget.hxx b/vcl/aqua/source/dtrans/DropTarget.hxx index f65de4ff164e..91b50c041916 100644 --- a/dtrans/source/aqua/DropTarget.hxx +++ b/vcl/aqua/source/dtrans/DropTarget.hxx @@ -95,7 +95,7 @@ class DropTarget: public cppu::BaseMutex, private boost::noncopyable { public: - DropTarget(const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context); + DropTarget(); virtual ~DropTarget(); // Overrides WeakComponentImplHelper::disposing which is called by @@ -157,7 +157,6 @@ private: void fire_dropActionChanged(const com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde); private: - com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mXComponentContext; com::sun::star::uno::Reference< com::sun::star::datatransfer::dnd::XDropTargetDragContext > mXCurrentDragContext; com::sun::star::uno::Reference< com::sun::star::datatransfer::dnd::XDropTargetDropContext > mXCurrentDropContext; com::sun::star::uno::Reference< com::sun::star::datatransfer::clipboard::XClipboard > mXCurrentDragClipboard; diff --git a/dtrans/source/aqua/HtmlFmtFlt.cxx b/vcl/aqua/source/dtrans/HtmlFmtFlt.cxx index 3f558b0a5b4f..3f558b0a5b4f 100644 --- a/dtrans/source/aqua/HtmlFmtFlt.cxx +++ b/vcl/aqua/source/dtrans/HtmlFmtFlt.cxx diff --git a/dtrans/source/aqua/HtmlFmtFlt.hxx b/vcl/aqua/source/dtrans/HtmlFmtFlt.hxx index 49f0cc70590c..49f0cc70590c 100644 --- a/dtrans/source/aqua/HtmlFmtFlt.hxx +++ b/vcl/aqua/source/dtrans/HtmlFmtFlt.hxx diff --git a/dtrans/source/aqua/OSXTransferable.cxx b/vcl/aqua/source/dtrans/OSXTransferable.cxx index a4f5b7807935..a893f09d89cc 100644 --- a/dtrans/source/aqua/OSXTransferable.cxx +++ b/vcl/aqua/source/dtrans/OSXTransferable.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <sal/types.h> #ifndef _TRANSFERABLE_HXX_ @@ -63,11 +63,9 @@ namespace // private } // namespace private -OSXTransferable::OSXTransferable(const Reference< XComponentContext >& context, - const Reference<XMimeContentTypeFactory> rXMimeCntFactory, +OSXTransferable::OSXTransferable(const Reference<XMimeContentTypeFactory> rXMimeCntFactory, DataFlavorMapperPtr_t pDataFlavorMapper, NSPasteboard* pasteboard) : - mXComponentContext(context), mrXMimeCntFactory(rXMimeCntFactory), mDataFlavorMapper(pDataFlavorMapper), mPasteboard(pasteboard) diff --git a/dtrans/source/aqua/OSXTransferable.hxx b/vcl/aqua/source/dtrans/OSXTransferable.hxx index d231611f0aaf..9b371523c440 100644 --- a/dtrans/source/aqua/OSXTransferable.hxx +++ b/vcl/aqua/source/dtrans/OSXTransferable.hxx @@ -58,8 +58,7 @@ class OSXTransferable : public ::cppu::WeakImplHelper1<com::sun::star::datatrans public: typedef com::sun::star::uno::Sequence< sal_Int8 > ByteSequence_t; - explicit OSXTransferable(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& context, - ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory> rXMimeCntFactory, + explicit OSXTransferable(com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory> rXMimeCntFactory, DataFlavorMapperPtr_t pDataFlavorMapper, NSPasteboard* pasteboard); @@ -96,7 +95,6 @@ public: private: com::sun::star::uno::Sequence< com::sun::star::datatransfer::DataFlavor > mFlavorList; - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mXComponentContext; ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory> mrXMimeCntFactory; DataFlavorMapperPtr_t mDataFlavorMapper; NSPasteboard* mPasteboard; diff --git a/dtrans/source/aqua/PictToBmpFlt.cxx b/vcl/aqua/source/dtrans/PictToBmpFlt.cxx index 0643efae33ca..0643efae33ca 100644 --- a/dtrans/source/aqua/PictToBmpFlt.cxx +++ b/vcl/aqua/source/dtrans/PictToBmpFlt.cxx diff --git a/dtrans/source/aqua/PictToBmpFlt.hxx b/vcl/aqua/source/dtrans/PictToBmpFlt.hxx index 29e9c535546f..29e9c535546f 100644 --- a/dtrans/source/aqua/PictToBmpFlt.hxx +++ b/vcl/aqua/source/dtrans/PictToBmpFlt.hxx diff --git a/dtrans/source/aqua/aqua_clipboard.cxx b/vcl/aqua/source/dtrans/aqua_clipboard.cxx index 370edee90eb7..27bf308dce9b 100644 --- a/dtrans/source/aqua/aqua_clipboard.cxx +++ b/vcl/aqua/source/dtrans/aqua_clipboard.cxx @@ -29,15 +29,15 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include "aqua_clipboard.hxx" #include "DataFlavorMapping.hxx" #include "OSXTransferable.hxx" -#ifndef COMPHELPER_MAKESEQUENCE_HXX_INCLUDED +#include "vcl/unohelp.hxx" + #include "comphelper/makesequence.hxx" -#endif #include <boost/assert.hpp> @@ -95,15 +95,14 @@ Sequence<OUString> clipboard_getSupportedServiceNames() } -AquaClipboard::AquaClipboard(const Reference< XComponentContext >& context, NSPasteboard* pasteboard, bool bUseSystemPasteboard) : +AquaClipboard::AquaClipboard(NSPasteboard* pasteboard, bool bUseSystemPasteboard) : WeakComponentImplHelper4<XClipboardEx, XClipboardNotifier, XFlushableClipboard, XServiceInfo>(m_aMutex), - mXComponentContext(context), mIsSystemPasteboard(bUseSystemPasteboard) { - Reference<XMultiComponentFactory> mrServiceMgr = mXComponentContext->getServiceManager(); + Reference<XMultiServiceFactory> mrServiceMgr = vcl::unohelper::GetMultiServiceFactory(); - mrXMimeCntFactory = Reference<XMimeContentTypeFactory>(mrServiceMgr->createInstanceWithContext( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.MimeContentTypeFactory")), mXComponentContext), UNO_QUERY); + mrXMimeCntFactory = Reference<XMimeContentTypeFactory>(mrServiceMgr->createInstance( + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.MimeContentTypeFactory"))), UNO_QUERY); if (!mrXMimeCntFactory.is()) { @@ -112,7 +111,7 @@ AquaClipboard::AquaClipboard(const Reference< XComponentContext >& context, NSPa static_cast<XClipboardEx*>(this)); } - mpDataFlavorMapper = DataFlavorMapperPtr_t(new DataFlavorMapper(mXComponentContext)); + mpDataFlavorMapper = DataFlavorMapperPtr_t(new DataFlavorMapper()); if (pasteboard != NULL) { @@ -183,8 +182,7 @@ Reference<XTransferable> SAL_CALL AquaClipboard::getContents() throw(RuntimeExce return mXClipboardContent; } - return Reference<XTransferable>(new OSXTransferable(mXComponentContext, - mrXMimeCntFactory, + return Reference<XTransferable>(new OSXTransferable(mrXMimeCntFactory, mpDataFlavorMapper, mPasteboard)); } diff --git a/dtrans/source/aqua/aqua_clipboard.hxx b/vcl/aqua/source/dtrans/aqua_clipboard.hxx index 3de02f5dcdcd..90bb404fdb36 100644 --- a/dtrans/source/aqua/aqua_clipboard.hxx +++ b/vcl/aqua/source/dtrans/aqua_clipboard.hxx @@ -92,8 +92,7 @@ public: system clipboard will be created (bUseSystemClipboard == true) or if the DragPasteboard if bUseSystemClipboard == false */ - AquaClipboard(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& context, - NSPasteboard* pasteboard = NULL, + AquaClipboard(NSPasteboard* pasteboard = NULL, bool bUseSystemClipboard = true); ~AquaClipboard(); @@ -171,7 +170,6 @@ private: void fireClipboardChangedEvent(); private: - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mXComponentContext; ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory > mrXMimeCntFactory; ::std::list< ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener > > mClipboardListeners; ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > mXClipboardContent; diff --git a/dtrans/source/aqua/aqua_service.cxx b/vcl/aqua/source/dtrans/aqua_service.cxx index 39453683a2cc..aeaf697670ef 100644 --- a/dtrans/source/aqua/aqua_service.cxx +++ b/vcl/aqua/source/dtrans/aqua_service.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include "aqua_clipboard.hxx" #include <cppuhelper/factory.hxx> #include <com/sun/star/container/XSet.hpp> diff --git a/dtrans/source/aqua/makefile.mk b/vcl/aqua/source/dtrans/makefile.mk index 86bbbc8f7f22..e802c98abf64 100644 --- a/dtrans/source/aqua/makefile.mk +++ b/vcl/aqua/source/dtrans/makefile.mk @@ -29,17 +29,11 @@ # #************************************************************************* -PRJ=..$/.. +PRJ=..$/..$/.. -PRJNAME=dtrans +PRJNAME=vcl TARGET=dtransaqua ENABLE_EXCEPTIONS=TRUE -LIBTARGET=NO -.IF "$(OS)"=="MACOSX" -.IF "$(GUIBASE)"=="aqua" -COMP1TYPELIST=$(TARGET) -.ENDIF # "$(GUIBASE)"=="aqua" -.ENDIF # "$(OS)"=="MACOSX" # --- Settings ----------------------------------------------------- @@ -56,7 +50,7 @@ dummy: @echo "Nothing to build for GUIBASE $(GUIBASE)" .ELSE -CFLAGSCXX+=$(OBJCXXFLAGS) -fconstant-cfstrings +CFLAGSCXX+=-fconstant-cfstrings -x objective-c++ -fobjc-exceptions SLOFILES= \ $(SLO)$/aqua_clipboard.obj \ @@ -70,35 +64,7 @@ SLOFILES= \ $(SLO)$/DragSourceContext.obj \ $(SLO)$/DragActionConversion.obj -SHL1TARGET=$(TARGET)$(DLLPOSTFIX) - -SHL1STDLIBS= \ - $(SALLIB) \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - -framework Carbon \ - -framework QuickTime \ - -framework Cocoa - -SHL1DEPN= -SHL1IMPLIB= i$(SHL1TARGET) - -SHL1OBJS= $(SLOFILES) - -#APP1NOSAL=TRUE -#APP1TARGET=test_aquacb -#APP1OBJS=$(SLO)$/test_aquacb.obj -#APP1STDLIBS= -#$(SALLIB) -#$(CPPULIB) -#$(CPPUHELPERLIB) -#-framework Cocoa - # --- Targets ------------------------------------------------------ - -ALL : ALLTAR - +cd $(LB) && $(REGCOMP) -register -r ../bin/$(COMP1TYPELIST).rdb -c $(SHL1TARGET) - .INCLUDE : target.mk .ENDIF # "$(GUIBASE)"!="aqua" diff --git a/vcl/aqua/source/dtrans/service_entry.cxx b/vcl/aqua/source/dtrans/service_entry.cxx new file mode 100644 index 000000000000..38784ecb53dd --- /dev/null +++ b/vcl/aqua/source/dtrans/service_entry.cxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: service_entry.cxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + +#include "saldata.hxx" +#include "salinst.h" +#include "DragSource.hxx" +#include "DropTarget.hxx" +#include "aqua_clipboard.hxx" +#include "osl/diagnose.h" + +using namespace ::osl; +using namespace ::rtl; +using namespace ::com::sun::star::uno; +using namespace ::cppu; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::datatransfer::clipboard; + + +Reference< XInterface > AquaSalInstance::CreateClipboard( const Sequence< Any >& i_rArguments ) +{ + SalData* pSalData = GetSalData(); + if( ! pSalData->mxClipboard.is() ) + pSalData->mxClipboard = Reference<XInterface>(static_cast< XClipboard* >(new AquaClipboard()), UNO_QUERY); + return pSalData->mxClipboard; +} + + +Reference<XInterface> AquaSalInstance::CreateDragSource() +{ + return Reference<XInterface>(static_cast< XInitialization* >(new DragSource()), UNO_QUERY); +} + +Reference<XInterface> AquaSalInstance::CreateDropTarget() +{ + return Reference<XInterface>(static_cast< XInitialization* >(new DropTarget()), UNO_QUERY); +} + diff --git a/dtrans/source/aqua/test_aquacb.cxx b/vcl/aqua/source/dtrans/test_aquacb.cxx index bcb9dcd164df..db60712ce852 100644 --- a/dtrans/source/aqua/test_aquacb.cxx +++ b/vcl/aqua/source/dtrans/test_aquacb.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include "aqua_clipboard.hxx" #include <cppuhelper/servicefactory.hxx> diff --git a/vcl/inc/vcl/salinst.hxx b/vcl/inc/vcl/salinst.hxx index 221c9e370ea6..650e57cdccc4 100644 --- a/vcl/inc/vcl/salinst.hxx +++ b/vcl/inc/vcl/salinst.hxx @@ -31,6 +31,8 @@ #ifndef _SV_SALINST_HXX #define _SV_SALINST_HXX +#include "com/sun/star/uno/Reference.hxx" + #include "vcl/sv.h" #include "vcl/dllapi.h" @@ -176,6 +178,12 @@ public: // this is only necessary because PrintFontManager is an exported vcl API and therefore // needs to be in libvcl while libvclplug_* do not contain exported C++ API virtual void FillFontPathList( std::list< rtl::OString >& o_rFontPaths ); + + // dtrans implementation + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > + CreateClipboard( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& i_rArguments ); + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDragSource(); + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget(); }; // called from SVMain diff --git a/vcl/prj/build.lst b/vcl/prj/build.lst index e8a328b04bcc..908dd1eafd72 100644 --- a/vcl/prj/build.lst +++ b/vcl/prj/build.lst @@ -20,7 +20,9 @@ vc vcl\win\source\gdi nmake - w vc__gdiw vc_inc NULL vc vcl\win\source\window nmake - w vc__winw vc_inc NULL vc vcl\win\source\src nmake - w vc__srcw vc_inc NULL vc vcl\unx\source\plugadapt nmake - u vc__plug vc_inc NULL +vc vcl\unx\source\desktopdetect nmake - u vc__desk vc_inc NULL vc vcl\unx\source\app nmake - u vc__appu vc_inc NULL +vc vcl\unx\source\dtrans nmake - u vc__dtru vc_inc NULL vc vcl\unx\source\fontmanager nmake - u vc__ftmu vc_inc NULL vc vcl\unx\source\gdi nmake - u vc__gdiu vc_inc NULL vc vcl\unx\source\printer nmake - u vc__prnu vc_inc NULL @@ -35,6 +37,7 @@ vc vcl\unx\kde nmake - u vc__kde vc_inc NULL vc vcl\unx\kde4 nmake - u vc__kde4 vc_inc NULL vc vcl\aqua\source\a11y nmake - u vc__aquy vc_inc NULL vc vcl\aqua\source\app nmake - u vc__appa vc_inc NULL +vc vcl\aqua\source\dtrans nmake - u vc__dtra vc_inc NULL vc vcl\aqua\source\gdi nmake - u vc__gdia vc_inc NULL vc vcl\aqua\source\res nmake - u vc__resa NULL vc vcl\aqua\source\window nmake - u vc__wina vc_inc NULL @@ -42,6 +45,6 @@ vc vcl\mac\source\app nmake - m vc__appm vc_inc NULL vc vcl\mac\source\gdi nmake - m vc__gdim vc_inc NULL vc vcl\mac\source\window nmake - m vc__winm vc_inc NULL vc vcl\mac\source\src nmake - m vc__srcm vc_inc NULL -vc vcl\util nmake - all vc_util vc__plug.u vc__aquy.u vc__appa.u vc__appm.m vc__appu.u vc__appw.w vc__appp.p vc__gdia.u vc__gdim.m vc__gdiu.u vc__gdiw.w vc__gdip.p vc__srcm.m vc__srcw.w vc__srcp.p vc__wina.u vc__winm.m vc__winu.u vc__winw.w vc__winp.p vc__gtka.u vc__gtky.u vc__gtkw.u vc__gtkg.u vc__kde.u vc__kde4.u vc__hl.u vc__ftmu.u vc__prgu.u vc__prnu.u vc_app vc_ctrl vc_gdi vc_hlp vc_src vc_win vc_glyphs vc_fts vc_components NULL +vc vcl\util nmake - all vc_util vc__plug.u vc__desk.u vc__aquy.u vc__appa.u vc__dtra.u vc__appm.m vc__appu.u vc__dtru.u vc__appw.w vc__appp.p vc__gdia.u vc__gdim.m vc__gdiu.u vc__gdiw.w vc__gdip.p vc__srcm.m vc__srcw.w vc__srcp.p vc__wina.u vc__winm.m vc__winu.u vc__winw.w vc__winp.p vc__gtka.u vc__gtky.u vc__gtkw.u vc__gtkg.u vc__kde.u vc__kde4.u vc__hl.u vc__ftmu.u vc__prgu.u vc__prnu.u vc_app vc_ctrl vc_gdi vc_hlp vc_src vc_win vc_glyphs vc_fts vc_components NULL vc vcl\util\linksvp nmake - u vc_lsvp vc_util NULL vc vcl\workben nmake - all vc_wrkb vc_util vc_salmain NULL diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst index b49b0473819f..983628184177 100644 --- a/vcl/prj/d.lst +++ b/vcl/prj/d.lst @@ -1,14 +1,12 @@ mkdir: %COMMON_DEST%\bin%_EXT%\hid mkdir: %_DEST%\inc%_EXT%\vcl -mkdir: %_DEST%\inc%_EXT%\vcl\plug -mkdir: %_DEST%\inc%_EXT%\vcl\plug\vcl ..\%COMMON_OUTDIR%\bin\*.zip %COMMON_DEST%\bin%_EXT%\*.zip ..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid ..\%__SRC%\bin\vcl*.res %_DEST%\bin%_EXT%\vcl*.res ..\%__SRC%\bin\vcl?????.dll %_DEST%\bin%_EXT%\vcl?????.dll ..\%__SRC%\bin\vcl?????.sym %_DEST%\bin%_EXT%\vcl?????.sym -..\%__SRC%\lib\libvcl*.so %_DEST%\lib%_EXT%\libvcl*.so +..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib ..\%__SRC%\lib\ivcl.lib %_DEST%\lib%_EXT%\ivcl.lib ..\%__SRC%\misc\vcl?????.map %_DEST%\bin%_EXT%\vcl?????.map diff --git a/vcl/source/components/dtranscomp.cxx b/vcl/source/components/dtranscomp.cxx new file mode 100644 index 000000000000..58792cd4fbdb --- /dev/null +++ b/vcl/source/components/dtranscomp.cxx @@ -0,0 +1,556 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: fontident.cxx,v $ + * + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/lang/XSingleServiceFactory.hpp" +#include "com/sun/star/lang/XInitialization.hpp" +#include "com/sun/star/lang/DisposedException.hpp" +#include "com/sun/star/datatransfer/XTransferable.hpp" +#include "com/sun/star/datatransfer/clipboard/XClipboard.hpp" +#include "com/sun/star/datatransfer/clipboard/XClipboardEx.hpp" +#include "com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp" +#include "com/sun/star/datatransfer/clipboard/XClipboardListener.hpp" +#include "com/sun/star/datatransfer/dnd/XDragSource.hpp" +#include "com/sun/star/datatransfer/dnd/XDropTarget.hpp" +#include "com/sun/star/datatransfer/dnd/DNDConstants.hpp" + +#include "vcl/svapp.hxx" +#include "vcl/svdata.hxx" +#include "vcl/salinst.hxx" +#include "vos/mutex.hxx" +#include "osl/mutex.hxx" + +#include "cppuhelper/compbase1.hxx" +#include "cppuhelper/compbase2.hxx" +#include "cppuhelper/compbase3.hxx" +#include "cppuhelper/implbase1.hxx" + +using rtl::OUString; +using namespace com::sun::star; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; + +// ----------------------------------------------------------------------- + +namespace vcl +{ +// generic implementation to satisfy SalInstance +class GenericClipboard : + public cppu::WeakComponentImplHelper3 < + datatransfer::clipboard::XClipboardEx, + datatransfer::clipboard::XClipboardNotifier, + XServiceInfo + > +{ + osl::Mutex m_aMutex; + Reference< ::com::sun::star::datatransfer::XTransferable > m_aContents; + Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner > m_aOwner; + std::list< Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener > > m_aListeners; + + void fireChangedContentsEvent(); + void clearContents(); + +public: + + GenericClipboard() : cppu::WeakComponentImplHelper3< + datatransfer::clipboard::XClipboardEx, + datatransfer::clipboard::XClipboardNotifier, + XServiceInfo + >( m_aMutex ) + {} + virtual ~GenericClipboard(); + + /* + * XServiceInfo + */ + + virtual rtl::OUString SAL_CALL getImplementationName() throw( RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( RuntimeException ); + virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( RuntimeException ); + + static rtl::OUString getImplementationName_static(); + static Sequence< rtl::OUString > getSupportedServiceNames_static(); + + /* + * XClipboard + */ + + virtual Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents() + throw(RuntimeException); + + virtual void SAL_CALL setContents( + const Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans, + const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner ) + throw(RuntimeException); + + virtual ::rtl::OUString SAL_CALL getName() + throw(RuntimeException); + + /* + * XClipboardEx + */ + + virtual sal_Int8 SAL_CALL getRenderingCapabilities() + throw(RuntimeException); + + /* + * XClipboardNotifier + */ + virtual void SAL_CALL addClipboardListener( + const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener ) + throw(RuntimeException); + + virtual void SAL_CALL removeClipboardListener( + const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener ) + throw(RuntimeException); +}; + +GenericClipboard::~GenericClipboard() +{ +} + +rtl::OUString GenericClipboard::getImplementationName_static() +{ + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.datatransfer.VCLGenericClipboard" ) ); +} + +Sequence< rtl::OUString > GenericClipboard::getSupportedServiceNames_static() +{ + Sequence< OUString > aRet(1); + aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.clipboard.SystemClipboard"); + return aRet; +} + +rtl::OUString GenericClipboard::getImplementationName() throw( RuntimeException ) +{ + return getImplementationName_static(); +} + +Sequence< rtl::OUString > GenericClipboard::getSupportedServiceNames() throw( RuntimeException ) +{ + return getSupportedServiceNames_static(); +} + +sal_Bool GenericClipboard::supportsService( const ::rtl::OUString& ServiceName ) throw( RuntimeException ) +{ + Sequence< OUString > aServices( getSupportedServiceNames() ); + sal_Int32 nServices = aServices.getLength(); + for( sal_Int32 i = 0; i < nServices; i++ ) + { + if( aServices[i] == ServiceName ) + return sal_True; + } + return sal_False; +} + +Reference< ::com::sun::star::datatransfer::XTransferable > GenericClipboard::getContents() throw( RuntimeException ) +{ + return m_aContents; +} + +void GenericClipboard::setContents( + const Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans, + const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner ) + throw( RuntimeException ) +{ + osl::ClearableMutexGuard aGuard( m_aMutex ); + Reference< datatransfer::clipboard::XClipboardOwner > xOldOwner( m_aOwner ); + Reference< datatransfer::XTransferable > xOldContents( m_aContents ); + m_aContents = xTrans; + m_aOwner = xClipboardOwner; + + std::list< Reference< datatransfer::clipboard::XClipboardListener > > xListeners( m_aListeners ); + datatransfer::clipboard::ClipboardEvent aEv; + aEv.Contents = m_aContents; + + aGuard.clear(); + + if( xOldOwner.is() && xOldOwner != xClipboardOwner ) + xOldOwner->lostOwnership( this, xOldContents ); + for( std::list< Reference< datatransfer::clipboard::XClipboardListener > >::iterator it = + xListeners.begin(); it != xListeners.end() ; ++it ) + { + (*it)->changedContents( aEv ); + } +} + +rtl::OUString GenericClipboard::getName() throw( RuntimeException ) +{ + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CLIPBOARD" ) ); +} + +sal_Int8 GenericClipboard::getRenderingCapabilities() throw( RuntimeException ) +{ + return 0; +} + +void GenericClipboard::addClipboardListener( const Reference< datatransfer::clipboard::XClipboardListener >& listener ) + throw( RuntimeException ) +{ + osl::ClearableMutexGuard aGuard( m_aMutex ); + + m_aListeners.push_back( listener ); +} + +void GenericClipboard::removeClipboardListener( const Reference< datatransfer::clipboard::XClipboardListener >& listener ) + throw( RuntimeException ) +{ + osl::ClearableMutexGuard aGuard( m_aMutex ); + + m_aListeners.remove( listener ); +} + +// ------------------------------------------------------------------------ + +class ClipboardFactory : public ::cppu::WeakComponentImplHelper1< + com::sun::star::lang::XSingleServiceFactory +> +{ + osl::Mutex m_aMutex; +public: + ClipboardFactory(); + virtual ~ClipboardFactory(); + + /* + * XSingleServiceFactory + */ + virtual Reference< XInterface > SAL_CALL createInstance() throw(); + virtual Reference< XInterface > SAL_CALL createInstanceWithArguments( const Sequence< Any >& rArgs ) throw(); +}; + +// ------------------------------------------------------------------------ + +ClipboardFactory::ClipboardFactory() : + cppu::WeakComponentImplHelper1< + com::sun::star::lang::XSingleServiceFactory +>( m_aMutex ) +{ +} + +// ------------------------------------------------------------------------ + +ClipboardFactory::~ClipboardFactory() +{ +} + +// ------------------------------------------------------------------------ + +Reference< XInterface > ClipboardFactory::createInstance() throw() +{ + return createInstanceWithArguments( Sequence< Any >() ); +} + +// ------------------------------------------------------------------------ + +Reference< XInterface > ClipboardFactory::createInstanceWithArguments( const Sequence< Any >& arguments ) throw() +{ + vos::OGuard aGuard( Application::GetSolarMutex() ); + Reference< XInterface > xResult = ImplGetSVData()->mpDefInst->CreateClipboard( arguments ); + return xResult; +} + +// ------------------------------------------------------------------------ + +Sequence< OUString > SAL_CALL Clipboard_getSupportedServiceNames() +{ + Sequence< OUString > aRet(1); + aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.clipboard.SystemClipboard"); + return aRet; +} + +OUString SAL_CALL Clipboard_getImplementationName() +{ + #if defined UNX + return OUString( RTL_CONSTASCII_USTRINGPARAM( + #if ! defined QUARTZ + "com.sun.star.datatransfer.X11ClipboardSupport" + #else + "com.sun.star.datatransfer.clipboard.AquaClipboard" + #endif + ) ); + #else + return GenericClipboard::getImplementationName_static(); + #endif +} + +Reference< XSingleServiceFactory > SAL_CALL Clipboard_createFactory( const Reference< XMultiServiceFactory > & ) +{ + return Reference< XSingleServiceFactory >( new ClipboardFactory() ); +} + +/* +* generic DragSource dummy +*/ +class GenericDragSource : public cppu::WeakComponentImplHelper2< + datatransfer::dnd::XDragSource, + XInitialization + > +{ + osl::Mutex m_aMutex; +public: + GenericDragSource() : cppu::WeakComponentImplHelper2< datatransfer::dnd::XDragSource, XInitialization >( m_aMutex ) {} + virtual ~GenericDragSource(); + + // XDragSource + virtual sal_Bool SAL_CALL isDragImageSupported() throw(); + virtual sal_Int32 SAL_CALL getDefaultCursor( sal_Int8 dragAction ) throw(); + virtual void SAL_CALL startDrag( + const datatransfer::dnd::DragGestureEvent& trigger, + sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image, + const Reference< datatransfer::XTransferable >& transferable, + const Reference< datatransfer::dnd::XDragSourceListener >& listener + ) throw(); + + // XInitialization + virtual void SAL_CALL initialize( const Sequence< Any >& arguments ) throw( ::com::sun::star::uno::Exception ); + + static Sequence< OUString > getSupportedServiceNames_static() + { + Sequence< OUString > aRet( 1 ); + aRet[0] = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.GenericDragSource" ); + return aRet; + } + + static OUString getImplementationName_static() + { + return OUString::createFromAscii( "com.sun.star.datatransfer.dnd.VclGenericDragSource" ); + } +}; + +GenericDragSource::~GenericDragSource() +{ +} + +sal_Bool GenericDragSource::isDragImageSupported() throw() +{ + return sal_False; +} + +sal_Int32 GenericDragSource::getDefaultCursor( sal_Int8 ) throw() +{ + return 0; +} + +void GenericDragSource::startDrag( const datatransfer::dnd::DragGestureEvent&, + sal_Int8 /*sourceActions*/, sal_Int32 /*cursor*/, sal_Int32 /*image*/, + const Reference< datatransfer::XTransferable >&, + const Reference< datatransfer::dnd::XDragSourceListener >& listener + ) throw() +{ + datatransfer::dnd::DragSourceDropEvent aEv; + aEv.DropAction = datatransfer::dnd::DNDConstants::ACTION_COPY; + aEv.DropSuccess = sal_False; + listener->dragDropEnd( aEv ); +} + +void GenericDragSource::initialize( const Sequence< Any >& ) throw( Exception ) +{ +} + + +Sequence< OUString > SAL_CALL DragSource_getSupportedServiceNames() +{ + #if defined UNX + static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( + #if ! defined QUARTZ + "com.sun.star.datatransfer.dnd.X11DragSource" + #else + "com.sun.star.datatransfer.dnd.OleDragSource" + #endif + ) ); + static Sequence< OUString > aServiceNames( &aServiceName, 1 ); + return aServiceNames; + #else + return GenericDragSource::getSupportedServiceNames_static(); + #endif +} + +OUString SAL_CALL DragSource_getImplementationName() +{ + #if defined UNX + return OUString( RTL_CONSTASCII_USTRINGPARAM( + #if ! defined QUARTZ + "com.sun.star.datatransfer.dnd.XdndSupport" + #else + "com.sun.star.comp.datatransfer.dnd.OleDragSource_V1" + #endif + ) ); + #else + return GenericDragSource::getImplementationName_static(); + #endif +} + +Reference< XInterface > SAL_CALL DragSource_createInstance( const Reference< XMultiServiceFactory >& ) +{ + vos::OGuard aGuard( Application::GetSolarMutex() ); + Reference< XInterface > xResult = ImplGetSVData()->mpDefInst->CreateDragSource(); + return xResult; +} + +/* +* generic DragSource dummy +*/ + +class GenericDropTarget : public cppu::WeakComponentImplHelper2< + datatransfer::dnd::XDropTarget, + XInitialization + > +{ + osl::Mutex m_aMutex; +public: + GenericDropTarget() : cppu::WeakComponentImplHelper2< + datatransfer::dnd::XDropTarget, + XInitialization + > ( m_aMutex ) + {} + virtual ~GenericDropTarget(); + + // XInitialization + virtual void SAL_CALL initialize( const Sequence< Any >& args ) throw ( Exception ); + + // XDropTarget + virtual void SAL_CALL addDropTargetListener( const Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw(); + virtual void SAL_CALL removeDropTargetListener( const Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw(); + virtual sal_Bool SAL_CALL isActive() throw(); + virtual void SAL_CALL setActive( sal_Bool active ) throw(); + virtual sal_Int8 SAL_CALL getDefaultActions() throw(); + virtual void SAL_CALL setDefaultActions( sal_Int8 actions ) throw(); + + static Sequence< OUString > getSupportedServiceNames_static() + { + Sequence< OUString > aRet( 1 ); + aRet[0] = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.GenericDropTarget" ); + return aRet; + } + + static OUString getImplementationName_static() + { + return OUString::createFromAscii( "com.sun.star.datatransfer.dnd.VclGenericDropTarget" ); + } +}; + +GenericDropTarget::~GenericDropTarget() +{ +} + +void GenericDropTarget::initialize( const Sequence< Any >& ) throw( Exception ) +{ +} + +void GenericDropTarget::addDropTargetListener( const Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw() +{ +} + +void GenericDropTarget::removeDropTargetListener( const Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw() +{ +} + +sal_Bool GenericDropTarget::isActive() throw() +{ + return sal_False; +} + +void GenericDropTarget::setActive( sal_Bool ) throw() +{ +} + +sal_Int8 GenericDropTarget::getDefaultActions() throw() +{ + return 0; +} + +void GenericDropTarget::setDefaultActions( sal_Int8) throw() +{ +} + +Sequence< OUString > SAL_CALL DropTarget_getSupportedServiceNames() +{ + #if defined UNX + static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( + #if ! defined QUARTZ + "com.sun.star.datatransfer.dnd.X11DropTarget" + #else + "com.sun.star.datatransfer.dnd.OleDropTarget" + #endif + ) ); + static Sequence< OUString > aServiceNames( &aServiceName, 1 ); + return aServiceNames; + #else + return GenericDropTarget::getSupportedServiceNames_static(); + #endif +} + +OUString SAL_CALL DropTarget_getImplementationName() +{ + #if defined UNX + return OUString( RTL_CONSTASCII_USTRINGPARAM( + #if ! defined QUARTZ + "com.sun.star.datatransfer.dnd.XdndDropTarget" + #else + "com.sun.star.comp.datatransfer.dnd.OleDropTarget_V1" + #endif + ) ); + #else + return GenericDropTarget::getImplementationName_static(); + #endif +} + +Reference< XInterface > SAL_CALL DropTarget_createInstance( const Reference< XMultiServiceFactory >& ) +{ + vos::OGuard aGuard( Application::GetSolarMutex() ); + Reference< XInterface > xResult = ImplGetSVData()->mpDefInst->CreateDropTarget(); + return xResult; +} + + +} // namespace vcl + +/* +* SalInstance generic +*/ +Reference< XInterface > SalInstance::CreateClipboard( const Sequence< Any >& ) +{ + return Reference< XInterface >( ( cppu::OWeakObject * )new vcl::GenericClipboard() ); +} + +Reference< XInterface > SalInstance::CreateDragSource() +{ + return Reference< XInterface >( ( cppu::OWeakObject * )new vcl::GenericDragSource() ); +} + +Reference< XInterface > SalInstance::CreateDropTarget() +{ + return Reference< XInterface >( ( cppu::OWeakObject * )new vcl::GenericDropTarget() ); +} + diff --git a/vcl/source/components/factory.cxx b/vcl/source/components/factory.cxx index ef2e5c3b85fd..e816c31c613a 100644 --- a/vcl/source/components/factory.cxx +++ b/vcl/source/components/factory.cxx @@ -59,11 +59,23 @@ namespace vcl { extern Sequence< OUString > SAL_CALL DisplayAccess_getSupportedServiceNames(); extern OUString SAL_CALL DisplayAccess_getImplementationName(); -extern Reference< XInterface > SAL_CALL DisplayAccess_createInstance( const Reference< XMultiServiceFactory > & ); +extern Reference< XInterface > SAL_CALL DisplayAccess_createInstance( const Reference< XMultiServiceFactory > & ); extern Sequence< OUString > SAL_CALL FontIdentificator_getSupportedServiceNames(); extern OUString SAL_CALL FontIdentificator_getImplementationName(); -extern Reference< XInterface > SAL_CALL FontIdentificator_createInstance( const Reference< XMultiServiceFactory > & ); +extern Reference< XInterface > SAL_CALL FontIdentificator_createInstance( const Reference< XMultiServiceFactory > & ); + +extern Sequence< OUString > SAL_CALL Clipboard_getSupportedServiceNames(); +extern OUString SAL_CALL Clipboard_getImplementationName(); +extern Reference< XSingleServiceFactory > SAL_CALL Clipboard_createFactory( const Reference< XMultiServiceFactory > & ); + +extern Sequence< OUString > SAL_CALL DragSource_getSupportedServiceNames(); +extern OUString SAL_CALL DragSource_getImplementationName(); +extern Reference< XInterface > SAL_CALL DragSource_createInstance( const Reference< XMultiServiceFactory > & ); + +extern Sequence< OUString > SAL_CALL DropTarget_getSupportedServiceNames(); +extern OUString SAL_CALL DropTarget_getImplementationName(); +extern Reference< XInterface > SAL_CALL DropTarget_createInstance( const Reference< XMultiServiceFactory > & ); } extern "C" { @@ -102,6 +114,26 @@ extern "C" { aImplName.append( vcl::FontIdentificator_getSupportedServiceNames()[0] ); xKey->createKey( aImplName.makeStringAndClear() ); + #if defined UNX + aImplName.appendAscii( "/" ); + aImplName.append( vcl::Clipboard_getImplementationName() ); + aImplName.appendAscii( "/UNO/SERVICES/" ); + aImplName.append( vcl::Clipboard_getSupportedServiceNames()[0] ); + xKey->createKey( aImplName.makeStringAndClear() ); + + aImplName.appendAscii( "/" ); + aImplName.append( vcl::DragSource_getImplementationName() ); + aImplName.appendAscii( "/UNO/SERVICES/" ); + aImplName.append( vcl::DragSource_getSupportedServiceNames()[0] ); + xKey->createKey( aImplName.makeStringAndClear() ); + + aImplName.appendAscii( "/" ); + aImplName.append( vcl::DropTarget_getImplementationName() ); + aImplName.appendAscii( "/UNO/SERVICES/" ); + aImplName.append( vcl::DropTarget_getSupportedServiceNames()[0] ); + xKey->createKey( aImplName.makeStringAndClear() ); + #endif + return sal_True; } catch( ::com::sun::star::registry::InvalidRegistryException& ) @@ -143,6 +175,22 @@ extern "C" { xMgr, vcl::FontIdentificator_getImplementationName(), vcl::FontIdentificator_createInstance, vcl::FontIdentificator_getSupportedServiceNames() ); } + else if( vcl::Clipboard_getImplementationName().equalsAscii( pImplementationName ) ) + { + xFactory = vcl::Clipboard_createFactory( xMgr ); + } + else if( vcl::DragSource_getImplementationName().equalsAscii( pImplementationName ) ) + { + xFactory = ::cppu::createSingleFactory( + xMgr, vcl::DragSource_getImplementationName(), vcl::DragSource_createInstance, + vcl::DragSource_getSupportedServiceNames() ); + } + else if( vcl::DropTarget_getImplementationName().equalsAscii( pImplementationName ) ) + { + xFactory = ::cppu::createSingleFactory( + xMgr, vcl::DropTarget_getImplementationName(), vcl::DropTarget_createInstance, + vcl::DropTarget_getSupportedServiceNames() ); + } if( xFactory.is() ) { xFactory->acquire(); diff --git a/vcl/source/components/makefile.mk b/vcl/source/components/makefile.mk index 9158d33bb888..8cc836fe5424 100644 --- a/vcl/source/components/makefile.mk +++ b/vcl/source/components/makefile.mk @@ -44,6 +44,7 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- SLOFILES= $(SLO)$/display.obj \ + $(SLO)$/dtranscomp.obj \ $(SLO)$/fontident.obj \ $(SLO)$/factory.obj diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx index 73b4432342bf..8bed40fa539f 100644 --- a/vcl/unx/gtk/app/gtkinst.cxx +++ b/vcl/unx/gtk/app/gtkinst.cxx @@ -134,6 +134,16 @@ extern "C" VCL_DLLPUBLIC SalInstance* create_SalInstance( oslModule pModule ) { + /* #i92121# workaround deadlocks in the X11 implementation + */ + static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" ); + /* #i90094# + from now on we know that an X connection will be + established, so protect X against itself + */ + if( ! ( pNoXInitThreads && *pNoXInitThreads ) ) + XInitThreads(); + #if OSL_DEBUG_LEVEL > 1 int nFd = open( "/home/pl93762/log.txt", O_CREAT | O_TRUNC | O_WRONLY, 0755 ); dup2( nFd, STDERR_FILENO ); diff --git a/vcl/unx/inc/salinst.h b/vcl/unx/inc/salinst.h index c0614a78af9b..bef5cfd5e9b4 100644 --- a/vcl/unx/inc/salinst.h +++ b/vcl/unx/inc/salinst.h @@ -116,6 +116,11 @@ public: virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); void FillFontPathList( std::list< rtl::OString >& o_rFontPaths ); + // dtrans implementation + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > + CreateClipboard( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& i_rArguments ); + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDragSource(); + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget(); bool isPrinterInit() const { diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx index 15a5ba087ab2..1b5a2f86dcee 100644 --- a/vcl/unx/kde/kdedata.cxx +++ b/vcl/unx/kde/kdedata.cxx @@ -232,6 +232,16 @@ void KDEData::Init() extern "C" { VCL_DLLPUBLIC SalInstance* create_SalInstance( oslModule ) { + /* #i92121# workaround deadlocks in the X11 implementation + */ + static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" ); + /* #i90094# + from now on we know that an X connection will be + established, so protect X against itself + */ + if( ! ( pNoXInitThreads && *pNoXInitThreads ) ) + XInitThreads(); + rtl::OString aVersion( qVersion() ); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "qt version string is \"%s\"\n", aVersion.getStr() ); diff --git a/vcl/unx/kde4/main.cxx b/vcl/unx/kde4/main.cxx index 2a48624d9d14..798990c06466 100644 --- a/vcl/unx/kde4/main.cxx +++ b/vcl/unx/kde4/main.cxx @@ -45,6 +45,16 @@ extern "C" { VCL_DLLPUBLIC SalInstance* create_SalInstance( oslModule ) { + /* #i92121# workaround deadlocks in the X11 implementation + */ + static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" ); + /* #i90094# + from now on we know that an X connection will be + established, so protect X against itself + */ + if( ! ( pNoXInitThreads && *pNoXInitThreads ) ) + XInitThreads(); + #if QT_VERSION < 0x050000 // Qt 4.x support needs >= 4.1.0 rtl::OString aVersion( qVersion() ); diff --git a/vcl/unx/source/app/salinst.cxx b/vcl/unx/source/app/salinst.cxx index c160ea4c2fa5..d84b7fa5df6d 100644 --- a/vcl/unx/source/app/salinst.cxx +++ b/vcl/unx/source/app/salinst.cxx @@ -103,6 +103,16 @@ extern "C" { VCL_DLLPUBLIC SalInstance* create_SalInstance() { + /* #i92121# workaround deadlocks in the X11 implementation + */ + static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" ); + /* #i90094# + from now on we know that an X connection will be + established, so protect X against itself + */ + if( ! ( pNoXInitThreads && *pNoXInitThreads ) ) + XInitThreads(); + X11SalInstance* pInstance = new X11SalInstance( new SalYieldMutex() ); // initialize SalData diff --git a/vcl/unx/source/desktopdetect/desktopdetector.cxx b/vcl/unx/source/desktopdetect/desktopdetector.cxx new file mode 100644 index 000000000000..07fb18fa8344 --- /dev/null +++ b/vcl/unx/source/desktopdetect/desktopdetector.cxx @@ -0,0 +1,346 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: salplug.cxx,v $ + * $Revision: 1.30 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + +#include <svunx.h> +#include <tools/prex.h> +#include <X11/Xatom.h> +#include <tools/postx.h> + +#include "vcl/dllapi.h" + +#include "rtl/ustrbuf.hxx" +#include "osl/module.h" +#include "osl/process.h" +#include "osl/thread.h" + +#include <unistd.h> + +using namespace rtl; + +enum { + DESKTOP_NONE = 0, + DESKTOP_UNKNOWN, + DESKTOP_GNOME, + DESKTOP_KDE, + DESKTOP_KDE4, + DESKTOP_CDE +}; + +static const char * desktop_strings[] = { "none", "unknown", "GNOME", "KDE", "KDE4", "CDE" }; + +static bool is_gnome_desktop( Display* pDisplay ) +{ + bool ret = false; + + // warning: these checks are coincidental, GNOME does not + // explicitly advertise itself + + if ( NULL != getenv( "GNOME_DESKTOP_SESSION_ID" ) ) + ret = true; + + if( ! ret ) + { + Atom nAtom1 = XInternAtom( pDisplay, "GNOME_SM_PROXY", True ); + Atom nAtom2 = XInternAtom( pDisplay, "NAUTILUS_DESKTOP_WINDOW_ID", True ); + if( nAtom1 || nAtom2 ) + { + int nProperties = 0; + Atom* pProperties = XListProperties( pDisplay, DefaultRootWindow( pDisplay ), &nProperties ); + if( pProperties && nProperties ) + { + for( int i = 0; i < nProperties; i++ ) + if( pProperties[ i ] == nAtom1 || + pProperties[ i ] == nAtom2 ) + { + ret = true; + } + XFree( pProperties ); + } + } + } + + if( ! ret ) + { + Atom nUTFAtom = XInternAtom( pDisplay, "UTF8_STRING", True ); + Atom nNetWMNameAtom = XInternAtom( pDisplay, "_NET_WM_NAME", True ); + if( nUTFAtom && nNetWMNameAtom ) + { + // another, more expensive check: search for a gnome-panel + XLIB_Window aRoot, aParent, *pChildren = NULL; + unsigned int nChildren = 0; + XQueryTree( pDisplay, DefaultRootWindow( pDisplay ), + &aRoot, &aParent, &pChildren, &nChildren ); + if( pChildren && nChildren ) + { + for( unsigned int i = 0; i < nChildren && ! ret; i++ ) + { + Atom nType = None; + int nFormat = 0; + unsigned long nItems = 0, nBytes = 0; + unsigned char* pProp = NULL; + XGetWindowProperty( pDisplay, + pChildren[i], + nNetWMNameAtom, + 0, 8, + False, + nUTFAtom, + &nType, + &nFormat, + &nItems, + &nBytes, + &pProp ); + if( pProp && nType == nUTFAtom ) + { + OString aWMName( (sal_Char*)pProp ); + if( aWMName.equalsIgnoreAsciiCase( "gnome-panel" ) ) + ret = true; + } + if( pProp ) + XFree( pProp ); + } + XFree( pChildren ); + } + } + } + + return ret; +} + +static bool bWasXError = false; + +static inline bool WasXError() +{ + bool bRet = bWasXError; + bWasXError = false; + return bRet; +} + +extern "C" +{ + static int autodect_error_handler( Display*, XErrorEvent* ) + { + bWasXError = true; + return 0; + } + + typedef int(* XErrorHandler)(Display*,XErrorEvent*); +} + +static int KDEVersion( Display* pDisplay ) +{ + int nRet = 0; + + Atom nFullSession = XInternAtom( pDisplay, "KDE_FULL_SESSION", True ); + Atom nKDEVersion = XInternAtom( pDisplay, "KDE_SESSION_VERSION", True ); + + if( nFullSession ) + { + if( !nKDEVersion ) + return 3; + + Atom aRealType = None; + int nFormat = 8; + unsigned long nItems = 0; + unsigned long nBytesLeft = 0; + unsigned char* pProperty = NULL; + XGetWindowProperty( pDisplay, + DefaultRootWindow( pDisplay ), + nKDEVersion, + 0, 1, + False, + AnyPropertyType, + &aRealType, + &nFormat, + &nItems, + &nBytesLeft, + &pProperty ); + if( !WasXError() && nItems != 0 && pProperty ) + { + nRet = *reinterpret_cast< sal_Int32* >( pProperty ); + } + if( pProperty ) + { + XFree( pProperty ); + pProperty = NULL; + } + } + return nRet; +} + +static bool is_kde_desktop( Display* pDisplay ) +{ + if ( NULL != getenv( "KDE_FULL_SESSION" ) ) + { + const char *pVer = getenv( "KDE_SESSION_VERSION" ); + if ( !pVer || pVer[0] == '0' ) + { + return true; // does not exist => KDE3 + } + + rtl::OUString aVer( RTL_CONSTASCII_USTRINGPARAM( "3" ) ); + if ( aVer.equalsIgnoreAsciiCaseAscii( pVer ) ) + { + return true; + } + } + + if ( KDEVersion( pDisplay ) == 3 ) + return true; + + return false; +} + +static bool is_kde4_desktop( Display* pDisplay ) +{ + if ( NULL != getenv( "KDE_FULL_SESSION" ) ) + { + rtl::OUString aVer( RTL_CONSTASCII_USTRINGPARAM( "4" ) ); + + const char *pVer = getenv( "KDE_SESSION_VERSION" ); + if ( pVer && aVer.equalsIgnoreAsciiCaseAscii( pVer ) ) + return true; + } + + if ( KDEVersion( pDisplay ) == 4 ) + return true; + + return false; +} + +static bool is_cde_desktop( Display* pDisplay ) +{ + void* pLibrary = NULL; + + Atom nDtAtom = XInternAtom( pDisplay, "_DT_WM_READY", True ); + OUString aPathName( RTL_CONSTASCII_USTRINGPARAM( "file:///usr/dt/lib/libDtSvc.so" ) ); + if( nDtAtom && ( pLibrary = osl_loadModule( aPathName.pData, SAL_LOADMODULE_DEFAULT ) ) ) + { + osl_unloadModule( (oslModule)pLibrary ); + return true; + } + + return false; +} + + +extern "C" +{ + +VCL_DLLPUBLIC rtl::OUString get_desktop_environment() +{ + rtl::OUStringBuffer aRet( 8 ); + static const char *pOverride = getenv( "OOO_FORCE_DESKTOP" ); + + if ( pOverride && *pOverride ) + { + OString aOver( pOverride ); + + if ( aOver.equalsIgnoreAsciiCase( "cde" ) ) + aRet.appendAscii( desktop_strings[DESKTOP_CDE] ); + if ( aOver.equalsIgnoreAsciiCase( "kde4" ) ) + aRet.appendAscii( desktop_strings[DESKTOP_KDE4] ); + if ( aOver.equalsIgnoreAsciiCase( "gnome" ) ) + aRet.appendAscii( desktop_strings[DESKTOP_GNOME] ); + if ( aOver.equalsIgnoreAsciiCase( "kde" ) ) + aRet.appendAscii( desktop_strings[DESKTOP_KDE] ); + if ( aOver.equalsIgnoreAsciiCase( "none" ) ) + aRet.appendAscii( desktop_strings[DESKTOP_UNKNOWN] ); + } + + if( aRet.getLength() == 0 ) + { + // get display to connect to + const char* pDisplayStr = getenv( "DISPLAY" ); + int nParams = osl_getCommandArgCount(); + OUString aParam; + OString aBParm; + for( int i = 0; i < nParams; i++ ) + { + osl_getCommandArg( i, &aParam.pData ); + if( aParam.equalsAscii( "-headless" ) ) + { + pDisplayStr = NULL; + break; + } + if( i < nParams-1 && (aParam.equalsAscii( "-display" ) || aParam.equalsAscii( "--display" )) ) + { + osl_getCommandArg( i+1, &aParam.pData ); + aBParm = OUStringToOString( aParam, osl_getThreadTextEncoding() ); + pDisplayStr = aBParm.getStr(); + break; + } + } + + // no server at all + if( ! pDisplayStr || !*pDisplayStr ) + aRet.appendAscii( desktop_strings[DESKTOP_NONE] ); + else + { + /* #i92121# workaround deadlocks in the X11 implementation + */ + static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" ); + /* #i90094# + from now on we know that an X connection will be + established, so protect X against itself + */ + if( ! ( pNoXInitThreads && *pNoXInitThreads ) ) + XInitThreads(); + + Display* pDisplay = XOpenDisplay( pDisplayStr ); + if( pDisplay ) + { + XErrorHandler pOldHdl = XSetErrorHandler( autodect_error_handler ); + + if ( is_kde4_desktop( pDisplay ) ) + aRet.appendAscii( desktop_strings[DESKTOP_KDE4] ); + else if ( is_gnome_desktop( pDisplay ) ) + aRet.appendAscii( desktop_strings[DESKTOP_GNOME] ); + else if ( is_cde_desktop( pDisplay ) ) + aRet.appendAscii( desktop_strings[DESKTOP_CDE] ); + else if ( is_kde_desktop( pDisplay ) ) + aRet.appendAscii( desktop_strings[DESKTOP_KDE] ); + else + aRet.appendAscii( desktop_strings[DESKTOP_UNKNOWN] ); + + // set the default handler again + XSetErrorHandler( pOldHdl ); + + XCloseDisplay( pDisplay ); + } + } + } + + return aRet.makeStringAndClear(); +} + +} diff --git a/vcl/unx/source/desktopdetect/makefile.mk b/vcl/unx/source/desktopdetect/makefile.mk new file mode 100644 index 000000000000..cc845ee34887 --- /dev/null +++ b/vcl/unx/source/desktopdetect/makefile.mk @@ -0,0 +1,61 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.8 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=vcl +TARGET=dtdetect + +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/makefile2.pmk + +# --- Files -------------------------------------------------------- + +.IF "$(GUIBASE)"!="unx" + +dummy: + @echo "Nothing to build for GUIBASE $(GUIBASE)" + +.ELSE # "$(GUIBASE)"!="unx" + +SLOFILES=$(SLO)$/desktopdetector.obj + +.ENDIF # "$(GUIBASE)"!="unx" + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + +.INCLUDE : $(PRJ)$/util$/target.pmk diff --git a/dtrans/source/X11/X11_clipboard.cxx b/vcl/unx/source/dtrans/X11_clipboard.cxx index 634ca9ce82e8..0a47076f0d09 100644 --- a/dtrans/source/X11/X11_clipboard.cxx +++ b/vcl/unx/source/dtrans/X11_clipboard.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <X11/Xatom.h> #include <X11_clipboard.hxx> @@ -146,8 +146,6 @@ void X11Clipboard::clearContents() // inform previous owner of lost ownership if ( xOwner.is() ) xOwner->lostOwnership(xThis, m_aContents); - - fireChangedContentsEvent(); } // ------------------------------------------------------------------------ diff --git a/dtrans/source/X11/X11_clipboard.hxx b/vcl/unx/source/dtrans/X11_clipboard.hxx index a12064df6cbd..a12064df6cbd 100644 --- a/dtrans/source/X11/X11_clipboard.hxx +++ b/vcl/unx/source/dtrans/X11_clipboard.hxx diff --git a/dtrans/source/X11/X11_dndcontext.cxx b/vcl/unx/source/dtrans/X11_dndcontext.cxx index b9d8f10efa23..59832c27c2a7 100644 --- a/dtrans/source/X11/X11_dndcontext.cxx +++ b/vcl/unx/source/dtrans/X11_dndcontext.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <X11_dndcontext.hxx> #include <X11_selection.hxx> diff --git a/dtrans/source/X11/X11_dndcontext.hxx b/vcl/unx/source/dtrans/X11_dndcontext.hxx index f2ecb7b0841b..f2ecb7b0841b 100644 --- a/dtrans/source/X11/X11_dndcontext.hxx +++ b/vcl/unx/source/dtrans/X11_dndcontext.hxx diff --git a/dtrans/source/X11/X11_droptarget.cxx b/vcl/unx/source/dtrans/X11_droptarget.cxx index 4f71a0507790..153514c668a0 100644 --- a/dtrans/source/X11/X11_droptarget.cxx +++ b/vcl/unx/source/dtrans/X11_droptarget.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <X11_selection.hxx> diff --git a/dtrans/source/X11/X11_selection.cxx b/vcl/unx/source/dtrans/X11_selection.cxx index 21030a220917..3f7dfc2df709 100644 --- a/dtrans/source/X11/X11_selection.cxx +++ b/vcl/unx/source/dtrans/X11_selection.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <unistd.h> #include <stdio.h> @@ -293,25 +293,11 @@ void SelectionManager::initialize( const Sequence< Any >& arguments ) throw (::c * registering us as XEventHandler on it. * * implementor's note: - * <RANT> - * Because XDND implementations send their ClientMessage events with - * XSendEvent and event mask 0 (which is perfectly sensible) - * these events get only sent to the connection that created - * the window in question: the vcl display. - * - * So this whole service should be implemented in vcl where - * it belongs. But as usual the dogmatics win and the dogma says: - * "vcl bad, service good". So instead of making vcl a service - * providing library we make a new one that is "independent" of vcl, - * because it is not linked against it and dispatch every event of - * the vcl event loop to here via uno mechanisms (that is copying it, - * locking and unlocking mutexes). Well, the user has fast computers - * these days, so why do we need performance where more memory and - * a faster CPU will do the job ? - * And that is why this runs under the title: - * How NOT to implement a service - * or the victory of dogma over common sense. - * </RANT> + * FIXME: + * finally the clipboard and XDND service is back in the module it belongs + * now cleanup and sharing of resources with the normal vcl event loop + * needs to be added. The display used whould be that of the normal event loop + * and synchronization should be done via the SolarMutex. */ if( arguments.getLength() > 0 ) arguments.getConstArray()[0] >>= m_xDisplayConnection; @@ -338,20 +324,8 @@ void SelectionManager::initialize( const Sequence< Any >& arguments ) throw (::c arguments.getConstArray()[2] >>= m_xBitmapConverter; } - int nParams = osl_getCommandArgCount(); OUString aParam; - bool bIsHeadless = false; - for( int i = 0; i < nParams; i++ ) - { - osl_getCommandArg( i, &aParam.pData ); - if( aParam.equalsAscii( "-headless" ) ) - { - bIsHeadless = true; - break; - } - } - - if( ! m_pDisplay && ! bIsHeadless ) + if( ! m_pDisplay ) { OUString aUDisplay; if( m_xDisplayConnection.is() ) diff --git a/dtrans/source/X11/X11_selection.hxx b/vcl/unx/source/dtrans/X11_selection.hxx index dc6c41247bbd..dc6c41247bbd 100644 --- a/dtrans/source/X11/X11_selection.hxx +++ b/vcl/unx/source/dtrans/X11_selection.hxx diff --git a/vcl/unx/source/dtrans/X11_service.cxx b/vcl/unx/source/dtrans/X11_service.cxx new file mode 100644 index 000000000000..cf971a2f8eb6 --- /dev/null +++ b/vcl/unx/source/dtrans/X11_service.cxx @@ -0,0 +1,138 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: X11_service.cxx,v $ + * $Revision: 1.11 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + +#include "salinst.h" + +#include <X11_clipboard.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/registry/XRegistryKey.hpp> +#include <uno/dispatcher.h> // declaration of generic uno interface +#include <uno/mapping.hxx> // mapping stuff +#include <cppuhelper/factory.hxx> +#include <cppuhelper/compbase1.hxx> + +using namespace rtl; +using namespace cppu; +using namespace com::sun::star::lang; +using namespace com::sun::star::datatransfer::clipboard; +using namespace com::sun::star::awt; +using namespace x11; + +Sequence< OUString > SAL_CALL x11::X11Clipboard_getSupportedServiceNames() +{ + Sequence< OUString > aRet(1); + aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.clipboard.SystemClipboard"); + return aRet; +} + +Sequence< OUString > SAL_CALL x11::Xdnd_getSupportedServiceNames() +{ + Sequence< OUString > aRet(1); + aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.dnd.X11DragSource"); + return aRet; +} + +Sequence< OUString > SAL_CALL x11::Xdnd_dropTarget_getSupportedServiceNames() +{ + Sequence< OUString > aRet(1); + aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.dnd.X11DropTarget"); + return aRet; +} + +// ------------------------------------------------------------------------ + +Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& arguments ) +{ + static std::hash_map< OUString, ::std::hash_map< Atom, Reference< XClipboard > >, ::rtl::OUStringHash > m_aInstances; + + OUString aDisplayName; + Atom nSelection; + + // extract display name from connection argument. An exception is thrown + // by SelectionManager.initialize() if no display connection is given. + if( arguments.getLength() > 0 ) + { + Reference< XDisplayConnection > xConn; + arguments.getConstArray()[0] >>= xConn; + + if( xConn.is() ) + { + Any aIdentifier = xConn->getIdentifier(); + aIdentifier >>= aDisplayName; + } + } + + SelectionManager& rManager = SelectionManager::get( aDisplayName ); + rManager.initialize( arguments ); + + // check if any other selection than clipboard selection is specified + if( arguments.getLength() > 1 ) + { + OUString aSelectionName; + + arguments.getConstArray()[1] >>= aSelectionName; + nSelection = rManager.getAtom( aSelectionName ); + } + else + { + // default atom is clipboard selection + nSelection = rManager.getAtom( OUString::createFromAscii( "CLIPBOARD" ) ); + } + + ::std::hash_map< Atom, Reference< XClipboard > >& rMap( m_aInstances[ aDisplayName ] ); + ::std::hash_map< Atom, Reference< XClipboard > >::iterator it = rMap.find( nSelection ); + if( it != rMap.end() ) + return it->second; + + X11Clipboard* pClipboard = new X11Clipboard( rManager, nSelection ); + rMap[ nSelection ] = pClipboard; + + return static_cast<OWeakObject*>(pClipboard); +} + +// ------------------------------------------------------------------------ + +Reference< XInterface > X11SalInstance::CreateDragSource() +{ + return Reference < XInterface >( ( OWeakObject * ) new SelectionManagerHolder() ); +} + +// ------------------------------------------------------------------------ + +Reference< XInterface > X11SalInstance::CreateDropTarget() +{ + return Reference < XInterface >( ( OWeakObject * ) new DropTarget() ); +} + + diff --git a/dtrans/source/X11/X11_transferable.cxx b/vcl/unx/source/dtrans/X11_transferable.cxx index d9dfa3a659a4..a95b87fe1c15 100644 --- a/dtrans/source/X11/X11_transferable.cxx +++ b/vcl/unx/source/dtrans/X11_transferable.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #if OSL_DEBUG_LEVEL > 1 #include <stdio.h> diff --git a/dtrans/source/X11/X11_transferable.hxx b/vcl/unx/source/dtrans/X11_transferable.hxx index 8e8367f666e2..8e8367f666e2 100644 --- a/dtrans/source/X11/X11_transferable.hxx +++ b/vcl/unx/source/dtrans/X11_transferable.hxx diff --git a/dtrans/source/X11/bmp.cxx b/vcl/unx/source/dtrans/bmp.cxx index 372dad10b696..49219bfb0e2a 100644 --- a/dtrans/source/X11/bmp.cxx +++ b/vcl/unx/source/dtrans/bmp.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <unistd.h> #include <cstdio> diff --git a/dtrans/source/X11/bmp.hxx b/vcl/unx/source/dtrans/bmp.hxx index baf04ac31d90..baf04ac31d90 100644 --- a/dtrans/source/X11/bmp.hxx +++ b/vcl/unx/source/dtrans/bmp.hxx diff --git a/dtrans/source/X11/config.cxx b/vcl/unx/source/dtrans/config.cxx index f2f8a0f19b90..2402fb4452c3 100644 --- a/dtrans/source/X11/config.cxx +++ b/vcl/unx/source/dtrans/config.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dtrans.hxx" +#include "precompiled_vcl.hxx" #include <cstdio> #include <unotools/configitem.hxx> diff --git a/dtrans/source/X11/copydata_curs.h b/vcl/unx/source/dtrans/copydata_curs.h index 21a095521939..21a095521939 100644 --- a/dtrans/source/X11/copydata_curs.h +++ b/vcl/unx/source/dtrans/copydata_curs.h diff --git a/dtrans/source/X11/copydata_mask.h b/vcl/unx/source/dtrans/copydata_mask.h index 25db64d9bfee..25db64d9bfee 100644 --- a/dtrans/source/X11/copydata_mask.h +++ b/vcl/unx/source/dtrans/copydata_mask.h diff --git a/dtrans/source/X11/linkdata_curs.h b/vcl/unx/source/dtrans/linkdata_curs.h index 01ea8678acd2..01ea8678acd2 100644 --- a/dtrans/source/X11/linkdata_curs.h +++ b/vcl/unx/source/dtrans/linkdata_curs.h diff --git a/dtrans/source/X11/linkdata_mask.h b/vcl/unx/source/dtrans/linkdata_mask.h index b4207ad40dcf..b4207ad40dcf 100644 --- a/dtrans/source/X11/linkdata_mask.h +++ b/vcl/unx/source/dtrans/linkdata_mask.h diff --git a/dtrans/source/X11/makefile.mk b/vcl/unx/source/dtrans/makefile.mk index 219033cb706d..6af3a7c75048 100644 --- a/dtrans/source/X11/makefile.mk +++ b/vcl/unx/source/dtrans/makefile.mk @@ -29,15 +29,13 @@ # #************************************************************************* -PRJ=..$/.. +PRJ=..$/..$/.. -PRJNAME=dtrans +PRJNAME=vcl TARGET=dtransX11 TARGETTYPE=GUI ENABLE_EXCEPTIONS=TRUE -COMP1TYPELIST=$(TARGET) -LIBTARGET=NO # --- Settings ----------------------------------------------------- @@ -67,28 +65,6 @@ SLOFILES=\ $(SLO)$/bmp.obj \ $(SLO)$/config.obj -SHL1TARGET= $(TARGET)$(DLLPOSTFIX) - -.IF "$(OS)"=="MACOSX" -SHL1STDLIBS= $(LIBSTLPORT) $(CPPUHELPERLIB) -.ELSE -SHL1STDLIBS= $(CPPUHELPERLIB) -.ENDIF - -SHL1STDLIBS+= \ - $(UNOTOOLSLIB) \ - $(CPPULIB) \ - $(SALLIB) \ - -lX11 - -SHL1DEPN= -SHL1IMPLIB= i$(SHL1TARGET) -SHL1OBJS= $(SLOFILES) - -SHL1VERSIONMAP=exports.map -SHL1DEF=$(MISC)$/$(SHL1TARGET).def -DEF1NAME=$(SHL1TARGET) - .ENDIF # "$(OS)"=="MACOSX" # --- Targets ------------------------------------------------------ diff --git a/dtrans/source/X11/movedata_curs.h b/vcl/unx/source/dtrans/movedata_curs.h index 36845d5e9d1e..36845d5e9d1e 100644 --- a/dtrans/source/X11/movedata_curs.h +++ b/vcl/unx/source/dtrans/movedata_curs.h diff --git a/dtrans/source/X11/movedata_mask.h b/vcl/unx/source/dtrans/movedata_mask.h index facca718b8bf..facca718b8bf 100644 --- a/dtrans/source/X11/movedata_mask.h +++ b/vcl/unx/source/dtrans/movedata_mask.h diff --git a/dtrans/source/X11/nodrop_curs.h b/vcl/unx/source/dtrans/nodrop_curs.h index 725b0fccf91b..725b0fccf91b 100644 --- a/dtrans/source/X11/nodrop_curs.h +++ b/vcl/unx/source/dtrans/nodrop_curs.h diff --git a/dtrans/source/X11/nodrop_mask.h b/vcl/unx/source/dtrans/nodrop_mask.h index ef67a2bc2642..ef67a2bc2642 100644 --- a/dtrans/source/X11/nodrop_mask.h +++ b/vcl/unx/source/dtrans/nodrop_mask.h diff --git a/vcl/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx index 48908ec498c5..14de25b13e4d 100644 --- a/vcl/unx/source/plugadapt/salplug.cxx +++ b/vcl/unx/source/plugadapt/salplug.cxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: salplug.cxx,v $ - * $Revision: 1.30 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -31,18 +28,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <osl/module.h> -#include <osl/process.h> +#include "osl/module.h" +#include "osl/process.h" -#include <rtl/ustrbuf.hxx> +#include "rtl/ustrbuf.hxx" -#include <svunx.h> -#include <tools/prex.h> -#include <X11/Xatom.h> -#include <tools/postx.h> -#include <vcl/salinst.hxx> -#include <saldata.hxx> +#include "vcl/salinst.hxx" +#include "saldata.hxx" #include <cstdio> #include <unistd.h> @@ -130,292 +123,45 @@ static SalInstance* tryInstance( const OUString& rModuleBase ) return pInst; } -static bool is_gnome_desktop( Display* pDisplay ) +static const rtl::OUString& get_desktop_environment() { - bool ret = false; - - // warning: these checks are coincidental, GNOME does not - // explicitly advertise itself - - if ( NULL != getenv( "GNOME_DESKTOP_SESSION_ID" ) ) - ret = true; - - if( ! ret ) - { - Atom nAtom1 = XInternAtom( pDisplay, "GNOME_SM_PROXY", True ); - Atom nAtom2 = XInternAtom( pDisplay, "NAUTILUS_DESKTOP_WINDOW_ID", True ); - if( nAtom1 || nAtom2 ) - { - int nProperties = 0; - Atom* pProperties = XListProperties( pDisplay, DefaultRootWindow( pDisplay ), &nProperties ); - if( pProperties && nProperties ) - { - for( int i = 0; i < nProperties; i++ ) - if( pProperties[ i ] == nAtom1 || - pProperties[ i ] == nAtom2 ) - { - ret = true; - } - XFree( pProperties ); - } - } - } - - if( ! ret ) + static rtl::OUString aRet; + if( ! aRet.getLength() ) { - Atom nUTFAtom = XInternAtom( pDisplay, "UTF8_STRING", True ); - Atom nNetWMNameAtom = XInternAtom( pDisplay, "_NET_WM_NAME", True ); - if( nUTFAtom && nNetWMNameAtom ) - { - // another, more expensive check: search for a gnome-panel - XLIB_Window aRoot, aParent, *pChildren = NULL; - unsigned int nChildren = 0; - XQueryTree( pDisplay, DefaultRootWindow( pDisplay ), - &aRoot, &aParent, &pChildren, &nChildren ); - if( pChildren && nChildren ) - { - for( unsigned int i = 0; i < nChildren && ! ret; i++ ) - { - Atom nType = None; - int nFormat = 0; - unsigned long nItems = 0, nBytes = 0; - unsigned char* pProp = NULL; - XGetWindowProperty( pDisplay, - pChildren[i], - nNetWMNameAtom, - 0, 8, - False, - nUTFAtom, - &nType, - &nFormat, - &nItems, - &nBytes, - &pProp ); - if( pProp && nType == nUTFAtom ) - { - OString aWMName( (sal_Char*)pProp ); - if( aWMName.equalsIgnoreAsciiCase( "gnome-panel" ) ) - ret = true; - } - if( pProp ) - XFree( pProp ); - } - XFree( pChildren ); - } - } - } - - return ret; -} - -static bool bWasXError = false; - -static inline bool WasXError() -{ - bool bRet = bWasXError; - bWasXError = false; - return bRet; -} - -extern "C" -{ - static int autodect_error_handler( Display*, XErrorEvent* ) - { - bWasXError = true; - return 0; - } - - typedef int(* XErrorHandler)(Display*,XErrorEvent*); -} - -static int KDEVersion( Display* pDisplay ) -{ - int nRet = 0; - - Atom nFullSession = XInternAtom( pDisplay, "KDE_FULL_SESSION", True ); - Atom nKDEVersion = XInternAtom( pDisplay, "KDE_SESSION_VERSION", True ); - - if( nFullSession ) - { - if( !nKDEVersion ) - return 3; - - Atom aRealType = None; - int nFormat = 8; - unsigned long nItems = 0; - unsigned long nBytesLeft = 0; - unsigned char* pProperty = NULL; - XGetWindowProperty( pDisplay, - DefaultRootWindow( pDisplay ), - nKDEVersion, - 0, 1, - False, - AnyPropertyType, - &aRealType, - &nFormat, - &nItems, - &nBytesLeft, - &pProperty ); - if( !WasXError() && nItems != 0 && pProperty ) - { - nRet = *reinterpret_cast< sal_Int32* >( pProperty ); - } - if( pProperty ) - { - XFree( pProperty ); - pProperty = NULL; - } - } - return nRet; -} - -static bool is_kde_desktop( Display* pDisplay ) -{ - if ( NULL != getenv( "KDE_FULL_SESSION" ) ) - { - const char *pVer = getenv( "KDE_SESSION_VERSION" ); - if ( !pVer || pVer[0] == '0' ) - { - return true; // does not exist => KDE3 - } - - rtl::OUString aVer( RTL_CONSTASCII_USTRINGPARAM( "3" ) ); - if ( aVer.equalsIgnoreAsciiCaseAscii( pVer ) ) + OUStringBuffer aModName( 128 ); + aModName.appendAscii( SAL_DLLPREFIX"desktop_detector" ); + aModName.appendAscii( SAL_DLLPOSTFIX ); + aModName.appendAscii( SAL_DLLEXTENSION ); + OUString aModule = aModName.makeStringAndClear(); + + oslModule aMod = osl_loadModuleRelative( + reinterpret_cast< oslGenericFunction >( &tryInstance ), aModule.pData, + SAL_LOADMODULE_DEFAULT ); + if( aMod ) { - return true; + rtl::OUString (*pSym)() = (rtl::OUString(*)()) + osl_getAsciiFunctionSymbol( aMod, "get_desktop_environment" ); + if( pSym ) + aRet = pSym(); } + osl_unloadModule( aMod ); } - - if ( KDEVersion( pDisplay ) == 3 ) - return true; - - return false; -} - -static bool is_kde4_desktop( Display* pDisplay ) -{ - if ( NULL != getenv( "KDE_FULL_SESSION" ) ) - { - rtl::OUString aVer( RTL_CONSTASCII_USTRINGPARAM( "4" ) ); - - const char *pVer = getenv( "KDE_SESSION_VERSION" ); - if ( pVer && aVer.equalsIgnoreAsciiCaseAscii( pVer ) ) - return true; - } - - if ( KDEVersion( pDisplay ) == 4 ) - return true; - - return false; -} - -static bool is_cde_desktop( Display* pDisplay ) -{ - void* pLibrary = NULL; - - Atom nDtAtom = XInternAtom( pDisplay, "_DT_WM_READY", True ); - OUString aPathName( RTL_CONSTASCII_USTRINGPARAM( "file:///usr/dt/lib/libDtSvc.so" ) ); - if( nDtAtom && ( pLibrary = osl_loadModule( aPathName.pData, SAL_LOADMODULE_DEFAULT ) ) ) - { - osl_unloadModule( (oslModule)pLibrary ); - return true; - } - - return false; -} - - -static const char * get_desktop_environment() -{ - static const char *pRet = NULL; - static const char *pOverride = getenv( "OOO_FORCE_DESKTOP" ); - - if ( pOverride && *pOverride ) - { - OString aOver( pOverride ); - - if ( aOver.equalsIgnoreAsciiCase( "cde" ) ) - pRet = desktop_strings[DESKTOP_CDE]; - if ( aOver.equalsIgnoreAsciiCase( "kde" ) ) - pRet = desktop_strings[DESKTOP_KDE]; - if ( aOver.equalsIgnoreAsciiCase( "kde4" ) ) - pRet = desktop_strings[DESKTOP_KDE4]; - if ( aOver.equalsIgnoreAsciiCase( "gnome" ) ) - pRet = desktop_strings[DESKTOP_GNOME]; - if ( aOver.equalsIgnoreAsciiCase( "none" ) ) - pRet = desktop_strings[DESKTOP_UNKNOWN]; - } - - if ( NULL == pRet ) - { - // get display to connect to - const char* pDisplayStr = getenv( "DISPLAY" ); - int nParams = osl_getCommandArgCount(); - OUString aParam; - OString aBParm; - for( int i = 0; i < nParams; i++ ) - { - osl_getCommandArg( i, &aParam.pData ); - if( aParam.equalsAscii( "-headless" ) ) - { - pDisplayStr = NULL; - break; - } - if( i < nParams-1 && (aParam.equalsAscii( "-display" ) || aParam.equalsAscii( "--display" )) ) - { - osl_getCommandArg( i+1, &aParam.pData ); - aBParm = OUStringToOString( aParam, osl_getThreadTextEncoding() ); - pDisplayStr = aBParm.getStr(); - break; - } - } - - // no server at all - if( ! pDisplayStr || !*pDisplayStr ) - pRet = desktop_strings[DESKTOP_NONE]; - else - { - Display* pDisplay = XOpenDisplay( pDisplayStr ); - if( pDisplay ) - { - XErrorHandler pOldHdl = XSetErrorHandler( autodect_error_handler ); - - if ( is_kde4_desktop( pDisplay ) ) - pRet = desktop_strings[DESKTOP_KDE4]; - else if ( is_gnome_desktop( pDisplay ) ) - pRet = desktop_strings[DESKTOP_GNOME]; - else if ( is_kde_desktop( pDisplay ) ) - pRet = desktop_strings[DESKTOP_KDE]; - else if ( is_cde_desktop( pDisplay ) ) - pRet = desktop_strings[DESKTOP_CDE]; - else - pRet = desktop_strings[DESKTOP_UNKNOWN]; - - // set the default handler again - XSetErrorHandler( pOldHdl ); - - XCloseDisplay( pDisplay ); - } - } - } - - return pRet; + return aRet; } - static const char* autodetect_plugin() { - const char * desktop = get_desktop_environment(); + const rtl::OUString& desktop( get_desktop_environment() ); const char * pRet = "gen"; // no server at all: dummy plugin - if ( desktop == desktop_strings[DESKTOP_NONE] ) + if ( desktop.equalsAscii( desktop_strings[DESKTOP_NONE] ) ) pRet = "svp"; - else if ( desktop == desktop_strings[DESKTOP_GNOME] ) + else if ( desktop.equalsAscii( desktop_strings[DESKTOP_GNOME] ) ) pRet = "gtk"; - else if( desktop == desktop_strings[DESKTOP_KDE] ) + else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE] ) ) pRet = "kde"; - else if( desktop == desktop_strings[DESKTOP_KDE4] ) + else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE4] ) ) pRet = "kde4"; else { @@ -455,19 +201,6 @@ SalInstance *CreateSalInstance() if( !(pUsePlugin && *pUsePlugin) ) pInst = check_headless_plugin(); - if( ! pInst ) - { - /* #i92121# workaround deadlocks in the X11 implementation - */ - static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" ); - /* #i90094# - from now on we know that an X connection will be - established, so protect X against itself - */ - if( ! ( pNoXInitThreads && *pNoXInitThreads ) ) - XInitThreads(); - } - if( ! pInst && !(pUsePlugin && *pUsePlugin) ) pUsePlugin = autodetect_plugin(); @@ -527,8 +260,7 @@ void SalAbort( const XubString& rErrorText ) const OUString& SalGetDesktopEnvironment() { - static OUString aRet = OStringToOUString(OString(get_desktop_environment()), RTL_TEXTENCODING_ASCII_US); - return aRet; + return get_desktop_environment(); } SalData::SalData() : diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk index 5bb18f25ecd3..32620d9e966a 100644 --- a/vcl/util/makefile.mk +++ b/vcl/util/makefile.mk @@ -158,6 +158,9 @@ LIB1FILES+= \ $(SLB)$/salwin.lib \ $(SLB)$/salgdi.lib \ $(SLB)$/salapp.lib +.IF "$(GUIBASE)" == "aqua" +LIB1FILES+= $(SLB)$/dtransaqua.lib +.ENDIF .ENDIF SHL1TARGET= vcl$(DLLPOSTFIX) @@ -195,7 +198,8 @@ SHL1USE_EXPORTS=name .IF "$(GUIBASE)"=="aqua" SHL1STDLIBS+= \ $(BASEBMPLIB) \ - -lAppleRemote$(DLLPOSTFIX) + -lAppleRemote$(DLLPOSTFIX) \ + -framework QuickTime LIB1FILES+= \ $(SLB)$/sala11y.lib @@ -268,9 +272,20 @@ STDSHL1 += ft2lib.lib # UNX sal plugins .IF "$(GUI)" == "UNX" && "$(GUIBASE)" != "aqua" +# desktop detector +LIB7TARGET=$(SLB)$/idet +LIB7FILES=$(SLB)$/dtdetect.lib +SHL7TARGET=desktop_detector$(DLLPOSTFIX) +SHL7STDLIBS=\ + $(SALLIB) \ + $(X11LINK_DYNAMIC) +SHL7IMPLIB=idet +SHL7LIBS=$(LIB7TARGET) + # basic pure X11 plugin LIB2TARGET=$(SLB)$/ipure_x LIB2FILES= \ + $(SLB)$/dtransX11.lib \ $(SLB)$/printergfx.lib \ $(SLB)$/salwin.lib \ $(SLB)$/salgdi.lib \ @@ -287,6 +302,9 @@ SHL2STDLIBS=\ $(TOOLSLIB) \ $(VOSLIB) \ $(BASEGFXLIB) \ + $(UNOTOOLSLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ $(SALLIB) # prepare linking of Xinerama @@ -362,7 +380,8 @@ SHL4STDLIBS+=\ $(CPPUHELPERLIB) \ $(CPPULIB) \ $(VOSLIB) \ - $(SALLIB) + $(SALLIB) \ + $(X11LINK_DYNAMIC) .IF "$(ENABLE_RANDR)" != "" .IF "$(XRANDR_DLOPEN)" == "FALSE" @@ -390,7 +409,8 @@ SHL5STDLIBS+=\ $(VCLLIB) \ $(TOOLSLIB) \ $(VOSLIB) \ - $(SALLIB) + $(SALLIB) \ + $(X11LINK_DYNAMIC) .IF "$(ENABLE_RANDR)" != "" .IF "$(XRANDR_DLOPEN)" == "FALSE" @@ -419,7 +439,8 @@ SHL6STDLIBS+=\ $(PSPLIB) \ $(TOOLSLIB) \ $(VOSLIB) \ - $(SALLIB) + $(SALLIB) \ + $(X11LINK_DYNAMIC) .IF "$(ENABLE_RANDR)" != "" .IF "$(XRANDR_DLOPEN)" == "FALSE" |