1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _SVTOOLS_STRINGTRANSFER_HXX_ 29 #define _SVTOOLS_STRINGTRANSFER_HXX_ 30 31 #include "svtools/svtdllapi.h" 32 #include <svtools/transfer.hxx> 33 34 //........................................................................ 35 namespace svt 36 { 37 //........................................................................ 38 39 //==================================================================== 40 //= OStringTransferable 41 //==================================================================== 42 class SVT_DLLPUBLIC OStringTransferable : public TransferableHelper 43 { 44 protected: 45 ::rtl::OUString m_sContent; 46 47 public: 48 OStringTransferable(const ::rtl::OUString& _rContent); 49 50 protected: 51 // TransferableHelper overridables 52 virtual void AddSupportedFormats(); 53 virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& _rFlavor ); 54 }; 55 56 //==================================================================== 57 //= OStringTransfer 58 //==================================================================== 59 class OStringTransfer 60 { 61 public: 62 /** copies the string given into the system clipboard 63 <p>Beware: In opposite to the old DragServer::CopyString, this method does not <em>add</em> the string 64 to the clipboard, instead the old clipboard content is <em>replaced</em>!</p> 65 */ 66 SVT_DLLPUBLIC static void CopyString( const ::rtl::OUString& _rContent, Window* _pWindow = NULL ); 67 68 /** extracts a string from the system clipboard given 69 @return <TRUE/> if the extraction was successfull, i.e. if the clipboard contained a string content 70 */ 71 SVT_DLLPUBLIC static sal_Bool PasteString( ::rtl::OUString& _rContent, Window* _pWindow = NULL ); 72 73 /** starts dragging a simple string 74 */ 75 SVT_DLLPUBLIC static void StartStringDrag( const ::rtl::OUString& _rContent, Window* _pWindow, sal_Int8 _nDragSourceActions ); 76 }; 77 78 //........................................................................ 79 } // namespace svt 80 //........................................................................ 81 82 #endif // _SVTOOLS_STRINGTRANSFER_HXX_ 83 84