1*fbcf0fe9SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*fbcf0fe9SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*fbcf0fe9SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*fbcf0fe9SAndrew Rist * distributed with this work for additional information 6*fbcf0fe9SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*fbcf0fe9SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*fbcf0fe9SAndrew Rist * "License"); you may not use this file except in compliance 9*fbcf0fe9SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*fbcf0fe9SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*fbcf0fe9SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*fbcf0fe9SAndrew Rist * software distributed under the License is distributed on an 15*fbcf0fe9SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*fbcf0fe9SAndrew Rist * KIND, either express or implied. See the License for the 17*fbcf0fe9SAndrew Rist * specific language governing permissions and limitations 18*fbcf0fe9SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*fbcf0fe9SAndrew Rist *************************************************************/ 21*fbcf0fe9SAndrew Rist 22*fbcf0fe9SAndrew Rist 23cdf0e10cSrcweir #ifndef _TRANSFERABLE_HXX_ 24cdf0e10cSrcweir #define _TRANSFERABLE_HXX_ 25cdf0e10cSrcweir 26cdf0e10cSrcweir //_________________________________________________________________________________________________________________________ 27cdf0e10cSrcweir // interface includes 28cdf0e10cSrcweir //_________________________________________________________________________________________________________________________ 29cdf0e10cSrcweir 30cdf0e10cSrcweir 31cdf0e10cSrcweir //#include "..\ImplHelper.hxx" 32cdf0e10cSrcweir 33cdf0e10cSrcweir //_________________________________________________________________________________________________________________________ 34cdf0e10cSrcweir // other includes 35cdf0e10cSrcweir //_________________________________________________________________________________________________________________________ 36cdf0e10cSrcweir 37cdf0e10cSrcweir #include <cppuhelper/servicefactory.hxx> 38cdf0e10cSrcweir #include <com/sun/star/datatransfer/XTransferable.hpp> 39cdf0e10cSrcweir #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp> 40cdf0e10cSrcweir #include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp> 41cdf0e10cSrcweir #include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp> 42cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 43cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx> 44cdf0e10cSrcweir #include <rtl/ustring.hxx> 45cdf0e10cSrcweir #include <sal/types.h> 46cdf0e10cSrcweir #include <osl/diagnose.h> 47cdf0e10cSrcweir 48cdf0e10cSrcweir #include <stdio.h> 49cdf0e10cSrcweir #if defined _MSC_VER 50cdf0e10cSrcweir #pragma warning(push,1) 51cdf0e10cSrcweir #endif 52cdf0e10cSrcweir #include <windows.h> 53cdf0e10cSrcweir #include <objbase.h> 54cdf0e10cSrcweir #if defined _MSC_VER 55cdf0e10cSrcweir #pragma warning(pop) 56cdf0e10cSrcweir #endif 57cdf0e10cSrcweir 58cdf0e10cSrcweir #include <memory> 59cdf0e10cSrcweir 60cdf0e10cSrcweir #include <process.h> 61cdf0e10cSrcweir 62cdf0e10cSrcweir #include "..\..\source\win32\ImplHelper.hxx" 63cdf0e10cSrcweir 64cdf0e10cSrcweir 65cdf0e10cSrcweir //------------------------------------------------------------- 66cdf0e10cSrcweir // my defines 67cdf0e10cSrcweir //------------------------------------------------------------- 68cdf0e10cSrcweir 69cdf0e10cSrcweir #define TEST_CLIPBOARD 70cdf0e10cSrcweir #define RDB_SYSPATH "d:\\projects\\src616\\dtrans\\wntmsci7\\bin\\applicat.rdb" 71cdf0e10cSrcweir #define WINCLIPBOARD_SERVICE_NAME L"com.sun.star.datatransfer.clipboard.SystemClipboard" 72cdf0e10cSrcweir #define WRITE_CB 73cdf0e10cSrcweir #define EVT_MANUAL_RESET TRUE 74cdf0e10cSrcweir #define EVT_INIT_NONSIGNALED FALSE 75cdf0e10cSrcweir #define EVT_NONAME "" 76cdf0e10cSrcweir 77cdf0e10cSrcweir //------------------------------------------------------------ 78cdf0e10cSrcweir // namesapces 79cdf0e10cSrcweir //------------------------------------------------------------ 80cdf0e10cSrcweir 81cdf0e10cSrcweir using namespace ::rtl; 82cdf0e10cSrcweir using namespace ::std; 83cdf0e10cSrcweir using namespace ::cppu; 84cdf0e10cSrcweir using namespace ::com::sun::star::datatransfer; 85cdf0e10cSrcweir using namespace ::com::sun::star::datatransfer::clipboard; 86cdf0e10cSrcweir using namespace ::com::sun::star::uno; 87cdf0e10cSrcweir using namespace ::com::sun::star::io; 88cdf0e10cSrcweir using namespace ::com::sun::star::lang; 89cdf0e10cSrcweir 90cdf0e10cSrcweir //------------------------------------------------------------ 91cdf0e10cSrcweir // 92cdf0e10cSrcweir //------------------------------------------------------------ 93cdf0e10cSrcweir 94cdf0e10cSrcweir class CTransferable : public WeakImplHelper2< XClipboardOwner, XTransferable > 95cdf0e10cSrcweir { 96cdf0e10cSrcweir public: CTransferable()97cdf0e10cSrcweir CTransferable( ){}; 98cdf0e10cSrcweir CTransferable( wchar_t* dataString); 99cdf0e10cSrcweir 100cdf0e10cSrcweir //------------------------------------------------- 101cdf0e10cSrcweir // XTransferable 102cdf0e10cSrcweir //------------------------------------------------- 103cdf0e10cSrcweir 104cdf0e10cSrcweir virtual Any SAL_CALL getTransferData( const DataFlavor& aFlavor ) throw(UnsupportedFlavorException, IOException, RuntimeException); 105cdf0e10cSrcweir virtual Sequence< DataFlavor > SAL_CALL getTransferDataFlavors( ) throw(RuntimeException); 106cdf0e10cSrcweir virtual sal_Bool SAL_CALL isDataFlavorSupported( const DataFlavor& aFlavor ) throw(RuntimeException); 107cdf0e10cSrcweir 108cdf0e10cSrcweir //------------------------------------------------- 109cdf0e10cSrcweir // XClipboardOwner 110cdf0e10cSrcweir //------------------------------------------------- 111cdf0e10cSrcweir 112cdf0e10cSrcweir virtual void SAL_CALL lostOwnership( const Reference< XClipboard >& xClipboard, const Reference< XTransferable >& xTrans ) throw(RuntimeException); 113cdf0e10cSrcweir 114cdf0e10cSrcweir private: 115cdf0e10cSrcweir Sequence< DataFlavor > m_seqDFlv; 116cdf0e10cSrcweir OUString m_Data; 117cdf0e10cSrcweir }; 118cdf0e10cSrcweir 119cdf0e10cSrcweir 120cdf0e10cSrcweir #endif 121