summaryrefslogtreecommitdiff
path: root/dtrans/source/win32/clipb
diff options
context:
space:
mode:
Diffstat (limited to 'dtrans/source/win32/clipb')
-rw-r--r--dtrans/source/win32/clipb/APNDataObject.hxx90
-rw-r--r--dtrans/source/win32/clipb/WinClipbImpl.cxx276
-rw-r--r--dtrans/source/win32/clipb/WinClipbImpl.hxx128
-rw-r--r--dtrans/source/win32/clipb/WinClipboard.cxx325
-rw-r--r--dtrans/source/win32/clipb/WinClipboard.hxx160
-rw-r--r--dtrans/source/win32/clipb/exports.dxp4
-rw-r--r--dtrans/source/win32/clipb/makefile.mk63
-rw-r--r--dtrans/source/win32/clipb/sysdtrans.xml43
-rw-r--r--dtrans/source/win32/clipb/wcbentry.cxx162
9 files changed, 1251 insertions, 0 deletions
diff --git a/dtrans/source/win32/clipb/APNDataObject.hxx b/dtrans/source/win32/clipb/APNDataObject.hxx
new file mode 100644
index 000000000000..a059046232fe
--- /dev/null
+++ b/dtrans/source/win32/clipb/APNDataObject.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * 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: APNDataObject.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+#ifndef _APNDATAOBJECT_HXX_
+#define _APNDATAOBJECT_HXX_
+
+//------------------------------------------------------------------------
+// deklarations
+//------------------------------------------------------------------------
+
+/*
+ an APartment Neutral dataobject wrapper; this wrapper of a IDataObject
+ pointer can be used from any apartment without RPC_E_WRONG_THREAD
+ which normally occurs if an apartment tries to use an interface
+ pointer of another apartment; we use containment to hold the original
+ DataObject
+*/
+class CAPNDataObject : public IDataObject
+{
+public:
+ CAPNDataObject( IDataObjectPtr rIDataObject );
+ ~CAPNDataObject( );
+
+ //-----------------------------------------------------------------
+ //IUnknown interface methods
+ //-----------------------------------------------------------------
+
+ STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject);
+ STDMETHODIMP_( ULONG ) AddRef( );
+ STDMETHODIMP_( ULONG ) Release( );
+
+ //-----------------------------------------------------------------
+ // IDataObject interface methods
+ //-----------------------------------------------------------------
+
+ STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
+ STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
+ STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc );
+ STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut );
+ STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease );
+ STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc );
+ STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection );
+ STDMETHODIMP DUnadvise( DWORD dwConnection );
+ STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise );
+
+ operator IDataObject*( );
+
+private:
+ HRESULT MarshalIDataObjectIntoCurrentApartment( IDataObject** ppIDataObj );
+
+private:
+ IDataObjectPtr m_rIDataObjectOrg;
+ HGLOBAL m_hGlobal;
+ LONG m_nRefCnt;
+
+// prevent copy and assignment
+private:
+ CAPNDataObject( const CAPNDataObject& theOther );
+ CAPNDataObject& operator=( const CAPNDataObject& theOther );
+};
+
+#endif
diff --git a/dtrans/source/win32/clipb/WinClipbImpl.cxx b/dtrans/source/win32/clipb/WinClipbImpl.cxx
new file mode 100644
index 000000000000..a7180ebade34
--- /dev/null
+++ b/dtrans/source/win32/clipb/WinClipbImpl.cxx
@@ -0,0 +1,276 @@
+/*************************************************************************
+ *
+ * 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: WinClipbImpl.cxx,v $
+ * $Revision: 1.20 $
+ *
+ * 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"
+
+//------------------------------------------------------------------------
+// includes
+//------------------------------------------------------------------------
+#include <osl/diagnose.h>
+#include "WinClipbImpl.hxx"
+
+#include <systools/win32/comtools.hxx>
+#include "..\..\inc\DtObjFactory.hxx"
+#include "..\dtobj\APNDataObject.hxx"
+#include "WinClipboard.hxx"
+#include <com/sun/star/datatransfer/clipboard/RenderingCapabilities.hpp>
+#include "..\dtobj\XNotifyingDataObject.hxx"
+
+#if defined _MSC_VER
+#pragma warning(push,1)
+#endif
+#include <windows.h>
+#include <ole2.h>
+#include <objidl.h>
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
+
+//------------------------------------------------------------------------
+// namespace directives
+//------------------------------------------------------------------------
+
+using namespace rtl;
+using namespace osl;
+using namespace std;
+using namespace cppu;
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::datatransfer;
+using namespace com::sun::star::datatransfer::clipboard;
+using namespace com::sun::star::datatransfer::clipboard::RenderingCapabilities;
+
+//------------------------------------------------------------------------
+// deklarations
+//------------------------------------------------------------------------
+
+// definition of static members
+CWinClipbImpl* CWinClipbImpl::s_pCWinClipbImpl = NULL;
+osl::Mutex CWinClipbImpl::s_aMutex;
+
+//------------------------------------------------------------------------
+//
+//------------------------------------------------------------------------
+
+CWinClipbImpl::CWinClipbImpl( const OUString& aClipboardName, CWinClipboard* theWinClipboard ) :
+ m_itsName( aClipboardName ),
+ m_pWinClipboard( theWinClipboard ),
+ m_pCurrentClipContent( NULL )
+{
+ OSL_ASSERT( NULL != m_pWinClipboard );
+
+ // necessary to reassociate from
+ // the static callback function
+ s_pCWinClipbImpl = this;
+ registerClipboardViewer( );
+}
+
+//------------------------------------------------------------------------
+//
+//------------------------------------------------------------------------
+
+CWinClipbImpl::~CWinClipbImpl( )
+{
+ ClearableMutexGuard aGuard( s_aMutex );
+ s_pCWinClipbImpl = NULL;
+ aGuard.clear( );
+
+ unregisterClipboardViewer( );
+}
+
+//------------------------------------------------------------------------
+// getContent
+//------------------------------------------------------------------------
+
+Reference< XTransferable > SAL_CALL CWinClipbImpl::getContents( ) throw( RuntimeException )
+{
+ // use the shotcut or create a transferable from
+ // system clipboard
+ ClearableMutexGuard aGuard( m_ClipContentMutex );
+
+ if ( NULL != m_pCurrentClipContent )
+ {
+ return m_pCurrentClipContent->m_XTransferable;
+ }
+
+ // release the mutex, so that the variable may be
+ // changed by other threads
+ aGuard.clear( );
+
+ Reference< XTransferable > rClipContent;
+
+ // get the current dataobject from clipboard
+ IDataObjectPtr pIDataObject;
+ HRESULT hr = m_MtaOleClipboard.getClipboard( &pIDataObject );
+
+ if ( SUCCEEDED( hr ) )
+ {
+ // create an apartment neutral dataobject and initialize it with a
+ // com smart pointer to the IDataObject from clipboard
+ IDataObjectPtr pIDo( new CAPNDataObject( pIDataObject ) );
+
+ CDTransObjFactory objFactory;
+
+ // remeber pIDo destroys itself due to the smart pointer
+ rClipContent = objFactory.createTransferableFromDataObj( m_pWinClipboard->m_SrvMgr, pIDo );
+ }
+
+ return rClipContent;
+}
+
+//------------------------------------------------------------------------
+// setContent
+//------------------------------------------------------------------------
+
+void SAL_CALL CWinClipbImpl::setContents(
+ const Reference< XTransferable >& xTransferable,
+ const Reference< XClipboardOwner >& xClipboardOwner )
+ throw( RuntimeException )
+{
+ CDTransObjFactory objFactory;
+ IDataObjectPtr pIDataObj;
+
+ if ( xTransferable.is( ) )
+ {
+ ClearableMutexGuard aGuard( m_ClipContentMutex );
+
+ m_pCurrentClipContent = new CXNotifyingDataObject(
+ objFactory.createDataObjFromTransferable( m_pWinClipboard->m_SrvMgr , xTransferable ),
+ xTransferable,
+ xClipboardOwner,
+ this );
+
+ aGuard.clear( );
+
+ pIDataObj = IDataObjectPtr( m_pCurrentClipContent );
+ }
+
+ m_MtaOleClipboard.setClipboard(pIDataObj.get());
+}
+
+//------------------------------------------------------------------------
+//
+//------------------------------------------------------------------------
+
+OUString SAL_CALL CWinClipbImpl::getName( ) throw( RuntimeException )
+{
+ return m_itsName;
+}
+
+//------------------------------------------------------------------------
+//
+//------------------------------------------------------------------------
+
+sal_Int8 SAL_CALL CWinClipbImpl::getRenderingCapabilities( ) throw( RuntimeException )
+{
+ return ( Delayed | Persistant );
+}
+
+//------------------------------------------------------------------------
+//
+//------------------------------------------------------------------------
+
+void SAL_CALL CWinClipbImpl::flushClipboard( ) throw( RuntimeException )
+{
+ // sollte eigentlich hier stehen: ClearableMutexGuard aGuard( m_ClipContentMutex );
+ // geht aber nicht, da FlushClipboard zurückruft und das DataObject
+ // freigibt und damit würde es einen Deadlock in onReleaseDataObject geben
+ // FlushClipboard muß synchron sein, damit das runterfahren ggf. erst weitergeht,
+ // wenn alle Clipboard-Formate gerendert wurden
+ // die Abfrage ist nötig, damit nur geflusht wird, wenn wir wirklich Clipboardowner
+ // sind (ich weiss nicht genau was passiert, wenn man flusht und nicht Clipboard
+ // owner ist).
+ // eventuell kann man aber die Abfrage in den Clipboard STA Thread verlagern, indem
+ // man sich dort das DataObject merkt und vor dem flushen OleIsCurrentClipboard ruft
+
+ if ( NULL != m_pCurrentClipContent )
+ m_MtaOleClipboard.flushClipboard( );
+}
+
+//------------------------------------------------------------------------
+//
+//------------------------------------------------------------------------
+
+void SAL_CALL CWinClipbImpl::registerClipboardViewer( )
+{
+ m_MtaOleClipboard.registerClipViewer( CWinClipbImpl::onClipboardContentChanged );
+}
+
+//------------------------------------------------------------------------
+//
+//------------------------------------------------------------------------
+
+void SAL_CALL CWinClipbImpl::unregisterClipboardViewer( )
+{
+ m_MtaOleClipboard.registerClipViewer( NULL );
+}
+
+//------------------------------------------------------------------------
+//
+//------------------------------------------------------------------------
+
+void SAL_CALL CWinClipbImpl::dispose() throw( RuntimeException )
+{
+ OSL_ENSURE( !m_pCurrentClipContent, "Clipboard was not flushed before shutdown!" );
+}
+
+//------------------------------------------------------------------------
+//
+//------------------------------------------------------------------------
+
+void WINAPI CWinClipbImpl::onClipboardContentChanged( void )
+{
+ MutexGuard aGuard( s_aMutex );
+
+ // reassocition to instance through static member
+ if ( NULL != s_pCWinClipbImpl )
+ s_pCWinClipbImpl->m_pWinClipboard->notifyAllClipboardListener( );
+}
+
+//------------------------------------------------------------------------
+//
+//------------------------------------------------------------------------
+
+void SAL_CALL CWinClipbImpl::onReleaseDataObject( CXNotifyingDataObject* theCaller )
+{
+ OSL_ASSERT( NULL != theCaller );
+
+ if ( theCaller )
+ theCaller->lostOwnership( );
+
+ // if the current caller is the one we currently
+ // hold, then set it to NULL because an external
+ // source must be the clipboardowner now
+ MutexGuard aGuard( m_ClipContentMutex );
+
+ if ( m_pCurrentClipContent == theCaller )
+ m_pCurrentClipContent = NULL;
+}
diff --git a/dtrans/source/win32/clipb/WinClipbImpl.hxx b/dtrans/source/win32/clipb/WinClipbImpl.hxx
new file mode 100644
index 000000000000..f8a23c76b8e7
--- /dev/null
+++ b/dtrans/source/win32/clipb/WinClipbImpl.hxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * 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: WinClipbImpl.hxx,v $
+ * $Revision: 1.12 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+#ifndef _WINCLIPBIMPL_HXX_
+#define _WINCLIPBIMPL_HXX_
+
+//------------------------------------------------------------------------
+// includes
+//------------------------------------------------------------------------
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
+#include "..\..\inc\MtaOleClipb.hxx"
+
+#if defined _MSC_VER
+#pragma warning(push,1)
+#endif
+#include <windows.h>
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
+
+class CWinClipboard;
+class CXNotifyingDataObject;
+
+//---------------------------------------------------
+// impl class to avoid deadlocks between XTDataObject
+// and the clipboard implementation
+//---------------------------------------------------
+
+class CWinClipbImpl
+{
+public:
+ ~CWinClipbImpl( );
+
+protected:
+ CWinClipbImpl( const ::rtl::OUString& aClipboardName, CWinClipboard* theWinClipboard );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents( )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ void SAL_CALL setContents(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ ::rtl::OUString SAL_CALL getName( ) throw( ::com::sun::star::uno::RuntimeException );
+
+ //------------------------------------------------
+ // XClipboardEx
+ //------------------------------------------------
+
+ sal_Int8 SAL_CALL getRenderingCapabilities( ) throw( ::com::sun::star::uno::RuntimeException );
+
+ //------------------------------------------------
+ // XFlushableClipboard
+ //------------------------------------------------
+
+ void SAL_CALL flushClipboard( ) throw( com::sun::star::uno::RuntimeException );
+
+ //------------------------------------------------
+ // XComponent
+ //------------------------------------------------
+
+ void SAL_CALL dispose( ) throw( ::com::sun::star::uno::RuntimeException );
+
+ //------------------------------------------------
+ // member functions
+ //------------------------------------------------
+
+ void SAL_CALL registerClipboardViewer( );
+ void SAL_CALL unregisterClipboardViewer( );
+
+ static void WINAPI onClipboardContentChanged( void );
+
+private:
+ void SAL_CALL onReleaseDataObject( CXNotifyingDataObject* theCaller );
+
+private:
+ ::rtl::OUString m_itsName;
+ CMtaOleClipboard m_MtaOleClipboard;
+ CWinClipboard* m_pWinClipboard;
+ CXNotifyingDataObject* m_pCurrentClipContent;
+ osl::Mutex m_ClipContentMutex;
+
+ static osl::Mutex s_aMutex;
+ static CWinClipbImpl* s_pCWinClipbImpl;
+
+private:
+ CWinClipbImpl( const CWinClipbImpl& );
+ CWinClipbImpl& operator=( const CWinClipbImpl& );
+
+ friend class CWinClipboard;
+ friend class CXNotifyingDataObject;
+};
+
+#endif
diff --git a/dtrans/source/win32/clipb/WinClipboard.cxx b/dtrans/source/win32/clipb/WinClipboard.cxx
new file mode 100644
index 000000000000..4002ce2b67b3
--- /dev/null
+++ b/dtrans/source/win32/clipb/WinClipboard.cxx
@@ -0,0 +1,325 @@
+/*************************************************************************
+ *
+ * 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: WinClipboard.cxx,v $
+ * $Revision: 1.15 $
+ *
+ * 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"
+
+//------------------------------------------------------------------------
+// includes
+//------------------------------------------------------------------------
+#include <osl/diagnose.h>
+#include "WinClipboard.hxx"
+#include <com/sun/star/datatransfer/clipboard/ClipboardEvent.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include "WinClipbImpl.hxx"
+
+//------------------------------------------------------------------------
+// namespace directives
+//------------------------------------------------------------------------
+
+using namespace rtl;
+using namespace osl;
+using namespace std;
+using namespace cppu;
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::datatransfer;
+using namespace com::sun::star::datatransfer::clipboard;
+using namespace com::sun::star::lang;
+
+//------------------------------------------------------------------------
+// defines
+//------------------------------------------------------------------------
+
+#define WINCLIPBOARD_IMPL_NAME "com.sun.star.datatransfer.clipboard.ClipboardW32"
+
+//------------------------------------------------------------------------
+// helper functions
+//------------------------------------------------------------------------
+
+namespace
+{
+ Sequence< OUString > SAL_CALL WinClipboard_getSupportedServiceNames()
+ {
+ Sequence< OUString > aRet(1);
+ aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.clipboard.SystemClipboard");
+ return aRet;
+ }
+}
+
+//------------------------------------------------------------------------
+// ctor
+//------------------------------------------------------------------------
+/*XEventListener,*/
+CWinClipboard::CWinClipboard( const Reference< XMultiServiceFactory >& rServiceManager, const OUString& aClipboardName ) :
+ WeakComponentImplHelper4< XClipboardEx, XFlushableClipboard, XClipboardNotifier, XServiceInfo >( m_aCbListenerMutex ),
+ m_SrvMgr( rServiceManager )
+{
+ m_pImpl.reset( new CWinClipbImpl( aClipboardName, this ) );
+}
+
+//========================================================================
+// XClipboard
+//========================================================================
+
+//------------------------------------------------------------------------
+// getContent
+// to avoid unecessary traffic we check first if there is a clipboard
+// content which was set via setContent, in this case we don't need
+// to query the content from the clipboard, create a new wrapper object
+// and so on, we simply return the orignial XTransferable instead of our
+// DOTransferable
+//------------------------------------------------------------------------
+
+Reference< XTransferable > SAL_CALL CWinClipboard::getContents( ) throw( RuntimeException )
+{
+ MutexGuard aGuard( m_aMutex );
+
+ if ( rBHelper.bDisposed )
+ throw DisposedException( OUString::createFromAscii( "object is already disposed" ),
+ static_cast< XClipboardEx* >( this ) );
+
+ if ( NULL != m_pImpl.get( ) )
+ return m_pImpl->getContents( );
+
+ return Reference< XTransferable >( );
+}
+
+//------------------------------------------------------------------------
+// setContent
+//------------------------------------------------------------------------
+
+void SAL_CALL CWinClipboard::setContents( const Reference< XTransferable >& xTransferable,
+ const Reference< XClipboardOwner >& xClipboardOwner )
+ throw( RuntimeException )
+{
+ MutexGuard aGuard( m_aMutex );
+
+ if ( rBHelper.bDisposed )
+ throw DisposedException( OUString::createFromAscii( "object is already disposed" ),
+ static_cast< XClipboardEx* >( this ) );
+
+ if ( NULL != m_pImpl.get( ) )
+ m_pImpl->setContents( xTransferable, xClipboardOwner );
+}
+
+//------------------------------------------------------------------------
+// getName
+//------------------------------------------------------------------------
+
+OUString SAL_CALL CWinClipboard::getName( ) throw( RuntimeException )
+{
+ if ( rBHelper.bDisposed )
+ throw DisposedException( OUString::createFromAscii( "object is already disposed" ),
+ static_cast< XClipboardEx* >( this ) );
+
+ if ( NULL != m_pImpl.get( ) )
+ return m_pImpl->getName( );
+
+ return OUString::createFromAscii( "" );
+}
+
+//========================================================================
+// XFlushableClipboard
+//========================================================================
+
+void SAL_CALL CWinClipboard::flushClipboard( ) throw( RuntimeException )
+{
+ MutexGuard aGuard( m_aMutex );
+
+ if ( rBHelper.bDisposed )
+ throw DisposedException( OUString::createFromAscii( "object is already disposed" ),
+ static_cast< XClipboardEx* >( this ) );
+
+ if ( NULL != m_pImpl.get( ) )
+ m_pImpl->flushClipboard( );
+}
+
+//========================================================================
+// XClipboardEx
+//========================================================================
+
+sal_Int8 SAL_CALL CWinClipboard::getRenderingCapabilities( ) throw( RuntimeException )
+{
+ if ( rBHelper.bDisposed )
+ throw DisposedException( OUString::createFromAscii( "object is already disposed" ),
+ static_cast< XClipboardEx* >( this ) );
+
+ if ( NULL != m_pImpl.get( ) )
+ return m_pImpl->getRenderingCapabilities( );
+
+ return 0;
+}
+
+//========================================================================
+// XClipboardNotifier
+//========================================================================
+
+//------------------------------------------------------------------------
+// getName
+//------------------------------------------------------------------------
+
+void SAL_CALL CWinClipboard::addClipboardListener( const Reference< XClipboardListener >& listener )
+ throw( RuntimeException )
+{
+ if ( rBHelper.bDisposed )
+ throw DisposedException( OUString::createFromAscii( "object is already disposed" ),
+ static_cast< XClipboardEx* >( this ) );
+
+ // check input parameter
+ if ( !listener.is( ) )
+ throw IllegalArgumentException( OUString::createFromAscii( "empty reference" ),
+ static_cast< XClipboardEx* >( this ),
+ 1 );
+
+ rBHelper.aLC.addInterface( getCppuType( &listener ), listener );
+}
+
+//------------------------------------------------------------------------
+// getName
+//------------------------------------------------------------------------
+
+void SAL_CALL CWinClipboard::removeClipboardListener( const Reference< XClipboardListener >& listener )
+ throw( RuntimeException )
+{
+ if ( rBHelper.bDisposed )
+ throw DisposedException( OUString::createFromAscii( "object is already disposed" ),
+ static_cast< XClipboardEx* >( this ) );
+
+ // check input parameter
+ if ( !listener.is( ) )
+ throw IllegalArgumentException( OUString::createFromAscii( "empty reference" ),
+ static_cast< XClipboardEx* >( this ),
+ 1 );
+
+ rBHelper.aLC.removeInterface( getCppuType( &listener ), listener );
+}
+
+//------------------------------------------------------------------------
+// getName
+//------------------------------------------------------------------------
+
+void SAL_CALL CWinClipboard::notifyAllClipboardListener( )
+{
+ if ( !rBHelper.bDisposed )
+ {
+ ClearableMutexGuard aGuard( rBHelper.rMutex );
+ if ( !rBHelper.bDisposed )
+ {
+ aGuard.clear( );
+
+ OInterfaceContainerHelper* pICHelper = rBHelper.aLC.getContainer(
+ getCppuType( ( Reference< XClipboardListener > * ) 0 ) );
+
+ if ( pICHelper )
+ {
+ try
+ {
+ OInterfaceIteratorHelper iter(*pICHelper);
+ Reference<XTransferable> rXTransf(m_pImpl->getContents());
+ ClipboardEvent aClipbEvent(static_cast<XClipboard*>(this), rXTransf);
+
+ while(iter.hasMoreElements())
+ {
+ try
+ {
+ Reference<XClipboardListener> xCBListener(iter.next(), UNO_QUERY);
+ if (xCBListener.is())
+ xCBListener->changedContents(aClipbEvent);
+ }
+ catch(RuntimeException&)
+ {
+ OSL_ENSURE( false, "RuntimeException caught" );
+ }
+ }
+ }
+ catch(const ::com::sun::star::lang::DisposedException&)
+ {
+ OSL_ENSURE(false, "Service Manager disposed");
+
+ // no further clipboard changed notifications
+ m_pImpl->unregisterClipboardViewer();
+ }
+
+ } // end if
+ } // end if
+ } // end if
+}
+
+//------------------------------------------------
+// overwritten base class method which will be
+// called by the base class dispose method
+//------------------------------------------------
+
+void SAL_CALL CWinClipboard::disposing()
+{
+ // do my own stuff
+ m_pImpl->dispose( );
+
+ // force destruction of the impl class
+ m_pImpl.reset( NULL );
+}
+
+// -------------------------------------------------
+// XServiceInfo
+// -------------------------------------------------
+
+OUString SAL_CALL CWinClipboard::getImplementationName( )
+ throw(RuntimeException)
+{
+ return OUString::createFromAscii( WINCLIPBOARD_IMPL_NAME );
+}
+
+// -------------------------------------------------
+// XServiceInfo
+// -------------------------------------------------
+
+sal_Bool SAL_CALL CWinClipboard::supportsService( const OUString& ServiceName )
+ throw(RuntimeException)
+{
+ Sequence < OUString > SupportedServicesNames = WinClipboard_getSupportedServiceNames();
+
+ for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; )
+ if (SupportedServicesNames[n].compareTo(ServiceName) == 0)
+ return sal_True;
+
+ return sal_False;
+}
+
+// -------------------------------------------------
+// XServiceInfo
+// -------------------------------------------------
+
+Sequence< OUString > SAL_CALL CWinClipboard::getSupportedServiceNames( )
+ throw(RuntimeException)
+{
+ return WinClipboard_getSupportedServiceNames();
+}
diff --git a/dtrans/source/win32/clipb/WinClipboard.hxx b/dtrans/source/win32/clipb/WinClipboard.hxx
new file mode 100644
index 000000000000..5b7a0218f605
--- /dev/null
+++ b/dtrans/source/win32/clipb/WinClipboard.hxx
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * 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: WinClipboard.hxx,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.
+ *
+ ************************************************************************/
+
+
+#ifndef _WINCLIPBOARD_HXX_
+#define _WINCLIPBOARD_HXX_
+
+
+//------------------------------------------------------------------------
+// includes
+//------------------------------------------------------------------------
+
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <cppuhelper/compbase4.hxx>
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
+#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <osl/conditn.hxx>
+
+#include <memory>
+
+// forward
+class CWinClipbImpl;
+
+//------------------------------------------------------------------------
+// implements the XClipboard[Ex] ... interfaces
+// for the clipboard viewer mechanism we need a static callback function
+// and a static member to reasocciate from this static function to the
+// class instance
+// watch out: we are using only one static member variable and not a list
+// because we assume to be instanciated only once
+// this will be asured by an OneInstanceFactory of the service and not
+// by this class!
+//------------------------------------------------------------------------
+
+// helper class, so that the mutex is constructed
+// before the constructor of WeakComponentImplHelper
+// will be called and initialized with this mutex
+class CWinClipboardDummy
+{
+protected:
+ osl::Mutex m_aMutex;
+ osl::Mutex m_aCbListenerMutex;
+};
+
+class CWinClipboard :
+ public CWinClipboardDummy,
+ public cppu::WeakComponentImplHelper4<
+ ::com::sun::star::datatransfer::clipboard::XClipboardEx, \
+ ::com::sun::star::datatransfer::clipboard::XFlushableClipboard,
+ ::com::sun::star::datatransfer::clipboard::XClipboardNotifier,
+ ::com::sun::star::lang::XServiceInfo >
+{
+public:
+ CWinClipboard( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager,
+ const ::rtl::OUString& aClipboardName );
+
+ //------------------------------------------------
+ // XClipboard
+ //------------------------------------------------
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents( )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setContents(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::rtl::OUString SAL_CALL getName( )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ //------------------------------------------------
+ // XFlushableClipboard
+ //------------------------------------------------
+
+ virtual void SAL_CALL flushClipboard( ) throw( com::sun::star::uno::RuntimeException );
+
+ //------------------------------------------------
+ // XClipboardEx
+ //------------------------------------------------
+
+ virtual sal_Int8 SAL_CALL getRenderingCapabilities( ) throw( ::com::sun::star::uno::RuntimeException );
+
+ //------------------------------------------------
+ // XClipboardNotifier
+ //------------------------------------------------
+
+ virtual void SAL_CALL addClipboardListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL removeClipboardListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ //------------------------------------------------
+ // overwrite base class method, which is called
+ // by base class dispose function
+ //------------------------------------------------
+
+ virtual void SAL_CALL disposing();
+
+ //------------------------------------------------
+ // XServiceInfo
+ //------------------------------------------------
+
+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw(::com::sun::star::uno::RuntimeException);
+
+private:
+ void SAL_CALL notifyAllClipboardListener( );
+
+private:
+ ::std::auto_ptr< CWinClipbImpl > m_pImpl;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_SrvMgr;
+
+ friend class CWinClipbImpl;
+};
+
+
+#endif
diff --git a/dtrans/source/win32/clipb/exports.dxp b/dtrans/source/win32/clipb/exports.dxp
new file mode 100644
index 000000000000..f72beb0fcb31
--- /dev/null
+++ b/dtrans/source/win32/clipb/exports.dxp
@@ -0,0 +1,4 @@
+component_getImplementationEnvironment
+component_writeInfo
+component_getFactory
+
diff --git a/dtrans/source/win32/clipb/makefile.mk b/dtrans/source/win32/clipb/makefile.mk
new file mode 100644
index 000000000000..82914b97bd7b
--- /dev/null
+++ b/dtrans/source/win32/clipb/makefile.mk
@@ -0,0 +1,63 @@
+#*************************************************************************
+#
+# 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.9 $
+#
+# 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=dtrans
+TARGET=sysdtrans
+ENABLE_EXCEPTIONS=TRUE
+COMP1TYPELIST=$(TARGET)
+USE_BOUNDCHK=
+
+.IF "$(USE_BOUNDCHK)"=="TR"
+bndchk=tr
+stoponerror=tr
+.ENDIF
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# ------------------------------------------------------------------
+
+.IF "$(COM)" != "GCC"
+CFLAGS+=-GR
+.ENDIF
+CFLAGS+=-DUNICODE -D_UNICODE
+
+SLOFILES=$(SLO)$/WinClipboard.obj \
+ $(SLO)$/WinClipbImpl.obj \
+ $(SLO)$/wcbentry.obj
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/dtrans/source/win32/clipb/sysdtrans.xml b/dtrans/source/win32/clipb/sysdtrans.xml
new file mode 100644
index 000000000000..a6dec8a03a42
--- /dev/null
+++ b/dtrans/source/win32/clipb/sysdtrans.xml
@@ -0,0 +1,43 @@
+<?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> sysdtrans </module-name>
+ <component-description>
+ <author> Tino Rachui </author>
+ <name> com.sun.star.comp.datatransfer.SystemClipboard </name>
+ <description>
+ The win32 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.XTransferableEx </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.clipboard.XFlushableClipboard</type>
+ <type> com.sun.star.datatransfer.clipboard.RenderingCapabilities</type>
+ <type> com.sun.star.datatransfer.XTransferDataAccess </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.lang.IllegalArgumentException </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/win32/clipb/wcbentry.cxx b/dtrans/source/win32/clipb/wcbentry.cxx
new file mode 100644
index 000000000000..2426c2799494
--- /dev/null
+++ b/dtrans/source/win32/clipb/wcbentry.cxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * 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: wcbentry.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * 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"
+//______________________________________________________________________________________________________________
+// includes of other projects
+//______________________________________________________________________________________________________________
+#include <cppuhelper/factory.hxx>
+#include <com/sun/star/container/XSet.hpp>
+#include <osl/diagnose.h>
+#include "WinClipboard.hxx"
+
+//-----------------------------------------------------------------
+// some defines
+//-----------------------------------------------------------------
+
+// the service names
+#define WINCLIPBOARD_SERVICE_NAME "com.sun.star.datatransfer.clipboard.SystemClipboard"
+
+// the implementation names
+#define WINCLIPBOARD_IMPL_NAME "com.sun.star.datatransfer.clipboard.ClipboardW32"
+
+// the registry key names
+// a key under which this service will be registered, Format: -> "/ImplName/UNO/SERVICES/ServiceName"
+// < Implementation-Name ></UNO/SERVICES/>< Service-Name >
+#define WINCLIPBOARD_REGKEY_NAME "/com.sun.star.datatransfer.clipboard.ClipboardW32/UNO/SERVICES/com.sun.star.datatransfer.clipboard.SystemClipboard"
+
+//-----------------------------------------------------------------------------------------------------------
+// namespace directives
+//-----------------------------------------------------------------------------------------------------------
+
+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;
+
+//-----------------------------------------------------------------
+// create a static object to initialize the shell9x library
+//-----------------------------------------------------------------
+
+namespace
+{
+
+ //-----------------------------------------------------------------------------------------------------------
+ // functions to create a new Clipboad instance; is needed by factory helper implementation
+ // @param rServiceManager - service manager, useful if the component needs other uno services
+ // so we should give it to every UNO-Implementation component
+ //-----------------------------------------------------------------------------------------------------------
+
+ Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& rServiceManager )
+ {
+ return Reference< XInterface >( static_cast< XClipboard* >( new CWinClipboard( rServiceManager, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" ) ) ) ) );
+ }
+}
+
+//-----------------------------------------------------------------------------------------------------------
+// the 3 important functions which will be exported
+//-----------------------------------------------------------------------------------------------------------
+
+extern "C"
+{
+
+//----------------------------------------------------------------------
+// component_getImplementationEnvironment
+//----------------------------------------------------------------------
+
+void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+//-------------------------------------------------------------------------
+// component_writeInfo - to register a UNO-Service
+// to register a UNO-Service use: regcomp -register -r *.rdb -c *.dll
+// to view the registry use: regview *.rdb /SERVICES/ServiceName
+// (you must use the full services name e.g. com.sun.star.frame.FilePicker
+//-------------------------------------------------------------------------
+
+sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, void* pRegistryKey )
+{
+ sal_Bool bRetVal = sal_False;
+
+ if ( pRegistryKey )
+ {
+ try
+ {
+ Reference< XRegistryKey > pXNewKey( static_cast< XRegistryKey* >( pRegistryKey ) );
+ pXNewKey->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM( WINCLIPBOARD_REGKEY_NAME ) ) );
+ bRetVal = sal_True;
+ }
+ catch( InvalidRegistryException& )
+ {
+ OSL_ENSURE(sal_False, "InvalidRegistryException caught");
+ bRetVal = sal_False;
+ }
+ }
+
+ return bRetVal;
+}
+
+//----------------------------------------------------------------------
+// component_getFactory
+// returns a factory to create XFilePicker-Services
+//----------------------------------------------------------------------
+
+void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* /*pRegistryKey*/ )
+{
+ void* pRet = 0;
+
+ if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, WINCLIPBOARD_IMPL_NAME ) ) )
+ {
+ Sequence< OUString > aSNS( 1 );
+ aSNS.getArray( )[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( WINCLIPBOARD_SERVICE_NAME ) );
+
+ //OUString( RTL_CONSTASCII_USTRINGPARAM( FPS_IMPL_NAME ) )
+ Reference< XSingleServiceFactory > xFactory ( createOneInstanceFactory(
+ reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
+ OUString::createFromAscii( pImplName ),
+ createInstance,
+ aSNS ) );
+ if ( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+
+ return pRet;
+}
+
+} // extern "C"